@itwin/map-layers 5.0.0-dev.2 → 5.0.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 +9 -1
- package/lib/cjs/MapLayerPreferences.js +1 -1
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/MapLayersPrefBrowserStorage.d.ts +5 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.d.ts.map +1 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.js +16 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.js.map +1 -0
- package/lib/cjs/PreferencesBrowserStorage.d.ts +36 -0
- package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -0
- package/lib/cjs/PreferencesBrowserStorage.js +92 -0
- package/lib/cjs/PreferencesBrowserStorage.js.map +1 -0
- 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 +1 -0
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +6 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +1 -3
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +2 -3
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +3 -7
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.js +2 -2
- package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.d.ts +12 -9
- package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +50 -79
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/MapLayerPreferences.js +1 -1
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/MapLayersPrefBrowserStorage.d.ts +5 -0
- package/lib/esm/MapLayersPrefBrowserStorage.d.ts.map +1 -0
- package/lib/esm/MapLayersPrefBrowserStorage.js +12 -0
- package/lib/esm/MapLayersPrefBrowserStorage.js.map +1 -0
- package/lib/esm/PreferencesBrowserStorage.d.ts +36 -0
- package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -0
- package/lib/esm/PreferencesBrowserStorage.js +88 -0
- package/lib/esm/PreferencesBrowserStorage.js.map +1 -0
- 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 +1 -0
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +6 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +1 -3
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.js +2 -3
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +3 -7
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.js +2 -2
- package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.d.ts +12 -9
- package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +50 -79
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/package.json +21 -21
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from "@itwin/core-frontend";
|
|
2
|
+
/**
|
|
3
|
+
* @beta
|
|
4
|
+
*/
|
|
5
|
+
export interface PreferencesBrowserStorageOptions {
|
|
6
|
+
/** indicate whether or not delete function should throw an error if the provided key cannot be found. */
|
|
7
|
+
throwOnDeleteMissingKey?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** User preferences implementation using browser's local storage.
|
|
10
|
+
* It creates storage item key in the form of:
|
|
11
|
+
* <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>
|
|
12
|
+
*
|
|
13
|
+
* <itwin_guid> and <imodel_guid> being optional.
|
|
14
|
+
*
|
|
15
|
+
* Each entry in the storage is a serialized JSON of the following index signature:
|
|
16
|
+
* {
|
|
17
|
+
* "<preference_namespace?>.<preference_key>": {
|
|
18
|
+
* ...
|
|
19
|
+
* <preferences_json_content>
|
|
20
|
+
* },
|
|
21
|
+
* ...
|
|
22
|
+
* }
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare class PreferencesBrowserStorage implements UserPreferencesAccess {
|
|
26
|
+
private readonly _options;
|
|
27
|
+
private readonly _storageItemKeyPrefix;
|
|
28
|
+
constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions);
|
|
29
|
+
private getStorageItemKey;
|
|
30
|
+
private static getPreferenceKey;
|
|
31
|
+
private loadFromStorage;
|
|
32
|
+
get(arg: PreferenceKeyArg & ITwinIdArg): Promise<any[] | undefined>;
|
|
33
|
+
delete(arg: PreferenceKeyArg & ITwinIdArg): Promise<void>;
|
|
34
|
+
save(arg: PreferenceArg & ITwinIdArg): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=PreferencesBrowserStorage.d.ts.map
|
|
@@ -0,0 +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;AAU1G;;EAEE;AACF,MAAM,WAAW,gCAAgC;IAC/C,yGAAyG;IACzG,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;EAeE;AACF,qBAAa,yBAA0B,YAAW,qBAAqB;IAErE,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;IAK/B,OAAO,CAAC,eAAe;IAeV,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAoBtC,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAoBzC,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU;CAUlD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** User preferences implementation using browser's local storage.
|
|
2
|
+
* It creates storage item key in the form of:
|
|
3
|
+
* <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>
|
|
4
|
+
*
|
|
5
|
+
* <itwin_guid> and <imodel_guid> being optional.
|
|
6
|
+
*
|
|
7
|
+
* Each entry in the storage is a serialized JSON of the following index signature:
|
|
8
|
+
* {
|
|
9
|
+
* "<preference_namespace?>.<preference_key>": {
|
|
10
|
+
* ...
|
|
11
|
+
* <preferences_json_content>
|
|
12
|
+
* },
|
|
13
|
+
* ...
|
|
14
|
+
* }
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export class PreferencesBrowserStorage {
|
|
18
|
+
constructor(storageItemKeyPrefix, opts) {
|
|
19
|
+
this._options = opts;
|
|
20
|
+
this._storageItemKeyPrefix = storageItemKeyPrefix;
|
|
21
|
+
}
|
|
22
|
+
getStorageItemKey(arg) {
|
|
23
|
+
const itwinIdStr = arg.iTwinId ? `.${arg.iTwinId}` : "";
|
|
24
|
+
const imodelIdStr = arg.iModelId ? `.${arg.iModelId}` : "";
|
|
25
|
+
return `${this._storageItemKeyPrefix}${itwinIdStr}${imodelIdStr}`;
|
|
26
|
+
}
|
|
27
|
+
static getPreferenceKey(arg) {
|
|
28
|
+
const nsStr = arg.namespace ? `${arg.namespace}.` : "";
|
|
29
|
+
return `${nsStr}${arg.key}`;
|
|
30
|
+
}
|
|
31
|
+
loadFromStorage(arg) {
|
|
32
|
+
const storage = window.localStorage;
|
|
33
|
+
let map = {};
|
|
34
|
+
const itemStr = storage.getItem(this.getStorageItemKey(arg));
|
|
35
|
+
if (itemStr === null) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (!itemStr || itemStr === "{}")
|
|
39
|
+
return map;
|
|
40
|
+
map = JSON.parse(itemStr);
|
|
41
|
+
return map;
|
|
42
|
+
}
|
|
43
|
+
async get(arg) {
|
|
44
|
+
const map = this.loadFromStorage(arg);
|
|
45
|
+
if (map === undefined)
|
|
46
|
+
return undefined;
|
|
47
|
+
if (arg.key) {
|
|
48
|
+
if (!Object.keys(map).includes(arg.key))
|
|
49
|
+
return undefined;
|
|
50
|
+
const nsStr = arg.namespace ? `${arg.namespace}.` : "";
|
|
51
|
+
const prefKey = `${nsStr}${arg.key}`;
|
|
52
|
+
return [map[prefKey]];
|
|
53
|
+
}
|
|
54
|
+
else { // No key provided, return all objects
|
|
55
|
+
const values = [];
|
|
56
|
+
for (const [_key, value] of Object.entries(map))
|
|
57
|
+
values.push(value);
|
|
58
|
+
return values;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async delete(arg) {
|
|
62
|
+
const map = this.loadFromStorage(arg);
|
|
63
|
+
if (map === undefined) {
|
|
64
|
+
if (this._options?.throwOnDeleteMissingKey)
|
|
65
|
+
throw new Error("Could not find key from storage.");
|
|
66
|
+
else
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const prefKey = PreferencesBrowserStorage.getPreferenceKey(arg);
|
|
70
|
+
if (!Object.keys(map).includes(prefKey)) {
|
|
71
|
+
if (this._options?.throwOnDeleteMissingKey)
|
|
72
|
+
throw Error("Could not find key from storage.");
|
|
73
|
+
else
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
delete map[prefKey];
|
|
77
|
+
window.localStorage.setItem(this.getStorageItemKey(arg), JSON.stringify(map));
|
|
78
|
+
}
|
|
79
|
+
async save(arg) {
|
|
80
|
+
let map = this.loadFromStorage(arg);
|
|
81
|
+
if (map === undefined)
|
|
82
|
+
map = {};
|
|
83
|
+
map[PreferencesBrowserStorage.getPreferenceKey(arg)] = arg.content;
|
|
84
|
+
const itemValue = JSON.stringify(map);
|
|
85
|
+
window.localStorage.setItem(this.getStorageItemKey(arg), itemValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=PreferencesBrowserStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;EAeE;AACF,MAAM,OAAO,yBAAyB;IAKpC,YAAY,oBAA4B,EAAE,IAAuC;QAC/E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;IACpD,CAAC;IAEO,iBAAiB,CAAC,GAAe;QACvC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CA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QAEX,GAAG,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;QAEnE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;IACtE,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 { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from \"@itwin/core-frontend\";\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\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 const nsStr = arg.namespace ? `${arg.namespace}.` : \"\";\n return `${nsStr}${arg.key}`;\n }\n\n private loadFromStorage(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = window.localStorage;\n\n let map: KeyContentProps = {};\n const itemStr = storage.getItem(this.getStorageItemKey(arg));\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 async get(arg: PreferenceKeyArg & ITwinIdArg) {\n const map = this.loadFromStorage(arg);\n if (map === undefined)\n return undefined;\n\n if (arg.key) {\n if (!Object.keys(map).includes(arg.key))\n return undefined;\n\n const nsStr = arg.namespace ? `${arg.namespace}.` : \"\";\n const prefKey = `${nsStr}${arg.key}`;\n return [map[prefKey]];\n } else { // No key provided, return all objects\n const values = [];\n for (const [_key, value] of Object.entries(map))\n values.push(value);\n return values;\n }\n }\n\n public async delete(arg: PreferenceKeyArg & ITwinIdArg) {\n const map = this.loadFromStorage(arg);\n if (map === undefined) {\n if (this._options?.throwOnDeleteMissingKey)\n throw new Error(\"Could not find key from storage.\");\n else\n return;\n }\n\n const prefKey = PreferencesBrowserStorage.getPreferenceKey(arg);\n if (!Object.keys(map).includes(prefKey)) {\n if (this._options?.throwOnDeleteMissingKey)\n throw Error(\"Could not find key from storage.\");\n else\n return;\n }\n delete map[prefKey];\n window.localStorage.setItem(this.getStorageItemKey(arg), JSON.stringify(map));\n }\n\n public async save(arg: PreferenceArg & ITwinIdArg) {\n let map = this.loadFromStorage(arg);\n if (map === undefined)\n map = {};\n\n map[PreferencesBrowserStorage.getPreferenceKey(arg)] = arg.content;\n\n const itemValue = JSON.stringify(map);\n window.localStorage.setItem(this.getStorageItemKey(arg), itemValue);\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,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,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,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC"}
|
package/lib/esm/map-layers.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export * from "./mapLayers";
|
|
6
|
+
export * from "./MapLayersPrefBrowserStorage";
|
|
6
7
|
export * from "./ui/Interfaces";
|
|
7
8
|
export * from "./ui/MapLayersUiItemsProvider";
|
|
8
9
|
export * from "./ui/FeatureInfoUiItemsProvider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./mapLayers\";\r\nexport * from \"./ui/Interfaces\";\r\nexport * from \"./ui/MapLayersUiItemsProvider\";\r\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\r\nexport * from \"./ui/MapFeatureInfoTool\";\r\nexport * from \"./ui/widget/MapLayersWidget\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./mapLayers\";\r\nexport * from \"./MapLayersPrefBrowserStorage\";\r\nexport * from \"./ui/Interfaces\";\r\nexport * from \"./ui/MapLayersUiItemsProvider\";\r\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\r\nexport * from \"./ui/MapFeatureInfoTool\";\r\nexport * from \"./ui/widget/MapLayersWidget\";\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerDroppable.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAkE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,wBAAwB,CAAC;AAIhC,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,EAAE,MAAM,WAAW,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtF,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACjF,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"MapLayerDroppable.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAkE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAOtH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,wBAAwB,CAAC;AAIhC,gBAAgB;AAChB,UAAU,sBAAsB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,EAAE,MAAM,WAAW,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtF,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACjF,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA4H9D"}
|
|
@@ -30,6 +30,11 @@ export function MapLayerDroppable(props) {
|
|
|
30
30
|
const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.NoOverlayLayers"));
|
|
31
31
|
const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.DropLayerLabel"));
|
|
32
32
|
const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:Widget.layerOutOfRange"));
|
|
33
|
+
const onSubLayerStateChange = (activeLayer, subLayerId, isSelected) => {
|
|
34
|
+
const mapLayerStyleIdx = props.activeViewport.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);
|
|
35
|
+
if (mapLayerStyleIdx !== -1 && activeLayer.subLayers)
|
|
36
|
+
props.activeViewport.displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, { index: mapLayerStyleIdx, isOverlay: activeLayer.isOverlay });
|
|
37
|
+
};
|
|
33
38
|
const renderItem = (dragProvided, _, rubric) => {
|
|
34
39
|
assert(props.layersList !== undefined);
|
|
35
40
|
const activeLayer = props.layersList[rubric.source.index];
|
|
@@ -39,7 +44,7 @@ export function MapLayerDroppable(props) {
|
|
|
39
44
|
React.createElement(Icon, { iconSpec: activeLayer.visible ? "icon-visibility" : "icon-visibility-hide-2" })),
|
|
40
45
|
React.createElement("span", { className: props.disabled || outOfRange ? "map-manager-item-label-disabled" : "map-manager-item-label", title: outOfRange ? outOfRangeTitle : undefined, ...dragProvided.dragHandleProps }, activeLayer.name),
|
|
41
46
|
React.createElement("div", { className: "map-manager-item-sub-layer-container" }, activeLayer.subLayers && activeLayer.subLayers.length > 1 &&
|
|
42
|
-
React.createElement(SubLayersPopupButton, {
|
|
47
|
+
React.createElement(SubLayersPopupButton, { subLayers: props.activeViewport ? activeLayer.subLayers : undefined, singleVisibleSubLayer: activeLayer.provider?.mutualExclusiveSubLayer, onSubLayerStateChange: (subLayerId, isSelected) => { onSubLayerStateChange(activeLayer, subLayerId, isSelected); } })),
|
|
43
48
|
activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&
|
|
44
49
|
React.createElement(Button, { disabled: props.disabled, size: "small", styleType: "borderless", onClick: () => {
|
|
45
50
|
const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,2CAA2C;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAuB,SAAS,EAA6C,MAAM,qBAAqB,CAAC;AAC3H,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAkB,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAe3D,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CA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EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport * as React from \"react\";\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { Icon } from \"@itwin/core-react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\n\n/** @internal */\ninterface MapLayerDroppableProps {\n isOverlay: boolean;\n layersList?: StyleMapLayerSettings[];\n mapTypesOptions?: MapTypesOptions;\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\n onItemEdited: () => void;\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\n const containsLayer = props.layersList && props.layersList.length > 0;\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\n\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\n assert(props.layersList !== undefined);\n const activeLayer = props.layersList[rubric.source.index];\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\n\n return (\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\n {...dragProvided.draggableProps}\n ref={dragProvided.innerRef} >\n {/* Visibility icon */}\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n {/* Label */}\n <span className={props.disabled||outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\n title = {outOfRange ? outOfRangeTitle : undefined }\n {...dragProvided.dragHandleProps}\n\n >\n {activeLayer.name}\n </span>\n <div className=\"map-manager-item-sub-layer-container\">\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\n <SubLayersPopupButton mapLayerSettings={activeLayer} activeViewport={props.activeViewport} />\n }\n </div>\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\n <Button\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n onClick={() => {\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex({index: indexInDisplayStyle, isOverlay: activeLayer.isOverlay});\n if (layerSettings instanceof ImageMapLayerSettings) {\n UiFramework.dialogs.modal.open(<MapUrlDialog activeViewport={props.activeViewport}\n isOverlay={props.isOverlay}\n layerRequiringCredentials={layerSettings?.toJSON()}\n onOkResult={props.onItemEdited}\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\n }\n }\n\n }}\n title={requireAuthTooltip}\n >\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n </Button>\n }\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\n </div>\n );\n };\n\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\n let node: React.ReactNode;\n if (containsLayer) {\n // Render a <Draggable>\n node = (props.layersList?.map((mapLayerSettings, i) =>\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\n {renderItem}\n </Draggable>));\n } else {\n // Render a label that provide a 'Drop here' hint\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\n node =\n <div title={label} className=\"map-manager-no-layers-container\">\n {snapshot.isDraggingOver ?\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\n :\n <>\n <span className=\"map-manager-no-layers-label\">{label}</span>\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\n </>\n }\n </div>;\n }\n return node;\n }\n\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\n return (\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\n\n {renderDraggableContent(dropSnapshot)}\n\n {\n /* We don't want a placeholder when displaying the 'Drop here' message\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\n }\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\n </div>);\n }\n\n return (\n <Droppable\n droppableId={droppableId}\n renderClone={renderItem}\n getContainerForClone={props.getContainerForClone as any}\n >\n {renderDraggable}\n </Droppable>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,2CAA2C;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAuB,SAAS,EAA6C,MAAM,qBAAqB,CAAC;AAC3H,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAkB,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO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M;YACL,iDAAiD;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,8BAA8B,CAAC;YAC3F,IAAI;gBACF,6BAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,iCAAiC,IAC3D,QAAQ,CAAC,cAAc,CAAC,CAAC;oBACxB,8BAAM,SAAS,EAAC,6BAA6B,IAAE,cAAc,CAAQ;oBACrE,CAAC;wBACD;4BACE,8BAAM,SAAS,EAAC,6BAA6B,IAAE,KAAK,CAAQ;4BAC5D,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CACvH,CAED,CAAC;SACV;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,eAAe,CAAC,YAA+B,EAAE,YAAoC;QAC5F,OAAO,CACL,6BAAK,SAAS,EAAE,0BAA0B,YAAY,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,QAAQ,KAAM,YAAY,CAAC,cAAc;YAEjL,sBAAsB,CAAC,YAAY,CAAC;YAOrC,6BAAK,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,YAAY,CAAC,WAAW,CAAO,CACzF,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,CACL,oBAAC,SAAS,IACR,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n// cSpell:ignore droppable Sublayer Basemap\n\n// the following quiet warning caused by react-beautiful-dnd package\n/* eslint-disable @typescript-eslint/unbound-method */\n\nimport * as React from \"react\";\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\nimport { Icon } from \"@itwin/core-react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\nimport \"./MapLayerManager.scss\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ImageMapLayerSettings, SubLayerId } from \"@itwin/core-common\";\n\n/** @internal */\ninterface MapLayerDroppableProps {\n isOverlay: boolean;\n layersList?: StyleMapLayerSettings[];\n mapTypesOptions?: MapTypesOptions;\n getContainerForClone: () => HTMLElement;\n activeViewport: ScreenViewport;\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\n onItemEdited: () => void;\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\n const containsLayer = props.layersList && props.layersList.length > 0;\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\n\n const onSubLayerStateChange = (activeLayer: StyleMapLayerSettings, subLayerId: SubLayerId, isSelected: boolean) => {\n const mapLayerStyleIdx = props.activeViewport.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\n if (mapLayerStyleIdx !== -1 && activeLayer.subLayers)\n props.activeViewport.displayStyle.changeMapSubLayerProps({ visible: isSelected }, subLayerId, { index: mapLayerStyleIdx, isOverlay: activeLayer.isOverlay });\n };\n\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\n assert(props.layersList !== undefined);\n const activeLayer = props.layersList[rubric.source.index];\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\n\n return (\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\n {...dragProvided.draggableProps}\n ref={dragProvided.innerRef} >\n {/* Visibility icon */}\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\n </Button>\n {/* Label */}\n <span className={props.disabled || outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\n title={outOfRange ? outOfRangeTitle : undefined}\n {...dragProvided.dragHandleProps}\n\n >\n {activeLayer.name}\n </span>\n <div className=\"map-manager-item-sub-layer-container\">\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\n <SubLayersPopupButton\n subLayers={props.activeViewport ? activeLayer.subLayers : undefined}\n singleVisibleSubLayer={activeLayer.provider?.mutualExclusiveSubLayer}\n onSubLayerStateChange={(subLayerId: SubLayerId, isSelected: boolean) => { onSubLayerStateChange(activeLayer, subLayerId, isSelected); }} />\n }\n </div>\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\n <Button\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n onClick={() => {\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex({ index: indexInDisplayStyle, isOverlay: activeLayer.isOverlay });\n if (layerSettings instanceof ImageMapLayerSettings) {\n UiFramework.dialogs.modal.open(<MapUrlDialog activeViewport={props.activeViewport}\n isOverlay={props.isOverlay}\n layerRequiringCredentials={layerSettings?.toJSON()}\n onOkResult={props.onItemEdited}\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\n }\n }\n\n }}\n title={requireAuthTooltip}\n >\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\n </Button>\n }\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\n </div>\n );\n };\n\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\n let node: React.ReactNode;\n if (containsLayer) {\n // Render a <Draggable>\n node = (props.layersList?.map((mapLayerSettings, i) =>\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\n {renderItem}\n </Draggable>));\n } else {\n // Render a label that provide a 'Drop here' hint\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\n node =\n <div title={label} className=\"map-manager-no-layers-container\">\n {snapshot.isDraggingOver ?\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\n :\n <>\n <span className=\"map-manager-no-layers-label\">{label}</span>\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\n </>\n }\n </div>;\n }\n return node;\n }\n\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\n return (\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\n\n {renderDraggableContent(dropSnapshot)}\n\n {\n /* We don't want a placeholder when displaying the 'Drop here' message\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\n }\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\n </div>);\n }\n\n return (\n <Droppable\n droppableId={droppableId}\n renderClone={renderItem}\n getContainerForClone={props.getContainerForClone as any}\n >\n {renderDraggable}\n </Droppable>\n );\n}\n"]}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { MapSubLayerProps } from "@itwin/core-common";
|
|
2
2
|
import { ITreeDataProvider, TreeNodeItem } from "@itwin/components-react";
|
|
3
|
-
import { StyleMapLayerSettings } from "../Interfaces";
|
|
4
3
|
/**
|
|
5
4
|
* Data provider that returns some fake nodes to show in tree.
|
|
6
5
|
*/
|
|
7
6
|
export declare class SubLayersDataProvider implements ITreeDataProvider {
|
|
8
7
|
private readonly _nodeMap;
|
|
9
|
-
|
|
10
|
-
constructor(mapLayer: StyleMapLayerSettings);
|
|
8
|
+
constructor(subLayers: MapSubLayerProps[]);
|
|
11
9
|
static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean;
|
|
12
10
|
private createId;
|
|
13
11
|
private createNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAA2B,iBAAiB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"SubLayersDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAc,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAA2B,iBAAiB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGnG;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;gBAElD,SAAS,EAAE,gBAAgB,EAAE;WAI3B,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,GAAG,OAAO;IAO7E,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,SAAS;IAOJ,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY;IAQnC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY;CAO5C"}
|
|
@@ -9,10 +9,9 @@ import { CheckBoxState } from "@itwin/core-react";
|
|
|
9
9
|
* Data provider that returns some fake nodes to show in tree.
|
|
10
10
|
*/
|
|
11
11
|
export class SubLayersDataProvider {
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(subLayers) {
|
|
13
13
|
this._nodeMap = new Map();
|
|
14
|
-
this.
|
|
15
|
-
this.loadNodes(mapLayer.subLayers);
|
|
14
|
+
this.loadNodes(subLayers);
|
|
16
15
|
}
|
|
17
16
|
static isUnnamedGroup(subLayer) {
|
|
18
17
|
if (!subLayer)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAGhC,YAAY,SAA6B;QAFxB,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAG5D,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,QAAsC;QACjE,IAAI,CAAC,QAAQ;YACX,OAAO,KAAK,CAAC;QAEf,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7H,CAAC;IAEO,QAAQ,CAAC,KAAuB;QACtC,OAAO,SAAS,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,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CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC;QAEnB,OAAO,EAAE,CAAC;IACZ,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 { compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeNodeItem } from \"@itwin/components-react\";\nimport { CheckBoxState } from \"@itwin/core-react\";\n\n/**\n * Data provider that returns some fake nodes to show in tree.\n */\nexport class SubLayersDataProvider implements ITreeDataProvider {\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\n\n constructor(subLayers: MapSubLayerProps[]) {\n this.loadNodes(subLayers);\n }\n\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\n if (!subLayer)\n return false;\n\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\n }\n\n private createId(props: MapSubLayerProps): string {\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\n }\n\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\n return {\n id: this.createId(props),\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\n hasChildren: !!props.children,\n isCheckboxVisible: true,\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\n extendedData: { subLayerId: props.id },\n isCheckboxDisabled,\n autoExpand: expanded,\n icon,\n };\n }\n\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\n if (filteredProps.length) {\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n const treeNodes: TreeNodeItem[] = [];\n\n filteredProps.forEach((props) => {\n treeNodes.push(this.createNode(props,\n (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),\n undefined,\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\n\n ));\n if (props.children)\n this.loadChildNodes(allSubLayers, props.id);\n });\n\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\n }\n }\n\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\n if (subLayerNodes) {\n this.loadChildNodes(subLayerNodes, undefined);\n }\n }\n\n public async getNodesCount(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray.length;\n\n return 0;\n }\n\n public async getNodes(parent?: TreeNodeItem) {\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\n if (nodeArray)\n return nodeArray;\n\n return [];\n }\n}\n"]}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StyleMapLayerSettings } from "../Interfaces";
|
|
1
|
+
import { SubLayersPanelProps } from "./SubLayersTree";
|
|
3
2
|
/** @internal */
|
|
4
|
-
export
|
|
5
|
-
mapLayerSettings: StyleMapLayerSettings;
|
|
6
|
-
activeViewport: ScreenViewport;
|
|
7
|
-
}
|
|
3
|
+
export declare type SubLayersPopupButtonProps = SubLayersPanelProps;
|
|
8
4
|
/** @internal */
|
|
9
|
-
export declare function SubLayersPopupButton(
|
|
5
|
+
export declare function SubLayersPopupButton(props: SubLayersPopupButtonProps): JSX.Element;
|
|
10
6
|
//# sourceMappingURL=SubLayersPopupButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubLayersPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAMtE,gBAAgB;AAEhB,oBAAY,yBAAyB,GAAG,mBAAmB,CAAC;AAE5D,gBAAgB;AAEhB,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eA0CpE"}
|
|
@@ -10,7 +10,7 @@ import { MapLayersUI } from "../../mapLayers";
|
|
|
10
10
|
import { Button } from "@itwin/itwinui-react";
|
|
11
11
|
/** @internal */
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
export function SubLayersPopupButton(
|
|
13
|
+
export function SubLayersPopupButton(props) {
|
|
14
14
|
const [showSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Show"));
|
|
15
15
|
const [hideSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Hide"));
|
|
16
16
|
const [popupOpen, setPopupOpen] = React.useState(false);
|
|
@@ -32,6 +32,6 @@ export function SubLayersPopupButton({ mapLayerSettings, activeViewport }) {
|
|
|
32
32
|
React.createElement(Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: onOutsideClick, target: buttonRef.current },
|
|
33
33
|
React.createElement("div", { className: "map-transparency-popup-panel" },
|
|
34
34
|
React.createElement("div", { ref: panelRef, className: "map-manager-sublayer-panel" },
|
|
35
|
-
React.createElement(SubLayersPanel, {
|
|
35
|
+
React.createElement(SubLayersPanel, { ...props }))))));
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=SubLayersPopupButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAqB,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"SubLayersPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAqB,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAQ9C,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACrH,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACrH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG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;gBAC3C,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,4BAA4B;oBACxD,oBAAC,cAAc,OAAK,KAAK,GAAI,CACzB,CACF,CACC,CACR,CACJ,CAAC;AACJ,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*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\n\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { OutsideClickEvent, Popup, useOnOutsideClick, WebFontIcon } from \"@itwin/core-react\";\nimport { SubLayersPanel, SubLayersPanelProps } from \"./SubLayersTree\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { Button } from \"@itwin/itwinui-react\";\n\n// cSpell:ignore droppable Sublayer\n\n/** @internal */\n\nexport type SubLayersPopupButtonProps = SubLayersPanelProps;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPopupButton(props: SubLayersPopupButtonProps) {\n\n const [showSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.Show\"));\n const [hideSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.Hide\"));\n const [popupOpen, setPopupOpen] = React.useState(false);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const togglePopup = React.useCallback(() => {\n setPopupOpen(!popupOpen);\n }, [popupOpen]);\n\n const onOutsideClick = React.useCallback(() => {\n setPopupOpen(false);\n }, []);\n\n const isOutsideEvent = React.useCallback((e: OutsideClickEvent) => {\n // if clicking on button that open panel - don't trigger outside click processing\n return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);\n }, []);\n\n const panelRef = useOnOutsideClick<HTMLDivElement>(onOutsideClick, isOutsideEvent);\n\n return (\n <>\n <Button size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-item-sub-layer-button\" title={popupOpen ? hideSubLayersLabel : showSubLayersLabel}\n onClick={togglePopup}>\n <WebFontIcon iconName=\"icon-layers\" />\n </Button>\n <Popup\n isOpen={popupOpen}\n position={RelativePosition.BottomRight}\n onClose={onOutsideClick}\n target={buttonRef.current}\n >\n <div className=\"map-transparency-popup-panel\">\n <div ref={panelRef} className=\"map-manager-sublayer-panel\">\n <SubLayersPanel {...props} />\n </div>\n </div>\n </Popup >\n </>\n );\n}\n"]}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StyleMapLayerSettings } from "../Interfaces";
|
|
1
|
+
import { MapSubLayerProps, SubLayerId } from "@itwin/core-common";
|
|
3
2
|
import "./SubLayersTree.scss";
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
3
|
+
export declare type OnSubLayerStateChangeType = (subLayerId: SubLayerId, isSelected: boolean) => void;
|
|
4
|
+
export interface SubLayersPanelProps extends Omit<SubLayersTreeProps, "subLayers"> {
|
|
5
|
+
subLayers?: MapSubLayerProps[];
|
|
6
|
+
}
|
|
7
|
+
export declare function SubLayersPanel(props: SubLayersPanelProps): JSX.Element;
|
|
8
|
+
export interface SubLayersTreeProps {
|
|
9
|
+
subLayers: MapSubLayerProps[];
|
|
10
|
+
singleVisibleSubLayer?: boolean;
|
|
11
|
+
onSubLayerStateChange?: OnSubLayerStateChangeType;
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* Tree Control that displays sub-layer hierarchy
|
|
10
15
|
* @internal
|
|
11
16
|
*/
|
|
12
|
-
export declare function SubLayersTree(props:
|
|
13
|
-
mapLayer: StyleMapLayerSettings;
|
|
14
|
-
}): JSX.Element;
|
|
17
|
+
export declare function SubLayersTree(props: SubLayersTreeProps): JSX.Element;
|
|
15
18
|
//# sourceMappingURL=SubLayersTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKlE,OAAO,sBAAsB,CAAC;AAgE9B,oBAAY,yBAAyB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;AAC9F,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC;IAChF,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAWxD;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,yBAAyB,CAAC;CACnD;AACD;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAiFtD"}
|