@itwin/map-layers 4.0.0-dev.44 → 4.0.0-dev.47

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 (193) hide show
  1. package/CHANGELOG.md +864 -864
  2. package/README.md +32 -32
  3. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  4. package/lib/cjs/MapLayerPreferences.js +311 -311
  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 -61
  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 -51
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  16. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  17. package/lib/cjs/ui/Interfaces.js +2 -2
  18. package/lib/cjs/ui/Interfaces.js.map +1 -1
  19. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  20. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  21. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  22. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  23. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  24. package/lib/cjs/ui/MapLayersUiItemsProvider.js +35 -38
  25. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  26. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  27. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  28. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +335 -335
  29. package/lib/cjs/ui/widget/BasemapPanel.d.ts +7 -8
  30. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  31. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  32. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  33. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  34. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  35. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  36. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +22 -22
  37. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  38. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  39. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +138 -138
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  41. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +6 -7
  42. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  43. package/lib/cjs/ui/widget/FeatureInfoWidget.js +65 -65
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  45. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +18 -19
  46. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerDroppable.js +85 -85
  48. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  50. package/lib/cjs/ui/widget/MapLayerManager.js +401 -401
  51. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  52. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  53. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  54. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +82 -82
  56. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  58. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  60. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  62. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +10 -11
  63. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  65. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  66. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +2 -3
  67. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  68. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  69. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  70. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  71. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +22 -23
  72. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  73. package/lib/cjs/ui/widget/MapUrlDialog.js +530 -530
  74. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  75. package/lib/cjs/ui/widget/MapUrlDialog.scss +99 -100
  76. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +17 -18
  77. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  78. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  79. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  80. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +18 -20
  81. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  82. package/lib/cjs/ui/widget/SubLayersDataProvider.js +74 -75
  83. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  84. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +9 -10
  85. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  86. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  87. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  88. package/lib/cjs/ui/widget/SubLayersTree.d.ts +14 -15
  89. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  90. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  91. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  92. package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
  93. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +13 -14
  94. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  95. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  96. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  97. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +35 -36
  98. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  99. package/lib/esm/MapLayerPreferences.js +307 -307
  100. package/lib/esm/MapLayerPreferences.js.map +1 -1
  101. package/lib/esm/map-layers.d.ts +6 -6
  102. package/lib/esm/map-layers.js +10 -10
  103. package/lib/esm/mapLayers.d.ts +26 -44
  104. package/lib/esm/mapLayers.d.ts.map +1 -1
  105. package/lib/esm/mapLayers.js +29 -57
  106. package/lib/esm/mapLayers.js.map +1 -1
  107. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +16 -11
  108. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  109. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +42 -47
  110. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  111. package/lib/esm/ui/Interfaces.d.ts +50 -50
  112. package/lib/esm/ui/Interfaces.js +1 -1
  113. package/lib/esm/ui/Interfaces.js.map +1 -1
  114. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  115. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  116. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  117. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  118. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  119. package/lib/esm/ui/MapLayersUiItemsProvider.js +31 -34
  120. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  121. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +13 -14
  122. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  123. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  124. package/lib/esm/ui/widget/BasemapPanel.d.ts +7 -8
  125. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  126. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  127. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  128. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  129. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +20 -21
  130. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  131. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  132. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  133. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  134. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  135. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  136. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +6 -7
  137. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  138. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  139. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  140. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +18 -19
  141. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  142. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  143. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  144. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  145. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  146. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  147. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  148. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +11 -12
  149. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  150. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  151. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  152. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +6 -7
  153. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  154. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  155. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  157. package/lib/esm/ui/widget/MapLayersWidget.d.ts +10 -11
  158. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  159. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  160. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  161. package/lib/esm/ui/widget/MapManagerSettings.d.ts +2 -3
  162. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  163. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  164. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  165. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  166. package/lib/esm/ui/widget/MapUrlDialog.d.ts +22 -23
  167. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  168. package/lib/esm/ui/widget/MapUrlDialog.js +526 -526
  169. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  170. package/lib/esm/ui/widget/MapUrlDialog.scss +99 -100
  171. package/lib/esm/ui/widget/SelectMapFormat.d.ts +17 -18
  172. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  173. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  174. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  175. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +18 -20
  176. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  177. package/lib/esm/ui/widget/SubLayersDataProvider.js +70 -71
  178. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  179. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +9 -10
  180. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  181. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  182. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  183. package/lib/esm/ui/widget/SubLayersTree.d.ts +14 -15
  184. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  185. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  186. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  187. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  188. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +13 -14
  189. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  190. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  191. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  192. package/lib/esm/ui/widget/TransparencyPopupButton.scss +35 -36
  193. package/package.json +28 -34
