@itwin/map-layers 4.0.0-dev.7 → 4.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.
Files changed (199) hide show
  1. package/CHANGELOG.md +746 -848
  2. package/README.md +32 -32
  3. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  4. package/lib/cjs/MapLayerPreferences.js +312 -312
  5. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  6. package/lib/cjs/map-layers.d.ts +6 -6
  7. package/lib/cjs/map-layers.js +22 -22
  8. package/lib/cjs/mapLayers.d.ts +26 -44
  9. package/lib/cjs/mapLayers.d.ts.map +1 -1
  10. package/lib/cjs/mapLayers.js +34 -63
  11. package/lib/cjs/mapLayers.js.map +1 -1
  12. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  13. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  14. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +47 -52
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  16. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  17. package/lib/cjs/ui/Interfaces.js +2 -2
  18. package/lib/cjs/ui/Interfaces.js.map +1 -1
  19. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  20. package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -1
  21. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  22. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  23. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  26. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  27. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  29. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +338 -338
  30. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  31. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  32. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  34. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  35. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  36. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  38. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +25 -25
  39. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  41. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  42. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +140 -139
  43. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  45. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  46. package/lib/cjs/ui/widget/FeatureInfoWidget.js +76 -71
  47. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  48. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  49. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  50. package/lib/cjs/ui/widget/MapLayerDroppable.js +88 -88
  51. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  53. package/lib/cjs/ui/widget/MapLayerManager.js +403 -403
  54. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  56. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  57. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  58. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +83 -83
  59. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  60. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  61. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  62. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  63. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  65. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  66. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  67. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  68. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  69. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  70. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  71. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  72. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  73. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  74. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  75. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  76. package/lib/cjs/ui/widget/MapUrlDialog.js +533 -527
  77. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  78. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  79. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  80. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  81. package/lib/cjs/ui/widget/SelectMapFormat.js +59 -59
  82. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  83. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  84. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  85. package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -76
  86. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  87. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  88. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  89. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  90. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  91. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  92. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  93. package/lib/cjs/ui/widget/SubLayersTree.js +419 -419
  94. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  95. package/lib/cjs/ui/widget/SubLayersTree.scss +70 -69
  96. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  97. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  98. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  99. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  100. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  101. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  102. package/lib/esm/MapLayerPreferences.js +308 -308
  103. package/lib/esm/MapLayerPreferences.js.map +1 -1
  104. package/lib/esm/map-layers.d.ts +6 -6
  105. package/lib/esm/map-layers.js +10 -10
  106. package/lib/esm/mapLayers.d.ts +26 -44
  107. package/lib/esm/mapLayers.d.ts.map +1 -1
  108. package/lib/esm/mapLayers.js +30 -59
  109. package/lib/esm/mapLayers.js.map +1 -1
  110. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  111. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  112. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +43 -48
  113. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  114. package/lib/esm/ui/Interfaces.d.ts +50 -50
  115. package/lib/esm/ui/Interfaces.js +1 -1
  116. package/lib/esm/ui/Interfaces.js.map +1 -1
  117. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  118. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
  119. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  120. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  121. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  122. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  123. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  124. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  125. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  126. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  127. package/lib/esm/ui/widget/AttachLayerPopupButton.js +334 -334
  128. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  129. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  130. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  131. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  132. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  133. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  134. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  135. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  136. package/lib/esm/ui/widget/ConfirmMessageDialog.js +21 -21
  137. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  138. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  139. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  140. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +136 -135
  141. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  142. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  143. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  144. package/lib/esm/ui/widget/FeatureInfoWidget.js +72 -67
  145. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  146. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  147. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  148. package/lib/esm/ui/widget/MapLayerDroppable.js +84 -84
  149. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  150. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  151. package/lib/esm/ui/widget/MapLayerManager.js +398 -398
  152. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  153. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  154. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  155. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +79 -79
  157. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  158. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  159. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  160. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  161. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  162. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  163. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  164. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  165. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  166. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  167. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  168. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  169. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  170. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  171. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  172. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  173. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  174. package/lib/esm/ui/widget/MapUrlDialog.js +529 -523
  175. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  176. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  177. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  178. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  179. package/lib/esm/ui/widget/SelectMapFormat.js +55 -55
  180. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  181. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  182. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  183. package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -72
  184. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  186. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  188. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  189. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  190. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  191. package/lib/esm/ui/widget/SubLayersTree.js +414 -414
  192. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  193. package/lib/esm/ui/widget/SubLayersTree.scss +70 -69
  194. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  195. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  196. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  197. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  198. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  199. package/package.json +39 -38
