@itwin/map-layers 4.0.0-dev.28 → 4.0.0-dev.30

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 (155) hide show
  1. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  2. package/lib/cjs/MapLayerPreferences.js +311 -311
  3. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  4. package/lib/cjs/map-layers.d.ts +6 -6
  5. package/lib/cjs/map-layers.js +22 -22
  6. package/lib/cjs/mapLayers.d.ts +44 -44
  7. package/lib/cjs/mapLayers.js +61 -61
  8. package/lib/cjs/mapLayers.js.map +1 -1
  9. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  10. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +51 -51
  11. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  12. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  13. package/lib/cjs/ui/Interfaces.js +2 -2
  14. package/lib/cjs/ui/Interfaces.js.map +1 -1
  15. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  16. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  17. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  18. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  19. package/lib/cjs/ui/MapLayersUiItemsProvider.js +38 -38
  20. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  21. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  22. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
  23. package/lib/cjs/ui/widget/BasemapPanel.d.ts +8 -8
  24. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  25. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  26. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  27. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  28. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
  29. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  30. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  31. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
  32. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  33. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +7 -7
  34. package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
  35. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  36. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +19 -19
  37. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
  38. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  39. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  40. package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
  41. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  42. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  43. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  44. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
  45. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  46. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  47. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  48. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  50. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +11 -11
  51. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  52. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  53. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +3 -3
  54. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  55. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  56. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  57. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +23 -23
  58. package/lib/cjs/ui/widget/MapUrlDialog.js +524 -524
  59. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  60. package/lib/cjs/ui/widget/MapUrlDialog.scss +100 -100
  61. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +18 -18
  62. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  63. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  64. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +20 -20
  65. package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -75
  66. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  67. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +10 -10
  68. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  69. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  70. package/lib/cjs/ui/widget/SubLayersTree.d.ts +15 -15
  71. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  72. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  73. package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
  74. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +14 -14
  75. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  76. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  77. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +36 -36
  78. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  79. package/lib/esm/MapLayerPreferences.js +307 -307
  80. package/lib/esm/MapLayerPreferences.js.map +1 -1
  81. package/lib/esm/map-layers.d.ts +6 -6
  82. package/lib/esm/map-layers.js +10 -10
  83. package/lib/esm/mapLayers.d.ts +44 -44
  84. package/lib/esm/mapLayers.js +57 -57
  85. package/lib/esm/mapLayers.js.map +1 -1
  86. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  87. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +47 -47
  88. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  89. package/lib/esm/ui/Interfaces.d.ts +50 -50
  90. package/lib/esm/ui/Interfaces.js +1 -1
  91. package/lib/esm/ui/Interfaces.js.map +1 -1
  92. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  93. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  94. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  95. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  96. package/lib/esm/ui/MapLayersUiItemsProvider.js +34 -34
  97. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  98. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  99. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  100. package/lib/esm/ui/widget/BasemapPanel.d.ts +8 -8
  101. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  102. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  103. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  104. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  105. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  106. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  107. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  108. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  109. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  110. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +7 -7
  111. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  112. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  113. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +19 -19
  114. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  115. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  116. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  117. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  118. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  119. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  120. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  121. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  122. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  123. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  124. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  125. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  126. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  127. package/lib/esm/ui/widget/MapLayersWidget.d.ts +11 -11
  128. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  129. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  130. package/lib/esm/ui/widget/MapManagerSettings.d.ts +3 -3
  131. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  132. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  133. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  134. package/lib/esm/ui/widget/MapUrlDialog.d.ts +23 -23
  135. package/lib/esm/ui/widget/MapUrlDialog.js +520 -520
  136. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  137. package/lib/esm/ui/widget/MapUrlDialog.scss +100 -100
  138. package/lib/esm/ui/widget/SelectMapFormat.d.ts +18 -18
  139. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  140. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  141. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +20 -20
  142. package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -71
  143. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  144. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +10 -10
  145. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  146. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  147. package/lib/esm/ui/widget/SubLayersTree.d.ts +15 -15
  148. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  149. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  150. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  151. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +14 -14
  152. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  153. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  154. package/lib/esm/ui/widget/TransparencyPopupButton.scss +36 -36
  155. package/package.json +14 -14
@@ -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,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,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;CAC/B,CAAC;AASF,gEAAgE;AAChE,MAAM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ClB,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,CAAC,CACV,oBAAC,QAAQ,IACP,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;gBACzC,6BAAK,KAAK,EAAE,kBAAkB;oBAC5B,oBAAC,UAAU,IAAC,SAAS,EAAC,sCAAsC,EAAE,IAAI,EAAC,OAAO;wBACxE,oBAAC,uBAAuB,OAAG,CAChB,CACT;gBACN,CAAC,CAAC,SAAS,IACZ,MAAM,CAAC,KAAK,CACJ,CAAC,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
+ {"version":3,"file":"SelectMapFormat.js","sourceRoot":"","sources":["../../../../src/ui/widget/SelectMapFormat.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;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;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\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,21 +1,21 @@
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 { 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
+ }
21
21
  //# sourceMappingURL=SubLayersDataProvider.d.ts.map
@@ -1,72 +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
- return {
28
- id: this.createId(props),
29
- label: PropertyRecord.fromString(props.title ?? props.name ?? "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?.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
43
- const treeNodes = [];
44
- filteredProps.forEach((props) => {
45
- treeNodes.push(this.createNode(props, (!parentId && 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?.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
- }
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
+ return {
28
+ id: this.createId(props),
29
+ label: PropertyRecord.fromString(props.title ?? props.name ?? "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?.sort((a, b) => compareStringsOrUndefined(a.title, b.title));
43
+ const treeNodes = [];
44
+ filteredProps.forEach((props) => {
45
+ treeNodes.push(this.createNode(props, (!parentId && 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?.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
+ }
72
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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AAS,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","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 { BeEvent, compareStringsOrUndefined } from \"@itwin/core-bentley\";\nimport { MapSubLayerProps, SubLayerId } from \"@itwin/core-common\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { DelayLoadedTreeNodeItem, ITreeDataProvider, TreeDataChangesListener, 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 onTreeNodeChanged = new BeEvent<TreeDataChangesListener>();\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
+ {"version":3,"file":"SubLayersDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/SubLayersDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,OAAO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,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,yBAAyB,CAAC,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;IAIM,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","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,11 +1,11 @@
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
+ /// <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;
11
11
  //# sourceMappingURL=SubLayersPopupButton.d.ts.map
@@ -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;;;+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,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B,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
+ {"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,C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ACtC,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,16 +1,16 @@
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
+ /// <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;
16
16
  //# sourceMappingURL=SubLayersTree.d.ts.map