@itwin/map-layers 4.0.0-dev.8 → 5.0.0-dev.2

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 (203) 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 +311 -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 +33 -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 +46 -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.d.ts.map +1 -1
  18. package/lib/cjs/ui/Interfaces.js +2 -2
  19. package/lib/cjs/ui/Interfaces.js.map +1 -1
  20. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  21. package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -1
  22. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  23. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  26. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  27. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  29. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  30. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +334 -338
  31. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  32. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  33. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  34. package/lib/cjs/ui/widget/BasemapPanel.js +151 -156
  35. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  36. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  38. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  39. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -25
  40. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  41. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  42. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  43. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +139 -139
  44. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  45. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  46. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/FeatureInfoWidget.js +70 -71
  48. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  50. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  51. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -88
  52. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  53. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  54. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerManager.js +399 -403
  56. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  58. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  59. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  60. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +79 -83
  61. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  62. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  63. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  65. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  66. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  67. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  68. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  69. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  70. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  71. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  72. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  73. package/lib/cjs/ui/widget/MapManagerSettings.js +195 -200
  74. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  75. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  76. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  77. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  78. package/lib/cjs/ui/widget/MapUrlDialog.js +528 -527
  79. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  80. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  81. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  82. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  83. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -59
  84. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  85. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  86. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  87. package/lib/cjs/ui/widget/SubLayersDataProvider.js +74 -76
  88. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  89. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  90. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  91. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  92. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  93. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  94. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  95. package/lib/cjs/ui/widget/SubLayersTree.js +408 -419
  96. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  97. package/lib/cjs/ui/widget/SubLayersTree.scss +70 -69
  98. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  99. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  100. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  101. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  102. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  103. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  104. package/lib/esm/MapLayerPreferences.js +307 -308
  105. package/lib/esm/MapLayerPreferences.js.map +1 -1
  106. package/lib/esm/map-layers.d.ts +6 -6
  107. package/lib/esm/map-layers.js +10 -10
  108. package/lib/esm/mapLayers.d.ts +26 -44
  109. package/lib/esm/mapLayers.d.ts.map +1 -1
  110. package/lib/esm/mapLayers.js +29 -59
  111. package/lib/esm/mapLayers.js.map +1 -1
  112. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  113. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  114. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +42 -48
  115. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  116. package/lib/esm/ui/Interfaces.d.ts +50 -50
  117. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  118. package/lib/esm/ui/Interfaces.js +1 -1
  119. package/lib/esm/ui/Interfaces.js.map +1 -1
  120. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  121. package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
  122. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  123. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  124. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  125. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  126. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  127. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  128. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  129. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  130. package/lib/esm/ui/widget/AttachLayerPopupButton.js +330 -334
  131. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  132. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  133. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  134. package/lib/esm/ui/widget/BasemapPanel.js +147 -152
  135. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  136. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  137. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  138. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  139. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -21
  140. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  141. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +35 -40
  142. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  143. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +135 -135
  144. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  145. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  146. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  147. package/lib/esm/ui/widget/FeatureInfoWidget.js +66 -67
  148. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  149. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  150. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  151. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -84
  152. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  153. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  154. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  155. package/lib/esm/ui/widget/MapLayerManager.js +394 -398
  156. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  157. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  158. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  159. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  160. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +75 -79
  161. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  162. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  163. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  164. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  165. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  166. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  167. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  168. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  169. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  170. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  171. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  172. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  173. package/lib/esm/ui/widget/MapManagerSettings.js +191 -196
  174. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  175. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  176. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  177. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  178. package/lib/esm/ui/widget/MapUrlDialog.js +524 -523
  179. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  180. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  181. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  182. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  183. package/lib/esm/ui/widget/SelectMapFormat.js +50 -55
  184. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  186. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersDataProvider.js +70 -72
  188. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  189. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  190. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  191. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  192. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  193. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  194. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  195. package/lib/esm/ui/widget/SubLayersTree.js +403 -414
  196. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  197. package/lib/esm/ui/widget/SubLayersTree.scss +70 -69
  198. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  199. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  200. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  201. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  202. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  203. package/package.json +39 -38
