@itwin/grouping-mapping-widget 0.11.1 → 0.12.0

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 (189) hide show
  1. package/lib/cjs/grouping-mapping-widget.d.ts +4 -1
  2. package/lib/cjs/grouping-mapping-widget.js +7 -1
  3. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  4. package/lib/cjs/test/WidgetHeader.test.js +3 -3
  5. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  6. package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +7 -9
  7. package/lib/cjs/widget/components/CalculatedPropertyAction.js +49 -24
  8. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  9. package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +9 -16
  10. package/lib/cjs/widget/components/CalculatedPropertyTable.js +29 -31
  11. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  12. package/lib/cjs/widget/components/CalculatedPropertyTable.scss +9 -0
  13. package/lib/cjs/widget/components/CustomCalculationAction.d.ts +6 -9
  14. package/lib/cjs/widget/components/CustomCalculationAction.js +79 -9
  15. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  16. package/lib/cjs/widget/components/CustomCalculationTable.d.ts +8 -16
  17. package/lib/cjs/widget/components/CustomCalculationTable.js +22 -29
  18. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  19. package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
  20. package/lib/cjs/widget/components/DeleteModal.js +9 -13
  21. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  22. package/lib/cjs/widget/components/GroupAction.js +1 -0
  23. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  24. package/lib/cjs/widget/components/GroupInformationPanel.d.ts +10 -0
  25. package/lib/cjs/widget/components/GroupInformationPanel.js +23 -0
  26. package/lib/cjs/widget/components/GroupInformationPanel.js.map +1 -0
  27. package/lib/cjs/widget/components/GroupInformationPanel.scss +13 -0
  28. package/lib/cjs/widget/components/GroupPropertyAction.d.ts +6 -9
  29. package/lib/cjs/widget/components/GroupPropertyAction.js +26 -15
  30. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  31. package/lib/cjs/widget/components/GroupPropertyTable.d.ts +8 -15
  32. package/lib/cjs/widget/components/GroupPropertyTable.js +23 -28
  33. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  34. package/lib/cjs/widget/components/Grouping.d.ts +2 -1
  35. package/lib/cjs/widget/components/Grouping.js +12 -15
  36. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  37. package/lib/cjs/widget/components/Grouping.scss +2 -9
  38. package/lib/cjs/widget/components/GroupingMapping.js +1 -2
  39. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  40. package/lib/cjs/widget/components/GroupingMappingContent.js +8 -4
  41. package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
  42. package/lib/cjs/widget/components/GroupingMappingContext.js +17 -1
  43. package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
  44. package/lib/cjs/widget/components/GroupingMappingHeader.js +2 -2
  45. package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
  46. package/lib/cjs/widget/components/GroupingMappingRouter.js +23 -2
  47. package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
  48. package/lib/cjs/widget/components/GroupsAddButton.d.ts +9 -0
  49. package/lib/cjs/widget/components/GroupsAddButton.js +17 -0
  50. package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -0
  51. package/lib/cjs/widget/components/GroupsAddButton.scss +7 -0
  52. package/lib/cjs/widget/components/Mapping.js +5 -11
  53. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  54. package/lib/cjs/widget/components/PropertyMenu.d.ts +12 -17
  55. package/lib/cjs/widget/components/PropertyMenu.js +52 -155
  56. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  57. package/lib/cjs/widget/components/PropertyMenu.scss +4 -28
  58. package/lib/cjs/widget/components/PropertyNameCell.d.ts +11 -0
  59. package/lib/cjs/widget/components/PropertyNameCell.js +15 -0
  60. package/lib/cjs/widget/components/PropertyNameCell.js.map +1 -0
  61. package/lib/cjs/widget/components/PropertyTable.d.ts +18 -0
  62. package/lib/cjs/widget/components/PropertyTable.js +54 -0
  63. package/lib/cjs/widget/components/PropertyTable.js.map +1 -0
  64. package/lib/cjs/widget/components/PropertyTable.scss +11 -0
  65. package/lib/cjs/widget/components/PropertyTableToolbar.d.ts +10 -0
  66. package/lib/cjs/widget/components/PropertyTableToolbar.js +23 -0
  67. package/lib/cjs/widget/components/PropertyTableToolbar.js.map +1 -0
  68. package/lib/cjs/widget/components/PropertyTableToolbar.scss +12 -0
  69. package/lib/cjs/widget/components/ToggleGroupVisibility.d.ts +9 -0
  70. package/lib/cjs/widget/components/ToggleGroupVisibility.js +16 -0
  71. package/lib/cjs/widget/components/ToggleGroupVisibility.js.map +1 -0
  72. package/lib/cjs/widget/components/ToggleGroupVisibility.scss +9 -0
  73. package/lib/cjs/widget/components/WidgetHeader.d.ts +9 -0
  74. package/lib/cjs/widget/components/WidgetHeader.js +22 -0
  75. package/lib/cjs/widget/components/WidgetHeader.js.map +1 -0
  76. package/lib/cjs/widget/components/WidgetHeader.scss +36 -0
  77. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  78. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  79. package/lib/cjs/widget/components/context/PropertiesContext.d.ts +15 -0
  80. package/lib/cjs/widget/components/context/PropertiesContext.js +43 -0
  81. package/lib/cjs/widget/components/context/PropertiesContext.js.map +1 -0
  82. package/lib/cjs/widget/components/groupsHelpers.d.ts +6 -3
  83. package/lib/cjs/widget/components/groupsHelpers.js +43 -40
  84. package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
  85. package/lib/cjs/widget/components/utils.d.ts +0 -6
  86. package/lib/cjs/widget/components/utils.js +1 -9
  87. package/lib/cjs/widget/components/utils.js.map +1 -1
  88. package/lib/cjs/widget/components/utils.scss +0 -29
  89. package/lib/cjs/widget/components/viewerUtils.d.ts +4 -2
  90. package/lib/cjs/widget/components/viewerUtils.js +4 -22
  91. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  92. package/lib/cjs/widget/hooks/useFetchData.d.ts +3 -5
  93. package/lib/cjs/widget/hooks/useFetchData.js +9 -7
  94. package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
  95. package/lib/esm/grouping-mapping-widget.d.ts +4 -1
  96. package/lib/esm/grouping-mapping-widget.js +3 -0
  97. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  98. package/lib/esm/test/WidgetHeader.test.js +1 -1
  99. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  100. package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +7 -9
  101. package/lib/esm/widget/components/CalculatedPropertyAction.js +50 -27
  102. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  103. package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +9 -16
  104. package/lib/esm/widget/components/CalculatedPropertyTable.js +30 -31
  105. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  106. package/lib/esm/widget/components/CalculatedPropertyTable.scss +9 -0
  107. package/lib/esm/widget/components/CustomCalculationAction.d.ts +6 -9
  108. package/lib/esm/widget/components/CustomCalculationAction.js +79 -11
  109. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  110. package/lib/esm/widget/components/CustomCalculationTable.d.ts +8 -16
  111. package/lib/esm/widget/components/CustomCalculationTable.js +23 -29
  112. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  113. package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
  114. package/lib/esm/widget/components/DeleteModal.js +9 -13
  115. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  116. package/lib/esm/widget/components/GroupAction.js +1 -0
  117. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  118. package/lib/esm/widget/components/GroupInformationPanel.d.ts +10 -0
  119. package/lib/esm/widget/components/GroupInformationPanel.js +16 -0
  120. package/lib/esm/widget/components/GroupInformationPanel.js.map +1 -0
  121. package/lib/esm/widget/components/GroupInformationPanel.scss +13 -0
  122. package/lib/esm/widget/components/GroupPropertyAction.d.ts +6 -9
  123. package/lib/esm/widget/components/GroupPropertyAction.js +25 -15
  124. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  125. package/lib/esm/widget/components/GroupPropertyTable.d.ts +8 -15
  126. package/lib/esm/widget/components/GroupPropertyTable.js +24 -28
  127. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  128. package/lib/esm/widget/components/Grouping.d.ts +2 -1
  129. package/lib/esm/widget/components/Grouping.js +14 -17
  130. package/lib/esm/widget/components/Grouping.js.map +1 -1
  131. package/lib/esm/widget/components/Grouping.scss +2 -9
  132. package/lib/esm/widget/components/GroupingMapping.js +1 -2
  133. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  134. package/lib/esm/widget/components/GroupingMappingContent.js +9 -5
  135. package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
  136. package/lib/esm/widget/components/GroupingMappingContext.js +17 -1
  137. package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
  138. package/lib/esm/widget/components/GroupingMappingHeader.js +1 -1
  139. package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
  140. package/lib/esm/widget/components/GroupingMappingRouter.js +23 -2
  141. package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
  142. package/lib/esm/widget/components/GroupsAddButton.d.ts +9 -0
  143. package/lib/esm/widget/components/GroupsAddButton.js +10 -0
  144. package/lib/esm/widget/components/GroupsAddButton.js.map +1 -0
  145. package/lib/esm/widget/components/GroupsAddButton.scss +7 -0
  146. package/lib/esm/widget/components/Mapping.js +5 -11
  147. package/lib/esm/widget/components/Mapping.js.map +1 -1
  148. package/lib/esm/widget/components/PropertyMenu.d.ts +12 -17
  149. package/lib/esm/widget/components/PropertyMenu.js +54 -154
  150. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  151. package/lib/esm/widget/components/PropertyMenu.scss +4 -28
  152. package/lib/esm/widget/components/PropertyNameCell.d.ts +11 -0
  153. package/lib/esm/widget/components/PropertyNameCell.js +8 -0
  154. package/lib/esm/widget/components/PropertyNameCell.js.map +1 -0
  155. package/lib/esm/widget/components/PropertyTable.d.ts +18 -0
  156. package/lib/esm/widget/components/PropertyTable.js +28 -0
  157. package/lib/esm/widget/components/PropertyTable.js.map +1 -0
  158. package/lib/esm/widget/components/PropertyTable.scss +11 -0
  159. package/lib/esm/widget/components/PropertyTableToolbar.d.ts +10 -0
  160. package/lib/esm/widget/components/PropertyTableToolbar.js +16 -0
  161. package/lib/esm/widget/components/PropertyTableToolbar.js.map +1 -0
  162. package/lib/esm/widget/components/PropertyTableToolbar.scss +12 -0
  163. package/lib/esm/widget/components/ToggleGroupVisibility.d.ts +9 -0
  164. package/lib/esm/widget/components/ToggleGroupVisibility.js +9 -0
  165. package/lib/esm/widget/components/ToggleGroupVisibility.js.map +1 -0
  166. package/lib/esm/widget/components/ToggleGroupVisibility.scss +9 -0
  167. package/lib/esm/widget/components/WidgetHeader.d.ts +9 -0
  168. package/lib/esm/widget/components/WidgetHeader.js +15 -0
  169. package/lib/esm/widget/components/WidgetHeader.js.map +1 -0
  170. package/lib/esm/widget/components/WidgetHeader.scss +36 -0
  171. package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  172. package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  173. package/lib/esm/widget/components/context/PropertiesContext.d.ts +15 -0
  174. package/lib/esm/widget/components/context/PropertiesContext.js +20 -0
  175. package/lib/esm/widget/components/context/PropertiesContext.js.map +1 -0
  176. package/lib/esm/widget/components/groupsHelpers.d.ts +6 -3
  177. package/lib/esm/widget/components/groupsHelpers.js +41 -40
  178. package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
  179. package/lib/esm/widget/components/utils.d.ts +0 -6
  180. package/lib/esm/widget/components/utils.js +0 -7
  181. package/lib/esm/widget/components/utils.js.map +1 -1
  182. package/lib/esm/widget/components/utils.scss +0 -29
  183. package/lib/esm/widget/components/viewerUtils.d.ts +4 -2
  184. package/lib/esm/widget/components/viewerUtils.js +3 -20
  185. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  186. package/lib/esm/widget/hooks/useFetchData.d.ts +3 -5
  187. package/lib/esm/widget/hooks/useFetchData.js +9 -7
  188. package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
  189. package/package.json +1 -1
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import "./PropertyTableToolbar.scss";
3
+ export interface PropertyTableToolbarProps {
4
+ propertyType: string;
5
+ onClickAddProperty?: () => void;
6
+ refreshProperties: () => void;
7
+ isLoading: boolean;
8
+ }
9
+ export declare const PropertyTableToolbar: ({ propertyType, onClickAddProperty, refreshProperties, isLoading, }: PropertyTableToolbarProps) => JSX.Element;
10
+ //# sourceMappingURL=PropertyTableToolbar.d.ts.map
@@ -0,0 +1,16 @@
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 React from "react";
6
+ import { SvgAdd, SvgRefresh } from "@itwin/itwinui-icons-react";
7
+ import { Button, IconButton } from "@itwin/itwinui-react";
8
+ import "./PropertyTableToolbar.scss";
9
+ export const PropertyTableToolbar = ({ propertyType, onClickAddProperty, refreshProperties, isLoading, }) => (React.createElement("div", { className: "gmw-property-table-toolbar" },
10
+ onClickAddProperty && (React.createElement(Button, { startIcon: React.createElement(SvgAdd, null), styleType: "high-visibility", onClick: onClickAddProperty },
11
+ "Add ",
12
+ propertyType,
13
+ " Property")),
14
+ React.createElement(IconButton, { title: "Refresh", className: "gmw-property-table-refresh-button", onClick: refreshProperties, disabled: isLoading, styleType: "borderless" },
15
+ React.createElement(SvgRefresh, null))));
16
+ //# sourceMappingURL=PropertyTableToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyTableToolbar.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyTableToolbar.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,6BAA6B,CAAC;AASrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,GACiB,EAAE,EAAE,CAAC,CAC/B,6BAAK,SAAS,EAAC,4BAA4B;IACxC,kBAAkB,IAAI,CACrB,oBAAC,MAAM,IACL,SAAS,EAAE,oBAAC,MAAM,OAAG,EACrB,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,kBAAkB;;QAEtB,YAAY;oBACV,CACV;IACD,oBAAC,UAAU,IACT,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,YAAY;QAEtB,oBAAC,UAAU,OAAG,CACH,CACT,CACP,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { SvgAdd, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport \"./PropertyTableToolbar.scss\";\n\nexport interface PropertyTableToolbarProps {\n propertyType: string;\n onClickAddProperty?: () => void;\n refreshProperties: () => void;\n isLoading: boolean;\n}\n\nexport const PropertyTableToolbar = ({\n propertyType,\n onClickAddProperty,\n refreshProperties,\n isLoading,\n}: PropertyTableToolbarProps) => (\n <div className=\"gmw-property-table-toolbar\">\n {onClickAddProperty && (\n <Button\n startIcon={<SvgAdd />}\n styleType=\"high-visibility\"\n onClick={onClickAddProperty}\n >\n Add {propertyType} Property\n </Button>\n )}\n <IconButton\n title=\"Refresh\"\n className=\"gmw-property-table-refresh-button\"\n onClick={refreshProperties}\n disabled={isLoading}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n </div>\n);\n"]}
@@ -0,0 +1,12 @@
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
+
6
+ .gmw-property-table-toolbar {
7
+ display: flex;
8
+ justify-content: space-between;
9
+ .gmw-property-table-refresh-button {
10
+ margin-left: auto;
11
+ }
12
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import "./ToggleGroupVisibility.scss";
3
+ export interface ToggleGroupVisibilityProps {
4
+ isLoadingQuery: boolean;
5
+ showGroupColor: boolean;
6
+ setShowGroupColor: (value: ((prevState: boolean) => boolean) | boolean) => void;
7
+ }
8
+ export declare const ToggleGroupVisibility: ({ isLoadingQuery, showGroupColor, setShowGroupColor }: ToggleGroupVisibilityProps) => JSX.Element;
9
+ //# sourceMappingURL=ToggleGroupVisibility.d.ts.map
@@ -0,0 +1,9 @@
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 { ToggleSwitch } from "@itwin/itwinui-react";
6
+ import "./ToggleGroupVisibility.scss";
7
+ import React from "react";
8
+ export const ToggleGroupVisibility = ({ isLoadingQuery, showGroupColor, setShowGroupColor }) => (React.createElement(ToggleSwitch, { label: "Color by Group", labelPosition: "left", className: "gmw-toggle", disabled: isLoadingQuery, checked: showGroupColor, onChange: () => setShowGroupColor((b) => !b) }));
9
+ //# sourceMappingURL=ToggleGroupVisibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleGroupVisibility.js","sourceRoot":"","sources":["../../../../src/widget/components/ToggleGroupVisibility.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAA8B,EAAE,EAAE,CAAC,CAC1H,oBAAC,YAAY,IACX,KAAK,EAAC,gBAAgB,EACtB,aAAa,EAAC,MAAM,EACpB,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAC5C,CACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\nimport \"./ToggleGroupVisibility.scss\";\nimport React from \"react\";\n\nexport interface ToggleGroupVisibilityProps {\n isLoadingQuery: boolean;\n showGroupColor: boolean;\n setShowGroupColor: (value: ((prevState: boolean) => boolean) | boolean) => void;\n}\n\nexport const ToggleGroupVisibility = ({ isLoadingQuery, showGroupColor, setShowGroupColor }: ToggleGroupVisibilityProps) => (\n <ToggleSwitch\n label=\"Color by Group\"\n labelPosition=\"left\"\n className=\"gmw-toggle\"\n disabled={isLoadingQuery}\n checked={showGroupColor}\n onChange={() => setShowGroupColor((b) => !b)}\n />\n);\n"]}
@@ -0,0 +1,9 @@
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 "~@itwin/itwinui-css/scss/variables";
6
+
7
+ .gmw-toggle {
8
+ margin-right: $iui-xs;
9
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import "./WidgetHeader.scss";
3
+ export interface WidgetHeaderProps {
4
+ title: string;
5
+ disabled?: boolean;
6
+ returnFn?: () => void;
7
+ }
8
+ export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeaderProps) => JSX.Element;
9
+ //# sourceMappingURL=WidgetHeader.d.ts.map
@@ -0,0 +1,15 @@
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 { SvgChevronLeft } from "@itwin/itwinui-icons-react";
6
+ import { Text } from "@itwin/itwinui-react";
7
+ import "./WidgetHeader.scss";
8
+ import React from "react";
9
+ export const WidgetHeader = ({ title, disabled = false, returnFn, }) => {
10
+ return (React.createElement("div", { className: 'gmw-widget-header-container' },
11
+ returnFn && (React.createElement("div", { className: disabled ? "gmw-chevron-disabled" : "gmw-chevron", onClick: disabled ? undefined : returnFn },
12
+ React.createElement(SvgChevronLeft, null))),
13
+ React.createElement(Text, { className: 'gmw-title', variant: 'title' }, title)));
14
+ };
15
+ //# sourceMappingURL=WidgetHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetHeader.js","sourceRoot":"","sources":["../../../../src/widget/components/WidgetHeader.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GACU,EAAE,EAAE;IACtB,OAAO,CACL,6BAAK,SAAS,EAAC,6BAA6B;QACzC,QAAQ,IAAI,CACX,6BACE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,aAAa,EAC5D,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAExC,oBAAC,cAAc,OAAG,CACd,CACP;QACD,oBAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,OAAO,EAAC,OAAO,IACxC,KAAK,CACD,CACH,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport \"./WidgetHeader.scss\";\nimport React from \"react\";\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => void;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='gmw-widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"gmw-chevron-disabled\" : \"gmw-chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='gmw-title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n"]}
@@ -0,0 +1,36 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
+ @import "~@itwin/itwinui-css/scss/icon/index";
7
+ @import "~@itwin/itwinui-css/scss/button/index";
8
+
9
+ .gmw-widget-header-container {
10
+ display: flex;
11
+ margin-bottom: $iui-baseline * 2;
12
+
13
+ .gmw-chevron {
14
+ @include iui-icons-large();
15
+ cursor: pointer;
16
+ align-self: center;
17
+ margin-right: $iui-s;
18
+ }
19
+
20
+ .gmw-chevron-disabled {
21
+ @include iui-icons-large();
22
+ @include themed {
23
+ fill: t(iui-icons-color-actionable-disabled);
24
+ }
25
+ cursor: not-allowed;
26
+
27
+ align-self: center;
28
+ margin-right: $iui-s;
29
+ }
30
+
31
+ .gmw-title {
32
+ overflow: hidden;
33
+ white-space: nowrap;
34
+ text-overflow: ellipsis;
35
+ }
36
+ }
@@ -1,8 +1,13 @@
1
1
  import * as React from "react";
2
2
  import type { MutableRefObject } from "react";
3
3
  import type { Group } from "@itwin/insights-client";
4
+ import type { KeySet } from "@itwin/presentation-common";
5
+ export interface QueryCacheItem {
6
+ keySet: KeySet;
7
+ ids: string[];
8
+ }
4
9
  export interface GroupHilitedElements {
5
- hilitedElementsQueryCache: MutableRefObject<Map<string, string[]>>;
10
+ hilitedElementsQueryCache: MutableRefObject<Map<string, QueryCacheItem>>;
6
11
  hiddenGroupsIds: string[];
7
12
  showGroupColor: boolean;
8
13
  groups: Group[];
@@ -1 +1 @@
1
- {"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;IACjD,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,KAAK;IACrB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC;IACpB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAyB,EAAE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { MutableRefObject } from \"react\";\nimport type { Group } from \"@itwin/insights-client\";\n\nexport interface GroupHilitedElements {\n hilitedElementsQueryCache: MutableRefObject<Map<string, string[]>>;\n hiddenGroupsIds: string[];\n showGroupColor: boolean;\n groups: Group[];\n setGroups: (groups: Group[]) => void;\n setHiddenGroupsIds: (hiddenGroupIds: string[]) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const GroupHilitedElementsContext = React.createContext<GroupHilitedElements>({\n hilitedElementsQueryCache: { current: new Map() },\n hiddenGroupsIds: [],\n showGroupColor: false,\n groups: [],\n setGroups: () => { },\n setHiddenGroupsIds: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const useGroupHilitedElementsContext = (): GroupHilitedElements => {\n const context = React.useContext(GroupHilitedElementsContext);\n if (!context) {\n throw new Error(\n \"useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider\"\n );\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,yBAAyB,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE;IACjD,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,KAAK;IACrB,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC;IACpB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAyB,EAAE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,6FAA6F,CAC9F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { MutableRefObject } from \"react\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nexport interface QueryCacheItem {\n keySet: KeySet;\n ids: string[];\n}\nexport interface GroupHilitedElements {\n hilitedElementsQueryCache: MutableRefObject<Map<string, QueryCacheItem>>;\n hiddenGroupsIds: string[];\n showGroupColor: boolean;\n groups: Group[];\n setGroups: (groups: Group[]) => void;\n setHiddenGroupsIds: (hiddenGroupIds: string[]) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const GroupHilitedElementsContext = React.createContext<GroupHilitedElements>({\n hilitedElementsQueryCache: { current: new Map() },\n hiddenGroupsIds: [],\n showGroupColor: false,\n groups: [],\n setGroups: () => { },\n setHiddenGroupsIds: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const useGroupHilitedElementsContext = (): GroupHilitedElements => {\n const context = React.useContext(GroupHilitedElementsContext);\n if (!context) {\n throw new Error(\n \"useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider\"\n );\n }\n return context;\n};\n"]}
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import type { CalculatedProperty, CustomCalculation, GroupProperty } from "@itwin/insights-client";
3
+ export interface Properties {
4
+ showGroupColor: boolean;
5
+ groupProperties?: GroupProperty[];
6
+ calculatedProperties?: CalculatedProperty[];
7
+ customCalculationProperties?: CustomCalculation[];
8
+ setGroupProperties: (groupProperties: GroupProperty[]) => void;
9
+ setCalculatedProperties: (calculatedProperties: CalculatedProperty[]) => void;
10
+ setCustomCalculationProperties: (customCalculationProperties: CustomCalculation[]) => void;
11
+ setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;
12
+ }
13
+ export declare const PropertiesContext: React.Context<Properties>;
14
+ export declare const usePropertiesContext: () => Properties;
15
+ //# sourceMappingURL=PropertiesContext.d.ts.map
@@ -0,0 +1,20 @@
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
+ export const PropertiesContext = React.createContext({
7
+ showGroupColor: false,
8
+ setGroupProperties: () => { },
9
+ setCalculatedProperties: () => { },
10
+ setCustomCalculationProperties: () => { },
11
+ setShowGroupColor: () => { },
12
+ });
13
+ export const usePropertiesContext = () => {
14
+ const context = React.useContext(PropertiesContext);
15
+ if (!context) {
16
+ throw new Error("usePropertiesContext should be used within a PropertiesContext provider");
17
+ }
18
+ return context;
19
+ };
20
+ //# sourceMappingURL=PropertiesContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertiesContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/PropertiesContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAa;IAC/D,cAAc,EAAE,KAAK;IACrB,kBAAkB,EAAE,GAAG,EAAE,GAAG,CAAC;IAC7B,uBAAuB,EAAE,GAAG,EAAE,GAAG,CAAC;IAClC,8BAA8B,EAAE,GAAG,EAAE,GAAG,CAAC;IACzC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAe,EAAE;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { CalculatedProperty, CustomCalculation, GroupProperty } from \"@itwin/insights-client\";\n\nexport interface Properties {\n showGroupColor: boolean;\n groupProperties?: GroupProperty[];\n calculatedProperties?: CalculatedProperty[];\n customCalculationProperties?: CustomCalculation[];\n setGroupProperties: (groupProperties: GroupProperty[]) => void;\n setCalculatedProperties: (calculatedProperties: CalculatedProperty[]) => void;\n setCustomCalculationProperties: (customCalculationProperties: CustomCalculation[]) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const PropertiesContext = React.createContext<Properties>({\n showGroupColor: false,\n setGroupProperties: () => { },\n setCalculatedProperties: () => { },\n setCustomCalculationProperties: () => { },\n setShowGroupColor: () => { },\n});\n\nexport const usePropertiesContext = (): Properties => {\n const context = React.useContext(PropertiesContext);\n if (!context) {\n throw new Error(\n \"usePropertiesContext should be used within a PropertiesContext provider\"\n );\n }\n return context;\n};\n"]}
@@ -1,7 +1,10 @@
1
1
  import type { IModelConnection } from "@itwin/core-frontend";
2
2
  import type { Group } from "@itwin/insights-client";
3
+ import type { QueryCacheItem } from "./context/GroupHilitedElementsContext";
3
4
  export declare const getGroupColor: (index: number) => string;
4
- export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>) => Promise<string[]>;
5
- export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>) => Promise<void>;
6
- export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[], viewGroups: Group[], hiddenGroupsIds: string[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>, doEmphasizeElements?: boolean) => Promise<void>;
5
+ export declare const getHiliteIdsFromGroups: (iModelConnection: IModelConnection, groups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<string[]>;
6
+ export declare const hideGroups: (iModelConnection: IModelConnection, viewGroups: Group[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
7
+ export declare const hideGroup: (iModelConnection: IModelConnection, viewGroup: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<void>;
8
+ export declare const visualizeGroupColors: (iModelConnection: IModelConnection, groups: Group[], viewGroups: Group[], hiddenGroupsIds: string[], hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>, doEmphasizeElements?: boolean) => Promise<void>;
9
+ export declare const getHiliteIdsAndKeysetFromGroup: (iModelConnection: IModelConnection, group: Group, hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>) => Promise<QueryCacheItem>;
7
10
  //# sourceMappingURL=groupsHelpers.d.ts.map
@@ -4,59 +4,39 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { FeatureOverrideType } from "@itwin/core-common";
6
6
  import { toaster } from "@itwin/itwinui-react";
7
- import { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, hideElementsByQuery, overrideElements, zoomToElements } from "./viewerUtils";
7
+ import { KeySet } from "@itwin/presentation-common";
8
+ import { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements, zoomToElements } from "./viewerUtils";
8
9
  const goldenAngle = 180 * (3 - Math.sqrt(5));
9
10
  export const getGroupColor = function (index) {
10
11
  return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;
11
12
  };
12
13
  export const getHiliteIdsFromGroups = async (iModelConnection, groups, hilitedElementsQueryCache) => {
13
- var _a;
14
- let allIds = [];
14
+ const distinctQueries = new Set();
15
+ const promises = [];
15
16
  for (const group of groups) {
16
- const query = group.query;
17
- let currentIds = [];
18
- if (hilitedElementsQueryCache.current.has(query)) {
19
- currentIds = (_a = hilitedElementsQueryCache.current.get(query)) !== null && _a !== void 0 ? _a : [];
20
- }
21
- else {
22
- try {
23
- const queryRowCount = await iModelConnection.queryRowCount(query);
24
- if (queryRowCount === 0) {
25
- toaster.warning(`${group.groupName}'s query is valid but produced no results.`);
26
- }
27
- currentIds = await getHiliteIds(query, iModelConnection);
28
- hilitedElementsQueryCache.current.set(query, currentIds);
29
- }
30
- catch {
31
- toaster.negative(`Could not hide/show ${group.groupName}. Query could not be resolved.`);
32
- }
17
+ if (!distinctQueries.has(group.query)) {
18
+ distinctQueries.add(group.query);
19
+ promises.push(getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache));
33
20
  }
34
- allIds = allIds.concat(currentIds);
35
21
  }
22
+ const results = await Promise.all(promises);
23
+ const allIds = results.flatMap((result) => result.ids);
36
24
  return allIds;
37
25
  };
38
26
  export const hideGroups = async (iModelConnection, viewGroups, hilitedElementsQueryCache) => {
39
- var _a;
27
+ const distinctQueries = new Set();
28
+ const promises = [];
40
29
  for (const viewGroup of viewGroups) {
41
- const query = viewGroup.query;
42
- if (hilitedElementsQueryCache.current.has(query)) {
43
- const hilitedIds = (_a = hilitedElementsQueryCache.current.get(query)) !== null && _a !== void 0 ? _a : [];
44
- hideElements(hilitedIds);
45
- }
46
- else {
47
- try {
48
- const queryRowCount = await iModelConnection.queryRowCount(query);
49
- if (queryRowCount === 0) {
50
- toaster.warning(`${viewGroup.groupName}'s query is valid but produced no results.`);
51
- }
52
- const hiliteIds = await hideElementsByQuery(query, iModelConnection, false);
53
- hilitedElementsQueryCache.current.set(query, hiliteIds);
54
- }
55
- catch {
56
- toaster.negative(`Could not hide/show ${viewGroup.groupName}. Query could not be resolved.`);
57
- }
30
+ if (!distinctQueries.has(viewGroup.query)) {
31
+ distinctQueries.add(viewGroup.query);
32
+ promises.push(hideGroup(iModelConnection, viewGroup, hilitedElementsQueryCache));
58
33
  }
59
34
  }
35
+ await Promise.all(promises);
36
+ };
37
+ export const hideGroup = async (iModelConnection, viewGroup, hilitedElementsQueryCache) => {
38
+ const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);
39
+ hideElements(result.ids);
60
40
  };
61
41
  export const visualizeGroupColors = async (iModelConnection, groups, viewGroups, hiddenGroupsIds, hilitedElementsQueryCache, doEmphasizeElements = true) => {
62
42
  clearEmphasizedOverriddenElements();
@@ -65,7 +45,8 @@ export const visualizeGroupColors = async (iModelConnection, groups, viewGroups,
65
45
  const index = viewGroups.length > groups.length
66
46
  ? viewGroups.findIndex((g) => g.id === group.id)
67
47
  : groups.findIndex((g) => g.id === group.id);
68
- const hilitedIds = await getHiliteIdsFromGroups(iModelConnection, [group], hilitedElementsQueryCache);
48
+ const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
49
+ const hilitedIds = result.ids;
69
50
  overrideElements(hilitedIds, getGroupColor(index), FeatureOverrideType.ColorAndAlpha);
70
51
  doEmphasizeElements && emphasizeElements(hilitedIds, undefined);
71
52
  if (!hiddenGroupsIds.includes(group.id)) {
@@ -74,4 +55,24 @@ export const visualizeGroupColors = async (iModelConnection, groups, viewGroups,
74
55
  }
75
56
  await zoomToElements(allIds);
76
57
  };
58
+ export const getHiliteIdsAndKeysetFromGroup = async (iModelConnection, group, hilitedElementsQueryCache) => {
59
+ var _a;
60
+ const query = group.query;
61
+ if (hilitedElementsQueryCache.current.has(query)) {
62
+ return (_a = hilitedElementsQueryCache.current.get(query)) !== null && _a !== void 0 ? _a : ({ keySet: new KeySet(), ids: [] });
63
+ }
64
+ try {
65
+ const queryRowCount = await iModelConnection.queryRowCount(query);
66
+ if (queryRowCount === 0) {
67
+ toaster.warning(`${group.groupName}'s query is valid but produced no results.`);
68
+ }
69
+ const result = await getHiliteIds(query, iModelConnection);
70
+ hilitedElementsQueryCache.current.set(query, result);
71
+ return result;
72
+ }
73
+ catch {
74
+ toaster.negative(`Query could not be resolved.`);
75
+ return ({ keySet: new KeySet(), ids: [] });
76
+ }
77
+ };
77
78
  //# sourceMappingURL=groupsHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/widget/components/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cA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AAM;YAC/B,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC;YAChD,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE,yBAAyB,CAAC,CAAC;QACtG,gBAAgB,CACd,UAAU,EACV,aAAa,CAAC,KAAK,CAAC,EACpB,mBAAmB,CAAC,aAAa,CAClC,CAAC;QACF,mBAAmB,IAAI,iBAAiB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;YACvC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SACpC;KACF;IAED,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, hideElementsByQuery, overrideElements, zoomToElements } from \"./viewerUtils\";\n\nconst goldenAngle = 180 * (3 - Math.sqrt(5));\n\nexport const getGroupColor = function (index: number) {\n return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;\n};\n\nexport const getHiliteIdsFromGroups = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>\n) => {\n let allIds: string[] = [];\n for (const group of groups) {\n const query = group.query;\n let currentIds: string[] = [];\n if (hilitedElementsQueryCache.current.has(query)) {\n currentIds = hilitedElementsQueryCache.current.get(query) ?? [];\n } else {\n try {\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\n `${group.groupName}'s query is valid but produced no results.`\n );\n }\n currentIds = await getHiliteIds(query, iModelConnection);\n hilitedElementsQueryCache.current.set(query, currentIds);\n } catch {\n toaster.negative(\n `Could not hide/show ${group.groupName}. Query could not be resolved.`\n );\n }\n }\n allIds = allIds.concat(currentIds);\n }\n return allIds;\n};\n\nexport const hideGroups = async (\n iModelConnection: IModelConnection,\n viewGroups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>\n) => {\n for (const viewGroup of viewGroups) {\n const query = viewGroup.query;\n if (hilitedElementsQueryCache.current.has(query)) {\n const hilitedIds = hilitedElementsQueryCache.current.get(query) ?? [];\n hideElements(hilitedIds);\n } else {\n try {\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\n `${viewGroup.groupName}'s query is valid but produced no results.`\n );\n }\n const hiliteIds = await hideElementsByQuery(\n query,\n iModelConnection,\n false\n );\n hilitedElementsQueryCache.current.set(query, hiliteIds);\n } catch {\n toaster.negative(\n `Could not hide/show ${viewGroup.groupName}. Query could not be resolved.`\n );\n }\n }\n }\n};\n\nexport const visualizeGroupColors = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n viewGroups: Group[],\n hiddenGroupsIds: string[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, string[]>>,\n doEmphasizeElements: boolean = true\n) => {\n clearEmphasizedOverriddenElements();\n let allIds: string[] = [];\n for (const group of viewGroups) {\n const index =\n viewGroups.length > groups.length\n ? viewGroups.findIndex((g) => g.id === group.id)\n : groups.findIndex((g) => g.id === group.id);\n const hilitedIds = await getHiliteIdsFromGroups(iModelConnection, [group], hilitedElementsQueryCache);\n overrideElements(\n hilitedIds,\n getGroupColor(index),\n FeatureOverrideType.ColorAndAlpha,\n );\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n if (!hiddenGroupsIds.includes(group.id)) {\n allIds = allIds.concat(hilitedIds);\n }\n }\n\n await zoomToElements(allIds);\n};\n"]}
1
+ {"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/widget/components/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnJ,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,KAAa;IAClD,OAAO,OAAO,KAAK,GAAG,WAAW,GAAG,EAAE,cAAc,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,gBAAkC,EAClC,MAAe,EACf,yBAA8E,EAC9E,EAAE;IACF,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,MAAM,QAAQ,GAAiC,EAAE,CAAC;IAClD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACrC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACjC,QAAQ,CAAC,IAAI,C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AC,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAC5F;IACD,IAAI;QACF,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAClE,IAAI,aAAa,KAAK,CAAC,EAAE;YACvB,OAAO,CAAC,OAAO,CACb,GAAG,KAAK,CAAC,SAAS,4CAA4C,CAC/D,CAAC;SACH;QACD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QAC3D,yBAAyB,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;KACf;IAAC,MAAM;QACN,OAAO,CAAC,QAAQ,CACd,8BAA8B,CAC/B,CAAC;QACF,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;KAC5C;AAEH,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport type { QueryCacheItem } from \"./context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements, zoomToElements } from \"./viewerUtils\";\n\nconst goldenAngle = 180 * (3 - Math.sqrt(5));\n\nexport const getGroupColor = function (index: number) {\n return `hsl(${index * goldenAngle + 60}, 100%, 50%)`;\n};\n\nexport const getHiliteIdsFromGroups = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<{ ids: string[] }>[] = [];\n for (const group of groups) {\n if (!distinctQueries.has(group.query)) {\n distinctQueries.add(group.query);\n promises.push(getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache));\n }\n }\n const results = await Promise.all(promises);\n const allIds = results.flatMap((result) => result.ids);\n return allIds;\n};\n\nexport const hideGroups = async (\n iModelConnection: IModelConnection,\n viewGroups: Group[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const distinctQueries = new Set<string>();\n const promises: Promise<void>[] = [];\n\n for (const viewGroup of viewGroups) {\n if (!distinctQueries.has(viewGroup.query)) {\n distinctQueries.add(viewGroup.query);\n promises.push(hideGroup(iModelConnection, viewGroup, hilitedElementsQueryCache));\n }\n }\n await Promise.all(promises);\n};\n\nexport const hideGroup = async (\n iModelConnection: IModelConnection,\n viewGroup: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, viewGroup, hilitedElementsQueryCache);\n hideElements(result.ids);\n};\n\nexport const visualizeGroupColors = async (\n iModelConnection: IModelConnection,\n groups: Group[],\n viewGroups: Group[],\n hiddenGroupsIds: string[],\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>,\n doEmphasizeElements: boolean = true\n) => {\n clearEmphasizedOverriddenElements();\n let allIds: string[] = [];\n for (const group of viewGroups) {\n const index =\n viewGroups.length > groups.length\n ? viewGroups.findIndex((g) => g.id === group.id)\n : groups.findIndex((g) => g.id === group.id);\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);\n const hilitedIds = result.ids;\n overrideElements(\n hilitedIds,\n getGroupColor(index),\n FeatureOverrideType.ColorAndAlpha,\n );\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n if (!hiddenGroupsIds.includes(group.id)) {\n allIds = allIds.concat(hilitedIds);\n }\n }\n\n await zoomToElements(allIds);\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n hilitedElementsQueryCache: React.MutableRefObject<Map<string, QueryCacheItem>>\n) => {\n const query = group.query;\n if (hilitedElementsQueryCache.current.has(query)) {\n return hilitedElementsQueryCache.current.get(query) ?? ({ keySet: new KeySet(), ids: [] });\n }\n try {\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\n `${group.groupName}'s query is valid but produced no results.`\n );\n }\n const result = await getHiliteIds(query, iModelConnection);\n hilitedElementsQueryCache.current.set(query, result);\n return result;\n } catch {\n toaster.negative(\n `Query could not be resolved.`\n );\n return ({ keySet: new KeySet(), ids: [] });\n }\n\n};\n"]}
@@ -1,12 +1,6 @@
1
1
  import "./utils.scss";
2
2
  import React from "react";
3
3
  import type { IModelConnection } from "@itwin/core-frontend";
4
- export interface WidgetHeaderProps {
5
- title: string;
6
- disabled?: boolean;
7
- returnFn?: () => void;
8
- }
9
- export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeaderProps) => JSX.Element;
10
4
  export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: React.Dispatch<React.SetStateAction<T>>) => void;
11
5
  export declare const fetchIdsFromQuery: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
12
6
  export declare const handleError: (errorStatus: number) => void;
@@ -2,17 +2,10 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { SvgChevronLeft } from "@itwin/itwinui-icons-react";
6
5
  import { ProgressRadial, Text, toaster } from "@itwin/itwinui-react";
7
6
  import "./utils.scss";
8
7
  import React from "react";
9
8
  import { QueryRowFormat } from "@itwin/core-common";
10
- export const WidgetHeader = ({ title, disabled = false, returnFn, }) => {
11
- return (React.createElement("div", { className: 'gmw-widget-header-container' },
12
- returnFn && (React.createElement("div", { className: disabled ? "gmw-chevron-disabled" : "gmw-chevron", onClick: disabled ? undefined : returnFn },
13
- React.createElement(SvgChevronLeft, null))),
14
- React.createElement(Text, { className: 'gmw-title', variant: 'title' }, title)));
15
- };
16
9
  export const handleInputChange = (e, values, setValues) => {
17
10
  const { name, value } = e.target;
18
11
  setValues({
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQpD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GACU,EAAE,EAAE;IACtB,OAAO,CACL,6BAAK,SAAS,EAAC,6BAA6B;QACzC,QAAQ,IAAI,CACX,6BACE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,aAAa,EAC5D,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAExC,oBAAC,cAAc,OAAG,CACd,CACP;QACD,oBAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,OAAO,EAAC,OAAO,IACxC,KAAK,CACD,CACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,CAAsC,EACtC,MAAS,EACT,SAAkD,EAClD,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,KAAK,E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------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => void;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='gmw-widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"gmw-chevron-disabled\" : \"gmw-chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='gmw-title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gmw-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gmw-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gmw-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,CAAsC,EACtC,MAAS,EACT,SAAkD,EAClD,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IAEjC,SAAS,CAAC;QACR,GAAG,MAAM;QACT,CAAC,IAAI,CAAC,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,K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M;QACR,KAAK,GAAG;YACN,YAAY,IAAI,2CAA2C,CAAC;YAC5D,MAAM;QACR,KAAK,GAAG;YACN,YAAY,IAAI,gCAAgC,CAAC;YACjD,MAAM;QACR,KAAK,GAAG;YACN,YAAY,IAAI,oBAAoB,CAAC;YACrC,MAAM;QACR,KAAK,GAAG;YACN,YAAY,IAAI,wBAAwB,CAAC;YACzC,MAAM;QACR,KAAK,GAAG;YACN,YAAY,IAAI,cAAc,CAAC;YAC/B,MAAM;QACR,KAAK,GAAG;YACN,YAAY,IAAI,sBAAsB,CAAC;YACvC,MAAM;QACR;YACE,YAAY,IAAI,uBAAuB,CAAC;KAC3C;IACD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,CAClC,6BAAK,SAAS,EAAC,oBAAoB;IACjC,oBAAC,IAAI,kBAAe;IACpB,oBAAC,cAAc,IAAC,aAAa,SAAG;IAChC,oBAAC,IAAI,yBAAsB,CACvB,CACP,CAAC;AAMF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAqB,EAAE,EAAE,CAAC,CAC9D,6BAAK,SAAS,EAAC,oBAAoB;IACjC,oBAAC,IAAI,QAAE,OAAO,CAAQ,CAClB,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CACL,6BAAK,SAAS,EAAC,qBAAqB;QAClC,oBAAC,cAAc,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CACzC,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gmw-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gmw-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gmw-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
@@ -6,35 +6,6 @@
6
6
  @import "~@itwin/itwinui-css/scss/icon/index";
7
7
  @import "~@itwin/itwinui-css/scss/button/index";
8
8
 
9
- .gmw-widget-header-container {
10
- display: flex;
11
- margin-bottom: $iui-baseline * 3;
12
-
13
- .gmw-chevron {
14
- @include iui-icons-large();
15
- cursor: pointer;
16
- align-self: center;
17
- margin-right: $iui-s;
18
- }
19
-
20
- .gmw-chevron-disabled {
21
- @include iui-icons-large();
22
- @include themed {
23
- fill: t(iui-icons-color-actionable-disabled);
24
- }
25
- cursor: not-allowed;
26
-
27
- align-self: center;
28
- margin-right: $iui-s;
29
- }
30
-
31
- .gmw-title {
32
- overflow: hidden;
33
- white-space: nowrap;
34
- text-overflow: ellipsis;
35
- }
36
- }
37
-
38
9
  .gmw-loading-spinner {
39
10
  display: flex;
40
11
  align-items: center;
@@ -6,7 +6,6 @@ export declare const isolateElementsByKeys: (keySet: KeySet, replace?: boolean)
6
6
  export declare const isolateElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
7
7
  export declare const isolateElements: (hilitedIds: string[], replace?: boolean) => void;
8
8
  export declare const clearIsolatedElements: () => void;
9
- export declare const hideElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
10
9
  export declare const hideElements: (hilitedIds: string[], replace?: boolean) => void;
11
10
  export declare const clearHiddenElements: () => void;
12
11
  export declare const overrideElementsByQuery: (iModelConnection: IModelConnection, query: string, color: string, overrideType?: FeatureOverrideType) => Promise<string[]>;
@@ -20,7 +19,10 @@ export declare const visualizeElementsByKeys: (keySet: KeySet, color: string, re
20
19
  export declare const visualizeElements: (elementIds: string[], color: string, replace?: boolean, wantEmphasis?: boolean) => void;
21
20
  export declare const transparentOverriddenElements: () => void;
22
21
  export declare const zoomToElements: (elementIds: string[]) => Promise<void>;
23
- export declare const getHiliteIds: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
22
+ export declare const getHiliteIds: (query: string, iModelConnection: IModelConnection) => Promise<{
23
+ keySet: KeySet;
24
+ ids: string[];
25
+ }>;
24
26
  export declare const manufactureKeys: (query: string, iModelConnection: IModelConnection) => Promise<KeySet>;
25
27
  export declare const clearEmphasizedElements: () => void;
26
28
  export declare const clearEmphasizedOverriddenElements: () => void;
@@ -51,23 +51,6 @@ export const clearIsolatedElements = () => {
51
51
  const emph = EmphasizeElements.getOrCreate(vp);
52
52
  emph.clearIsolatedElements(vp);
53
53
  };
54
- export const hideElementsByQuery = async (query, iModelConnection, replace = false) => {
55
- if (!IModelApp.viewManager.selectedView) {
56
- return [];
57
- }
58
- const vp = IModelApp.viewManager.selectedView;
59
- const keySet = await manufactureKeys(query, iModelConnection);
60
- const hiliteProvider = HiliteSetProvider.create({
61
- imodel: vp.iModel,
62
- });
63
- const set = await hiliteProvider.getHiliteSet(keySet);
64
- if (set.elements) {
65
- const ids = [...set.elements];
66
- hideElements(ids, replace);
67
- return ids;
68
- }
69
- return [];
70
- };
71
54
  export const hideElements = (hilitedIds, replace = false) => {
72
55
  if (!IModelApp.viewManager.selectedView) {
73
56
  return;
@@ -232,7 +215,7 @@ export const zoomToElements = async (elementIds) => {
232
215
  };
233
216
  export const getHiliteIds = async (query, iModelConnection) => {
234
217
  if (!IModelApp.viewManager.selectedView) {
235
- return [];
218
+ return ({ keySet: new KeySet(), ids: [] });
236
219
  }
237
220
  const vp = IModelApp.viewManager.selectedView;
238
221
  const keySet = await manufactureKeys(query, iModelConnection);
@@ -241,9 +224,9 @@ export const getHiliteIds = async (query, iModelConnection) => {
241
224
  });
242
225
  const set = await hiliteProvider.getHiliteSet(keySet);
243
226
  if (set.elements) {
244
- return [...set.elements];
227
+ return { keySet, ids: [...set.elements] };
245
228
  }
246
- return [];
229
+ return ({ keySet: new KeySet(), ids: [] });
247
230
  };
248
231
  export const manufactureKeys = async (query, iModelConnection) => {
249
232
  if (query === "") {