@itwin/map-layers 3.7.12 → 3.7.14

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 (156) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/MapLayerPreferences.d.ts +88 -88
  3. package/lib/cjs/MapLayerPreferences.js +312 -312
  4. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  5. package/lib/cjs/map-layers.d.ts +6 -6
  6. package/lib/cjs/map-layers.js +22 -22
  7. package/lib/cjs/mapLayers.d.ts +44 -44
  8. package/lib/cjs/mapLayers.js +63 -63
  9. package/lib/cjs/mapLayers.js.map +1 -1
  10. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +11 -11
  11. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +52 -52
  12. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  13. package/lib/cjs/ui/Interfaces.d.ts +50 -50
  14. package/lib/cjs/ui/Interfaces.js +2 -2
  15. package/lib/cjs/ui/Interfaces.js.map +1 -1
  16. package/lib/cjs/ui/MapFeatureInfoTool.d.ts +13 -13
  17. package/lib/cjs/ui/MapFeatureInfoTool.js +50 -50
  18. package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
  19. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +8 -8
  20. package/lib/cjs/ui/MapLayersUiItemsProvider.js +38 -38
  21. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  22. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +14 -14
  23. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +338 -338
  24. package/lib/cjs/ui/widget/BasemapPanel.d.ts +8 -8
  25. package/lib/cjs/ui/widget/BasemapPanel.js +156 -156
  26. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  27. package/lib/cjs/ui/widget/BasemapPanel.scss +87 -87
  28. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +21 -21
  29. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +25 -25
  30. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  31. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +40 -40
  32. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +139 -139
  33. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  34. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +7 -7
  35. package/lib/cjs/ui/widget/FeatureInfoWidget.js +71 -71
  36. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  37. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +19 -19
  38. package/lib/cjs/ui/widget/MapLayerDroppable.js +88 -88
  39. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  40. package/lib/cjs/ui/widget/MapLayerManager.d.ts +26 -26
  41. package/lib/cjs/ui/widget/MapLayerManager.js +403 -403
  42. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  43. package/lib/cjs/ui/widget/MapLayerManager.scss +409 -409
  44. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +12 -12
  45. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +83 -83
  46. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +7 -7
  48. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +65 -65
  49. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  50. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +20 -20
  51. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +11 -11
  52. package/lib/cjs/ui/widget/MapLayersWidget.js +31 -31
  53. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  54. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +3 -3
  55. package/lib/cjs/ui/widget/MapManagerSettings.js +200 -200
  56. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapManagerSettings.scss +29 -29
  58. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +23 -23
  59. package/lib/cjs/ui/widget/MapUrlDialog.js +527 -527
  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 +59 -59
  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 +76 -76
  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 +419 -419
  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 +308 -308
  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 +59 -59
  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 +48 -48
  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 +334 -334
  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 +21 -21
  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 +135 -135
  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 +67 -67
  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 +84 -84
  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 +398 -398
  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 +79 -79
  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.js +523 -523
  137. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  138. package/lib/esm/ui/widget/MapUrlDialog.scss +100 -100
  139. package/lib/esm/ui/widget/SelectMapFormat.d.ts +18 -18
  140. package/lib/esm/ui/widget/SelectMapFormat.js +55 -55
  141. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  142. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +20 -20
  143. package/lib/esm/ui/widget/SubLayersDataProvider.js +72 -72
  144. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  145. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +10 -10
  146. package/lib/esm/ui/widget/SubLayersPopupButton.js +36 -36
  147. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  148. package/lib/esm/ui/widget/SubLayersTree.d.ts +15 -15
  149. package/lib/esm/ui/widget/SubLayersTree.js +414 -414
  150. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  151. package/lib/esm/ui/widget/SubLayersTree.scss +69 -69
  152. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +14 -14
  153. package/lib/esm/ui/widget/TransparencyPopupButton.js +43 -43
  154. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  155. package/lib/esm/ui/widget/TransparencyPopupButton.scss +36 -36
  156. package/package.json +27 -27
@@ -1,22 +1,22 @@
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
+ /// <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 {};
22
22
  //# sourceMappingURL=ConfirmMessageDialog.d.ts.map