@@ -1,22 +1,21 @@
1
- /// <reference types="react" />
2
- import { CommonProps } from "@itwin/core-react";
3
- import "./MapUrlDialog.scss";
4
- interface ConfirmMessageDialogProps extends CommonProps {
5
- /** Title to show in title bar of dialog */
6
- title?: string | JSX.Element;
7
- message?: string | JSX.Element;
8
- onYesResult?: () => void;
9
- onNoResult?: () => void;
10
- onClose?: () => void;
11
- onEscape?: () => void;
12
- minWidth?: string | number;
13
- /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */
14
- minHeight?: string | number;
15
- /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
16
- maxWidth?: string | number;
17
- /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
18
- maxHeight?: string | number;
19
- }
20
- export declare function ConfirmMessageDialog(props: ConfirmMessageDialogProps): JSX.Element;
21
- export {};
1
+ import { CommonProps } from "@itwin/core-react";
2
+ import "./MapUrlDialog.scss";
3
+ interface ConfirmMessageDialogProps extends CommonProps {
4
+ /** Title to show in title bar of dialog */
5
+ title?: string | JSX.Element;
6
+ message?: string | JSX.Element;
7
+ onYesResult?: () => void;
8
+ onNoResult?: () => void;
9
+ onClose?: () => void;
10
+ onEscape?: () => void;
11
+ minWidth?: string | number;
12
+ /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */
13
+ minHeight?: string | number;
14
+ /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
15
+ maxWidth?: string | number;
16
+ /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */
17
+ maxHeight?: string | number;
18
+ }
19
+ export declare function ConfirmMessageDialog(props: ConfirmMessageDialogProps): JSX.Element;
20
+ export {};
22
21
  //# sourceMappingURL=ConfirmMessageDialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmMessageDialog.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/ConfirmMessageDialog.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAU,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,CAAC;AAG7B,UAAU,yBAA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SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,yIAAyI;IACzI,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,0IAA0I;IAC1I,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eA2BpE"}