@@ -1,60 +1,55 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- // cSpell:ignore Modeless WMTS
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.SelectMapFormat = exports.MAP_TYPES = void 0;
9
- const itwinui_react_1 = require("@itwin/itwinui-react");
10
- const React = require("react");
11
- require("./MapUrlDialog.scss");
12
- const itwinui_icons_color_react_1 = require("@itwin/itwinui-icons-color-react");
13
- const mapLayers_1 = require("../../mapLayers");
14
- const core_frontend_1 = require("@itwin/core-frontend");
15
- // TODO:
16
- // Remove this structure and iterate over the registry's active formats.
17
- // Still need a proper way to exclude some format, like we currently do with
18
- // 'TileUrl' without the need to hardcode any format Id.
19
- exports.MAP_TYPES = {
20
- wms: "WMS",
21
- arcGis: "ArcGIS",
22
- wmts: "WMTS",
23
- tileUrl: "TileURL",
24
- arcGisFeature: "ArcGISFeature",
25
- };
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
- function SelectMapFormat(props) {
28
- var _a;
29
- const [mapFormat, setMapFormat] = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : exports.MAP_TYPES.arcGis);
30
- const [techPreviewTooltip] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
31
- const [mapFormats] = React.useState(() => {
32
- var _a;
33
- const formats = [
34
- { value: exports.MAP_TYPES.arcGis, label: exports.MAP_TYPES.arcGis },
35
- { value: exports.MAP_TYPES.wms, label: exports.MAP_TYPES.wms },
36
- { value: exports.MAP_TYPES.wmts, label: exports.MAP_TYPES.wmts },
37
- ];
38
- if ((_a = props.mapTypesOptions) === null || _a === void 0 ? void 0 : _a.supportTileUrl)
39
- formats.push({ value: exports.MAP_TYPES.tileUrl, label: exports.MAP_TYPES.tileUrl });
40
- if (core_frontend_1.IModelApp.mapLayerFormatRegistry.isRegistered(exports.MAP_TYPES.arcGisFeature))
41
- formats.push({ value: exports.MAP_TYPES.arcGisFeature, label: exports.MAP_TYPES.arcGisFeature, id: "techPreview" });
42
- return formats;
43
- });
44
- const handleOnChange = React.useCallback((value) => {
45
- setMapFormat(value);
46
- if (props.onChange) {
47
- props.onChange(value);
48
- }
49
- }, [props]);
50
- return (React.createElement(itwinui_react_1.Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => {
51
- var _a;
52
- return (React.createElement(itwinui_react_1.MenuItem, { badge: ((_a = option.id) === null || _a === void 0 ? void 0 : _a.includes("techPreview")) ?
53
- React.createElement("div", { title: techPreviewTooltip },
54
- React.createElement(itwinui_react_1.IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
55
- React.createElement(itwinui_icons_color_react_1.SvgTechnicalPreviewMini, null)))
56
- : undefined }, option.label));
57
- } }));
58
- }
59
- exports.SelectMapFormat = SelectMapFormat;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ // cSpell:ignore Modeless WMTS
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SelectMapFormat = exports.MAP_TYPES = void 0;
9
+ const itwinui_react_1 = require("@itwin/itwinui-react");
10
+ const React = require("react");
11
+ require("./MapUrlDialog.scss");
12
+ const itwinui_icons_color_react_1 = require("@itwin/itwinui-icons-color-react");
13
+ const mapLayers_1 = require("../../mapLayers");
14
+ const core_frontend_1 = require("@itwin/core-frontend");
15
+ // TODO:
16
+ // Remove this structure and iterate over the registry's active formats.
17
+ // Still need a proper way to exclude some format, like we currently do with
18
+ // 'TileUrl' without the need to hardcode any format Id.
19
+ exports.MAP_TYPES = {
20
+ wms: "WMS",
21
+ arcGis: "ArcGIS",
22
+ wmts: "WMTS",
23
+ tileUrl: "TileURL",
24
+ arcGisFeature: "ArcGISFeature",
25
+ };
26
+ // eslint-disable-next-line @typescript-eslint/naming-convention
27
+ function SelectMapFormat(props) {
28
+ const [mapFormat, setMapFormat] = React.useState(props.value ?? exports.MAP_TYPES.arcGis);
29
+ const [techPreviewTooltip] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.TechPreviewBadgeTooltip"));
30
+ const [mapFormats] = React.useState(() => {
31
+ const formats = [
32
+ { value: exports.MAP_TYPES.arcGis, label: exports.MAP_TYPES.arcGis },
33
+ { value: exports.MAP_TYPES.wms, label: exports.MAP_TYPES.wms },
34
+ { value: exports.MAP_TYPES.wmts, label: exports.MAP_TYPES.wmts },
35
+ ];
36
+ if (props.mapTypesOptions?.supportTileUrl)
37
+ formats.push({ value: exports.MAP_TYPES.tileUrl, label: exports.MAP_TYPES.tileUrl });
38
+ if (core_frontend_1.IModelApp.mapLayerFormatRegistry.isRegistered(exports.MAP_TYPES.arcGisFeature))
39
+ formats.push({ value: exports.MAP_TYPES.arcGisFeature, label: exports.MAP_TYPES.arcGisFeature, id: "techPreview" });
40
+ return formats;
41
+ });
42
+ const handleOnChange = React.useCallback((value) => {
43
+ setMapFormat(value);
44
+ if (props.onChange) {
45
+ props.onChange(value);
46
+ }
47
+ }, [props]);
48
+ return (React.createElement(itwinui_react_1.Select, { className: "map-layer-source-select", options: mapFormats, value: mapFormat, disabled: props.disabled, onChange: handleOnChange, size: "small", itemRenderer: (option) => (React.createElement(itwinui_react_1.MenuItem, { badge: option.id?.includes("techPreview") ?
49
+ React.createElement("div", { title: techPreviewTooltip },
50
+ React.createElement(itwinui_react_1.IconButton, { className: "map-layer-source-select-previewBadge", size: "small" },
51
+ React.createElement(itwinui_icons_color_react_1.SvgTechnicalPreviewMini, null)))
52
+ : undefined }, option.label)) }));
53
+ }
54
+ exports.SelectMapFormat = SelectMapFormat;
60
55
  //# 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,wDAAkF;AAClF,+BAA+B;AAE/B,+BAA6B;AAC7B,gFAAyE;AACzE,+CAA8C;AAC9C,wDAAiD;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AAC3C,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AASF,gEAAgE;AAChE,SAAgB,eAAe,CAAC,KAA2B;;IAEzD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAA,KAAK,CAAC,KAAK,mCAAI,iBAAS,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,gDAAgD,CAAC,CAAC,CAAC;IAE3I,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAA2B,EAAE;;QAC/D,MAAM,OAAO,GAA2B;YACtC,EAAE,KAAK,EAAE,iBAAS,CAAC,MAAM,EAAS,KAAK,EAAE,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AQ,CAAC,aAAa,CAAC,EAAC,CAAC;oBACzC,6BAAK,KAAK,EAAE,kBAAkB;wBAC5B,oBAAC,0BAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;4BACxE,oBAAC,mDAAuB,OAAG,CAChB,CACT;oBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,CAAA;SAAA,GAChB,CACH,CAAC;AACJ,CAAC;AAlDD,0CAkDC","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,wDAAkF;AAClF,+BAA+B;AAE/B,+BAA6B;AAC7B,gFAAyE;AACzE,+CAA8C;AAC9C,wDAAiD;AAEjD,QAAQ;AACR,wEAAwE;AACxE,4EAA4E;AAC5E,wDAAwD;AA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G,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,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,sBAAM,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,CAAC,CACV,oBAAC,wBAAQ,IACP,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;gBACzC,6BAAK,KAAK,EAAE,kBAAkB;oBAC5B,oBAAC,0BAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;wBACxE,oBAAC,mDAAuB,OAAG,CAChB,CACT;gBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,GAChB,CACH,CAAC;AACJ,CAAC;AAlDD,0CAkDC","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/SubLayersD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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"}