@@ -1,26 +1,26 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- // cSpell:ignore Modeless WMTS
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ConfirmMessageDialog = void 0;
9
- const React = require("react");
10
- const core_react_1 = require("@itwin/core-react");
11
- require("./MapUrlDialog.scss");
12
- const appui_abstract_1 = require("@itwin/appui-abstract");
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
- function ConfirmMessageDialog(props) {
15
- const buttonCluster = React.useMemo(() => {
16
- var _a, _b;
17
- return [
18
- { type: appui_abstract_1.DialogButtonType.Yes, onClick: (_a = props.onYesResult) !== null && _a !== void 0 ? _a : (() => { }) },
19
- { type: appui_abstract_1.DialogButtonType.No, onClick: (_b = props.onNoResult) !== null && _b !== void 0 ? _b : (() => { }) },
20
- ];
21
- }, [props.onYesResult, props.onNoResult]);
22
- return (React.createElement(core_react_1.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 },
23
- React.createElement("div", null, props.message)));
24
- }
25
- exports.ConfirmMessageDialog = ConfirmMessageDialog;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ // cSpell:ignore Modeless WMTS
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ConfirmMessageDialog = void 0;
9
+ const React = require("react");
10
+ const core_react_1 = require("@itwin/core-react");
11
+ require("./MapUrlDialog.scss");
12
+ const appui_abstract_1 = require("@itwin/appui-abstract");
13
+ // eslint-disable-next-line @typescript-eslint/naming-convention
14
+ function ConfirmMessageDialog(props) {
15
+ const buttonCluster = React.useMemo(() => {
16
+ var _a, _b;
17
+ return [
18
+ { type: appui_abstract_1.DialogButtonType.Yes, onClick: (_a = props.onYesResult) !== null && _a !== void 0 ? _a : (() => { }) },
19
+ { type: appui_abstract_1.DialogButtonType.No, onClick: (_b = props.onNoResult) !== null && _b !== void 0 ? _b : (() => { }) },
20
+ ];
21
+ }, [props.onYesResult, props.onNoResult]);
22
+ return (React.createElement(core_react_1.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 },
23
+ React.createElement("div", null, props.message)));
24
+ }
25
+ exports.ConfirmMessageDialog = ConfirmMessageDialog;
26
26
  //# 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,+BAA+B;AAC/B,kDAAwD;AAExD,+BAA6B;AAC7B,0DAAyD;AAoBzD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAAC,OAAA;YACxC,EAAE,IAAI,EAAE,iCAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,WAAW,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;YACzE,EAAE,IAAI,EAAE,iCAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,UAAU,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;SACxE,CAAA;KAAA,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,mBAAM,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;AA3BD,oDA2BC","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,+BAA+B;AAC/B,kDAAwD;AAExD,+BAA6B;AAC7B,0DAAyD;AAoBzD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,KAAgC;IAEnE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAAC,OAAA;YACxC,EAAE,IAAI,EAAE,iCAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,WAAW,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;YACzE,EAAE,IAAI,EAAE,iCAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAA,KAAK,CAAC,UAAU,mCAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE;SACxE,CAAA;KAAA,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,oBAAC,mBAAM,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;AA3BD,oDA2BC","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,140 +1,140 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.FeatureInfoDataProvider = exports.MapFeatureInfoLoadState = void 0;