@@ -1,56 +1,56 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- // cSpell:ignore Modeless WMTS
6
- import { IconButton, MenuItem, Select } from "@itwin/itwinui-react";
7
- import * as React from "react";
8
- import "./MapUrlDialog.scss";
9
- import { SvgTechnicalPreviewMini } from "@itwin/itwinui-icons-color-react";
10
- import { MapLayersUI } from "../../mapLayers";
11
- import { IModelApp } from "@itwin/core-frontend";
12
- // TODO:
13
- // Remove this structure and iterate over the registry's active formats.
14
- // Still need a proper way to exclude some format, like we currently do with
15
- // 'TileUrl' without the need to hardcode any format Id.
16
- export const MAP_TYPES = {
17
- wms: "WMS",
18
- arcGis: "ArcGIS",
19
- wmts: "WMTS",
20
- tileUrl: "TileURL",
21
- arcGisFeature: "ArcGISFeature",
22
- };
23
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
- export function SelectMapFormat(props) {
25
- var _a;
26
- const [mapFormat, setMapFormat] = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : MAP_TYPES.arcGis);
27
- const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
28
- const [mapFormats] = React.useState(() => {
29
- var _a;
30
- const formats = [
31
- { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },
32
- { value: MAP_TYPES.wms, label: MAP_TYPES.wms },
33
- { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },
34
- ];
35
- if ((_a = props.mapTypesOptions) === null || _a === void 0 ? void 0 : _a.supportTileUrl)
36
- formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });
37
- if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))
38
- formats.push({ value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id: "techPreview" });
39
- return formats;
40
- });
41
- const handleOnChange = React.useCallback((value) => {
42
- setMapFormat(value);
43
- if (props.onChange) {
44
- props.onChange(value);
45
- }
46
- }, [props]);
47
- return (React.createElement(Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => {
48
- var _a;
49
- return (React.createElement(MenuItem, { badge: ((_a = option.id) === null || _a === void 0 ? void 0 : _a.includes("techPreview")) ?
50
- React.createElement("div", { title: techPreviewTooltip },
51
- React.createElement(IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
52
- React.createElement(SvgTechnicalPreviewMini, null)))
53
- : undefined }, option.label));
54
- } }));
55
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // cSpell:ignore Modeless WMTS
6
+ import { IconButton, MenuItem, Select } from "@itwin/itwinui-react";
7
+ import * as React from "react";
8
+ import "./MapUrlDialog.scss";
9
+ import { SvgTechnicalPreviewMini } from "@itwin/itwinui-icons-color-react";
10
+ import { MapLayersUI } from "../../mapLayers";
11
+ import { IModelApp } from "@itwin/core-frontend";
12
+ // TODO:
13
+ // Remove this structure and iterate over the registry's active formats.
14
+ // Still need a proper way to exclude some format, like we currently do with
15
+ // 'TileUrl' without the need to hardcode any format Id.
16
+ export const MAP_TYPES = {
17
+ wms: "WMS",
18
+ arcGis: "ArcGIS",
19
+ wmts: "WMTS",
20
+ tileUrl: "TileURL",
21
+ arcGisFeature: "ArcGISFeature",
22
+ };
23
+ // eslint-disable-next-line @typescript-eslint/naming-convention
24
+ export function SelectMapFormat(props) {
25
+ var _a;
26
+ const [mapFormat, setMapFormat] = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : MAP_TYPES.arcGis);
27
+ const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
28
+ const [mapFormats] = React.useState(() => {
29
+ var _a;
30
+ const formats = [
31
+ { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },
32
+ { value: MAP_TYPES.wms, label: MAP_TYPES.wms },
33
+ { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },
34
+ ];
35
+ if ((_a = props.mapTypesOptions) === null || _a === void 0 ? void 0 : _a.supportTileUrl)
36
+ formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });
37
+ if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))
38
+ formats.push({ value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id: "techPreview" });
39
+ return formats;
40
+ });
41
+ const handleOnChange = React.useCallback((value) => {
42
+ setMapFormat(value);
43
+ if (props.onChange) {
44
+ props.onChange(value);
45
+ }
46
+ }, [props]);
47
+ return (React.createElement(Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => {
48
+ var _a;
49
+ return (React.createElement(MenuItem, { badge: ((_a = option.id) === null || _a === void 0 ? void 0 : _a.includes("techPreview")) ?
50
+ React.createElement("div", { title: techPreviewTooltip },
51
+ React.createElement(IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
52
+ React.createElement(SvgTechnicalPreviewMini, null)))
53
+ : undefined }, option.label));
54
+ } }));
55
+ }
56
56
  //# sourceMappingURL=SelectMapFormat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,M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","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\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\n\r\n// TODO:\r\n// Remove this structure and iterate over the registry's active formats.\r\n// Still need a proper way to exclude some format, like we currently do with\r\n// 'TileUrl' without the need to hardcode any format Id.\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface SelectMapFormatProps {\r\n value?: string;\r\n disabled?: boolean;\r\n mapTypesOptions?: MapTypesOptions;\r\n onChange?: (mapType: string) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function SelectMapFormat(props: SelectMapFormatProps) {\r\n\r\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\r\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\r\n\r\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\r\n const formats: SelectOption<string>[] = [\r\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\r\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\r\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\r\n ];\r\n if (props.mapTypesOptions?.supportTileUrl)\r\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\r\n\r\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\r\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\r\n\r\n return formats;\r\n });\r\n\r\n const handleOnChange = React.useCallback((value: string) => {\r\n setMapFormat(value);\r\n if (props.onChange) {\r\n props.onChange(value);\r\n }\r\n }, [props]);\r\n\r\n return (\r\n\r\n <Select\r\n className=\"map-layer-source-select\"\r\n options={mapFormats}\r\n value={mapFormat}\r\n disabled={props.disabled}\r\n onChange={handleOnChange}\r\n size=\"small\"\r\n itemRenderer={\r\n (option) => (\r\n <MenuItem\r\n badge={option.id?.includes(\"techPreview\") ?\r\n <div title={techPreviewTooltip}>\r\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\r\n <SvgTechnicalPreviewMini />\r\n </IconButton>\r\n </div>\r\n : undefined}>\r\n {option.label}\r\n </MenuItem>) }\r\n />\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,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K,CAAC,WAAW,CAAC,CAAC,KAAa,EAAE,EAAE;QACzD,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CAEL,oBAAC,MAAM,IACL,SAAS,EAAC,yBAAyB,EACnC,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,EACZ,YAAY,EACV,CAAC,MAAM,EAAE,EAAE;;YAAC,OAAA,CACV,oBAAC,QAAQ,IACP,KAAK,EAAE,CAAA,MAAA,MAAM,CAAC,EAAE,0CAAE,QAAQ,CAAC,aAAa,CAAC,EAAC,CAAC;oBACzC,6BAAK,KAAK,EAAE,kBAAkB;wBAC5B,oBAAC,UAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;4BACxE,oBAAC,uBAAuB,OAAG,CAChB,CACT;oBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,CAAA;SAAA,GAChB,CACH,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 Modeless WMTS\n\nimport { IconButton, MenuItem, Select, SelectOption } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport { MapTypesOptions } from \"../Interfaces\";\nimport \"./MapUrlDialog.scss\";\nimport {SvgTechnicalPreviewMini} from \"@itwin/itwinui-icons-color-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n// TODO:\n// Remove this structure and iterate over the registry's active formats.\n// Still need a proper way to exclude some format, like we currently do with\n// 'TileUrl' without the need to hardcode any format Id.\nexport const MAP_TYPES = {\n wms: \"WMS\",\n arcGis: \"ArcGIS\",\n wmts: \"WMTS\",\n tileUrl: \"TileURL\",\n arcGisFeature: \"ArcGISFeature\",\n};\n\ninterface SelectMapFormatProps {\n value?: string;\n disabled?: boolean;\n mapTypesOptions?: MapTypesOptions;\n onChange?: (mapType: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SelectMapFormat(props: SelectMapFormatProps) {\n\n const [mapFormat, setMapFormat] = React.useState(props.value ?? MAP_TYPES.arcGis);\n const [techPreviewTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.TechPreviewBadgeTooltip\"));\n\n const [mapFormats] = React.useState((): SelectOption<string>[] => {\n const formats: SelectOption<string>[] = [\n { value: MAP_TYPES.arcGis, label: MAP_TYPES.arcGis },\n { value: MAP_TYPES.wms, label: MAP_TYPES.wms },\n { value: MAP_TYPES.wmts, label: MAP_TYPES.wmts },\n ];\n if (props.mapTypesOptions?.supportTileUrl)\n formats.push({ value: MAP_TYPES.tileUrl, label: MAP_TYPES.tileUrl });\n\n if (IModelApp.mapLayerFormatRegistry.isRegistered(MAP_TYPES.arcGisFeature))\n formats.push( { value: MAP_TYPES.arcGisFeature, label: MAP_TYPES.arcGisFeature, id:\"techPreview\" });\n\n return formats;\n });\n\n const handleOnChange = React.useCallback((value: string) => {\n setMapFormat(value);\n if (props.onChange) {\n props.onChange(value);\n }\n }, [props]);\n\n return (\n\n <Select\n className=\"map-layer-source-select\"\n options={mapFormats}\n value={mapFormat}\n disabled={props.disabled}\n onChange={handleOnChange}\n size=\"small\"\n itemRenderer={\n (option) => (\n <MenuItem\n badge={option.id?.includes(\"techPreview\") ?\n <div title={techPreviewTooltip}>\n <IconButton className=\"map-layer-source-select-previewBadge\" size=\"small\">\n <SvgTechnicalPreviewMini />\n </IconButton>\n </div>\n : undefined}>\n {option.label}\n </MenuItem>) }\n />\n );\n}\n"]}