@@ -1,77 +1,75 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubLayersDataProvider = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const core_bentley_1 = require("@itwin/core-bentley");
9
- const appui_abstract_1 = require("@itwin/appui-abstract");
10
- const core_react_1 = require("@itwin/core-react");
11
- /**
12
- * Data provider that returns some fake nodes to show in tree.
13
- */
14
- class SubLayersDataProvider {
15
- constructor(mapLayer) {
16
- this._nodeMap = new Map();
17
- this.onTreeNodeChanged = new core_bentley_1.BeEvent();
18
- this._mapLayer = mapLayer;
19
- this.loadNodes(mapLayer.subLayers);
20
- }
21
- static isUnnamedGroup(subLayer) {
22
- if (!subLayer)
23
- return false;
24
- return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);
25
- }
26
- createId(props) {
27
- return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
28
- }
29
- createNode(props, expanded, isCheckboxDisabled, icon) {
30
- var _a, _b;
31
- return {
32
- id: this.createId(props),
33
- label: appui_abstract_1.PropertyRecord.fromString((_b = (_a = props.title) !== null && _a !== void 0 ? _a : props.name) !== null && _b !== void 0 ? _b : "unknown"),
34
- hasChildren: !!props.children,
35
- isCheckboxVisible: true,
36
- checkBoxState: props.visible && !isCheckboxDisabled ? core_react_1.CheckBoxState.On : core_react_1.CheckBoxState.Off,
37
- extendedData: { subLayerId: props.id },
38
- isCheckboxDisabled,
39
- autoExpand: expanded,
40
- icon,
41
- };
42
- }
43
- loadChildNodes(allSubLayers, parentId) {
44
- const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
45
- if (filteredProps.length) {
46
- filteredProps === null || filteredProps === void 0 ? void 0 : filteredProps.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
47
- const treeNodes = [];
48
- filteredProps.forEach((props) => {
49
- 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),
50
- undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
51
- if (props.children)
52
- this.loadChildNodes(allSubLayers, props.id);
53
- });
54
- this._nodeMap.set(undefined !== parentId ? `${parentId}` : "", treeNodes);
55
- }
56
- }
57
- loadNodes(subLayerNodes) {
58
- subLayerNodes === null || subLayerNodes === void 0 ? void 0 : subLayerNodes.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
59
- if (subLayerNodes) {
60
- this.loadChildNodes(subLayerNodes, undefined);
61
- }
62
- }
63
- async getNodesCount(parent) {
64
- const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
65
- if (nodeArray)
66
- return nodeArray.length;
67
- return 0;
68
- }
69
- async getNodes(parent) {
70
- const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
71
- if (nodeArray)
72
- return nodeArray;
73
- return [];
74
- }
75
- }
76
- exports.SubLayersDataProvider = SubLayersDataProvider;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubLayersDataProvider = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const core_bentley_1 = require("@itwin/core-bentley");
9
+ const appui_abstract_1 = require("@itwin/appui-abstract");
10
+ const core_react_1 = require("@itwin/core-react");
11
+ /**
12
+ * Data provider that returns some fake nodes to show in tree.
13
+ */
14
+ class SubLayersDataProvider {
15
+ constructor(mapLayer) {
16
+ this._nodeMap = new Map();
17
+ this._mapLayer = mapLayer;
18
+ this.loadNodes(mapLayer.subLayers);
19
+ }
20
+ static isUnnamedGroup(subLayer) {
21
+ if (!subLayer)
22
+ return false;
23
+ return (!subLayer.name || subLayer.name.length === 0) && (subLayer.children !== undefined && subLayer.children.length > 0);
24
+ }
25
+ createId(props) {
26
+ return undefined !== props.id ? `${props.id}` : props.name ? props.name : "no-id";
27
+ }
28
+ createNode(props, expanded, isCheckboxDisabled, icon) {
29
+ return {
30
+ id: this.createId(props),
31
+ label: appui_abstract_1.PropertyRecord.fromString(props.title ?? props.name ?? "unknown"),
32
+ hasChildren: !!props.children,
33
+ isCheckboxVisible: true,
34
+ checkBoxState: props.visible && !isCheckboxDisabled ? core_react_1.CheckBoxState.On : core_react_1.CheckBoxState.Off,
35
+ extendedData: { subLayerId: props.id },
36
+ isCheckboxDisabled,
37
+ autoExpand: expanded,
38
+ icon,
39
+ };
40
+ }
41
+ loadChildNodes(allSubLayers, parentId) {
42
+ const filteredProps = allSubLayers.filter((props) => parentId === props.parent);
43
+ if (filteredProps.length) {
44
+ filteredProps?.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
45
+ const treeNodes = [];
46
+ filteredProps.forEach((props) => {
47
+ treeNodes.push(this.createNode(props, (!parentId && props?.children !== undefined) ? true : undefined, // expand root group only (i.e. not the entire tree),
48
+ undefined, SubLayersDataProvider.isUnnamedGroup(props) ? "icon-folder" : "icon-layers"));
49
+ if (props.children)
50
+ this.loadChildNodes(allSubLayers, props.id);
51
+ });
52
+ this._nodeMap.set(undefined !== parentId ? `${parentId}` : "", treeNodes);
53
+ }
54
+ }
55
+ loadNodes(subLayerNodes) {
56
+ subLayerNodes?.sort((a, b) => (0, core_bentley_1.compareStringsOrUndefined)(a.title, b.title));
57
+ if (subLayerNodes) {
58
+ this.loadChildNodes(subLayerNodes, undefined);
59
+ }
60
+ }
61
+ async getNodesCount(parent) {
62
+ const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
63
+ if (nodeArray)
64
+ return nodeArray.length;
65
+ return 0;
66
+ }
67
+ async getNodes(parent) {
68
+ const nodeArray = parent ? this._nodeMap.get(parent.id) : this._nodeMap.get("");
69
+ if (nodeArray)
70
+ return nodeArray;
71
+ return [];
72
+ }
73
+ }
74
+ exports.SubLayersDataProvider = SubLayersDataProvider;
77
75
  //# 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,sDAAyE;AAEzE,0DAAuD;AAEvD,kDAAkD;AAGlD;;GAEG;AACH,MAAa,qBAAqB;IAIhC,YAAY,QAA+B;QAH1B,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QA6DvD,sBAAiB,GAAG,IAAI,sBAAO,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,C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AAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,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;AA/ED,sDA+EC","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\n"]}
