@itwin/grouping-mapping-widget 0.11.1 → 0.13.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 (355) 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/ConfirmMappingsImport.js +1 -1
  14. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  15. package/lib/cjs/widget/components/CustomCalculationAction.d.ts +6 -9
  16. package/lib/cjs/widget/components/CustomCalculationAction.js +79 -9
  17. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  18. package/lib/cjs/widget/components/CustomCalculationTable.d.ts +8 -16
  19. package/lib/cjs/widget/components/CustomCalculationTable.js +22 -29
  20. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  21. package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
  22. package/lib/cjs/widget/components/DeleteModal.js +9 -13
  23. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  24. package/lib/cjs/widget/components/GroupAction.js +51 -66
  25. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  26. package/lib/cjs/widget/components/GroupAction.scss +0 -18
  27. package/lib/cjs/widget/components/GroupDetails.d.ts +13 -0
  28. package/lib/cjs/widget/components/GroupDetails.js +34 -0
  29. package/lib/cjs/widget/components/GroupDetails.js.map +1 -0
  30. package/lib/cjs/widget/components/GroupDetailsActionPanel.d.ts +8 -0
  31. package/lib/cjs/widget/components/GroupDetailsActionPanel.js +19 -0
  32. package/lib/cjs/widget/components/GroupDetailsActionPanel.js.map +1 -0
  33. package/lib/cjs/widget/components/GroupDetailsStep.d.ts +13 -0
  34. package/lib/cjs/widget/components/GroupDetailsStep.js +25 -0
  35. package/lib/cjs/widget/components/GroupDetailsStep.js.map +1 -0
  36. package/lib/cjs/widget/components/GroupDetailsStep.scss +11 -0
  37. package/lib/cjs/widget/components/GroupInformationPanel.d.ts +10 -0
  38. package/lib/cjs/widget/components/GroupInformationPanel.js +23 -0
  39. package/lib/cjs/widget/components/GroupInformationPanel.js.map +1 -0
  40. package/lib/cjs/widget/components/GroupInformationPanel.scss +13 -0
  41. package/lib/cjs/widget/components/GroupPropertyAction.d.ts +6 -9
  42. package/lib/cjs/widget/components/GroupPropertyAction.js +26 -15
  43. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  44. package/lib/cjs/widget/components/GroupPropertyTable.d.ts +8 -15
  45. package/lib/cjs/widget/components/GroupPropertyTable.js +23 -28
  46. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  47. package/lib/cjs/widget/components/Grouping.d.ts +2 -1
  48. package/lib/cjs/widget/components/Grouping.js +13 -17
  49. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  50. package/lib/cjs/widget/components/Grouping.scss +2 -9
  51. package/lib/cjs/widget/components/GroupingMapping.js +1 -2
  52. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  53. package/lib/cjs/widget/components/GroupingMappingContent.js +8 -4
  54. package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
  55. package/lib/cjs/widget/components/GroupingMappingContext.js +17 -1
  56. package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
  57. package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +1 -2
  58. package/lib/cjs/widget/components/GroupingMappingHeader.js +10 -3
  59. package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
  60. package/lib/cjs/widget/components/GroupingMappingRouter.js +23 -2
  61. package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
  62. package/lib/cjs/widget/components/GroupsAddButton.d.ts +9 -0
  63. package/lib/cjs/widget/components/GroupsAddButton.js +17 -0
  64. package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -0
  65. package/lib/cjs/widget/components/GroupsAddButton.scss +7 -0
  66. package/lib/cjs/widget/components/Mapping.js +7 -14
  67. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  68. package/lib/cjs/widget/components/MappingAction.js +1 -1
  69. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  70. package/lib/cjs/widget/components/MappingImportWizardModal.js +1 -1
  71. package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
  72. package/lib/cjs/widget/components/PropertyAction.d.ts +8 -0
  73. package/lib/cjs/widget/components/PropertyAction.js +100 -0
  74. package/lib/cjs/widget/components/PropertyAction.js.map +1 -0
  75. package/lib/cjs/widget/components/PropertyAction.scss +9 -0
  76. package/lib/cjs/widget/components/PropertyMenu.d.ts +12 -17
  77. package/lib/cjs/widget/components/PropertyMenu.js +52 -155
  78. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  79. package/lib/cjs/widget/components/PropertyMenu.scss +4 -28
  80. package/lib/cjs/widget/components/PropertyNameCell.d.ts +11 -0
  81. package/lib/cjs/widget/components/PropertyNameCell.js +15 -0
  82. package/lib/cjs/widget/components/PropertyNameCell.js.map +1 -0
  83. package/lib/cjs/widget/components/PropertyTable.d.ts +18 -0
  84. package/lib/cjs/widget/components/PropertyTable.js +54 -0
  85. package/lib/cjs/widget/components/PropertyTable.js.map +1 -0
  86. package/lib/cjs/widget/components/PropertyTable.scss +11 -0
  87. package/lib/cjs/widget/components/PropertyTableToolbar.d.ts +10 -0
  88. package/lib/cjs/widget/components/PropertyTableToolbar.js +23 -0
  89. package/lib/cjs/widget/components/PropertyTableToolbar.js.map +1 -0
  90. package/lib/cjs/widget/components/PropertyTableToolbar.scss +12 -0
  91. package/lib/cjs/widget/components/QueryBuilder.d.ts +1 -1
  92. package/lib/cjs/widget/components/QueryBuilder.js +4 -4
  93. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  94. package/lib/cjs/widget/components/QueryBuilderActionPanel.d.ts +6 -0
  95. package/lib/cjs/widget/components/QueryBuilderActionPanel.js +17 -0
  96. package/lib/cjs/widget/components/QueryBuilderActionPanel.js.map +1 -0
  97. package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +11 -0
  98. package/lib/cjs/widget/components/QueryBuilderCustomUI.js +27 -0
  99. package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -0
  100. package/lib/cjs/widget/components/QueryBuilderStep.d.ts +16 -0
  101. package/lib/cjs/widget/components/QueryBuilderStep.js +30 -0
  102. package/lib/cjs/widget/components/QueryBuilderStep.js.map +1 -0
  103. package/lib/cjs/widget/components/QueryBuilderStep.scss +18 -0
  104. package/lib/cjs/widget/components/SelectMappings.js +1 -1
  105. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  106. package/lib/cjs/widget/components/StatusIcon.d.ts +15 -0
  107. package/lib/cjs/widget/components/StatusIcon.js +26 -0
  108. package/lib/cjs/widget/components/StatusIcon.js.map +1 -0
  109. package/lib/cjs/widget/components/StatusIcon.scss +26 -0
  110. package/lib/cjs/widget/components/ToggleGroupVisibility.d.ts +9 -0
  111. package/lib/cjs/widget/components/ToggleGroupVisibility.js +16 -0
  112. package/lib/cjs/widget/components/ToggleGroupVisibility.js.map +1 -0
  113. package/lib/cjs/widget/components/ToggleGroupVisibility.scss +9 -0
  114. package/lib/cjs/widget/components/WidgetHeader.d.ts +9 -0
  115. package/lib/cjs/widget/components/WidgetHeader.js +22 -0
  116. package/lib/cjs/widget/components/WidgetHeader.js.map +1 -0
  117. package/lib/cjs/widget/components/WidgetHeader.scss +36 -0
  118. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  119. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  120. package/lib/cjs/widget/components/context/PropertiesContext.d.ts +15 -0
  121. package/lib/cjs/widget/components/context/PropertiesContext.js +43 -0
  122. package/lib/cjs/widget/components/context/PropertiesContext.js.map +1 -0
  123. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
  124. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js +0 -2
  125. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
  126. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
  127. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +51 -32
  128. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
  129. package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
  130. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
  131. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
  132. package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
  133. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +1 -1
  134. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
  135. package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
  136. package/lib/cjs/widget/components/groupsHelpers.d.ts +6 -3
  137. package/lib/cjs/widget/components/groupsHelpers.js +43 -40
  138. package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
  139. package/lib/cjs/widget/components/utils.d.ts +1 -7
  140. package/lib/cjs/widget/components/utils.js +1 -9
  141. package/lib/cjs/widget/components/utils.js.map +1 -1
  142. package/lib/cjs/widget/components/utils.scss +0 -29
  143. package/lib/cjs/widget/components/viewerUtils.d.ts +4 -2
  144. package/lib/cjs/widget/components/viewerUtils.js +4 -22
  145. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  146. package/lib/cjs/widget/hooks/useFetchData.d.ts +3 -5
  147. package/lib/cjs/widget/hooks/useFetchData.js +9 -7
  148. package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
  149. package/lib/esm/grouping-mapping-widget.d.ts +4 -1
  150. package/lib/esm/grouping-mapping-widget.js +3 -0
  151. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  152. package/lib/esm/test/WidgetHeader.test.js +1 -1
  153. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  154. package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +7 -9
  155. package/lib/esm/widget/components/CalculatedPropertyAction.js +50 -27
  156. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  157. package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +9 -16
  158. package/lib/esm/widget/components/CalculatedPropertyTable.js +30 -31
  159. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  160. package/lib/esm/widget/components/CalculatedPropertyTable.scss +9 -0
  161. package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -1
  162. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  163. package/lib/esm/widget/components/CustomCalculationAction.d.ts +6 -9
  164. package/lib/esm/widget/components/CustomCalculationAction.js +79 -11
  165. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  166. package/lib/esm/widget/components/CustomCalculationTable.d.ts +8 -16
  167. package/lib/esm/widget/components/CustomCalculationTable.js +23 -29
  168. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  169. package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
  170. package/lib/esm/widget/components/DeleteModal.js +9 -13
  171. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  172. package/lib/esm/widget/components/GroupAction.js +54 -69
  173. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  174. package/lib/esm/widget/components/GroupAction.scss +0 -18
  175. package/lib/esm/widget/components/GroupDetails.d.ts +13 -0
  176. package/lib/esm/widget/components/GroupDetails.js +27 -0
  177. package/lib/esm/widget/components/GroupDetails.js.map +1 -0
  178. package/lib/esm/widget/components/GroupDetailsActionPanel.d.ts +8 -0
  179. package/lib/esm/widget/components/GroupDetailsActionPanel.js +12 -0
  180. package/lib/esm/widget/components/GroupDetailsActionPanel.js.map +1 -0
  181. package/lib/esm/widget/components/GroupDetailsStep.d.ts +13 -0
  182. package/lib/esm/widget/components/GroupDetailsStep.js +18 -0
  183. package/lib/esm/widget/components/GroupDetailsStep.js.map +1 -0
  184. package/lib/esm/widget/components/GroupDetailsStep.scss +11 -0
  185. package/lib/esm/widget/components/GroupInformationPanel.d.ts +10 -0
  186. package/lib/esm/widget/components/GroupInformationPanel.js +16 -0
  187. package/lib/esm/widget/components/GroupInformationPanel.js.map +1 -0
  188. package/lib/esm/widget/components/GroupInformationPanel.scss +13 -0
  189. package/lib/esm/widget/components/GroupPropertyAction.d.ts +6 -9
  190. package/lib/esm/widget/components/GroupPropertyAction.js +25 -15
  191. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  192. package/lib/esm/widget/components/GroupPropertyTable.d.ts +8 -15
  193. package/lib/esm/widget/components/GroupPropertyTable.js +24 -28
  194. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  195. package/lib/esm/widget/components/Grouping.d.ts +2 -1
  196. package/lib/esm/widget/components/Grouping.js +15 -19
  197. package/lib/esm/widget/components/Grouping.js.map +1 -1
  198. package/lib/esm/widget/components/Grouping.scss +2 -9
  199. package/lib/esm/widget/components/GroupingMapping.js +1 -2
  200. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  201. package/lib/esm/widget/components/GroupingMappingContent.js +9 -5
  202. package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
  203. package/lib/esm/widget/components/GroupingMappingContext.js +17 -1
  204. package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
  205. package/lib/esm/widget/components/GroupingMappingHeader.d.ts +1 -2
  206. package/lib/esm/widget/components/GroupingMappingHeader.js +10 -3
  207. package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
  208. package/lib/esm/widget/components/GroupingMappingRouter.js +23 -2
  209. package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
  210. package/lib/esm/widget/components/GroupsAddButton.d.ts +9 -0
  211. package/lib/esm/widget/components/GroupsAddButton.js +10 -0
  212. package/lib/esm/widget/components/GroupsAddButton.js.map +1 -0
  213. package/lib/esm/widget/components/GroupsAddButton.scss +7 -0
  214. package/lib/esm/widget/components/Mapping.js +7 -14
  215. package/lib/esm/widget/components/Mapping.js.map +1 -1
  216. package/lib/esm/widget/components/MappingAction.js +1 -1
  217. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  218. package/lib/esm/widget/components/MappingImportWizardModal.js +1 -1
  219. package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
  220. package/lib/esm/widget/components/PropertyAction.d.ts +8 -0
  221. package/lib/esm/widget/components/PropertyAction.js +77 -0
  222. package/lib/esm/widget/components/PropertyAction.js.map +1 -0
  223. package/lib/esm/widget/components/PropertyAction.scss +9 -0
  224. package/lib/esm/widget/components/PropertyMenu.d.ts +12 -17
  225. package/lib/esm/widget/components/PropertyMenu.js +54 -154
  226. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  227. package/lib/esm/widget/components/PropertyMenu.scss +4 -28
  228. package/lib/esm/widget/components/PropertyNameCell.d.ts +11 -0
  229. package/lib/esm/widget/components/PropertyNameCell.js +8 -0
  230. package/lib/esm/widget/components/PropertyNameCell.js.map +1 -0
  231. package/lib/esm/widget/components/PropertyTable.d.ts +18 -0
  232. package/lib/esm/widget/components/PropertyTable.js +28 -0
  233. package/lib/esm/widget/components/PropertyTable.js.map +1 -0
  234. package/lib/esm/widget/components/PropertyTable.scss +11 -0
  235. package/lib/esm/widget/components/PropertyTableToolbar.d.ts +10 -0
  236. package/lib/esm/widget/components/PropertyTableToolbar.js +16 -0
  237. package/lib/esm/widget/components/PropertyTableToolbar.js.map +1 -0
  238. package/lib/esm/widget/components/PropertyTableToolbar.scss +12 -0
  239. package/lib/esm/widget/components/QueryBuilder.d.ts +1 -1
  240. package/lib/esm/widget/components/QueryBuilder.js +4 -4
  241. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  242. package/lib/esm/widget/components/QueryBuilderActionPanel.d.ts +6 -0
  243. package/lib/esm/widget/components/QueryBuilderActionPanel.js +10 -0
  244. package/lib/esm/widget/components/QueryBuilderActionPanel.js.map +1 -0
  245. package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +11 -0
  246. package/lib/esm/widget/components/QueryBuilderCustomUI.js +20 -0
  247. package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -0
  248. package/lib/esm/widget/components/QueryBuilderStep.d.ts +16 -0
  249. package/lib/esm/widget/components/QueryBuilderStep.js +23 -0
  250. package/lib/esm/widget/components/QueryBuilderStep.js.map +1 -0
  251. package/lib/esm/widget/components/QueryBuilderStep.scss +18 -0
  252. package/lib/esm/widget/components/SelectMappings.js +1 -1
  253. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  254. package/lib/esm/widget/components/StatusIcon.d.ts +15 -0
  255. package/lib/esm/widget/components/StatusIcon.js +19 -0
  256. package/lib/esm/widget/components/StatusIcon.js.map +1 -0
  257. package/lib/esm/widget/components/StatusIcon.scss +26 -0
  258. package/lib/esm/widget/components/ToggleGroupVisibility.d.ts +9 -0
  259. package/lib/esm/widget/components/ToggleGroupVisibility.js +9 -0
  260. package/lib/esm/widget/components/ToggleGroupVisibility.js.map +1 -0
  261. package/lib/esm/widget/components/ToggleGroupVisibility.scss +9 -0
  262. package/lib/esm/widget/components/WidgetHeader.d.ts +9 -0
  263. package/lib/esm/widget/components/WidgetHeader.js +15 -0
  264. package/lib/esm/widget/components/WidgetHeader.js.map +1 -0
  265. package/lib/esm/widget/components/WidgetHeader.scss +36 -0
  266. package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  267. package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  268. package/lib/esm/widget/components/context/PropertiesContext.d.ts +15 -0
  269. package/lib/esm/widget/components/context/PropertiesContext.js +20 -0
  270. package/lib/esm/widget/components/context/PropertiesContext.js.map +1 -0
  271. package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
  272. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js +0 -2
  273. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
  274. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
  275. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +53 -34
  276. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
  277. package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
  278. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
  279. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
  280. package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
  281. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +2 -2
  282. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
  283. package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
  284. package/lib/esm/widget/components/groupsHelpers.d.ts +6 -3
  285. package/lib/esm/widget/components/groupsHelpers.js +41 -40
  286. package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
  287. package/lib/esm/widget/components/utils.d.ts +1 -7
  288. package/lib/esm/widget/components/utils.js +0 -7
  289. package/lib/esm/widget/components/utils.js.map +1 -1
  290. package/lib/esm/widget/components/utils.scss +0 -29
  291. package/lib/esm/widget/components/viewerUtils.d.ts +4 -2
  292. package/lib/esm/widget/components/viewerUtils.js +3 -20
  293. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  294. package/lib/esm/widget/hooks/useFetchData.d.ts +3 -5
  295. package/lib/esm/widget/hooks/useFetchData.js +9 -7
  296. package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
  297. package/package.json +1 -1
  298. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
  299. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -91
  300. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
  301. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
  302. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -62
  303. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
  304. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +0 -67
  305. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +0 -198
  306. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +0 -1
  307. package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +0 -71
  308. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
  309. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +0 -77
  310. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
  311. package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +0 -69
  312. package/lib/cjs/widget/components/property-grid/PropertyList.js +0 -87
  313. package/lib/cjs/widget/components/property-grid/PropertyList.js.map +0 -1
  314. package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +0 -92
  315. package/lib/cjs/widget/components/property-grid/PropertyRender.js +0 -109
  316. package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +0 -1
  317. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +0 -22
  318. package/lib/cjs/widget/components/property-grid/PropertyView.js +0 -232
  319. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +0 -1
  320. package/lib/cjs/widget/components/property-grid/PropertyView.scss +0 -77
  321. package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +0 -8
  322. package/lib/cjs/widget/components/property-grid/countMatchesInString.js +0 -32
  323. package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +0 -1
  324. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
  325. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +0 -65
  326. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
  327. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
  328. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -68
  329. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
  330. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
  331. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -39
  332. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
  333. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +0 -67
  334. package/lib/esm/widget/components/property-grid/PropertyGrid.js +0 -172
  335. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +0 -1
  336. package/lib/esm/widget/components/property-grid/PropertyGrid.scss +0 -71
  337. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
  338. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +0 -54
  339. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
  340. package/lib/esm/widget/components/property-grid/PropertyList.d.ts +0 -69
  341. package/lib/esm/widget/components/property-grid/PropertyList.js +0 -60
  342. package/lib/esm/widget/components/property-grid/PropertyList.js.map +0 -1
  343. package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +0 -92
  344. package/lib/esm/widget/components/property-grid/PropertyRender.js +0 -86
  345. package/lib/esm/widget/components/property-grid/PropertyRender.js.map +0 -1
  346. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +0 -22
  347. package/lib/esm/widget/components/property-grid/PropertyView.js +0 -209
  348. package/lib/esm/widget/components/property-grid/PropertyView.js.map +0 -1
  349. package/lib/esm/widget/components/property-grid/PropertyView.scss +0 -77
  350. package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +0 -8
  351. package/lib/esm/widget/components/property-grid/countMatchesInString.js +0 -28
  352. package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +0 -1
  353. package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
  354. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +0 -42
  355. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGridWrapperContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/PropertyGridWrapperContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAoB;IAC/E,mBAAmB,EAAE,EAAE;IACvB,sBAAsB,EAAE,GAAG,EAAE,CAAC,EAAE;IAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;IAChC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK,IAAI,EAAE,GAAG,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAsB,EAAE;IAC5D,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { QueryBuilder } from \"../QueryBuilder\";\n\nexport interface PropertySelection {\n currentPropertyList: PropertyRecord[];\n setCurrentPropertyList: (value: PropertyRecord[]) => void;\n setQuery: (value: string) => void;\n queryBuilder?: QueryBuilder;\n setQueryBuilder: (value: QueryBuilder | undefined) => void;\n isUpdating: boolean;\n resetView: () => Promise<void>;\n}\n\nexport const PropertyGridWrapperContext = React.createContext<PropertySelection>({\n currentPropertyList: [],\n setCurrentPropertyList: () => [],\n setQuery: () => \"\",\n setQueryBuilder: () => undefined,\n isUpdating: false,\n resetView: async () => { },\n});\n\nexport const usePropertyGridWrapper = (): PropertySelection => {\n const context = React.useContext(PropertyGridWrapperContext);\n if (!context) {\n throw new Error(\n \"usePropertyGridWrapperContext should be used within a PropertyGridWrapperContext provider\"\n );\n }\n return context;\n};\n"]}