@@ -1,21 +1,19 @@
1
- import { BeEvent } from "@itwin/core-bentley";
2
- import { MapSubLayerProps } from "@itwin/core-common";
3
- import { ITreeDataProvider, TreeDataChangesListener, TreeNodeItem } from "@itwin/components-react";
4
- import { StyleMapLayerSettings } from "../Interfaces";
5
- /**
6
- * Data provider that returns some fake nodes to show in tree.
7
- */
8
- export declare class SubLayersDataProvider implements ITreeDataProvider {
9
- private readonly _nodeMap;
10
- private readonly _mapLayer;
11
- constructor(mapLayer: StyleMapLayerSettings);
12
- static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean;
13
- private createId;
14
- private createNode;
15
- private loadChildNodes;
16
- private loadNodes;
17
- onTreeNodeChanged: BeEvent<TreeDataChangesListener>;
18
- getNodesCount(parent?: TreeNodeItem): Promise<number>;
19
- getNodes(parent?: TreeNodeItem): Promise<TreeNodeItem[]>;
20
- }
1
+ import { MapSubLayerProps } from "@itwin/core-common";
2
+ import { ITreeDataProvider, TreeNodeItem } from "@itwin/components-react";
3
+ import { StyleMapLayerSettings } from "../Interfaces";
4
+ /**
5
+ * Data provider that returns some fake nodes to show in tree.
6
+ */
7
+ export declare class SubLayersDataProvider implements ITreeDataProvider {
8
+ private readonly _nodeMap;
9
+ private readonly _mapLayer;
10
+ constructor(mapLayer: StyleMapLayerSettings);
11
+ static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean;
12
+ private createId;
13
+ private createNode;
14
+ private loadChildNodes;
15
+ private loadNodes;
16
+ getNodesCount(parent?: TreeNodeItem): Promise<number>;
17
+ getNodes(parent?: TreeNodeItem): Promise<TreeNodeItem[]>;
18
+ }
21
19
  //# sourceMappingURL=SubLayersDataProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAA6B,MAA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AC,cAAc;IAqBtB,OAAO,CAAC,SAAS;IAOJ,aAAa,CAAC,MAAM,CAAC,EAAE,YAAY;IAQnC,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY;CAO5C"}