1
+ {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,sDAAgE;AAEhE,0DAAuD;AAEvD,kDAAkD;AAGlD;;GAEG;AACH,MAAa,qBAAqB;IAIhC,YAAY,QAA+B;QAH1B,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;QAI5D,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;IACpF,CAAC;IAEO,UAAU,CAAC,KAAuB,EAAE,QAAkB,EAAE,kBAA4B,EAAE,IAAa;QACzG,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YACxB,KAAK,EAAE,+BAAc,CAAC,UAAU,CAAC,KAA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EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;SAC3E;IACH,CAAC;IAEO,SAAS,CAAC,aAA6C;QAC7D,aAAa,EAAE,IAAI,CAAC,CAAC,CAAmB,EAAE,CAAmB,EAAE,EAAE,CAAC,IAAA,wCAAyB,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/G,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;SAC/C;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAAqB;QAC9C,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5G,IAAI,SAAS;YACX,OAAO,SAAS,CAAC,MAAM,CAAC;QAE1B,OAAO,CAAC,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAqB;QACzC,MAAM,SAAS,GAA+B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,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;AA7ED,sDA6EC","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\";\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,41 +1,41 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubLayersPopupButton = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const React = require("react");
9
- const appui_abstract_1 = require("@itwin/appui-abstract");
10
- const core_react_1 = require("@itwin/core-react");
11
- const SubLayersTree_1 = require("./SubLayersTree");
12
- const mapLayers_1 = require("../../mapLayers");
13
- const itwinui_react_1 = require("@itwin/itwinui-react");
14
- /** @internal */
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- function SubLayersPopupButton({ mapLayerSettings, activeViewport }) {
17
- const [showSubLayersLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Show"));
18
- const [hideSubLayersLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Hide"));
19
- const [popupOpen, setPopupOpen] = React.useState(false);
20
- const buttonRef = React.useRef(null);
21
- const togglePopup = React.useCallback(() => {
22
- setPopupOpen(!popupOpen);
23
- }, [popupOpen]);
24
- const onOutsideClick = React.useCallback(() => {
25
- setPopupOpen(false);
26
- }, []);
27
- const isOutsideEvent = React.useCallback((e) => {
28
- // if clicking on button that open panel - don't trigger outside click processing
29
- return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);
30
- }, []);
31
- const panelRef = (0, core_react_1.useOnOutsideClick)(onOutsideClick, isOutsideEvent);
32
- return (React.createElement(React.Fragment, null,
33
- React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-item-sub-layer-button", title: popupOpen ? hideSubLayersLabel : showSubLayersLabel, onClick: togglePopup },
34
- React.createElement(core_react_1.WebFontIcon, { iconName: "icon-layers" })),
35
- React.createElement(core_react_1.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: onOutsideClick, target: buttonRef.current },
36
- React.createElement("div", { className: "map-transparency-popup-panel" },
37
- React.createElement("div", { ref: panelRef, className: "map-manager-sublayer-panel" },
38
- React.createElement(SubLayersTree_1.SubLayersPanel, { mapLayer: mapLayerSettings, viewport: activeViewport }))))));
39
- }
40
- exports.SubLayersPopupButton = SubLayersPopupButton;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubLayersPopupButton = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const React = require("react");
9
+ const appui_abstract_1 = require("@itwin/appui-abstract");
10
+ const core_react_1 = require("@itwin/core-react");
11
+ const SubLayersTree_1 = require("./SubLayersTree");
12
+ const mapLayers_1 = require("../../mapLayers");
13
+ const itwinui_react_1 = require("@itwin/itwinui-react");
14
+ /** @internal */
15
+ // eslint-disable-next-line @typescript-eslint/naming-convention
16
+ function SubLayersPopupButton({ mapLayerSettings, activeViewport }) {
17
+ const [showSubLayersLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Show"));
18
+ const [hideSubLayersLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:SubLayers.Hide"));
19
+ const [popupOpen, setPopupOpen] = React.useState(false);
20
+ const buttonRef = React.useRef(null);
21
+ const togglePopup = React.useCallback(() => {
22
+ setPopupOpen(!popupOpen);
23
+ }, [popupOpen]);
24
+ const onOutsideClick = React.useCallback(() => {
25
+ setPopupOpen(false);
26
+ }, []);
27
+ const isOutsideEvent = React.useCallback((e) => {
28
+ // if clicking on button that open panel - don't trigger outside click processing
29
+ return !!buttonRef.current && (e.target instanceof Node) && !buttonRef.current.contains(e.target);
30
+ }, []);
31
+ const panelRef = (0, core_react_1.useOnOutsideClick)(onOutsideClick, isOutsideEvent);
32
+ return (React.createElement(React.Fragment, null,
33
+ React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-item-sub-layer-button", title: popupOpen ? hideSubLayersLabel : showSubLayersLabel, onClick: togglePopup },
34
+ React.createElement(core_react_1.WebFontIcon, { iconName: "icon-layers" })),
35
+ React.createElement(core_react_1.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: onOutsideClick, target: buttonRef.current },
36
+ React.createElement("div", { className: "map-transparency-popup-panel" },
37
+ React.createElement("div", { ref: panelRef, className: "map-manager-sublayer-panel" },
38
+ React.createElement(SubLayersTree_1.SubLayersPanel, { mapLayer: mapLayerSettings, viewport: activeViewport }))))));
39
+ }
40
+ exports.SubLayersPopupButton = SubLayersPopupButton;
41
41
  //# 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,+BAA+B;AAE/B,0DAAyD;AACzD,kDAA6F;AAC7F,mDAAiD;AAEjD,+CAA8C;AAC9C,wDAA8C;AAU9C,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAA6B;IAElG,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACrH,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,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,IAAA,8BAAiB,EAAiB,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,OAAO,CACL;QACE,oBAAC,sBAAM,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,wBAAW,IAAC,QAAQ,EAAC,aAAa,GAAG,CAC/B;QACT,oBAAC,kBAAK,IACJ,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,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,8BAAc,IAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,GAAI,CACpE,CACF,CACC,CACR,CACJ,CAAC;AACJ,CAAC;AA1CD,oDA0CC","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,+BAA+B;AAE/B,0DAAyD;AACzD,kDAA6F;AAC7F,mDAAiD;AAEjD,+CAA8C;AAC9C,wDAA8C;AAU9C,gBAAgB;AAChB,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAA6B;IAElG,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACrH,MAAM,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,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,IAAA,8BAAiB,EAAiB,cAAc,EAAE,cAAc,CAAC,CAAC;IAEnF,OAAO,CACL;QACE,oBAAC,sBAAM,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,wBAAW,IAAC,QAAQ,EAAC,aAAa,GAAG,CAC/B;QACT,oBAAC,kBAAK,IACJ,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,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,8BAAc,IAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,GAAI,CACpE,CACF,CACC,CACR,CACJ,CAAC;AACJ,CAAC;AA1CD,oDA0CC","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;AAiE9B,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,eAkGvE"}