1
+ {"version":3,"file":"PropertyGridWrapperContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/PropertyGridWrapperContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAoB;IAC/E,mBAAmB,EAAE,EAAE;IACvB,sBAAsB,EAAE,GAAG,EAAE,CAAC,EAAE;IAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE;IAClB,UAAU,EAAE,KAAK;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAsB,EAAE;IAC5D,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { QueryBuilder } from \"../QueryBuilder\";\n\nexport interface PropertySelection {\n currentPropertyList: PropertyRecord[];\n setCurrentPropertyList: (value: PropertyRecord[] | ((value: PropertyRecord[]) => PropertyRecord[])) => void;\n setQuery: (value: string) => void;\n queryBuilder?: QueryBuilder;\n isUpdating: boolean;\n}\n\nexport const PropertyGridWrapperContext = React.createContext<PropertySelection>({\n currentPropertyList: [],\n setCurrentPropertyList: () => [],\n setQuery: () => \"\",\n isUpdating: false,\n});\n\nexport const usePropertyGridWrapper = (): PropertySelection => {\n const context = React.useContext(PropertyGridWrapperContext);\n if (!context) {\n throw new Error(\n \"usePropertyGridWrapperContext should be used within a PropertyGridWrapperContext provider\"\n );\n }\n return context;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import "./GroupQueryBuilderCustomUI.scss";
3
3
  import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
4
- export declare const GroupQueryBuilderCustomUI: ({ isUpdating, resetView, updateQuery }: GroupingCustomUIProps) => JSX.Element;
4
+ export declare const GroupQueryBuilderCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
5
5
  //# sourceMappingURL=GroupQueryBuilderCustomUI.d.ts.map
@@ -2,58 +2,77 @@
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 React, { useEffect, useState } from "react";
5
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
6
6
  import { useActiveIModelConnection } from "@itwin/appui-react";
7
7
  import { Presentation } from "@itwin/presentation-frontend";
8
8
  import { KeySet } from "@itwin/presentation-common";
9
- import { PropertyGridWrapper } from "../property-grid/PropertyGridWrapper";
10
- import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
11
- import { Button } from "@itwin/itwinui-react";
12
9
  import "./GroupQueryBuilderCustomUI.scss";
13
- export const GroupQueryBuilderCustomUI = ({ isUpdating, resetView, updateQuery }) => {
10
+ import { QueryBuilder } from "../QueryBuilder";
11
+ import { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider, } from "@itwin/presentation-components";
12
+ import { VirtualizedPropertyGridWithDataProvider } from "@itwin/components-react";
13
+ import { ResizableContainerObserver } from "@itwin/core-react";
14
+ import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
15
+ import { PropertyAction } from "../PropertyAction";
16
+ import { Alert, Button } from "@itwin/itwinui-react";
17
+ const createPropertyDataProvider = (keys, iModelConnection) => {
18
+ const dataProvider = new PresentationPropertyDataProvider({
19
+ imodel: iModelConnection,
20
+ ruleset: DEFAULT_PROPERTY_GRID_RULESET,
21
+ });
22
+ dataProvider.keys = keys;
23
+ dataProvider.isNestedPropertyCategoryGroupingEnabled = true;
24
+ return dataProvider;
25
+ };
26
+ export const GroupQueryBuilderCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
14
27
  const iModelConnection = useActiveIModelConnection();
15
- const [keysState, setKeysState] = useState(new KeySet());
16
- const [selected, setSelected] = useState(false);
17
- const [queryBuilder, setQueryBuilder] = useState();
28
+ if (!iModelConnection) {
29
+ throw new Error("This component requires an active iModelConnection.");
30
+ }
31
+ const [size, setSize] = useState({ width: 0, height: 0 });
32
+ const [dataProvider, setDataProvider] = useState(undefined);
18
33
  const [currentPropertyList, setCurrentPropertyList] = useState([]);
34
+ const [selectionKeySet, setSelectionKeyset] = useState(new KeySet());
35
+ const [queryBuilder, setQueryBuilder] = useState();
19
36
  useEffect(() => {
20
- if (!iModelConnection) {
21
- throw new Error("This component requires an active iModelConnection.");
22
- }
23
- }, [iModelConnection]);
24
- useEffect(() => {
25
- const _onSelectionChanged = async (evt, selectionProvider) => {
26
- setSelected(true);
27
- setCurrentPropertyList([]);
37
+ const onSelectionChanged = async (evt, selectionProvider) => {
28
38
  const selection = selectionProvider.getSelection(evt.imodel, evt.level);
29
39
  const keys = new KeySet(selection);
30
- setKeysState(keys);
40
+ setSelectionKeyset(keys);
41
+ const dataProvider = createPropertyDataProvider(keys, iModelConnection);
42
+ setDataProvider(dataProvider);
43
+ setQueryBuilder(new QueryBuilder(dataProvider));
31
44
  };
32
45
  return iModelConnection
33
- ? Presentation.selection.selectionChange.addListener(_onSelectionChanged) :
34
- () => { };
46
+ ? Presentation.selection.selectionChange.addListener(onSelectionChanged)
47
+ : () => { };
35
48
  }, [iModelConnection]);
36
- const _onClickResetButton = async () => {
49
+ const onClickResetButton = async () => {
50
+ queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.resetQueryBuilder();
37
51
  updateQuery("");
38
- queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.resetQuery();
39
52
  setCurrentPropertyList([]);
40
53
  if (resetView)
41
54
  await resetView().catch((e) =>
42
55
  /* eslint-disable no-console */
43
56
  console.error(e));
44
57
  };
45
- return (React.createElement("div", { className: "gmw-find-similar-container" },
46
- React.createElement(PropertyGridWrapperContext.Provider, { value: {
47
- currentPropertyList,
48
- setCurrentPropertyList,
49
- queryBuilder,
50
- setQueryBuilder,
51
- resetView: resetView !== null && resetView !== void 0 ? resetView : (async () => { }),
52
- setQuery: updateQuery,
53
- isUpdating: isUpdating !== null && isUpdating !== void 0 ? isUpdating : false,
54
- } },
55
- React.createElement(PropertyGridWrapper, { keys: keysState, imodel: iModelConnection })),
56
- selected && (React.createElement("div", { className: "gmw-button-container" },
57
- React.createElement(Button, { styleType: "default", size: "small", className: "gmw-reset-button", onClick: _onClickResetButton }, "Reset")))));
58
+ const resize = useCallback((width, height) => setSize({ width, height }), []);
59
+ const propertyContextValues = useMemo(() => ({
60
+ currentPropertyList,
61
+ setCurrentPropertyList,
62
+ queryBuilder,
63
+ setQuery: updateQuery,
64
+ isUpdating: isUpdating !== null && isUpdating !== void 0 ? isUpdating : false,
65
+ }), [currentPropertyList, isUpdating, queryBuilder, updateQuery]);
66
+ const actionButtonRenderers = useMemo(() => [
67
+ ({ property }) => (React.createElement(PropertyAction, { property: property })),
68
+ ], []);
69
+ return (React.createElement("div", { className: "gmw-select-query-generator-container" }, !dataProvider || selectionKeySet.size === 0 ? (React.createElement(Alert, { type: 'informational' }, "Please select on an element within the viewer first, then select properties to generate a group query.")) :
70
+ React.createElement(React.Fragment, null,
71
+ React.createElement("div", { className: "gmw-select-property-grid-container" },
72
+ React.createElement(ResizableContainerObserver, { onResize: resize }),
73
+ React.createElement(PropertyGridWrapperContext.Provider, { value: propertyContextValues },
74
+ React.createElement(VirtualizedPropertyGridWithDataProvider, { dataProvider: dataProvider, width: size.width, height: size.height, actionButtonRenderers: actionButtonRenderers }))),
75
+ React.createElement("div", { className: "gmw-select-reset-button" },
76
+ React.createElement(Button, { styleType: "default", size: "small", onClick: onClickResetButton }, "Reset")))));
58
77
  };
59
78
  //# sourceMappingURL=GroupQueryBuilderCustomUI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupQueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupQueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3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eAAe,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC;YAC3E,GAAG,EAAE,GAAG,CAAC,CAAC;IACd,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,MAAM,mBAAmB,GAAG,KAAK,IAAI,EAAE;QACrC,WAAW,CAAC,EAAE,CAAC,CAAC;QAChB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,UAAU,EAAE,CAAC;QAC3B,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC3B,IAAI,SAAS;YACX,MAAM,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,+BAA+B;YAC/B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CACjB,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,4BAA4B;QACzC,oBAAC,0BAA0B,CAAC,QAAQ,IAClC,KAAK,EAAE;gBACL,mBAAmB;gBACnB,sBAAsB;gBACtB,YAAY;gBACZ,eAAe;gBACf,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,CAAC,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC;gBACzC,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK;aAChC;YACD,oBAAC,mBAAmB,IAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,GAAI,CAC9B;QAEpC,QAAQ,IAAI,CACV,6BAAK,SAAS,EAAC,sBAAsB;YACnC,oBAAC,MAAM,IACL,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,kBAAkB,EAC5B,OAAO,EAAE,mBAAmB,YAGrB,CACL,CACP,CAEE,CACR,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 React, { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport type { ISelectionProvider, SelectionChangeEventArgs } from \"@itwin/presentation-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { PropertyGridWrapper } from \"../property-grid/PropertyGridWrapper\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport \"./GroupQueryBuilderCustomUI.scss\";\nimport type { QueryBuilder } from \"../QueryBuilder\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const GroupQueryBuilderCustomUI = ({ isUpdating, resetView, updateQuery }: GroupingCustomUIProps) => {\n const iModelConnection = useActiveIModelConnection();\n\n const [keysState, setKeysState] = useState<KeySet>(new KeySet());\n const [selected, setSelected] = useState<boolean>(false);\n\n const [queryBuilder, setQueryBuilder] = useState<QueryBuilder | undefined>();\n const [currentPropertyList, setCurrentPropertyList] = useState<PropertyRecord[]>([]);\n\n useEffect(() => {\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n }, [iModelConnection]);\n\n useEffect(() => {\n const _onSelectionChanged = async (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider\n ) => {\n setSelected(true);\n setCurrentPropertyList([]);\n\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n const keys = new KeySet(selection);\n setKeysState(keys);\n };\n\n return iModelConnection\n ? Presentation.selection.selectionChange.addListener(_onSelectionChanged) :\n () => { };\n }, [iModelConnection]);\n\n const _onClickResetButton = async () => {\n updateQuery(\"\");\n queryBuilder?.resetQuery();\n setCurrentPropertyList([]);\n if (resetView)\n await resetView().catch((e) =>\n /* eslint-disable no-console */\n console.error(e)\n );\n };\n\n return (\n <div className=\"gmw-find-similar-container\">\n <PropertyGridWrapperContext.Provider\n value={{\n currentPropertyList,\n setCurrentPropertyList,\n queryBuilder,\n setQueryBuilder,\n resetView: resetView ?? (async () => { }),\n setQuery: updateQuery,\n isUpdating: isUpdating ?? false,\n }}>\n <PropertyGridWrapper keys={keysState} imodel={iModelConnection} />\n </PropertyGridWrapperContext.Provider>\n {\n selected && (\n <div className=\"gmw-button-container\">\n <Button\n styleType=\"default\"\n size=\"small\"\n className=\"gmw-reset-button\"\n onClick={_onClickResetButton}\n >\n Reset\n </Button>\n </div>\n )\n }\n </div >\n );\n};\n"]}
1
+ {"version":3,"file":"GroupQueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupQueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,0BAA0B,GAAG,CACjC,IAAY,EACZ,gBAAkC,EACA,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AAE,CAAC;QACJ,CAAC,EAAE,QAAQ,EAA6B,EAAE,EAAE,CAAC,CAC3C,oBAAC,cAAc,IAAC,QAAQ,EAAE,QAAQ,GAAI,CACvC;KACF,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,sCAAsC,IAClD,CAAC,YAAY,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAC7C,oBAAC,KAAK,IAAC,IAAI,EAAC,eAAe,6GAEnB,CACT,CAAC,CAAC;QACD;YACE,6BAAK,SAAS,EAAC,oCAAoC;gBACjD,oBAAC,0BAA0B,IAAC,QAAQ,EAAE,MAAM,GAAI;gBAChD,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,qBAAqB;oBAC/D,oBAAC,uCAAuC,IACtC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,qBAAqB,EAAE,qBAAqB,GAC5C,CACkC,CAClC;YACN,6BAAK,SAAS,EAAC,yBAAyB;gBACtC,oBAAC,MAAM,IACL,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,kBAAkB,YAGpB,CACL,CACL,CAED,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 React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport type {\n ISelectionProvider,\n SelectionChangeEventArgs,\n} from \"@itwin/presentation-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport \"./GroupQueryBuilderCustomUI.scss\";\nimport { QueryBuilder } from \"../QueryBuilder\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\nimport {\n DEFAULT_PROPERTY_GRID_RULESET,\n PresentationPropertyDataProvider,\n} from \"@itwin/presentation-components\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ActionButtonRendererProps } from \"@itwin/components-react\";\nimport { VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { ResizableContainerObserver } from \"@itwin/core-react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { PropertyAction } from \"../PropertyAction\";\nimport { Alert, Button } from \"@itwin/itwinui-react\";\n\nconst createPropertyDataProvider = (\n keys: KeySet,\n iModelConnection: IModelConnection\n): PresentationPropertyDataProvider => {\n const dataProvider = new PresentationPropertyDataProvider({\n imodel: iModelConnection,\n ruleset: DEFAULT_PROPERTY_GRID_RULESET,\n });\n dataProvider.keys = keys;\n dataProvider.isNestedPropertyCategoryGroupingEnabled = true;\n return dataProvider;\n};\n\ninterface ContainerDimensions {\n width: number;\n height: number;\n}\n\nexport const GroupQueryBuilderCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const iModelConnection = useActiveIModelConnection();\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n const [size, setSize] = useState<ContainerDimensions>({ width: 0, height: 0 });\n const [dataProvider, setDataProvider] =\n useState<PresentationPropertyDataProvider | undefined>(undefined);\n const [currentPropertyList, setCurrentPropertyList] = useState<PropertyRecord[]>([]);\n const [selectionKeySet, setSelectionKeyset] = useState<KeySet>(new KeySet());\n const [queryBuilder, setQueryBuilder] = useState<QueryBuilder | undefined>();\n\n useEffect(() => {\n const onSelectionChanged = async (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider\n ) => {\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n const keys = new KeySet(selection);\n setSelectionKeyset(keys);\n const dataProvider = createPropertyDataProvider(keys, iModelConnection);\n setDataProvider(dataProvider);\n setQueryBuilder(new QueryBuilder(dataProvider));\n };\n\n return iModelConnection\n ? Presentation.selection.selectionChange.addListener(onSelectionChanged)\n : () => { };\n }, [iModelConnection]);\n\n const onClickResetButton = async () => {\n queryBuilder?.resetQueryBuilder();\n updateQuery(\"\");\n setCurrentPropertyList([]);\n if (resetView)\n await resetView().catch((e) =>\n /* eslint-disable no-console */\n console.error(e)\n );\n };\n\n const resize = useCallback((width, height) => setSize({ width, height }), []);\n\n const propertyContextValues = useMemo(\n () => ({\n currentPropertyList,\n setCurrentPropertyList,\n queryBuilder,\n setQuery: updateQuery,\n isUpdating: isUpdating ?? false,\n }),\n [currentPropertyList, isUpdating, queryBuilder, updateQuery]\n );\n\n const actionButtonRenderers = useMemo(\n () => [\n ({ property }: ActionButtonRendererProps) => (\n <PropertyAction property={property} />\n ),\n ],\n []\n );\n\n return (\n <div className=\"gmw-select-query-generator-container\">\n {!dataProvider || selectionKeySet.size === 0 ? (\n <Alert type='informational'>\n Please select on an element within the viewer first, then select properties to generate a group query.\n </Alert>\n ) :\n <>\n <div className=\"gmw-select-property-grid-container\">\n <ResizableContainerObserver onResize={resize} />\n <PropertyGridWrapperContext.Provider value={propertyContextValues}>\n <VirtualizedPropertyGridWithDataProvider\n dataProvider={dataProvider}\n width={size.width}\n height={size.height}\n actionButtonRenderers={actionButtonRenderers}\n />\n </PropertyGridWrapperContext.Provider>\n </div>\n <div className=\"gmw-select-reset-button\">\n <Button\n styleType=\"default\"\n size=\"small\"\n onClick={onClickResetButton}\n >\n Reset\n </Button>\n </div>\n </>\n }\n </div>\n );\n};\n\n"]}
@@ -2,23 +2,31 @@
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 '~@itwin/itwinui-css/scss/variables';
5
+ @import "~@itwin/itwinui-css/scss/variables";
6
6
 
7
- .gmw-find-similar-container {
8
- color: var(--buic-foreground-body);
9
- }
10
-
11
- .gmw-button-container {
12
- text-align: right;
13
- }
14
-
15
- .gmw-reset-button {
16
- margin-left: 10px;
17
- }
18
-
19
- .gmw-select-element-hint {
7
+ .gmw-select-query-generator-container {
20
8
  display: flex;
21
- height: 300px;
22
- justify-content: center;
23
- align-items: center;
9
+ flex-grow: 1;
10
+ flex-direction: column;
11
+ min-height: 0;
12
+ overflow: auto;
13
+ .gmw-select-element-hint {
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ flex-grow: 1;
18
+ }
19
+ .gmw-select-property-grid-container {
20
+ display: flex;
21
+ flex: 1 1;
22
+ min-width: 0;
23
+ min-height: 0;
24
+ justify-content: center;
25
+ align-items: center;
26
+ }
27
+ .gmw-select-reset-button {
28
+ display: flex;
29
+ justify-content: right;
30
+ margin-top: $iui-baseline;
31
+ }
24
32
  }
@@ -3,13 +3,13 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
- import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
6
+ import { Alert, Button, LabeledTextarea } from "@itwin/itwinui-react";
7
7
  import { LoadingSpinner } from "../utils";
8
8
  import "./ManualGroupingCustomUI.scss";
9
9
  export const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
10
10
  const [manualInput, setManualInput] = React.useState("");
11
11
  return (React.createElement("div", { className: 'gmw-manual-form' },
12
- React.createElement(Text, null, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
12
+ React.createElement(Alert, { type: 'informational' }, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
13
13
  React.createElement(LabeledTextarea, { label: 'Query', required: true, value: manualInput, onChange: (event) => setManualInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement"` }),
14
14
  React.createElement("div", { className: 'gmw-manual-actions' },
15
15
  isUpdating && React.createElement(LoadingSpinner, null),
@@ -1 +1 @@
1
- {"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,IAAI,8GAEE;QACP,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,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 React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(\"\");\n\n return (\n <div className='gmw-manual-form'>\n <Text>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Text>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,KAAK,IAAC,IAAI,EAAC,eAAe,0GAEnB;QACR,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,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 React from \"react\";\nimport { Alert, Button, LabeledTextarea } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nexport const ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(\"\");\n\n return (\n <div className='gmw-manual-form'>\n <Alert type='informational'>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Alert>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n"]}
@@ -8,6 +8,7 @@
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  gap: $iui-baseline;
11
+ overflow: auto;
11
12
  margin-top: $iui-baseline;
12
13
  > .gmw-manual-actions {
13
14
  display: flex;
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
- import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
6
+ import { Alert, Button, LabeledTextarea } from "@itwin/itwinui-react";
7
7
  import { LoadingSpinner } from "../utils";
8
8
  import "./SearchGroupingCustomUI.scss";
9
9
  export const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
@@ -70,7 +70,7 @@ export const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, })
70
70
  updateQuery(generatedSearchQuery);
71
71
  };
72
72
  return (React.createElement("div", { className: 'gmw-search-form' },
73
- React.createElement(Text, null, "Generate a query by keywords. Keywords wrapped in double quotes will be considered a required criteria."),
73
+ React.createElement(Alert, { type: 'informational' }, "Generate a query by keywords. Keywords wrapped in double quotes will be considered a required criteria."),
74
74
  React.createElement(LabeledTextarea, { label: 'Query Keywords', required: true, value: searchInput, onChange: (event) => setSearchInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "red" chair` }),
75
75
  React.createElement("div", { className: 'gmw-search-actions' },
76
76
  isUpdating && React.createElement(LoadingSpinner, null),
@@ -1 +1 @@
1
- {"version":3,"file":"SearchGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/SearchGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEF,MAAM,gBAAgB,GAAG,CACvB,KAAa,EACb,KAAa,EACb,WAAqB,EACrB,EAAE,CACF,iBAAiB,CAAC,KAAK,CAAC;QACxB,CAAC,KAAK,KAAK,CAAC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,MAAM,mBAAmB,GAAG,CAAC,WAAqB,EAAE,EAAE;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;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O,CAAC,gBAAgB,EAAE,EAAE,CAAC;yBAC7B,IAAI,EAAE;yBACN,KAAK,CAAC,GAAG,CAAC;oBACb,CAAC,CAAC,EAAE,CACP,YAII;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,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 React from \"react\";\nimport { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./SearchGroupingCustomUI.scss\";\n\nexport const SearchGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [searchInput, setSearchInput] = React.useState(\"\");\n const isWrappedInQuotes = (text: string) => {\n return text.startsWith(`\"`) && text.endsWith(`\"`);\n };\n\n const needsAndOperator = (\n token: string,\n index: number,\n searchQuery: string[],\n ) =>\n isWrappedInQuotes(token) ||\n (index === 1 && isWrappedInQuotes(searchQuery[0]));\n\n const generateSearchQuery = (searchQuery: string[]) => {\n if (searchQuery.length === 0) {\n updateQuery(\"\");\n return;\n }\n\n let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;\n generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;\n generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;\n generatedSearchQuery += ` WHERE `;\n generatedSearchQuery += `((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})`;\n // Physical Types\n generatedSearchQuery += ` OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) `;\n\n updateQuery(generatedSearchQuery);\n };\n\n return (\n <div className='gmw-search-form'>\n <Text>\n Generate a query by keywords. Keywords wrapped in double quotes will be\n considered a required criteria.\n </Text>\n <LabeledTextarea\n label='Query Keywords'\n required\n value={searchInput}\n onChange={(event) => setSearchInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"red\" chair`}\n />\n <div className='gmw-search-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button\n disabled={isUpdating}\n onClick={() =>\n generateSearchQuery(\n searchInput\n ? searchInput\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n .trim()\n .split(\" \")\n : [],\n )\n }\n >\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setSearchInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\n"]}
1
+ {"version":3,"file":"SearchGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/SearchGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC,G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AgB,EACtB,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,kBAAkB,GAC/B;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,GAAG,EAAE,CACZ,mBAAmB,CACjB,WAAW;oBACT,CAAC,CAAC,WAAW;yBACV,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;yBAC7B,IAAI,EAAE;yBACN,KAAK,CAAC,GAAG,CAAC;oBACb,CAAC,CAAC,EAAE,CACP,YAII;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,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 React from \"react\";\nimport { Alert, Button, LabeledTextarea } from \"@itwin/itwinui-react\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./SearchGroupingCustomUI.scss\";\n\nexport const SearchGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [searchInput, setSearchInput] = React.useState(\"\");\n const isWrappedInQuotes = (text: string) => {\n return text.startsWith(`\"`) && text.endsWith(`\"`);\n };\n\n const needsAndOperator = (\n token: string,\n index: number,\n searchQuery: string[],\n ) =>\n isWrappedInQuotes(token) ||\n (index === 1 && isWrappedInQuotes(searchQuery[0]));\n\n const generateSearchQuery = (searchQuery: string[]) => {\n if (searchQuery.length === 0) {\n updateQuery(\"\");\n return;\n }\n\n let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;\n generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;\n generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;\n generatedSearchQuery += ` WHERE `;\n generatedSearchQuery += `((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})`;\n // Physical Types\n generatedSearchQuery += ` OR ((${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")}) OR (${searchQuery\n .map(\n (token, index) =>\n `${index === 0\n ? \"\"\n : needsAndOperator(token, index, searchQuery)\n ? \"AND\"\n : \"OR\"\n } pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token\n }%'`,\n )\n .join(\" \")})) `;\n\n updateQuery(generatedSearchQuery);\n };\n\n return (\n <div className='gmw-search-form'>\n <Alert type='informational'>\n Generate a query by keywords. Keywords wrapped in double quotes will be\n considered a required criteria.\n </Alert>\n <LabeledTextarea\n label='Query Keywords'\n required\n value={searchInput}\n onChange={(event) => setSearchInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"red\" chair`}\n />\n <div className='gmw-search-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button\n disabled={isUpdating}\n onClick={() =>\n generateSearchQuery(\n searchInput\n ? searchInput\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n .trim()\n .split(\" \")\n : [],\n )\n }\n >\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setSearchInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\n"]}
@@ -8,6 +8,7 @@
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
  gap: $iui-baseline;
11
+ overflow: auto;
11
12
  margin-top: $iui-baseline;
12
13
  > .gmw-search-actions {
13
14
  display: flex;
@@ -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,cAAc,EAAE,MAAM,eAAe,CAAC;AAExK,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,yBAAwE,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B,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;AA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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,13 +1,7 @@
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
- export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: React.Dispatch<React.SetStateAction<T>>) => void;
4
+ export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: (newValues: T) => void) => void;
11
5
  export declare const fetchIdsFromQuery: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
12
6
  export declare const handleError: (errorStatus: number) => void;
13
7
  export declare const LoadingOverlay: () => JSX.Element;
@@ -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,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,KAAK,EACpC,KAAa,EACb,gBAAkC,EAClC,EAAE;IACF,IAAI,KA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D,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 { 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,SAAiC,EACjC,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,KAAK,EACpC,KAAa,EACb,gBAAkC,EAClC,EAAE;IACF,IAAI,KAAK,KAAK,EAAE,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE;QAC3D,SAAS,EAAE,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zC,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: (newValues: T) => void,\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"]}