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

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 (157) 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.d.ts.map +1 -1
  59. package/lib/cjs/ui/widget/MapUrlDialog.js +530 -524
  60. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  61. package/lib/cjs/ui/widget/MapUrlDialog.scss +100 -100
  62. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +18 -18
  63. package/lib/cjs/ui/widget/SelectMapFormat.js +54 -54
  64. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  65. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +20 -20
  66. package/lib/cjs/ui/widget/SubLayersDataProvider.js +75 -75
  67. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  68. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +10 -10
  69. package/lib/cjs/ui/widget/SubLayersPopupButton.js +40 -40
  70. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  71. package/lib/cjs/ui/widget/SubLayersTree.d.ts +15 -15
  72. package/lib/cjs/ui/widget/SubLayersTree.js +413 -413
  73. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  74. package/lib/cjs/ui/widget/SubLayersTree.scss +69 -69
  75. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +14 -14
  76. package/lib/cjs/ui/widget/TransparencyPopupButton.js +47 -47
  77. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  78. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +36 -36
  79. package/lib/esm/MapLayerPreferences.d.ts +88 -88
  80. package/lib/esm/MapLayerPreferences.js +307 -307
  81. package/lib/esm/MapLayerPreferences.js.map +1 -1
  82. package/lib/esm/map-layers.d.ts +6 -6
  83. package/lib/esm/map-layers.js +10 -10
  84. package/lib/esm/mapLayers.d.ts +44 -44
  85. package/lib/esm/mapLayers.js +57 -57
  86. package/lib/esm/mapLayers.js.map +1 -1
  87. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  88. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +47 -47
  89. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  90. package/lib/esm/ui/Interfaces.d.ts +50 -50
  91. package/lib/esm/ui/Interfaces.js +1 -1
  92. package/lib/esm/ui/Interfaces.js.map +1 -1
  93. package/lib/esm/ui/MapFeatureInfoTool.d.ts +13 -13
  94. package/lib/esm/ui/MapFeatureInfoTool.js +45 -45
  95. package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
  96. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +8 -8
  97. package/lib/esm/ui/MapLayersUiItemsProvider.js +34 -34
  98. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  99. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  100. package/lib/esm/ui/widget/AttachLayerPopupButton.js +331 -331
  101. package/lib/esm/ui/widget/BasemapPanel.d.ts +8 -8
  102. package/lib/esm/ui/widget/BasemapPanel.js +152 -152
  103. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  104. package/lib/esm/ui/widget/BasemapPanel.scss +87 -87
  105. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  106. package/lib/esm/ui/widget/ConfirmMessageDialog.js +18 -18
  107. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  108. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  109. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +134 -134
  110. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  111. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +7 -7
  112. package/lib/esm/ui/widget/FeatureInfoWidget.js +61 -61
  113. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  114. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +19 -19
  115. package/lib/esm/ui/widget/MapLayerDroppable.js +81 -81
  116. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  117. package/lib/esm/ui/widget/MapLayerManager.d.ts +26 -26
  118. package/lib/esm/ui/widget/MapLayerManager.js +396 -396
  119. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  120. package/lib/esm/ui/widget/MapLayerManager.scss +409 -409
  121. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  122. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +78 -78
  123. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  124. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  125. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +61 -61
  126. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  127. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  128. package/lib/esm/ui/widget/MapLayersWidget.d.ts +11 -11
  129. package/lib/esm/ui/widget/MapLayersWidget.js +27 -27
  130. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  131. package/lib/esm/ui/widget/MapManagerSettings.d.ts +3 -3
  132. package/lib/esm/ui/widget/MapManagerSettings.js +196 -196
  133. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  134. package/lib/esm/ui/widget/MapManagerSettings.scss +29 -29
  135. package/lib/esm/ui/widget/MapUrlDialog.d.ts +23 -23
  136. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  137. package/lib/esm/ui/widget/MapUrlDialog.js +526 -520
  138. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  139. package/lib/esm/ui/widget/MapUrlDialog.scss +100 -100
  140. package/lib/esm/ui/widget/SelectMapFormat.d.ts +18 -18
  141. package/lib/esm/ui/widget/SelectMapFormat.js +50 -50
  142. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  143. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +20 -20
  144. package/lib/esm/ui/widget/SubLayersDataProvider.js +71 -71
  145. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  146. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +10 -10
  147. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  148. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  149. package/lib/esm/ui/widget/SubLayersTree.d.ts +15 -15
  150. package/lib/esm/ui/widget/SubLayersTree.js +408 -408
  151. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  152. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  153. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +14 -14
  154. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  155. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  156. package/lib/esm/ui/widget/TransparencyPopupButton.scss +36 -36
  157. package/package.json +16 -16