@@ -1,19 +1,19 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- // cSpell:ignore Modeless WMTS
6
- import * as React from "react";
7
- import { Dialog } from "@itwin/core-react";
8
- import "./MapUrlDialog.scss";
9
- import { DialogButtonType } from "@itwin/appui-abstract";
10
- // eslint-disable-next-line @typescript-eslint/naming-convention
11
- export function ConfirmMessageDialog(props) {
12
- const buttonCluster = React.useMemo(() => [
13
- { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },
14
- { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },
15
- ], [props.onYesResult, props.onNoResult]);
16
- return (React.createElement(Dialog, { className: props.className, title: props.title, opened: true, resizable: false, movable: true, modal: true, buttonCluster: buttonCluster, onClose: props.onClose, onEscape: props.onEscape, minHeight: props.minHeight, maxHeight: props.maxHeight, minWidth: props.minWidth, maxWidth: props.maxWidth, trapFocus: false },
17
- React.createElement("div", null, props.message)));
18
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // cSpell:ignore Modeless WMTS
6
+ import * as React from "react";
7
+ import { Dialog } from "@itwin/core-react";
8
+ import "./MapUrlDialog.scss";
9
+ import { DialogButtonType } from "@itwin/appui-abstract";
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ export function ConfirmMessageDialog(props) {
12
+ const buttonCluster = React.useMemo(() => [
13
+ { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },
14
+ { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },
15
+ ], [props.onYesResult, props.onNoResult]);
16
+ return (React.createElement(Dialog, { className: props.className, title: props.title, opened: true, resizable: false, movable: true, modal: true, buttonCluster: buttonCluster, onClose: props.onClose, onEscape: props.onEscape, minHeight: props.minHeight, maxHeight: props.maxHeight, minWidth: props.minWidth, maxWidth: props.maxWidth, trapFocus: false },
17
+ React.createElement("div", null, props.message)));
18
+ }
19
19
  //# sourceMappingURL=ConfirmMessageDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmMessageDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/ConfirmMessageDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACxC,EAAE,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;QACzE,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;KACxE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,MAAM,IACL,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK;QAEhB,iCAAM,KAAK,CAAC,OAAO,CAAO,CACnB,CACV,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\n// cSpell:ignore Modeless WMTS\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps, Dialog } from \"@itwin/core-react\";\r\n\r\nimport \"./MapUrlDialog.scss\";\r\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\r\n\r\ninterface ConfirmMessageDialogProps extends CommonProps {\r\n\r\n /** Title to show in title bar of dialog */\r\n title?: string | JSX.Element;\r\n message?: string | JSX.Element;\r\n onYesResult?: () => void;\r\n onNoResult?: () => void;\r\n onClose?: () => void;\r\n onEscape?: () => void;\r\n minWidth?: string | number;\r\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */\r\n minHeight?: string | number;\r\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\r\n maxWidth?: string | number;\r\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\r\n maxHeight?: string | number;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ConfirmMessageDialog(props: ConfirmMessageDialogProps) {\r\n\r\n const buttonCluster = React.useMemo(() => [\r\n { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },\r\n { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },\r\n ], [props.onYesResult, props.onNoResult]);\r\n\r\n return (\r\n <Dialog\r\n className={props.className}\r\n title={props.title}\r\n opened={true}\r\n resizable={false}\r\n movable={true}\r\n modal={true}\r\n buttonCluster={buttonCluster}\r\n onClose={props.onClose}\r\n onEscape={props.onEscape}\r\n minHeight={props.minHeight}\r\n maxHeight={props.maxHeight}\r\n minWidth={props.minWidth}\r\n maxWidth={props.maxWidth}\r\n trapFocus={false}\r\n >\r\n <div>{props.message}</div>\r\n </Dialog>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"ConfirmMessageDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/ConfirmMessageDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoBzD,gEAAgE;AAChE,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACxC,EAAE,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;QACzE,EAAE,IAAI,EAAE,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;KACxE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,MAAM,IACL,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,KAAK,EAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK;QAEhB,iCAAM,KAAK,CAAC,OAAO,CAAO,CACnB,CACV,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 * as React from \"react\";\nimport { CommonProps, Dialog } from \"@itwin/core-react\";\n\nimport \"./MapUrlDialog.scss\";\nimport { DialogButtonType } from \"@itwin/appui-abstract\";\n\ninterface ConfirmMessageDialogProps extends CommonProps {\n\n /** Title to show in title bar of dialog */\n title?: string | JSX.Element;\n message?: string | JSX.Element;\n onYesResult?: () => void;\n onNoResult?: () => void;\n onClose?: () => void;\n onEscape?: () => void;\n minWidth?: string | number;\n /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */\n minHeight?: string | number;\n /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxWidth?: string | number;\n /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */\n maxHeight?: string | number;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function ConfirmMessageDialog(props: ConfirmMessageDialogProps) {\n\n const buttonCluster = React.useMemo(() => [\n { type: DialogButtonType.Yes, onClick: props.onYesResult ?? (() => { }) },\n { type: DialogButtonType.No, onClick: props.onNoResult ?? (() => { }) },\n ], [props.onYesResult, props.onNoResult]);\n\n return (\n <Dialog\n className={props.className}\n title={props.title}\n opened={true}\n resizable={false}\n movable={true}\n modal={true}\n buttonCluster={buttonCluster}\n onClose={props.onClose}\n onEscape={props.onEscape}\n minHeight={props.minHeight}\n maxHeight={props.maxHeight}\n minWidth={props.minWidth}\n maxWidth={props.maxWidth}\n trapFocus={false}\n >\n <div>{props.message}</div>\n </Dialog>\n );\n}\n"]}
@@ -1,41 +1,41 @@
1
- import { PropertyRecord } from "@itwin/appui-abstract";
2
- import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from "@itwin/components-react";
3
- import { BeEvent } from "@itwin/core-bentley";
4
- import { MapHitEvent } from "../Interfaces";
5
- /**
6
- * Implementation of [IPropertyDataProvider] that uses an associative array.
7
- * @public
8
- */
9
- export declare enum MapFeatureInfoLoadState {
10
- DataLoadStart = 0,
11
- DataLoadEnd = 1
12
- }
13
- export declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;
14
- export interface MapFeatureInfoDataUpdate {
15
- recordCount: number;
16
- }
17
- export declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;
18
- export declare class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {
19
- private _removeListener;
20
- label: PropertyRecord;
21
- description?: string;
22
- categories: PropertyCategory[];
23
- records: {
24
- [categoryName: string]: PropertyRecord[];
25
- };
26
- onDataChanged: PropertyDataChangeEvent;
27
- onDataLoadStateChanged: BeEvent<MapFeatureInfoLoadListener>;
28
- onDataUpdated: BeEvent<MapFeatureInfoDataUpdatedListener>;
29
- constructor(onMapHit: MapHitEvent);
30
- onUnload(): void;
31
- private _handleMapHit;
32
- addSubCategory(categoryName: string): void;
33
- addCategory(category: PropertyCategory): number;
34
- findCategoryIndex(category: PropertyCategory): number;
35
- findCategoryIndexByName(name: string): number;
36
- addProperty(propertyRecord: PropertyRecord, categoryName: string): void;
37
- removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean;
38
- replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean;
39
- getData(): Promise<PropertyData>;
40
- }
1
+ import { PropertyRecord } from "@itwin/appui-abstract";
2
+ import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from "@itwin/components-react";
3
+ import { BeEvent } from "@itwin/core-bentley";
4
+ import { MapHitEvent } from "../Interfaces";
5
+ /**
6
+ * Implementation of [IPropertyDataProvider] that uses an associative array.
7
+ * @public
8
+ */
9
+ export declare enum MapFeatureInfoLoadState {
10
+ DataLoadStart = 0,
11
+ DataLoadEnd = 1
12
+ }
13
+ export declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;
14
+ export interface MapFeatureInfoDataUpdate {
15
+ recordCount: number;
16
+ }
17
+ export declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;
18
+ export declare class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {
19
+ private _removeListener;
20
+ label: PropertyRecord;
21
+ description?: string;
22
+ categories: PropertyCategory[];
23
+ records: {
24
+ [categoryName: string]: PropertyRecord[];
25
+ };
26
+ onDataChanged: PropertyDataChangeEvent;
27
+ onDataLoadStateChanged: BeEvent<MapFeatureInfoLoadListener>;
28
+ onDataUpdated: BeEvent<MapFeatureInfoDataUpdatedListener>;
29
+ constructor(onMapHit: MapHitEvent);
30
+ onUnload(): void;
31
+ private _handleMapHit;
32
+ addSubCategory(categoryName: string): void;
33
+ addCategory(category: PropertyCategory): number;
34
+ findCategoryIndex(category: PropertyCategory): number;
35
+ findCategoryIndexByName(name: string): number;
36
+ addProperty(propertyRecord: PropertyRecord, categoryName: string): void;
37
+ removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean;
38
+ replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean;
39
+ getData(): Promise<PropertyData>;
40
+ }
41
41
  //# sourceMappingURL=FeatureInfoDataProvider.d.ts.map
@@ -1,135 +1,135 @@
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 { PropertyRecord } from "@itwin/appui-abstract";
6
- import { PropertyDataChangeEvent } from "@itwin/components-react";
7
- import { BeEvent } from "@itwin/core-bentley";
8
- // import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
9
- /**
10
- * Implementation of [IPropertyDataProvider] that uses an associative array.
11
- * @public
12
- */
13
- export var MapFeatureInfoLoadState;
14
- (function (MapFeatureInfoLoadState) {
15
- MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
16
- MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
17
- })(MapFeatureInfoLoadState || (MapFeatureInfoLoadState = {}));
18
- export class FeatureInfoDataProvider {
19
- constructor(onMapHit) {
20
- this.label = PropertyRecord.fromString("");
21
- this.categories = [];
22
- this.records = {};
23
- this.onDataChanged = new PropertyDataChangeEvent();
24
- this.onDataLoadStateChanged = new BeEvent();
25
- this.onDataUpdated = new BeEvent();
26
- // eslint-disable-next-line @typescript-eslint/unbound-method
27
- this._removeListener = onMapHit.addListener(this._handleMapHit, this);
28
- }
29
- onUnload() {
30
- this._removeListener();
31
- }
32
- async _handleMapHit(mapHit) {
33
- this.records = {};
34
- this.categories = [];
35
- let recordCount = 0;
36
- if (mapHit?.isMapHit) {
37
- this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
38
- const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
39
- this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
40
- if (mapInfo.layerInfo !== undefined) {
41
- for (const curLayerInfo of mapInfo.layerInfo) {
42
- const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
43
- let nbRecords = 0;
44
- const layerCategory = (layerCatIdx === -1 ?
45
- { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
46
- : this.categories[layerCatIdx]);
47
- if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
48
- // This is not an HTMLElement, so iterate over each sub-layer info
49
- for (const subLayerInfo of curLayerInfo.info) {
50
- nbRecords++;
51
- const subCatIdx = layerCategory.childCategories?.findIndex((testCategory) => {
52
- return testCategory.name === subLayerInfo.subLayerName;
53
- });
54
- let subLayerCategory;
55
- if (subCatIdx === -1) {
56
- subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
57
- this.addSubCategory(subLayerCategory.name);
58
- layerCategory.childCategories?.push(subLayerCategory);
59
- }
60
- if (subLayerInfo.records) {
61
- for (const record of subLayerInfo.records) {
62
- // Always use the string value for now
63
- this.addProperty(record, subLayerInfo.subLayerName);
64
- }
65
- }
66
- }
67
- }
68
- if (layerCatIdx === -1 && nbRecords > 0)
69
- this.addCategory(layerCategory);
70
- recordCount = recordCount + nbRecords;
71
- }
72
- }
73
- }
74
- this.onDataUpdated.raiseEvent({ recordCount });
75
- this.onDataChanged.raiseEvent();
76
- }
77
- addSubCategory(categoryName) {
78
- this.records[categoryName] = [];
79
- }
80
- addCategory(category) {
81
- const categoryIdx = this.categories.push(category) - 1;
82
- this.records[this.categories[categoryIdx].name] = [];
83
- return categoryIdx;
84
- }
85
- findCategoryIndex(category) {
86
- const index = this.categories.findIndex((testCategory) => {
87
- return testCategory.name === category.name;
88
- });
89
- return index;
90
- }
91
- findCategoryIndexByName(name) {
92
- const index = this.categories.findIndex((testCategory) => {
93
- return testCategory.name === name;
94
- });
95
- return index;
96
- }
97
- addProperty(propertyRecord, categoryName) {
98
- const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
99
- if (idx === -1) {
100
- this.records[categoryName].push(propertyRecord);
101
- }
102
- else {
103
- this.records[categoryName][idx].isMerged = true;
104
- this.records[categoryName][idx].isReadonly = true;
105
- }
106
- }
107
- removeProperty(propertyRecord, categoryIdx) {
108
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
109
- return record === propertyRecord;
110
- });
111
- let result = false;
112
- if (index >= 0) {
113
- this.records[this.categories[categoryIdx].name].splice(index, 1);
114
- this.onDataChanged.raiseEvent();
115
- result = true;
116
- }
117
- return result;
118
- }
119
- replaceProperty(propertyRecord, categoryIdx, newRecord) {
120
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
121
- return record === propertyRecord;
122
- });
123
- let result = false;
124
- // istanbul ignore else
125
- if (index >= 0) {
126
- this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
127
- result = true;
128
- }
129
- return result;
130
- }
131
- async getData() {
132
- return this;
133
- }
134
- }
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 { PropertyRecord } from "@itwin/appui-abstract";
6
+ import { PropertyDataChangeEvent } from "@itwin/components-react";
7
+ import { BeEvent } from "@itwin/core-bentley";
8
+ // import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
9
+ /**
10
+ * Implementation of [IPropertyDataProvider] that uses an associative array.
11
+ * @public
12
+ */
13
+ export var MapFeatureInfoLoadState;
14
+ (function (MapFeatureInfoLoadState) {
15
+ MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
16
+ MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
17
+ })(MapFeatureInfoLoadState || (MapFeatureInfoLoadState = {}));
18
+ export class FeatureInfoDataProvider {
19
+ constructor(onMapHit) {
20
+ this.label = PropertyRecord.fromString("");
21
+ this.categories = [];
22
+ this.records = {};
23
+ this.onDataChanged = new PropertyDataChangeEvent();
24
+ this.onDataLoadStateChanged = new BeEvent();
25
+ this.onDataUpdated = new BeEvent();
26
+ // eslint-disable-next-line @typescript-eslint/unbound-method
27
+ this._removeListener = onMapHit.addListener(this._handleMapHit, this);
28
+ }
29
+ onUnload() {
30
+ this._removeListener();
31
+ }
32
+ async _handleMapHit(mapHit) {
33
+ this.records = {};
34
+ this.categories = [];
35
+ let recordCount = 0;
36
+ if (mapHit?.isMapHit) {
37
+ this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
38
+ const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
39
+ this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
40
+ if (mapInfo.layerInfo !== undefined) {
41
+ for (const curLayerInfo of mapInfo.layerInfo) {
42
+ const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
43
+ let nbRecords = 0;
44
+ const layerCategory = (layerCatIdx === -1 ?
45
+ { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
46
+ : this.categories[layerCatIdx]);
47
+ if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
48
+ // This is not an HTMLElement, so iterate over each sub-layer info
49
+ for (const subLayerInfo of curLayerInfo.info) {
50
+ nbRecords++;
51
+ const subCatIdx = layerCategory.childCategories?.findIndex((testCategory) => {
52
+ return testCategory.name === subLayerInfo.subLayerName;
53
+ });
54
+ let subLayerCategory;
55
+ if (subCatIdx === -1) {
56
+ subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
57
+ this.addSubCategory(subLayerCategory.name);
58
+ layerCategory.childCategories?.push(subLayerCategory);
59
+ }
60
+ if (subLayerInfo.records) {
61
+ for (const record of subLayerInfo.records) {
62
+ // Always use the string value for now
63
+ this.addProperty(record, subLayerInfo.subLayerName);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ if (layerCatIdx === -1 && nbRecords > 0)
69
+ this.addCategory(layerCategory);
70
+ recordCount = recordCount + nbRecords;
71
+ }
72
+ }
73
+ }
74
+ this.onDataUpdated.raiseEvent({ recordCount });
75
+ this.onDataChanged.raiseEvent();
76
+ }
77
+ addSubCategory(categoryName) {
78
+ this.records[categoryName] = [];
79
+ }
80
+ addCategory(category) {
81
+ const categoryIdx = this.categories.push(category) - 1;
82
+ this.records[this.categories[categoryIdx].name] = [];
83
+ return categoryIdx;
84
+ }
85
+ findCategoryIndex(category) {
86
+ const index = this.categories.findIndex((testCategory) => {
87
+ return testCategory.name === category.name;
88
+ });
89
+ return index;
90
+ }
91
+ findCategoryIndexByName(name) {
92
+ const index = this.categories.findIndex((testCategory) => {
93
+ return testCategory.name === name;
94
+ });
95
+ return index;
96
+ }
97
+ addProperty(propertyRecord, categoryName) {
98
+ const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
99
+ if (idx === -1) {
100
+ this.records[categoryName].push(propertyRecord);
101
+ }
102
+ else {
103
+ this.records[categoryName][idx].isMerged = true;
104
+ this.records[categoryName][idx].isReadonly = true;
105
+ }
106
+ }
107
+ removeProperty(propertyRecord, categoryIdx) {
108
+ const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
109
+ return record === propertyRecord;
110
+ });
111
+ let result = false;
112
+ if (index >= 0) {
113
+ this.records[this.categories[categoryIdx].name].splice(index, 1);
114
+ this.onDataChanged.raiseEvent();
115
+ result = true;
116
+ }
117
+ return result;
118
+ }
119
+ replaceProperty(propertyRecord, categoryIdx, newRecord) {
120
+ const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
121
+ return record === propertyRecord;
122
+ });
123
+ let result = false;
124
+ // istanbul ignore else
125
+ if (index >= 0) {
126
+ this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
127
+ result = true;
128
+ }
129
+ return result;
130
+ }
131
+ async getData() {
132
+ return this;
133
+ }
134
+ }
135
135
  //# sourceMappingURL=FeatureInfoDataProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAG,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAyD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,oGAAoG;AAEpG;;;GAGG;AAEH,MAAM,CAAN,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,KAAvB,uBAAuB,QAA6B;AAQhE,MAAM,OAAO,uBAAuB;IASlC,YAAY,QAAqB;QAP1B,UAAK,GAAmB,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;QAC3D,kBAAa,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAC9C,2BAAsB,GAAG,IAAI,OAAO,EAA8B,CAAC;QACnE,kBAAa,GAAG,IAAI,OAAO,EAAqC,CAAC;QAEtE,6DAA6D;QAC7D,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAEO,KAAK,CAAC,aAAa,CA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nC,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACjE,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;YAChC,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,eAAe,CAAC,cAA8B,EAAE,WAAmB,EAAE,SAAyB;QACnG,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,MAAsB,EAAE,EAAE;YACjG,OAAO,MAAM,KAAK,cAAc,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,uBAAuB;QACvB,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC5E,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC;IACd,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\n\r\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\r\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { HitDetail } from \"@itwin/core-frontend\";\r\nimport { MapHitEvent } from \"../Interfaces\";\r\n// import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"\"\r\n\r\n/**\r\n * Implementation of [IPropertyDataProvider] that uses an associative array.\r\n * @public\r\n */\r\n\r\nexport enum MapFeatureInfoLoadState {DataLoadStart, DataLoadEnd}\r\nexport declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;\r\n\r\nexport interface MapFeatureInfoDataUpdate {\r\n recordCount: number;\r\n}\r\nexport declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;\r\n\r\nexport class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {\r\n private _removeListener: () => void;\r\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\r\n public description?: string;\r\n public categories: PropertyCategory[] = [];\r\n public records: { [categoryName: string]: PropertyRecord[] } = {};\r\n public onDataChanged = new PropertyDataChangeEvent();\r\n public onDataLoadStateChanged = new BeEvent<MapFeatureInfoLoadListener>();\r\n public onDataUpdated = new BeEvent<MapFeatureInfoDataUpdatedListener>();\r\n constructor(onMapHit: MapHitEvent) {\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n this._removeListener = onMapHit.addListener(this._handleMapHit, this);\r\n }\r\n\r\n public onUnload() {\r\n this._removeListener();\r\n }\r\n\r\n private async _handleMapHit(mapHit: HitDetail) {\r\n this.records = {};\r\n this.categories = [];\r\n let recordCount = 0;\r\n if (mapHit?.isMapHit) {\r\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);\r\n const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);\r\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);\r\n if (mapInfo.layerInfo !== undefined ) {\r\n for (const curLayerInfo of mapInfo.layerInfo) {\r\n const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);\r\n let nbRecords = 0;\r\n const layerCategory = (\r\n layerCatIdx === -1 ?\r\n {name:curLayerInfo.layerName, label:curLayerInfo.layerName, expand:true, childCategories:[]}\r\n : this.categories[layerCatIdx] );\r\n\r\n if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {\r\n // This is not an HTMLElement, so iterate over each sub-layer info\r\n for (const subLayerInfo of curLayerInfo.info) {\r\n nbRecords++;\r\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === subLayerInfo.subLayerName;\r\n });\r\n let subLayerCategory;\r\n if (subCatIdx === -1) {\r\n subLayerCategory = {name:subLayerInfo.subLayerName, label:subLayerInfo.subLayerName, expand:true};\r\n this.addSubCategory(subLayerCategory.name);\r\n layerCategory.childCategories?.push(subLayerCategory);\r\n }\r\n if (subLayerInfo.records) {\r\n for (const record of subLayerInfo.records) {\r\n // Always use the string value for now\r\n this.addProperty(record, subLayerInfo.subLayerName);\r\n\r\n }\r\n }\r\n }\r\n }\r\n if (layerCatIdx === -1 && nbRecords>0)\r\n this.addCategory(layerCategory);\r\n\r\n recordCount = recordCount + nbRecords;\r\n }\r\n }\r\n }\r\n this.onDataUpdated.raiseEvent({recordCount});\r\n this.onDataChanged.raiseEvent();\r\n }\r\n\r\n public addSubCategory(categoryName: string) {\r\n this.records[categoryName] = [];\r\n }\r\n public addCategory(category: PropertyCategory): number {\r\n const categoryIdx = this.categories.push(category) - 1;\r\n this.records[this.categories[categoryIdx].name] = [];\r\n return categoryIdx;\r\n }\r\n\r\n public findCategoryIndex(category: PropertyCategory): number {\r\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === category.name;\r\n });\r\n return index;\r\n }\r\n public findCategoryIndexByName(name: string): number {\r\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\r\n return testCategory.name === name;\r\n });\r\n return index;\r\n }\r\n\r\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\r\n const idx = this.records[categoryName].findIndex((prop)=> prop.property.name === propertyRecord.property.name);\r\n if (idx === -1) {\r\n this.records[categoryName].push(propertyRecord);\r\n } else {\r\n this.records[categoryName][idx].isMerged = true;\r\n this.records[categoryName][idx].isReadonly = true;\r\n }\r\n }\r\n\r\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\r\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\r\n return record === propertyRecord;\r\n });\r\n\r\n let result = false;\r\n\r\n if (index >= 0) {\r\n this.records[this.categories[categoryIdx].name].splice(index, 1);\r\n this.onDataChanged.raiseEvent();\r\n result = true;\r\n }\r\n return result;\r\n }\r\n\r\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\r\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\r\n return record === propertyRecord;\r\n });\r\n\r\n let result = false;\r\n\r\n // istanbul ignore else\r\n if (index >= 0) {\r\n this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);\r\n result = true;\r\n }\r\n return result;\r\n }\r\n\r\n public async getData(): Promise<PropertyData> {\r\n return this;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAG,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAyD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACzH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,oGAAoG;AAEpG;;;GAGG;AAEH,MAAM,CAAN,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,KAAvB,uBAAuB,QAA6B;AAQhE,MAAM,OAAO,uBAAuB;IASlC,YAAY,QAAq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C,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC5E,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC;IACd,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*--------------------------------------------------------------------------------------------*/\n\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HitDetail } from \"@itwin/core-frontend\";\nimport { MapHitEvent } from \"../Interfaces\";\n// import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"\"\n\n/**\n * Implementation of [IPropertyDataProvider] that uses an associative array.\n * @public\n */\n\nexport enum MapFeatureInfoLoadState {DataLoadStart, DataLoadEnd}\nexport declare type MapFeatureInfoLoadListener = (state: MapFeatureInfoLoadState) => void;\n\nexport interface MapFeatureInfoDataUpdate {\n recordCount: number;\n}\nexport declare type MapFeatureInfoDataUpdatedListener = (data: MapFeatureInfoDataUpdate) => void;\n\nexport class FeatureInfoDataProvider implements IPropertyDataProvider, PropertyData {\n private _removeListener: () => void;\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\n public description?: string;\n public categories: PropertyCategory[] = [];\n public records: { [categoryName: string]: PropertyRecord[] } = {};\n public onDataChanged = new PropertyDataChangeEvent();\n public onDataLoadStateChanged = new BeEvent<MapFeatureInfoLoadListener>();\n public onDataUpdated = new BeEvent<MapFeatureInfoDataUpdatedListener>();\n constructor(onMapHit: MapHitEvent) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._removeListener = onMapHit.addListener(this._handleMapHit, this);\n }\n\n public onUnload() {\n this._removeListener();\n }\n\n private async _handleMapHit(mapHit: HitDetail) {\n this.records = {};\n this.categories = [];\n let recordCount = 0;\n if (mapHit?.isMapHit) {\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);\n const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);\n this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);\n if (mapInfo.layerInfo !== undefined ) {\n for (const curLayerInfo of mapInfo.layerInfo) {\n const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);\n let nbRecords = 0;\n const layerCategory = (\n layerCatIdx === -1 ?\n {name:curLayerInfo.layerName, label:curLayerInfo.layerName, expand:true, childCategories:[]}\n : this.categories[layerCatIdx] );\n\n if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {\n // This is not an HTMLElement, so iterate over each sub-layer info\n for (const subLayerInfo of curLayerInfo.info) {\n nbRecords++;\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === subLayerInfo.subLayerName;\n });\n let subLayerCategory;\n if (subCatIdx === -1) {\n subLayerCategory = {name:subLayerInfo.subLayerName, label:subLayerInfo.subLayerName, expand:true};\n this.addSubCategory(subLayerCategory.name);\n layerCategory.childCategories?.push(subLayerCategory);\n }\n if (subLayerInfo.records) {\n for (const record of subLayerInfo.records) {\n // Always use the string value for now\n this.addProperty(record, subLayerInfo.subLayerName);\n\n }\n }\n }\n }\n if (layerCatIdx === -1 && nbRecords>0)\n this.addCategory(layerCategory);\n\n recordCount = recordCount + nbRecords;\n }\n }\n }\n this.onDataUpdated.raiseEvent({recordCount});\n this.onDataChanged.raiseEvent();\n }\n\n public addSubCategory(categoryName: string) {\n this.records[categoryName] = [];\n }\n public addCategory(category: PropertyCategory): number {\n const categoryIdx = this.categories.push(category) - 1;\n this.records[this.categories[categoryIdx].name] = [];\n return categoryIdx;\n }\n\n public findCategoryIndex(category: PropertyCategory): number {\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === category.name;\n });\n return index;\n }\n public findCategoryIndexByName(name: string): number {\n const index = this.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === name;\n });\n return index;\n }\n\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\n const idx = this.records[categoryName].findIndex((prop)=> prop.property.name === propertyRecord.property.name);\n if (idx === -1) {\n this.records[categoryName].push(propertyRecord);\n } else {\n this.records[categoryName][idx].isMerged = true;\n this.records[categoryName][idx].isReadonly = true;\n }\n }\n\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this.records[this.categories[categoryIdx].name].splice(index, 1);\n this.onDataChanged.raiseEvent();\n result = true;\n }\n return result;\n }\n\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\n const index = this.records[this.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n // istanbul ignore else\n if (index >= 0) {\n this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);\n result = true;\n }\n return result;\n }\n\n public async getData(): Promise<PropertyData> {\n return this;\n }\n}\n"]}
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- import { MapFeatureInfoOptions } from "../Interfaces";
3
- interface MapFeatureInfoWidgetProps {
4
- featureInfoOpts: MapFeatureInfoOptions;
5
- }
6
- export declare function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps): JSX.Element;
7
- export {};
1
+ import { MapFeatureInfoOptions } from "../Interfaces";
2
+ interface MapFeatureInfoWidgetProps {
3
+ featureInfoOpts: MapFeatureInfoOptions;
4
+ }
5
+ export declare function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps): JSX.Element;
6
+ export {};
8
7
  //# sourceMappingURL=FeatureInfoWidget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAsDlF"}
1
+ {"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAsDlF"}