8
- const appui_abstract_1 = require("@itwin/appui-abstract");
9
- const components_react_1 = require("@itwin/components-react");
10
- const core_bentley_1 = require("@itwin/core-bentley");
11
- // import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
12
- /**
13
- * Implementation of [IPropertyDataProvider] that uses an associative array.
14
- * @public
15
- */
16
- var MapFeatureInfoLoadState;
17
- (function (MapFeatureInfoLoadState) {
18
- MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
19
- MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
20
- })(MapFeatureInfoLoadState = exports.MapFeatureInfoLoadState || (exports.MapFeatureInfoLoadState = {}));
21
- class FeatureInfoDataProvider {
22
- constructor(onMapHit) {
23
- this.label = appui_abstract_1.PropertyRecord.fromString("");
24
- this.categories = [];
25
- this.records = {};
26
- this.onDataChanged = new components_react_1.PropertyDataChangeEvent();
27
- this.onDataLoadStateChanged = new core_bentley_1.BeEvent();
28
- this.onDataUpdated = new core_bentley_1.BeEvent();
29
- // eslint-disable-next-line @typescript-eslint/unbound-method
30
- this._removeListener = onMapHit.addListener(this._handleMapHit, this);
31
- }
32
- onUnload() {
33
- this._removeListener();
34
- }
35
- async _handleMapHit(mapHit) {
36
- var _a, _b;
37
- this.records = {};
38
- this.categories = [];
39
- let recordCount = 0;
40
- if (mapHit === null || mapHit === void 0 ? void 0 : mapHit.isMapHit) {
41
- this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
42
- const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
43
- this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
44
- if (mapInfo.layerInfo !== undefined) {
45
- for (const curLayerInfo of mapInfo.layerInfo) {
46
- const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
47
- let nbRecords = 0;
48
- const layerCategory = (layerCatIdx === -1 ?
49
- { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
50
- : this.categories[layerCatIdx]);
51
- if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
52
- // This is not an HTMLElement, so iterate over each sub-layer info
53
- for (const subLayerInfo of curLayerInfo.info) {
54
- nbRecords++;
55
- const subCatIdx = (_a = layerCategory.childCategories) === null || _a === void 0 ? void 0 : _a.findIndex((testCategory) => {
56
- return testCategory.name === subLayerInfo.subLayerName;
57
- });
58
- let subLayerCategory;
59
- if (subCatIdx === -1) {
60
- subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
61
- this.addSubCategory(subLayerCategory.name);
62
- (_b = layerCategory.childCategories) === null || _b === void 0 ? void 0 : _b.push(subLayerCategory);
63
- }
64
- if (subLayerInfo.records) {
65
- for (const record of subLayerInfo.records) {
66
- // Always use the string value for now
67
- this.addProperty(record, subLayerInfo.subLayerName);
68
- }
69
- }
70
- }
71
- }
72
- if (layerCatIdx === -1 && nbRecords > 0)
73
- this.addCategory(layerCategory);
74
- recordCount = recordCount + nbRecords;
75
- }
76
- }
77
- }
78
- this.onDataUpdated.raiseEvent({ recordCount });
79
- this.onDataChanged.raiseEvent();
80
- }
81
- addSubCategory(categoryName) {
82
- this.records[categoryName] = [];
83
- }
84
- addCategory(category) {
85
- const categoryIdx = this.categories.push(category) - 1;
86
- this.records[this.categories[categoryIdx].name] = [];
87
- return categoryIdx;
88
- }
89
- findCategoryIndex(category) {
90
- const index = this.categories.findIndex((testCategory) => {
91
- return testCategory.name === category.name;
92
- });
93
- return index;
94
- }
95
- findCategoryIndexByName(name) {
96
- const index = this.categories.findIndex((testCategory) => {
97
- return testCategory.name === name;
98
- });
99
- return index;
100
- }
101
- addProperty(propertyRecord, categoryName) {
102
- const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
103
- if (idx === -1) {
104
- this.records[categoryName].push(propertyRecord);
105
- }
106
- else {
107
- this.records[categoryName][idx].isMerged = true;
108
- this.records[categoryName][idx].isReadonly = true;
109
- }
110
- }
111
- removeProperty(propertyRecord, categoryIdx) {
112
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
113
- return record === propertyRecord;
114
- });
115
- let result = false;
116
- if (index >= 0) {
117
- this.records[this.categories[categoryIdx].name].splice(index, 1);
118
- this.onDataChanged.raiseEvent();
119
- result = true;
120
- }
121
- return result;
122
- }
123
- replaceProperty(propertyRecord, categoryIdx, newRecord) {
124
- const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
125
- return record === propertyRecord;
126
- });
127
- let result = false;
128
- // istanbul ignore else
129
- if (index >= 0) {
130
- this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
131
- result = true;
132
- }
133
- return result;
134
- }
135
- async getData() {
136
- return this;
137
- }
138
- }
139
- exports.FeatureInfoDataProvider = FeatureInfoDataProvider;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.FeatureInfoDataProvider = exports.MapFeatureInfoLoadState = void 0;
8
+ const appui_abstract_1 = require("@itwin/appui-abstract");
9
+ const components_react_1 = require("@itwin/components-react");
10
+ const core_bentley_1 = require("@itwin/core-bentley");
11
+ // import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from ""
12
+ /**
13
+ * Implementation of [IPropertyDataProvider] that uses an associative array.
14
+ * @public
15
+ */
16
+ var MapFeatureInfoLoadState;
17
+ (function (MapFeatureInfoLoadState) {
18
+ MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadStart"] = 0] = "DataLoadStart";
19
+ MapFeatureInfoLoadState[MapFeatureInfoLoadState["DataLoadEnd"] = 1] = "DataLoadEnd";
20
+ })(MapFeatureInfoLoadState = exports.MapFeatureInfoLoadState || (exports.MapFeatureInfoLoadState = {}));
21
+ class FeatureInfoDataProvider {
22
+ constructor(onMapHit) {
23
+ this.label = appui_abstract_1.PropertyRecord.fromString("");
24
+ this.categories = [];
25
+ this.records = {};
26
+ this.onDataChanged = new components_react_1.PropertyDataChangeEvent();
27
+ this.onDataLoadStateChanged = new core_bentley_1.BeEvent();
28
+ this.onDataUpdated = new core_bentley_1.BeEvent();
29
+ // eslint-disable-next-line @typescript-eslint/unbound-method
30
+ this._removeListener = onMapHit.addListener(this._handleMapHit, this);
31
+ }
32
+ onUnload() {
33
+ this._removeListener();
34
+ }
35
+ async _handleMapHit(mapHit) {
36
+ var _a, _b;
37
+ this.records = {};
38
+ this.categories = [];
39
+ let recordCount = 0;
40
+ if (mapHit === null || mapHit === void 0 ? void 0 : mapHit.isMapHit) {
41
+ this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadStart);
42
+ const mapInfo = await mapHit.viewport.getMapFeatureInfo(mapHit);
43
+ this.onDataLoadStateChanged.raiseEvent(MapFeatureInfoLoadState.DataLoadEnd);
44
+ if (mapInfo.layerInfo !== undefined) {
45
+ for (const curLayerInfo of mapInfo.layerInfo) {
46
+ const layerCatIdx = this.findCategoryIndexByName(curLayerInfo.layerName);
47
+ let nbRecords = 0;
48
+ const layerCategory = (layerCatIdx === -1 ?
49
+ { name: curLayerInfo.layerName, label: curLayerInfo.layerName, expand: true, childCategories: [] }
50
+ : this.categories[layerCatIdx]);
51
+ if (curLayerInfo.info && !(curLayerInfo.info instanceof HTMLElement)) {
52
+ // This is not an HTMLElement, so iterate over each sub-layer info
53
+ for (const subLayerInfo of curLayerInfo.info) {
54
+ nbRecords++;
55
+ const subCatIdx = (_a = layerCategory.childCategories) === null || _a === void 0 ? void 0 : _a.findIndex((testCategory) => {
56
+ return testCategory.name === subLayerInfo.subLayerName;
57
+ });
58
+ let subLayerCategory;
59
+ if (subCatIdx === -1) {
60
+ subLayerCategory = { name: subLayerInfo.subLayerName, label: subLayerInfo.subLayerName, expand: true };
61
+ this.addSubCategory(subLayerCategory.name);
62
+ (_b = layerCategory.childCategories) === null || _b === void 0 ? void 0 : _b.push(subLayerCategory);
63
+ }
64
+ if (subLayerInfo.records) {
65
+ for (const record of subLayerInfo.records) {
66
+ // Always use the string value for now
67
+ this.addProperty(record, subLayerInfo.subLayerName);
68
+ }
69
+ }
70
+ }
71
+ }
72
+ if (layerCatIdx === -1 && nbRecords > 0)
73
+ this.addCategory(layerCategory);
74
+ recordCount = recordCount + nbRecords;
75
+ }
76
+ }
77
+ }
78
+ this.onDataUpdated.raiseEvent({ recordCount });
79
+ this.onDataChanged.raiseEvent();
80
+ }
81
+ addSubCategory(categoryName) {
82
+ this.records[categoryName] = [];
83
+ }
84
+ addCategory(category) {
85
+ const categoryIdx = this.categories.push(category) - 1;
86
+ this.records[this.categories[categoryIdx].name] = [];
87
+ return categoryIdx;
88
+ }
89
+ findCategoryIndex(category) {
90
+ const index = this.categories.findIndex((testCategory) => {
91
+ return testCategory.name === category.name;
92
+ });
93
+ return index;
94
+ }
95
+ findCategoryIndexByName(name) {
96
+ const index = this.categories.findIndex((testCategory) => {
97
+ return testCategory.name === name;
98
+ });
99
+ return index;
100
+ }
101
+ addProperty(propertyRecord, categoryName) {
102
+ const idx = this.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);
103
+ if (idx === -1) {
104
+ this.records[categoryName].push(propertyRecord);
105
+ }
106
+ else {
107
+ this.records[categoryName][idx].isMerged = true;
108
+ this.records[categoryName][idx].isReadonly = true;
109
+ }
110
+ }
111
+ removeProperty(propertyRecord, categoryIdx) {
112
+ const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
113
+ return record === propertyRecord;
114
+ });
115
+ let result = false;
116
+ if (index >= 0) {
117
+ this.records[this.categories[categoryIdx].name].splice(index, 1);
118
+ this.onDataChanged.raiseEvent();
119
+ result = true;
120
+ }
121
+ return result;
122
+ }
123
+ replaceProperty(propertyRecord, categoryIdx, newRecord) {
124
+ const index = this.records[this.categories[categoryIdx].name].findIndex((record) => {
125
+ return record === propertyRecord;
126
+ });
127
+ let result = false;
128
+ // istanbul ignore else
129
+ if (index >= 0) {
130
+ this.records[this.categories[categoryIdx].name].splice(index, 1, newRecord);
131
+ result = true;
132
+ }
133
+ return result;
134
+ }
135
+ async getData() {
136
+ return this;
137
+ }
138
+ }
139
+ exports.FeatureInfoDataProvider = FeatureInfoDataProvider;
140
140
  //# 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,0DAAwD;AACxD,8DAAyH;AACzH,sDAA8C;AAG9C,oGAAoG;AAEpG;;;GAGG;AAEH,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAA6B;AAQhE,MAAa,uBAAuB;IASlC,YAAY,QAAqB;QAP1B,UAAK,GAAmB,+BAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;QAC3D,kBAAa,GAAG,IAAI,0CAAuB,EAAE,CAAC;QAC9C,2BAAsB,GAAG,IAAI,sBAAO,EAA8B,CAAC;QACnE,kBAAa,GAAG,IAAI,sBAAO,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,CAAC,MAAiB;;QAC3C,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QA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AC,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;AArID,0DAqIC","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,0DAAwD;AACxD,8DAAyH;AACzH,sDAA8C;AAG9C,oGAAoG;AAEpG;;;GAGG;AAEH,IAAY,uBAAoD;AAAhE,WAAY,uBAAuB;IAAE,uFAAa,CAAA;IAAE,mFAAW,CAAA;AAAA,CAAC,EAApD,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAA6B;AAQhE,MAAa,uBAAuB;IASlC,YAAY,QAAqB;QAP1B,UAAK,GAAmB,+BAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;QAC3D,kBAAa,GAAG,IAAI,0CAAuB,EAAE,CAAC;QAC9C,2BAAsB,GAAG,IAAI,sBAAO,EAA8B,CAAC;QACnE,kBAAa,GAAG,IAAI,sBAAO,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,CAAC,MAAiB;;QAC3C,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IA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AAI,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;AArID,0DAqIC","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