@@ -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":["/*---------------------------------------------------------------------------------------------\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
+ {"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,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,E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,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
+ {"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,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,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,8 +1,8 @@
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
+ /// <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 {};
8
8
  //# sourceMappingURL=FeatureInfoWidget.d.ts.map
@@ -1,62 +1,62 @@
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 { PropertyGrid } from "@itwin/components-react";
7
- import { FillCentered, Orientation } from "@itwin/core-react";
8
- import { FeatureInfoDataProvider, MapFeatureInfoLoadState } from "./FeatureInfoDataProvider";
9
- import { ProgressRadial } from "@itwin/itwinui-react";
10
- import { MapLayersUI } from "../../mapLayers";
11
- // eslint-disable-next-line @typescript-eslint/naming-convention
12
- export function MapFeatureInfoWidget({ featureInfoOpts }) {
13
- const dataProvider = React.useRef();
14
- const [loadingData, setLoadingData] = React.useState(false);
15
- const [hasData, setHasData] = React.useState(false);
16
- const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
17
- const handleLoadStateChange = (state) => {
18
- setLoadingData(state === MapFeatureInfoLoadState.DataLoadStart);
19
- };
20
- const handleDataUpdated = (state) => {
21
- setHasData(state.recordCount !== 0);
22
- };
23
- React.useEffect(() => {
24
- if (featureInfoOpts?.onMapHit) {
25
- dataProvider.current = new FeatureInfoDataProvider(featureInfoOpts.onMapHit);
26
- }
27
- return () => {
28
- dataProvider?.current?.onUnload();
29
- };
30
- }, [featureInfoOpts?.onMapHit]);
31
- React.useEffect(() => {
32
- dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);
33
- return () => {
34
- dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);
35
- };
36
- }, []);
37
- React.useEffect(() => {
38
- if (featureInfoOpts?.showLoadProgressAnimation) {
39
- dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);
40
- return () => {
41
- dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);
42
- };
43
- }
44
- return;
45
- }, [featureInfoOpts?.showLoadProgressAnimation]);
46
- if (loadingData) {
47
- return (React.createElement(FillCentered, null,
48
- React.createElement(ProgressRadial, { indeterminate: true })));
49
- }
50
- else if (!hasData) {
51
- return (React.createElement(FillCentered, null,
52
- React.createElement("span", null,
53
- React.createElement("i", null, noRecordsMessage))));
54
- }
55
- else {
56
- if (dataProvider.current)
57
- return (React.createElement(PropertyGrid, { dataProvider: dataProvider.current, orientation: Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled }));
58
- else
59
- return (React.createElement(React.Fragment, null));
60
- }
61
- }
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 { PropertyGrid } from "@itwin/components-react";
7
+ import { FillCentered, Orientation } from "@itwin/core-react";
8
+ import { FeatureInfoDataProvider, MapFeatureInfoLoadState } from "./FeatureInfoDataProvider";
9
+ import { ProgressRadial } from "@itwin/itwinui-react";
10
+ import { MapLayersUI } from "../../mapLayers";
11
+ // eslint-disable-next-line @typescript-eslint/naming-convention
12
+ export function MapFeatureInfoWidget({ featureInfoOpts }) {
13
+ const dataProvider = React.useRef();
14
+ const [loadingData, setLoadingData] = React.useState(false);
15
+ const [hasData, setHasData] = React.useState(false);
16
+ const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.NoRecords"));
17
+ const handleLoadStateChange = (state) => {
18
+ setLoadingData(state === MapFeatureInfoLoadState.DataLoadStart);
19
+ };
20
+ const handleDataUpdated = (state) => {
21
+ setHasData(state.recordCount !== 0);
22
+ };
23
+ React.useEffect(() => {
24
+ if (featureInfoOpts?.onMapHit) {
25
+ dataProvider.current = new FeatureInfoDataProvider(featureInfoOpts.onMapHit);
26
+ }
27
+ return () => {
28
+ dataProvider?.current?.onUnload();
29
+ };
30
+ }, [featureInfoOpts?.onMapHit]);
31
+ React.useEffect(() => {
32
+ dataProvider.current?.onDataUpdated.addListener(handleDataUpdated);
33
+ return () => {
34
+ dataProvider.current?.onDataUpdated.removeListener(handleDataUpdated);
35
+ };
36
+ }, []);
37
+ React.useEffect(() => {
38
+ if (featureInfoOpts?.showLoadProgressAnimation) {
39
+ dataProvider.current?.onDataLoadStateChanged.addListener(handleLoadStateChange);
40
+ return () => {
41
+ dataProvider.current?.onDataLoadStateChanged.removeListener(handleLoadStateChange);
42
+ };
43
+ }
44
+ return;
45
+ }, [featureInfoOpts?.showLoadProgressAnimation]);
46
+ if (loadingData) {
47
+ return (React.createElement(FillCentered, null,
48
+ React.createElement(ProgressRadial, { indeterminate: true })));
49
+ }
50
+ else if (!hasData) {
51
+ return (React.createElement(FillCentered, null,
52
+ React.createElement("span", null,
53
+ React.createElement("i", null, noRecordsMessage))));
54
+ }
55
+ else {
56
+ if (dataProvider.current)
57
+ return (React.createElement(PropertyGrid, { dataProvider: dataProvider.current, orientation: Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled }));
58
+ else
59
+ return (React.createElement(React.Fragment, null));
60
+ }
61
+ }
62
62
  //# sourceMappingURL=FeatureInfoWidget.js.map