@@ -1,73 +1,72 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import { BeEvent, compareStringsOrUndefined } from "@itwin/core-bentley";
6
- import { PropertyRecord } from "@itwin/appui-abstract";
7
- import { CheckBoxState } from "@itwin/core-react";
8
- /**
9
- * Data provider that returns some fake nodes to show in tree.
10
- */
11
- export class SubLayersDataProvider {
12
- constructor(mapLayer) {
13
- this._nodeMap = new Map();
14
- this.onTreeNodeChanged = new BeEvent();
15
- this._mapLayer = mapLayer;
16
- this.loadNodes(mapLayer.subLayers);
17
- }
18
- static isUnnamedGroup(subLayer) {
19
- if (!subLayer)
20
- return false;
21
- return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);
22
- }
23
- createId(props) {
24
- return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
25
- }
26
- createNode(props, expanded, isCheckboxDisabled, icon) {
27
- var _a, _b;
28
- return {
29
- id: this.createId(props),
30
- label: PropertyRecord.fromString((_b = (_a = props.title) !== null && _a !== void 0 ? _a : props.name) !== null && _b !== void 0 ? _b : "unknown"),
31
- hasChildren: !!props.children,
32
- isCheckboxVisible: true,
33
- checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,
34
- extendedData: { subLayerId: props.id },
35
- isCheckboxDisabled,
36
- autoExpand: expanded,
37
- icon,
38
- };
39
- }
40
- loadChildNodes(allSubLayers, parentId) {
41
- const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
42
- if (filteredProps.length) {
43
- filteredProps === null || filteredProps === void 0 ? void 0 : filteredProps.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
44
- const treeNodes = [];
45
- filteredProps.forEach((props) => {
46
- treeNodes.push(this.createNode(props, (!parentId && (props === null || props === void 0 ? void 0 : props.children) !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
47
- undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
48
- if (props.children)
49
- this.loadChildNodes(allSubLayers, props.id);
50
- });
51
- this._nodeMap.set(undefined !== parentId ? `${parentId}` : "", treeNodes);
52
- }
53
- }
54
- loadNodes(subLayerNodes) {
55
- subLayerNodes === null || subLayerNodes === void 0 ? void 0 : subLayerNodes.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
56
- if (subLayerNodes) {
57
- this.loadChildNodes(subLayerNodes, undefined);
58
- }
59
- }
60
- async getNodesCount(parent) {
61
- const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
62
- if (nodeArray)
63
- return nodeArray.length;
64
- return 0;
65
- }
66
- async getNodes(parent) {
67
- const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
68
- if (nodeArray)
69
- return nodeArray;
70
- return [];
71
- }
72
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { compareStringsOrUndefined } from "@itwin/core-bentley";
6
+ import { PropertyRecord } from "@itwin/appui-abstract";
7
+ import { CheckBoxState } from "@itwin/core-react";
8
+ /**
9
+ * Data provider that returns some fake nodes to show in tree.
10
+ */
11
+ export class SubLayersDataProvider {
12
+ constructor(mapLayer) {
13
+ this._nodeMap = new Map();
14
+ this._mapLayer = mapLayer;
15
+ this.loadNodes(mapLayer.subLayers);
16
+ }
17
+ static isUnnamedGroup(subLayer) {
18
+ if (!subLayer)
19
+ return false;
20
+ return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);
21
+ }
22
+ createId(props) {
23
+ return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
24
+ }
25
+ createNode(props, expanded, isCheckboxDisabled, icon) {
26
+ var _a, _b;
27
+ return {
28
+ id: this.createId(props),
29
+ label: PropertyRecord.fromString((_b = (_a = props.title) !== null && _a !== void 0 ? _a : props.name) !== null && _b !== void 0 ? _b : "unknown"),
30
+ hasChildren: !!props.children,
31
+ isCheckboxVisible: true,
32
+ checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,
33
+ extendedData: { subLayerId: props.id },
34
+ isCheckboxDisabled,
35
+ autoExpand: expanded,
36
+ icon,
37
+ };
38
+ }
39
+ loadChildNodes(allSubLayers, parentId) {
40
+ const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
41
+ if (filteredProps.length) {
42
+ filteredProps === null || filteredProps === void 0 ? void 0 : filteredProps.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
43
+ const treeNodes = [];
44
+ filteredProps.forEach((props) => {
45
+ treeNodes.push(this.createNode(props, (!parentId && (props === null || props === void 0 ? void 0 : props.children) !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
46
+ undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
47
+ if (props.children)
48
+ this.loadChildNodes(allSubLayers, props.id);
49
+ });
50
+ this._nodeMap.set(undefined !== parentId ? `${parentId}` : "", treeNodes);
51
+ }
52
+ }
53
+ loadNodes(subLayerNodes) {
54
+ subLayerNodes === null || subLayerNodes === void 0 ? void 0 : subLayerNodes.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
55
+ if (subLayerNodes) {
56
+ this.loadChildNodes(subLayerNodes, undefined);
57
+ }
58
+ }
59
+ async getNodesCount(parent) {
60
+ const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
61
+ if (nodeArray)
62
+ return nodeArray.length;
63
+ return 0;
64
+ }
65
+ async getNodes(parent) {
66
+ const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
67
+ if (nodeArray)
68
+ return nodeArray;
69
+ return [];
70
+ }
71
+ }
73
72
  //# sourceMappingURL=SubLayersDataProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAIhC,YAAY,QAA+B;QAH1B,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QA6DvD,sBAAiB,GAAG,IAAI,OAAO,EAA2B,CAAC;QAzDhE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACrC,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,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;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,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { BeEvent, compareStringsOrUndefined } from \"@itwin/core-bentley\";\r\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeDataChangesListener, TreeNodeItem } from \"@itwin/components-react\";\r\nimport { CheckBoxState } from \"@itwin/core-react\";\r\nimport { StyleMapLayerSettings } from \"../Interfaces\";\r\n\r\n/**\r\n * Data provider that returns some fake nodes to show in tree.\r\n */\r\nexport class SubLayersDataProvider implements ITreeDataProvider {\r\n private readonly _nodeMap = new Map<string, TreeNodeItem[]>();\r\n private readonly _mapLayer: StyleMapLayerSettings;\r\n\r\n constructor(mapLayer: StyleMapLayerSettings) {\r\n this._mapLayer = mapLayer;\r\n this.loadNodes(mapLayer.subLayers);\r\n }\r\n\r\n public static isUnnamedGroup(subLayer: MapSubLayerProps | undefined): boolean {\r\n if (!subLayer)\r\n return false;\r\n\r\n return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);\r\n }\r\n\r\n private createId(props: MapSubLayerProps): string {\r\n return undefined !== props.id ? `${props.id}` : props.name ? props.name : \"no-id\";\r\n }\r\n\r\n private createNode(props: MapSubLayerProps, expanded?: boolean, isCheckboxDisabled?: boolean, icon?: string): DelayLoadedTreeNodeItem {\r\n return {\r\n id: this.createId(props),\r\n label: PropertyRecord.fromString(props.title ?? props.name ?? \"unknown\"),\r\n hasChildren: !!props.children,\r\n isCheckboxVisible: true,\r\n checkBoxState: props.visible && !isCheckboxDisabled ? CheckBoxState.On : CheckBoxState.Off,\r\n extendedData: { subLayerId: props.id },\r\n isCheckboxDisabled,\r\n autoExpand: expanded,\r\n icon,\r\n };\r\n }\r\n\r\n private loadChildNodes(allSubLayers: MapSubLayerProps[], parentId?: SubLayerId) {\r\n const filteredProps = allSubLayers.filter((props) => parentId === props.parent);\r\n if (filteredProps.length) {\r\n filteredProps?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\r\n const treeNodes: TreeNodeItem[] = [];\r\n\r\n filteredProps.forEach((props) => {\r\n treeNodes.push(this.createNode(props,\r\n (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),\r\n undefined,\r\n SubLayersDataProvider.isUnnamedGroup(props) ? \"icon-folder\" : \"icon-layers\"\r\n\r\n ));\r\n if (props.children)\r\n this.loadChildNodes(allSubLayers, props.id);\r\n });\r\n\r\n this._nodeMap.set(undefined !== parentId ? `${parentId}` : \"\", treeNodes);\r\n }\r\n }\r\n\r\n private loadNodes(subLayerNodes: MapSubLayerProps[] | undefined) {\r\n subLayerNodes?.sort((a: MapSubLayerProps, b: MapSubLayerProps) => compareStringsOrUndefined(a.title, b.title));\r\n if (subLayerNodes) {\r\n this.loadChildNodes(subLayerNodes, undefined);\r\n }\r\n }\r\n\r\n public onTreeNodeChanged = new BeEvent<TreeDataChangesListener>();\r\n\r\n public async getNodesCount(parent?: TreeNodeItem) {\r\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\r\n if (nodeArray)\r\n return nodeArray.length;\r\n\r\n return 0;\r\n }\r\n\r\n public async getNodes(parent?: TreeNodeItem) {\r\n const nodeArray: TreeNodeItem[] | undefined = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get(\"\");\r\n if (nodeArray)\r\n return nodeArray;\r\n\r\n return [];\r\n }\r\n}\r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yright (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\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\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 private readonly _mapLayer: StyleMapLayerSettings;\n\n constructor(mapLayer: StyleMapLayerSettings) {\n this._mapLayer = mapLayer;\n this.loadNodes(mapLayer.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,11 +1,10 @@
1
- /// <reference types="react" />
2
- import { ScreenViewport } from "@itwin/core-frontend";
3
- import { StyleMapLayerSettings } from "../Interfaces";
4
- /** @internal */
5
- export interface SubLayersPopupButtonProps {
6
- mapLayerSettings: StyleMapLayerSettings;
7
- activeViewport: ScreenViewport;
8
- }
9
- /** @internal */
10
- export declare function SubLayersPopupButton({ mapLayerSettings, activeViewport }: SubLayersPopupButtonProps): JSX.Element;
1
+ import { ScreenViewport } from "@itwin/core-frontend";
2
+ import { StyleMapLayerSettings } from "../Interfaces";
3
+ /** @internal */
4
+ export interface SubLayersPopupButtonProps {
5
+ mapLayerSettings: StyleMapLayerSettings;
6
+ activeViewport: ScreenViewport;
7
+ }
8
+ /** @internal */
9
+ export declare function SubLayersPopupButton({ mapLayerSettings, activeViewport }: SubLayersPopupButtonProps): JSX.Element;
11
10
  //# sourceMappingURL=SubLayersPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAMtD,gBAAgB;AAChB,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,gBAAgB;AAEhB,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,yBAAyB,eA0CnG"}
1
+ {"version":3,"file":"SubLayersPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersPopupButton.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAMtD,gBAAgB;AAChB,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,gBAAgB;AAEhB,wBAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,yBAAyB,eA0CnG"}
@@ -1,37 +1,37 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import * as React from "react";
6
- import { RelativePosition } from "@itwin/appui-abstract";
7
- import { Popup, useOnOutsideClick, WebFontIcon } from "@itwin/core-react";
8
- import { SubLayersPanel } from "./SubLayersTree";
9
- import { MapLayersUI } from "../../mapLayers";
10
- import { Button } from "@itwin/itwinui-react";
11
- /** @internal */
12
- // eslint-disable-next-line @typescript-eslint/naming-convention
13
- export function SubLayersPopupButton({ mapLayerSettings, activeViewport }) {
14
- const [showSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Show"));
15
- const [hideSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Hide"));
16
- const [popupOpen, setPopupOpen] = React.useState(false);
17
- const buttonRef = React.useRef(null);
18
- const togglePopup = React.useCallback(() => {
19
- setPopupOpen(!popupOpen);
20
- }, [popupOpen]);
21
- const onOutsideClick = React.useCallback(() => {
22
- setPopupOpen(false);
23
- }, []);
24
- const isOutsideEvent = React.useCallback((e) => {
25
- // if clicking on button that open panel - don't trigger outside click processing
26
- return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);
27
- }, []);
28
- const panelRef = useOnOutsideClick(onOutsideClick, isOutsideEvent);
29
- return (React.createElement(React.Fragment, null,
30
- React.createElement(Button, { size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-item-sub-layer-button", title: popupOpen ? hideSubLayersLabel : showSubLayersLabel, onClick: togglePopup },
31
- React.createElement(WebFontIcon, { iconName: "icon-layers" })),
32
- React.createElement(Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: onOutsideClick, target: buttonRef.current },
33
- React.createElement("div", { className: "map-transparency-popup-panel" },
34
- React.createElement("div", { ref: panelRef, className: "map-manager-sublayer-panel" },
35
- React.createElement(SubLayersPanel, { mapLayer: mapLayerSettings, viewport: activeViewport }))))));
36
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as React from "react";
6
+ import { RelativePosition } from "@itwin/appui-abstract";
7
+ import { Popup, useOnOutsideClick, WebFontIcon } from "@itwin/core-react";
8
+ import { SubLayersPanel } from "./SubLayersTree";
9
+ import { MapLayersUI } from "../../mapLayers";
10
+ import { Button } from "@itwin/itwinui-react";
11
+ /** @internal */
12
+ // eslint-disable-next-line @typescript-eslint/naming-convention
13
+ export function SubLayersPopupButton({ mapLayerSettings, activeViewport }) {
14
+ const [showSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Show"));
15
+ const [hideSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Hide"));
16
+ const [popupOpen, setPopupOpen] = React.useState(false);
17
+ const buttonRef = React.useRef(null);
18
+ const togglePopup = React.useCallback(() => {
19
+ setPopupOpen(!popupOpen);
20
+ }, [popupOpen]);
21
+ const onOutsideClick = React.useCallback(() => {
22
+ setPopupOpen(false);
23
+ }, []);
24
+ const isOutsideEvent = React.useCallback((e) => {
25
+ // if clicking on button that open panel - don't trigger outside click processing
26
+ return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);
27
+ }, []);
28
+ const panelRef = useOnOutsideClick(onOutsideClick, isOutsideEvent);
29
+ return (React.createElement(React.Fragment, null,
30
+ React.createElement(Button, { size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-item-sub-layer-button", title: popupOpen ? hideSubLayersLabel : showSubLayersLabel, onClick: togglePopup },
31
+ React.createElement(WebFontIcon, { iconName: "icon-layers" })),
32
+ React.createElement(Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: onOutsideClick, target: buttonRef.current },
33
+ React.createElement("div", { className: "map-transparency-popup-panel" },
34
+ React.createElement("div", { ref: panelRef, className: "map-manager-sublayer-panel" },
35
+ React.createElement(SubLayersPanel, { mapLayer: mapLayerSettings, viewport: activeViewport }))))));
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;;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,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACpG,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,iBAAiB,CAAiB,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,mCAAmC,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,EAClK,OAAO,EAAE,WAAW;YACpB,oBAAC,WAAW,IAAC,QAAQ,EAAC,aAAa,GAAG,CAC/B;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,CAAC,OAAO;YAEzB,6BAAK,SAAS,EAAC,8BAA8B;gBAC3C,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,4BAA4B;oBACxD,oBAAC,cAAc,IAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,GAAI,CACpE,CACF,CACC,CACR,CACJ,CAAC;AACJ,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\nimport * as React from \"react\";\r\nimport { ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { OutsideClickEvent, Popup, useOnOutsideClick, WebFontIcon } from \"@itwin/core-react\";\r\nimport { SubLayersPanel } from \"./SubLayersTree\";\r\nimport { StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\n/** @internal */\r\nexport interface SubLayersPopupButtonProps {\r\n mapLayerSettings: StyleMapLayerSettings;\r\n activeViewport: ScreenViewport;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function SubLayersPopupButton({ mapLayerSettings, activeViewport }: SubLayersPopupButtonProps) {\r\n\r\n const [showSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.Show\"));\r\n const [hideSubLayersLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:SubLayers.Hide\"));\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const onOutsideClick = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const isOutsideEvent = React.useCallback((e: OutsideClickEvent) => {\r\n // if clicking on button that open panel - don't trigger outside click processing\r\n return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);\r\n }, []);\r\n\r\n const panelRef = useOnOutsideClick<HTMLDivElement>(onOutsideClick, isOutsideEvent);\r\n\r\n return (\r\n <>\r\n <Button size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-item-sub-layer-button\" title={popupOpen ? hideSubLayersLabel : showSubLayersLabel}\r\n onClick={togglePopup}>\r\n <WebFontIcon iconName=\"icon-layers\" />\r\n </Button>\r\n <Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={onOutsideClick}\r\n target={buttonRef.current}\r\n >\r\n <div className=\"map-transparency-popup-panel\">\r\n <div ref={panelRef} className=\"map-manager-sublayer-panel\">\r\n <SubLayersPanel mapLayer={mapLayerSettings} viewport={activeViewport} />\r\n </div>\r\n </div>\r\n </Popup >\r\n </>\r\n );\r\n}\r\n"]}
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,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,gBAAgB;AAChB,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAA6B;IAElG,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,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAoB,IAAI,CAAC,CAAC;IAExD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC5C,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAoB,EAAE,EAAE;QAChE,iFAAiF;QACjF,OAAO,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,YAAY,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACpG,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,iBAAiB,CAAiB,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAC,mCAAmC,EAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,kBAAkB,EAClK,OAAO,EAAE,WAAW;YACpB,oBAAC,WAAW,IAAC,QAAQ,EAAC,aAAa,GAAG,CAC/B;QACT,oBAAC,KAAK,IACJ,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,SAAS,CAAC,OAAO;YAEzB,6BAAK,SAAS,EAAC,8BAA8B;gBAC3C,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,4BAA4B;oBACxD,oBAAC,cAAc,IAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,GAAI,CACpE,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\";\nimport { ScreenViewport } from \"@itwin/core-frontend\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { OutsideClickEvent, Popup, useOnOutsideClick, WebFontIcon } from \"@itwin/core-react\";\nimport { SubLayersPanel } from \"./SubLayersTree\";\nimport { StyleMapLayerSettings } from \"../Interfaces\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { Button } from \"@itwin/itwinui-react\";\n\n// cSpell:ignore droppable Sublayer\n\n/** @internal */\nexport interface SubLayersPopupButtonProps {\n mapLayerSettings: StyleMapLayerSettings;\n activeViewport: ScreenViewport;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function SubLayersPopupButton({ mapLayerSettings, activeViewport }: 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 mapLayer={mapLayerSettings} viewport={activeViewport} />\n </div>\n </div>\n </Popup >\n </>\n );\n}\n"]}
@@ -1,16 +1,15 @@
1
- /// <reference types="react" />
2
- import { ScreenViewport } from "@itwin/core-frontend";
3
- import { StyleMapLayerSettings } from "../Interfaces";
4
- import "./SubLayersTree.scss";
5
- export declare function SubLayersPanel({ mapLayer, viewport }: {
6
- mapLayer: StyleMapLayerSettings;
7
- viewport: ScreenViewport | undefined;
8
- }): JSX.Element;
9
- /**
10
- * Tree Control that displays sub-layer hierarchy
11
- * @internal
12
- */
13
- export declare function SubLayersTree(props: {
14
- mapLayer: StyleMapLayerSettings;
15
- }): JSX.Element;
1
+ import { ScreenViewport } from "@itwin/core-frontend";
2
+ import { StyleMapLayerSettings } from "../Interfaces";
3
+ import "./SubLayersTree.scss";
4
+ export declare function SubLayersPanel({ mapLayer, viewport }: {
5
+ mapLayer: StyleMapLayerSettings;
6
+ viewport: ScreenViewport | undefined;
7
+ }): JSX.Element;
8
+ /**
9
+ * Tree Control that displays sub-layer hierarchy
10
+ * @internal
11
+ */
12
+ export declare function SubLayersTree(props: {
13
+ mapLayer: StyleMapLayerSettings;
14
+ }): JSX.Element;
16
15
  //# sourceMappingURL=SubLayersTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":";AAaA,OAAO,EAA8C,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIlG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,sBAAsB,CAAC;AAkE9B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,eAW/H;AAsBD;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,eAoGvE"}
1
+ {"version":3,"file":"SubLayersTree.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersTree.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8C,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAIlG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,sBAAsB,CAAC;AAkE9B,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,eAW/H;AAsBD;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,qBAAqB,CAAA;CAAE,eAoGvE"}