@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
@@ -10,7 +10,10 @@ export { MappingAction, MappingActionProps } from "./widget/components/MappingAc
10
10
  export { GroupingMappingContext, GroupingMappingContextProps } from "./widget/components/GroupingMappingContext";
11
11
  export { Groupings, GroupingProps } from "./widget/components/Grouping";
12
12
  export { GroupAction, GroupActionProps } from "./widget/components/GroupAction";
13
- export { PropertyMenu } from "./widget/components/PropertyMenu";
13
+ export { PropertyMenu, PropertyMenuProps } from "./widget/components/PropertyMenu";
14
+ export { GroupPropertyAction, GroupPropertyActionProps } from "./widget/components/GroupPropertyAction";
15
+ export { CalculatedPropertyAction, CalculatedPropertyActionProps } from "./widget/components/CalculatedPropertyAction";
16
+ export { CustomCalculationAction, CustomCalculationActionProps } from "./widget/components/CustomCalculationAction";
14
17
  export { SearchGroupingCustomUI } from "./widget/components/customUI/SearchGroupingCustomUI";
15
18
  export { ManualGroupingCustomUI } from "./widget/components/customUI/ManualGroupingCustomUI";
16
19
  export { GroupQueryBuilderCustomUI } from "./widget/components/customUI/GroupQueryBuilderCustomUI";
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.resolveFormulaDataType = exports.GroupingMappingCustomUIType = exports.GroupQueryBuilderCustomUI = exports.ManualGroupingCustomUI = exports.SearchGroupingCustomUI = exports.PropertyMenu = exports.GroupAction = exports.Groupings = exports.GroupingMappingContext = exports.MappingAction = exports.Mappings = exports.useGroupingMappingApiConfig = exports.GroupingMappingApiConfigContext = exports.useMappingClient = exports.MappingClientContext = exports.createMappingClient = exports.createDefaultMappingClient = void 0;
13
+ exports.resolveFormulaDataType = exports.GroupingMappingCustomUIType = exports.GroupQueryBuilderCustomUI = exports.ManualGroupingCustomUI = exports.SearchGroupingCustomUI = exports.CustomCalculationAction = exports.CalculatedPropertyAction = exports.GroupPropertyAction = exports.PropertyMenu = exports.GroupAction = exports.Groupings = exports.GroupingMappingContext = exports.MappingAction = exports.Mappings = exports.useGroupingMappingApiConfig = exports.GroupingMappingApiConfigContext = exports.useMappingClient = exports.MappingClientContext = exports.createMappingClient = exports.createDefaultMappingClient = void 0;
14
14
  /*---------------------------------------------------------------------------------------------
15
15
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
16
16
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -40,6 +40,12 @@ var GroupAction_1 = require("./widget/components/GroupAction");
40
40
  Object.defineProperty(exports, "GroupAction", { enumerable: true, get: function () { return GroupAction_1.GroupAction; } });
41
41
  var PropertyMenu_1 = require("./widget/components/PropertyMenu");
42
42
  Object.defineProperty(exports, "PropertyMenu", { enumerable: true, get: function () { return PropertyMenu_1.PropertyMenu; } });
43
+ var GroupPropertyAction_1 = require("./widget/components/GroupPropertyAction");
44
+ Object.defineProperty(exports, "GroupPropertyAction", { enumerable: true, get: function () { return GroupPropertyAction_1.GroupPropertyAction; } });
45
+ var CalculatedPropertyAction_1 = require("./widget/components/CalculatedPropertyAction");
46
+ Object.defineProperty(exports, "CalculatedPropertyAction", { enumerable: true, get: function () { return CalculatedPropertyAction_1.CalculatedPropertyAction; } });
47
+ var CustomCalculationAction_1 = require("./widget/components/CustomCalculationAction");
48
+ Object.defineProperty(exports, "CustomCalculationAction", { enumerable: true, get: function () { return CustomCalculationAction_1.CustomCalculationAction; } });
43
49
  var SearchGroupingCustomUI_1 = require("./widget/components/customUI/SearchGroupingCustomUI");
44
50
  Object.defineProperty(exports, "SearchGroupingCustomUI", { enumerable: true, get: function () { return SearchGroupingCustomUI_1.SearchGroupingCustomUI; } });
45
51
  var ManualGroupingCustomUI_1 = require("./widget/components/customUI/ManualGroupingCustomUI");
@@ -1 +1 @@
1
- {"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,0EAA0E;AAC1E,yFAA2J;AAAlJ,kIAAA,0BAA0B,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAAE,wHAAA,gBAAgB,OAAA;AAChG,iGAA8L;AAA3H,2IAAA,+BAA+B,OAAA;AAAE,uIAAA,2BAA2B,OAAA;AAC/H,yDAAuC;AAEvC,yCAAyC;AACzC,uDAAsE;AAA7D,mGAAA,QAAQ,OAAA;AACjB,mEAAsF;AAA7E,8GAAA,aAAa,OAAA;AACtB,qFAAiH;AAAxG,gIAAA,sBAAsB,OAAA;AAC/B,yDAAwE;AAA/D,qGAAA,SAAS,OAAA;AAClB,+DAAgF;AAAvE,0GAAA,WAAW,OAAA;AACpB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,oGAAmG;AAA1F,sIAAA,yBAAyB,OAAA;AAClC,gGAA4M;AAA1K,sIAAA,2BAA2B,OAAA;AAE7D,gCAAgC;AAChC,6EAA2E;AAAlE,iIAAA,sBAAsB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./widget/GroupingMappingWidget\";\n\n/** Interfaces for providing custom MappingClient and API configuration */\nexport { createDefaultMappingClient, createMappingClient, MappingClientContext, useMappingClient } from \"./widget/components/context/MappingClientContext\";\nexport { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig, GroupingMappingApiConfigContext, useGroupingMappingApiConfig } from \"./widget/components/context/GroupingApiConfigContext\";\nexport * from \"@itwin/insights-client\";\n\n/** Internal components for custom UIs */\nexport { Mappings, MappingsProps } from \"./widget/components/Mapping\";\nexport { MappingAction, MappingActionProps } from \"./widget/components/MappingAction\";\nexport { GroupingMappingContext, GroupingMappingContextProps } from \"./widget/components/GroupingMappingContext\";\nexport { Groupings, GroupingProps } from \"./widget/components/Grouping\";\nexport { GroupAction, GroupActionProps } from \"./widget/components/GroupAction\";\nexport { PropertyMenu } from \"./widget/components/PropertyMenu\";\nexport { SearchGroupingCustomUI } from \"./widget/components/customUI/SearchGroupingCustomUI\";\nexport { ManualGroupingCustomUI } from \"./widget/components/customUI/ManualGroupingCustomUI\";\nexport { GroupQueryBuilderCustomUI } from \"./widget/components/customUI/GroupQueryBuilderCustomUI\";\nexport { GroupingMappingCustomUI, GroupingMappingCustomUIType, ContextCustomUI, GroupingCustomUI, GroupingCustomUIProps, ContextCustomUIProps } from \"./widget/components/customUI/GroupingMappingCustomUI\";\n\n/** Formula DataType resolver */\nexport { resolveFormulaDataType } from \"./formula/FormulaDataTypeResolver\";\nexport { DataType, PropertyMap } from \"./formula/Types\";\nexport { IResult } from \"./formula/IResult\";\n"]}
1
+ {"version":3,"file":"grouping-mapping-widget.js","sourceRoot":"","sources":["../../src/grouping-mapping-widget.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,gDAAgD;AAChD,iEAA+C;AAE/C,0EAA0E;AAC1E,yFAA2J;AAAlJ,kIAAA,0BAA0B,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAAE,wHAAA,gBAAgB,OAAA;AAChG,iGAA8L;AAA3H,2IAAA,+BAA+B,OAAA;AAAE,uIAAA,2BAA2B,OAAA;AAC/H,yDAAuC;AAEvC,yCAAyC;AACzC,uDAAsE;AAA7D,mGAAA,QAAQ,OAAA;AACjB,mEAAsF;AAA7E,8GAAA,aAAa,OAAA;AACtB,qFAAiH;AAAxG,gIAAA,sBAAsB,OAAA;AAC/B,yDAAwE;AAA/D,qGAAA,SAAS,OAAA;AAClB,+DAAgF;AAAvE,0GAAA,WAAW,OAAA;AACpB,iEAAmF;AAA1E,4GAAA,YAAY,OAAA;AACrB,+EAAwG;AAA/F,0HAAA,mBAAmB,OAAA;AAC5B,yFAAuH;AAA9G,oIAAA,wBAAwB,OAAA;AACjC,uFAAoH;AAA3G,kIAAA,uBAAuB,OAAA;AAChC,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,8FAA6F;AAApF,gIAAA,sBAAsB,OAAA;AAC/B,oGAAmG;AAA1F,sIAAA,yBAAyB,OAAA;AAClC,gGAA4M;AAA1K,sIAAA,2BAA2B,OAAA;AAE7D,gCAAgC;AAChC,6EAA2E;AAAlE,iIAAA,sBAAsB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** UI Provider for iTwin Viewer Applications */\nexport * from \"./widget/GroupingMappingWidget\";\n\n/** Interfaces for providing custom MappingClient and API configuration */\nexport { createDefaultMappingClient, createMappingClient, MappingClientContext, useMappingClient } from \"./widget/components/context/MappingClientContext\";\nexport { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig, GroupingMappingApiConfigContext, useGroupingMappingApiConfig } from \"./widget/components/context/GroupingApiConfigContext\";\nexport * from \"@itwin/insights-client\";\n\n/** Internal components for custom UIs */\nexport { Mappings, MappingsProps } from \"./widget/components/Mapping\";\nexport { MappingAction, MappingActionProps } from \"./widget/components/MappingAction\";\nexport { GroupingMappingContext, GroupingMappingContextProps } from \"./widget/components/GroupingMappingContext\";\nexport { Groupings, GroupingProps } from \"./widget/components/Grouping\";\nexport { GroupAction, GroupActionProps } from \"./widget/components/GroupAction\";\nexport { PropertyMenu, PropertyMenuProps } from \"./widget/components/PropertyMenu\";\nexport { GroupPropertyAction, GroupPropertyActionProps } from \"./widget/components/GroupPropertyAction\";\nexport { CalculatedPropertyAction, CalculatedPropertyActionProps } from \"./widget/components/CalculatedPropertyAction\";\nexport { CustomCalculationAction, CustomCalculationActionProps } from \"./widget/components/CustomCalculationAction\";\nexport { SearchGroupingCustomUI } from \"./widget/components/customUI/SearchGroupingCustomUI\";\nexport { ManualGroupingCustomUI } from \"./widget/components/customUI/ManualGroupingCustomUI\";\nexport { GroupQueryBuilderCustomUI } from \"./widget/components/customUI/GroupQueryBuilderCustomUI\";\nexport { GroupingMappingCustomUI, GroupingMappingCustomUIType, ContextCustomUI, GroupingCustomUI, GroupingCustomUIProps, ContextCustomUIProps } from \"./widget/components/customUI/GroupingMappingCustomUI\";\n\n/** Formula DataType resolver */\nexport { resolveFormulaDataType } from \"./formula/FormulaDataTypeResolver\";\nexport { DataType, PropertyMap } from \"./formula/Types\";\nexport { IResult } from \"./formula/IResult\";\n"]}
@@ -10,14 +10,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  const react_1 = __importDefault(require("react"));
11
11
  require("@testing-library/jest-dom");
12
12
  const test_utils_1 = require("../test/test-utils");
13
- const utils_1 = require("../widget/components/utils");
14
13
  const faker_1 = require("@faker-js/faker");
14
+ const WidgetHeader_1 = require("../widget/components/WidgetHeader");
15
15
  describe("Widget Header Component", () => {
16
16
  it("title renders", async () => {
17
17
  // Arrange
18
18
  const fakeTitle = faker_1.faker.word.interjection();
19
19
  // Act
20
- test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: fakeTitle }));
20
+ test_utils_1.render(react_1.default.createElement(WidgetHeader_1.WidgetHeader, { title: fakeTitle }));
21
21
  // Assert
22
22
  const title = test_utils_1.screen.getByText(fakeTitle);
23
23
  expect(title).toHaveTextContent(fakeTitle);
@@ -26,7 +26,7 @@ describe("Widget Header Component", () => {
26
26
  // Arrange
27
27
  const mockReturnFn = jest.fn();
28
28
  // Act
29
- const { user, container } = test_utils_1.render(react_1.default.createElement(utils_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
29
+ const { user, container } = test_utils_1.render(react_1.default.createElement(WidgetHeader_1.WidgetHeader, { title: "", returnFn: mockReturnFn }));
30
30
  // Assert
31
31
  const returnBtn = container.getElementsByClassName("gmw-chevron")[0];
32
32
  await user.click(returnBtn);
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,sDAA0D;AAC1D,2CAAwC;AAExC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,UAAU;QACV,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAE5C,MAAM;QACN,mBAAM,CAAC,8BAAC,oBAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,SAAS;QACT,MAAM,KAAK,GAAG,mBAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,UAAU;QACV,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAE/B,MAAM;QACN,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,mBAAM,CAAC,8BAAC,oBAAY,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,YAAY,GAAI,CAAC,CAAC;QAEtF,SAAS;QACT,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,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 \"@testing-library/jest-dom\";\nimport { render, screen } from \"../test/test-utils\";\nimport { WidgetHeader } from \"../widget/components/utils\";\nimport { faker } from \"@faker-js/faker\";\n\ndescribe(\"Widget Header Component\", () => {\n it(\"title renders\", async () => {\n // Arrange\n const fakeTitle = faker.word.interjection();\n\n // Act\n render(<WidgetHeader title={fakeTitle} />);\n\n // Assert\n const title = screen.getByText(fakeTitle);\n expect(title).toHaveTextContent(fakeTitle);\n });\n\n it(\"header allows return callback\", async () => {\n // Arrange\n const mockReturnFn = jest.fn();\n\n // Act\n const { user, container } = render(<WidgetHeader title=\"\" returnFn={mockReturnFn} />);\n\n // Assert\n const returnBtn = container.getElementsByClassName(\"gmw-chevron\")[0];\n await user.click(returnBtn);\n expect(mockReturnFn).toHaveBeenCalledTimes(1);\n });\n});\n"]}
1
+ {"version":3,"file":"WidgetHeader.test.js","sourceRoot":"","sources":["../../../src/test/WidgetHeader.test.tsx"],"names":[],"mappings":";;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,mDAAoD;AACpD,2CAAwC;AACxC,oEAAiE;AAEjE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;QAC7B,UAAU;QACV,MAAM,SAAS,GAAG,aAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAE5C,MAAM;QACN,mBAAM,CAAC,8BAAC,2BAAY,IAAC,KAAK,EAAE,SAAS,GAAI,CAAC,CAAC;QAE3C,SAAS;QACT,MAAM,KAAK,GAAG,mBAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,UAAU;QACV,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QAE/B,MAAM;QACN,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,mBAAM,CAAC,8BAAC,2BAAY,IAAC,KAAK,EAAC,EAAE,EAAC,QAAQ,EAAE,YAAY,GAAI,CAAC,CAAC;QAEtF,SAAS;QACT,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,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 \"@testing-library/jest-dom\";\nimport { render, screen } from \"../test/test-utils\";\nimport { faker } from \"@faker-js/faker\";\nimport { WidgetHeader } from \"../widget/components/WidgetHeader\";\n\ndescribe(\"Widget Header Component\", () => {\n it(\"title renders\", async () => {\n // Arrange\n const fakeTitle = faker.word.interjection();\n\n // Act\n render(<WidgetHeader title={fakeTitle} />);\n\n // Assert\n const title = screen.getByText(fakeTitle);\n expect(title).toHaveTextContent(fakeTitle);\n });\n\n it(\"header allows return callback\", async () => {\n // Arrange\n const mockReturnFn = jest.fn();\n\n // Act\n const { user, container } = render(<WidgetHeader title=\"\" returnFn={mockReturnFn} />);\n\n // Assert\n const returnBtn = container.getElementsByClassName(\"gmw-chevron\")[0];\n await user.click(returnBtn);\n expect(mockReturnFn).toHaveBeenCalledTimes(1);\n });\n});\n"]}
@@ -1,14 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import "./CalculatedPropertyAction.scss";
3
- import type { ICalculatedPropertyTyped } from "./CalculatedPropertyTable";
4
- interface CalculatedPropertyActionProps {
5
- iModelId: string;
3
+ import type { CalculatedProperty, Group } from "@itwin/insights-client";
4
+ export interface CalculatedPropertyActionProps {
6
5
  mappingId: string;
7
- groupId: string;
8
- property?: ICalculatedPropertyTyped;
9
- ids: string[];
10
- returnFn: (modified: boolean) => Promise<void>;
6
+ group: Group;
7
+ calculatedProperty?: CalculatedProperty;
8
+ onSaveSuccess: () => void;
9
+ onClickCancel?: () => void;
11
10
  }
12
- declare const CalculatedPropertyAction: ({ iModelId, mappingId, groupId, property, ids, returnFn, }: CalculatedPropertyActionProps) => JSX.Element;
13
- export default CalculatedPropertyAction;
11
+ export declare const CalculatedPropertyAction: ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel, }: CalculatedPropertyActionProps) => JSX.Element;
14
12
  //# sourceMappingURL=CalculatedPropertyAction.d.ts.map
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.CalculatedPropertyAction = void 0;
25
26
  /*---------------------------------------------------------------------------------------------
26
27
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
27
28
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -38,16 +39,23 @@ require("./CalculatedPropertyAction.scss");
38
39
  const MappingClientContext_1 = require("./context/MappingClientContext");
39
40
  const GroupingApiConfigContext_1 = require("./context/GroupingApiConfigContext");
40
41
  const insights_client_1 = require("@itwin/insights-client");
41
- const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids, returnFn, }) => {
42
- var _a, _b, _c;
43
- const { getAccessToken } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
42
+ const GroupHilitedElementsContext_1 = require("./context/GroupHilitedElementsContext");
43
+ const appui_react_1 = require("@itwin/appui-react");
44
+ const groupsHelpers_1 = require("./groupsHelpers");
45
+ const CalculatedPropertyAction = ({ mappingId, group, calculatedProperty, onSaveSuccess, onClickCancel, }) => {
46
+ var _a, _b;
47
+ const { getAccessToken, iModelId } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
44
48
  const mappingClient = MappingClientContext_1.useMappingClient();
45
- const [propertyName, setPropertyName] = react_1.useState((_a = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _a !== void 0 ? _a : "");
46
- const [type, setType] = react_1.useState((_b = property === null || property === void 0 ? void 0 : property.type) !== null && _b !== void 0 ? _b : insights_client_1.CalculatedPropertyType.Undefined);
49
+ const [propertyName, setPropertyName] = react_1.useState((_a = calculatedProperty === null || calculatedProperty === void 0 ? void 0 : calculatedProperty.propertyName) !== null && _a !== void 0 ? _a : "");
50
+ const iModelConnection = appui_react_1.useActiveIModelConnection();
51
+ const [type, setType] = react_1.useState((_b = calculatedProperty === null || calculatedProperty === void 0 ? void 0 : calculatedProperty.type) !== null && _b !== void 0 ? _b : insights_client_1.CalculatedPropertyType.Undefined);
47
52
  const [bboxDecorator, setBboxDecorator] = react_1.useState();
48
53
  const [isLoading, setIsLoading] = react_1.useState(false);
54
+ const { hilitedElementsQueryCache } = GroupHilitedElementsContext_1.useGroupHilitedElementsContext();
49
55
  const [inferredSpatialData, setInferredSpatialData] = react_1.useState();
50
56
  const [validator, showValidationMessage] = useValidator_1.default();
57
+ const [resolvedHiliteIds, setResolvedHiliteIds] = react_1.useState([]);
58
+ const [colorProperty, setColorProperty] = react_1.useState(false);
51
59
  react_1.useEffect(() => {
52
60
  const decorator = new BboxDimensionsDecorator_1.BboxDimensionsDecorator();
53
61
  core_frontend_1.IModelApp.viewManager.addDecorator(decorator);
@@ -57,31 +65,45 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
57
65
  };
58
66
  }, []);
59
67
  react_1.useEffect(() => {
60
- if (ids.length === 0) {
68
+ const initialize = async () => {
69
+ if (!iModelConnection)
70
+ return;
71
+ viewerUtils_1.clearEmphasizedOverriddenElements();
72
+ if (!colorProperty)
73
+ return;
74
+ setIsLoading(true);
75
+ const result = await groupsHelpers_1.getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);
76
+ setResolvedHiliteIds(result.ids);
77
+ setIsLoading(false);
78
+ };
79
+ void initialize();
80
+ }, [iModelConnection, hilitedElementsQueryCache, group, colorProperty]);
81
+ react_1.useEffect(() => {
82
+ if (!colorProperty || resolvedHiliteIds.length === 0) {
61
83
  return;
62
84
  }
63
- viewerUtils_1.visualizeElements([ids[0]], "red");
64
- void viewerUtils_1.zoomToElements([ids[0]]);
65
- }, [ids]);
85
+ viewerUtils_1.visualizeElements([resolvedHiliteIds[0]], "red");
86
+ void viewerUtils_1.zoomToElements([resolvedHiliteIds[0]]);
87
+ }, [colorProperty, resolvedHiliteIds]);
66
88
  react_1.useEffect(() => {
67
- if (ids.length === 0) {
89
+ if (!colorProperty || resolvedHiliteIds.length === 0) {
68
90
  return;
69
91
  }
70
92
  const setContext = async () => {
71
93
  if (bboxDecorator) {
72
- await bboxDecorator.setContext(ids[0]);
94
+ await bboxDecorator.setContext(resolvedHiliteIds[0]);
73
95
  setInferredSpatialData(bboxDecorator.getInferredSpatialData());
74
96
  }
75
97
  };
76
98
  void setContext();
77
- }, [bboxDecorator, ids]);
99
+ }, [bboxDecorator, colorProperty, resolvedHiliteIds]);
78
100
  react_1.useEffect(() => {
79
101
  if (bboxDecorator && type && inferredSpatialData) {
80
- inferredSpatialData.has(BboxDimensionsDecorator_1.BboxDimension[type])
102
+ inferredSpatialData.has(BboxDimensionsDecorator_1.BboxDimension[type]) && colorProperty
81
103
  ? bboxDecorator.drawContext(BboxDimensionsDecorator_1.BboxDimension[type])
82
104
  : bboxDecorator.clearContext();
83
105
  }
84
- }, [bboxDecorator, inferredSpatialData, type]);
106
+ }, [bboxDecorator, colorProperty, inferredSpatialData, type]);
85
107
  const onSave = async () => {
86
108
  if (!validator.allValid()) {
87
109
  showValidationMessage(true);
@@ -90,19 +112,23 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
90
112
  try {
91
113
  setIsLoading(true);
92
114
  const accessToken = await getAccessToken();
93
- property
94
- ? await mappingClient.updateCalculatedProperty(accessToken, iModelId, mappingId, groupId, property.id, {
115
+ calculatedProperty
116
+ ? await mappingClient.updateCalculatedProperty(accessToken, iModelId, mappingId, group.id, calculatedProperty.id, {
95
117
  propertyName,
96
118
  type,
97
119
  })
98
- : await mappingClient.createCalculatedProperty(accessToken, iModelId, mappingId, groupId, {
120
+ : await mappingClient.createCalculatedProperty(accessToken, iModelId, mappingId, group.id, {
99
121
  propertyName,
100
122
  type,
101
123
  });
102
- await returnFn(true);
124
+ onSaveSuccess();
125
+ setPropertyName("");
126
+ setType(insights_client_1.CalculatedPropertyType.Undefined);
103
127
  }
104
128
  catch (error) {
105
129
  utils_1.handleError(error.status);
130
+ }
131
+ finally {
106
132
  setIsLoading(false);
107
133
  }
108
134
  };
@@ -111,12 +137,11 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
111
137
  return (inferredSpatialData === null || inferredSpatialData === void 0 ? void 0 : inferredSpatialData.has(BboxDimensionsDecorator_1.BboxDimension[value])) && (react_1.default.createElement("div", null, `${(_a = inferredSpatialData === null || inferredSpatialData === void 0 ? void 0 : inferredSpatialData.get(BboxDimensionsDecorator_1.BboxDimension[value])) === null || _a === void 0 ? void 0 : _a.toPrecision(4)}m`));
112
138
  };
113
139
  return (react_1.default.createElement(react_1.default.Fragment, null,
114
- react_1.default.createElement(utils_1.WidgetHeader, { title: property
115
- ? `${(_c = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _c !== void 0 ? _c : ""}`
116
- : "Create Calculated Property", returnFn: async () => returnFn(false) }),
117
140
  react_1.default.createElement("div", { className: 'gmw-calculated-properties-action-container' },
118
141
  react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Calculated Property Details', className: 'gmw-details-form' },
119
- react_1.default.createElement(itwinui_react_1.Small, { className: 'gmw-field-legend' }, "Asterisk * indicates mandatory fields."),
142
+ react_1.default.createElement("div", { className: 'gmw-field-legend-container' },
143
+ react_1.default.createElement(itwinui_react_1.Small, { className: 'gmw-field-legend' }, "Asterisk * indicates mandatory fields."),
144
+ react_1.default.createElement(itwinui_react_1.ToggleSwitch, { label: 'Visualize Dimensions', labelPosition: 'left', disabled: isLoading, checked: colorProperty, onChange: () => setColorProperty((b) => !b) })),
120
145
  react_1.default.createElement(itwinui_react_1.LabeledInput, { value: propertyName, required: true, name: 'name', label: 'Name', onChange: (event) => {
121
146
  setPropertyName(event.target.value);
122
147
  validator.showMessageFor("name");
@@ -166,7 +191,7 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
166
191
  getSpatialData(option.value)))), selectedItemRenderer: (option) => (react_1.default.createElement("div", { className: 'gmw-select-item' },
167
192
  react_1.default.createElement("div", null, option.label),
168
193
  getSpatialData(option.value))), onShow: () => { }, onHide: () => { } }))),
169
- react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: async () => returnFn(false), isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
194
+ react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: onClickCancel, isSavingDisabled: !(type && propertyName), isLoading: isLoading })));
170
195
  };
171
- exports.default = CalculatedPropertyAction;
196
+ exports.CalculatedPropertyAction = CalculatedPropertyAction;
172
197
  //# sourceMappingURL=CalculatedPropertyAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAIjD,wDAM8B;AAC9B,+CAAmD;AACnD,gEAAwC;AACxC,sFAGkD;AAClD,sEAAwE;AACxE,mCAAoD;AACpD,+CAAkE;AAClE,2CAAyC;AAEzC,yEAAkE;AAClE,iFAAiF;AACjF,4DAAgE;AAWhE,MAAM,wBAAwB,GAAG,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,EACH,QAAQ,GACsB,EAAE,EAAE;;IAClC,MAAM,EAAE,cAAc,EAAE,GAAG,sDAA2B,EAAE,CAAC;IACzD,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IACzC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAC9C,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,mCAAI,EAAE,CAC7B,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,gBAAQ,CAAyB,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,mCAAI,wCAAsB,CAAC,SAAS,CAAC,CAAC;IAC7G,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,gBAAQ,EAAuC,CAAC;IAC1F,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,g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CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,uCAAK,SAAS,EAAC,iBAAiB;wBAC9B,2CAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,EACD,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrC,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EACzC,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,wBAAwB,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 { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Fieldset,\n LabeledInput,\n LabeledSelect,\n MenuItem,\n Small,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport {\n BboxDimension,\n BboxDimensionsDecorator,\n} from \"../../decorators/BboxDimensionsDecorator\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError, WidgetHeader } from \"./utils\";\nimport { visualizeElements, zoomToElements } from \"./viewerUtils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { ICalculatedPropertyTyped } from \"./CalculatedPropertyTable\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { CalculatedPropertyType } from \"@itwin/insights-client\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: ICalculatedPropertyTyped;\n ids: string[];\n returnFn: (modified: boolean) => Promise<void>;\n}\n\nconst CalculatedPropertyAction = ({\n iModelId,\n mappingId,\n groupId,\n property,\n ids,\n returnFn,\n}: CalculatedPropertyActionProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<CalculatedPropertyType>(property?.type ?? CalculatedPropertyType.Undefined);\n const [bboxDecorator, setBboxDecorator] = useState<BboxDimensionsDecorator | undefined>();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [inferredSpatialData, setInferredSpatialData] = useState<Map<BboxDimension, number> | undefined>();\n const [validator, showValidationMessage] = useValidator();\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n visualizeElements([ids[0]], \"red\");\n void zoomToElements([ids[0]]);\n }, [ids]);\n\n useEffect(() => {\n if (ids.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(ids[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, ids]);\n\n useEffect(() => {\n if (bboxDecorator && type && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[type as keyof typeof BboxDimension])\n ? bboxDecorator.drawContext(\n BboxDimension[type as keyof typeof BboxDimension],\n )\n : bboxDecorator.clearContext();\n }\n }, [bboxDecorator, inferredSpatialData, type]);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n\n const accessToken = await getAccessToken();\n\n property\n ? await mappingClient.updateCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n property.id,\n {\n propertyName,\n type,\n },\n )\n : await mappingClient.createCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n {\n propertyName,\n type,\n },\n );\n await returnFn(true);\n } catch (error: any) {\n handleError(error.status);\n setIsLoading(false);\n }\n };\n\n const getSpatialData = (value: string) =>\n inferredSpatialData?.has(\n BboxDimension[value as keyof typeof BboxDimension],\n ) && (\n <div>\n {`${inferredSpatialData\n ?.get(BboxDimension[value as keyof typeof BboxDimension])\n ?.toPrecision(4)}m`}\n </div>\n );\n\n return (\n <>\n <WidgetHeader\n title={\n property\n ? `${property?.propertyName ?? \"\"}`\n : \"Create Calculated Property\"\n }\n returnFn={async () => returnFn(false)}\n />\n <div className='gmw-calculated-properties-action-container'>\n <Fieldset legend='Calculated Property Details' className='gmw-details-form'>\n <Small className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <LabeledInput\n value={propertyName}\n required\n name='name'\n label='Name'\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<CalculatedPropertyType>\n label='Quantity Type'\n required\n options={[\n { value: CalculatedPropertyType.Length, label: \"Length\" },\n { value: CalculatedPropertyType.Area, label: \"Area\" },\n { value: CalculatedPropertyType.Volume, label: \"Volume\" },\n {\n value: CalculatedPropertyType.BoundingBoxLongestEdgeLength,\n label: \"Longest Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxIntermediateEdgeLength,\n label: \"Intermediate Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxShortestEdgeLength,\n label: \"Shortest Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxDiagonalLength,\n label: \"Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxLongestFaceDiagonalLength,\n label: \"Longest Face Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxIntermediateFaceDiagonalLength,\n label: \"Intermediate Face Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxShortestFaceDiagonalLength,\n label: \"Shortest Face Diagonal Length\",\n },\n ]}\n value={type}\n onChange={setType}\n itemRenderer={(option: SelectOption<string>) => (\n <MenuItem>\n <div className='gmw-gr-cp-menu-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className='gmw-select-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n onShow={() => { }}\n onHide={() => { }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={async () => returnFn(false)}\n isSavingDisabled={!(type && propertyName)}\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyAction;\n"]}
1
+ {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAIjD,wDAO8B;AAC9B,+CAAmD;AACnD,gEAAwC;AACxC,sFAGkD;AAClD,sEAAwE;AACxE,mCAAsC;AACtC,+CAAqG;AACrG,2CAAyC;AACzC,yEAAkE;AAClE,iFAAiF;AAEjF,4DAAgE;AAChE,uFAAuF;AACvF,oDAA+D;AAC/D,mDAAiE;AAU1D,MAAM,wBAAwB,GAAG,CAAC,EACvC,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,GACiB,EAAE,EAAE;;IAClC,MAAM,EAAE,cA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C;yBAC3C;wBACD;4BACE,KAAK,EAAE,wCAAsB,CAAC,qCAAqC;4BACnE,KAAK,EAAE,+BAA+B;yBACvC;qBACF,EACD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CAC9C,8BAAC,wBAAQ;wBACP,uCAAK,SAAS,EAAC,qBAAqB;4BAClC,2CAAM,MAAM,CAAC,KAAK,CAAO;4BACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,uCAAK,SAAS,EAAC,iBAAiB;wBAC9B,2CAAM,MAAM,CAAC,KAAK,CAAO;wBACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACP,EACD,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EACzC,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAxOW,QAAA,wBAAwB,4BAwOnC","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 { IModelApp } from \"@itwin/core-frontend\";\nimport type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Fieldset,\n LabeledInput,\n LabeledSelect,\n MenuItem,\n Small,\n ToggleSwitch,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport {\n BboxDimension,\n BboxDimensionsDecorator,\n} from \"../../decorators/BboxDimensionsDecorator\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"./utils\";\nimport { clearEmphasizedOverriddenElements, visualizeElements, zoomToElements } from \"./viewerUtils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CalculatedProperty, Group } from \"@itwin/insights-client\";\nimport { CalculatedPropertyType } from \"@itwin/insights-client\";\nimport { useGroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { getHiliteIdsAndKeysetFromGroup } from \"./groupsHelpers\";\n\nexport interface CalculatedPropertyActionProps {\n mappingId: string;\n group: Group;\n calculatedProperty?: CalculatedProperty;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\nexport const CalculatedPropertyAction = ({\n mappingId,\n group,\n calculatedProperty,\n onSaveSuccess,\n onClickCancel,\n}: CalculatedPropertyActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [propertyName, setPropertyName] = useState<string>(\n calculatedProperty?.propertyName ?? \"\",\n );\n const iModelConnection = useActiveIModelConnection();\n const [type, setType] = useState<CalculatedPropertyType>(calculatedProperty?.type ?? CalculatedPropertyType.Undefined);\n const [bboxDecorator, setBboxDecorator] = useState<BboxDimensionsDecorator | undefined>();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const { hilitedElementsQueryCache } = useGroupHilitedElementsContext();\n const [inferredSpatialData, setInferredSpatialData] = useState<Map<BboxDimension, number> | undefined>();\n const [validator, showValidationMessage] = useValidator();\n const [resolvedHiliteIds, setResolvedHiliteIds] = useState<string[]>([]);\n const [colorProperty, setColorProperty] = useState<boolean>(false);\n\n useEffect(() => {\n const decorator = new BboxDimensionsDecorator();\n IModelApp.viewManager.addDecorator(decorator);\n setBboxDecorator(decorator);\n return () => {\n IModelApp.viewManager.dropDecorator(decorator);\n };\n }, []);\n\n useEffect(() => {\n const initialize = async () => {\n if (!iModelConnection) return;\n clearEmphasizedOverriddenElements();\n if (!colorProperty) return;\n setIsLoading(true);\n const result = await getHiliteIdsAndKeysetFromGroup(iModelConnection, group, hilitedElementsQueryCache);\n setResolvedHiliteIds(result.ids);\n setIsLoading(false);\n };\n void initialize();\n }, [iModelConnection, hilitedElementsQueryCache, group, colorProperty]);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n return;\n }\n visualizeElements([resolvedHiliteIds[0]], \"red\");\n void zoomToElements([resolvedHiliteIds[0]]);\n }, [colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (!colorProperty || resolvedHiliteIds.length === 0) {\n return;\n }\n const setContext = async () => {\n if (bboxDecorator) {\n await bboxDecorator.setContext(resolvedHiliteIds[0]);\n setInferredSpatialData(bboxDecorator.getInferredSpatialData());\n }\n };\n void setContext();\n }, [bboxDecorator, colorProperty, resolvedHiliteIds]);\n\n useEffect(() => {\n if (bboxDecorator && type && inferredSpatialData) {\n inferredSpatialData.has(BboxDimension[type as keyof typeof BboxDimension]) && colorProperty\n ? bboxDecorator.drawContext(\n BboxDimension[type as keyof typeof BboxDimension],\n )\n : bboxDecorator.clearContext();\n }\n }, [bboxDecorator, colorProperty, inferredSpatialData, type]);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n\n const accessToken = await getAccessToken();\n\n calculatedProperty\n ? await mappingClient.updateCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n group.id,\n calculatedProperty.id,\n {\n propertyName,\n type,\n },\n )\n : await mappingClient.createCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n group.id,\n {\n propertyName,\n type,\n },\n );\n onSaveSuccess();\n setPropertyName(\"\");\n setType(CalculatedPropertyType.Undefined);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n };\n\n const getSpatialData = (value: string) =>\n inferredSpatialData?.has(\n BboxDimension[value as keyof typeof BboxDimension],\n ) && (\n <div>\n {`${inferredSpatialData\n ?.get(BboxDimension[value as keyof typeof BboxDimension])\n ?.toPrecision(4)}m`}\n </div>\n );\n\n return (\n <>\n <div className='gmw-calculated-properties-action-container'>\n <Fieldset legend='Calculated Property Details' className='gmw-details-form'>\n <div className='gmw-field-legend-container'>\n <Small className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <ToggleSwitch\n label='Visualize Dimensions'\n labelPosition='left'\n disabled={isLoading}\n checked={colorProperty}\n onChange={() => setColorProperty((b) => !b)}\n ></ToggleSwitch>\n </div>\n <LabeledInput\n value={propertyName}\n required\n name='name'\n label='Name'\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<CalculatedPropertyType>\n label='Quantity Type'\n required\n options={[\n { value: CalculatedPropertyType.Length, label: \"Length\" },\n { value: CalculatedPropertyType.Area, label: \"Area\" },\n { value: CalculatedPropertyType.Volume, label: \"Volume\" },\n {\n value: CalculatedPropertyType.BoundingBoxLongestEdgeLength,\n label: \"Longest Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxIntermediateEdgeLength,\n label: \"Intermediate Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxShortestEdgeLength,\n label: \"Shortest Edge Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxDiagonalLength,\n label: \"Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxLongestFaceDiagonalLength,\n label: \"Longest Face Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxIntermediateFaceDiagonalLength,\n label: \"Intermediate Face Diagonal Length\",\n },\n {\n value: CalculatedPropertyType.BoundingBoxShortestFaceDiagonalLength,\n label: \"Shortest Face Diagonal Length\",\n },\n ]}\n value={type}\n onChange={setType}\n itemRenderer={(option: SelectOption<string>) => (\n <MenuItem>\n <div className='gmw-gr-cp-menu-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className='gmw-select-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n )}\n onShow={() => { }}\n onHide={() => { }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={onClickCancel}\n isSavingDisabled={!(type && propertyName)}\n isLoading={isLoading}\n />\n </>\n );\n};\n"]}
@@ -1,21 +1,14 @@
1
- import React from "react";
2
- import type { CreateTypeFromInterface } from "../utils";
3
- import { PropertyMenuView } from "./PropertyMenu";
4
- import type { CellProps } from "react-table";
1
+ /// <reference types="react" />
5
2
  import type { CalculatedProperty } from "@itwin/insights-client";
6
- export declare type ICalculatedPropertyTyped = CreateTypeFromInterface<CalculatedProperty>;
7
- interface CalculatedPropertyTableProps {
8
- iModelId: string;
3
+ import "./CalculatedPropertyTable.scss";
4
+ export interface CalculatedPropertyTableProps {
9
5
  mappingId: string;
10
6
  groupId: string;
11
- setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<ICalculatedPropertyTyped | undefined>>;
12
- setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;
13
- onCalculatedPropertyModify: (value: CellProps<ICalculatedPropertyTyped>) => void;
14
- isLoadingCalculatedProperties: boolean;
15
- calculatedProperties: ICalculatedPropertyTyped[];
16
- refreshCalculatedProperties: () => Promise<void>;
17
- selectedCalculatedProperty?: ICalculatedPropertyTyped;
7
+ onClickAdd?: () => void;
8
+ onClickModify?: (value: CalculatedProperty) => void;
9
+ isLoading: boolean;
10
+ calculatedProperties: CalculatedProperty[];
11
+ refresh: () => Promise<void>;
18
12
  }
19
- declare const CalculatedPropertyTable: ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, isLoadingCalculatedProperties: isLoadingGroupProperties, calculatedProperties, refreshCalculatedProperties, selectedCalculatedProperty, }: CalculatedPropertyTableProps) => JSX.Element;
20
- export default CalculatedPropertyTable;
13
+ export declare const CalculatedPropertyTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }: CalculatedPropertyTableProps) => JSX.Element;
21
14
  //# sourceMappingURL=CalculatedPropertyTable.d.ts.map
@@ -18,27 +18,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.CalculatedPropertyTable = void 0;
25
23
  /*---------------------------------------------------------------------------------------------
26
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
27
- * See LICENSE.md in the project root for license terms and full copyright notice.
28
- *--------------------------------------------------------------------------------------------*/
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
29
27
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
30
28
  const itwinui_react_1 = require("@itwin/itwinui-react");
31
29
  const react_1 = __importStar(require("react"));
32
- const PropertyMenu_1 = require("./PropertyMenu");
33
- const DeleteModal_1 = __importDefault(require("./DeleteModal"));
34
30
  const MappingClientContext_1 = require("./context/MappingClientContext");
31
+ require("./CalculatedPropertyTable.scss");
32
+ const PropertyNameCell_1 = require("./PropertyNameCell");
33
+ const PropertyTable_1 = require("./PropertyTable");
35
34
  const GroupingApiConfigContext_1 = require("./context/GroupingApiConfigContext");
36
- const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, isLoadingCalculatedProperties: isLoadingGroupProperties, calculatedProperties, refreshCalculatedProperties, selectedCalculatedProperty, }) => {
37
- var _a;
38
- const { getAccessToken } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
35
+ const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }) => {
39
36
  const mappingClient = MappingClientContext_1.useMappingClient();
40
- const [showCalculatedPropertyDeleteModal, setShowCalculatedPropertyDeleteModal,] = react_1.useState(false);
41
- const calculatedPropertiesColumns = react_1.useMemo(() => [
37
+ const { getAccessToken, iModelId } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
38
+ const columnsFactory = react_1.useCallback((handleShowDeleteModal) => [
42
39
  {
43
40
  Header: "Table",
44
41
  columns: [
@@ -46,7 +43,7 @@ const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalc
46
43
  id: "propertyName",
47
44
  Header: "Calculated Property",
48
45
  accessor: "propertyName",
49
- Cell: (value) => (react_1.default.createElement("div", { className: 'iui-anchor', onClick: () => onCalculatedPropertyModify(value) }, value.row.original.propertyName)),
46
+ Cell: (value) => (react_1.default.createElement(PropertyNameCell_1.PropertyNameCell, { property: value.row.original, onClickModify: onClickModify })),
50
47
  },
51
48
  {
52
49
  id: "dropdown",
@@ -54,14 +51,20 @@ const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalc
54
51
  width: 80,
55
52
  Cell: (value) => {
56
53
  return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
57
- react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => onCalculatedPropertyModify(value), icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, "Modify"),
54
+ onClickModify
55
+ ? [
56
+ react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
57
+ onClickModify(value.row.original);
58
+ close();
59
+ }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, "Modify"),
60
+ ]
61
+ : [],
58
62
  react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
59
- setSelectedCalculatedProperty(value.row.original);
60
- setShowCalculatedPropertyDeleteModal(true);
63
+ handleShowDeleteModal(value.row.original);
61
64
  close();
62
65
  }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, "Remove"),
63
- ] },
64
- react_1.default.createElement(itwinui_react_1.IconButton, { styleType: 'borderless' },
66
+ ].flatMap((p) => p) },
67
+ react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless" },
65
68
  react_1.default.createElement(itwinui_icons_react_1.SvgMore, { style: {
66
69
  width: "16px",
67
70
  height: "16px",
@@ -70,17 +73,12 @@ const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalc
70
73
  },
71
74
  ],
72
75
  },
73
- ], [onCalculatedPropertyModify, setSelectedCalculatedProperty]);
74
- return (react_1.default.createElement(react_1.default.Fragment, null,
75
- react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), styleType: 'high-visibility', onClick: () => {
76
- setGroupModifyView(PropertyMenu_1.PropertyMenuView.ADD_CALCULATED_PROPERTY);
77
- } }, "Add Calculated Property"),
78
- react_1.default.createElement(itwinui_react_1.Table, { data: calculatedProperties, density: 'extra-condensed', columns: calculatedPropertiesColumns, emptyTableContent: 'No Calculated Properties', isSortable: true, isLoading: isLoadingGroupProperties }),
79
- react_1.default.createElement(DeleteModal_1.default, { entityName: (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.propertyName) !== null && _a !== void 0 ? _a : "", show: showCalculatedPropertyDeleteModal, setShow: setShowCalculatedPropertyDeleteModal, onDelete: async () => {
80
- var _a;
81
- const accessToken = await getAccessToken();
82
- await mappingClient.deleteCalculatedProperty(accessToken, iModelId, mappingId, groupId, (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.id) !== null && _a !== void 0 ? _a : "");
83
- }, refresh: refreshCalculatedProperties })));
76
+ ], [onClickModify]);
77
+ const deleteProperty = react_1.useCallback(async (propertyId) => {
78
+ const accessToken = await getAccessToken();
79
+ await mappingClient.deleteCalculatedProperty(accessToken, iModelId, mappingId, groupId, propertyId);
80
+ }, [getAccessToken, groupId, iModelId, mappingClient, mappingId]);
81
+ return (react_1.default.createElement(PropertyTable_1.PropertyTable, { propertyType: "Calculated", columnsFactory: columnsFactory, data: calculatedProperties, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
84
82
  };
85
- exports.default = CalculatedPropertyTable;
83
+ exports.CalculatedPropertyTable = CalculatedPropertyTable;
86
84
  //# sourceMappingURL=CalculatedPropertyTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oEAKoC;AACpC,wDAM8B;AAC9B,+CAAiD;AAEjD,iDAAkD;AAElD,gEAAwC;AAExC,yEAAkE;AAClE,iFAAiF;AAkBjF,MAAM,uBAAuB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,OAAO,EACP,6BAA6B,EAC7B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAAE,wBAAwB,EACvD,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,GACG,EAAE,EAAE;;IACjC,MAAM,EAAE,cAAc,EAAE,GAAG,sDAA2B,EAAE,CAAC;IACzD,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IACzC,MAAM,CACJ,iCAAiC,EACjC,oCAAoC,EACrC,GAAG,g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ACF;aACF;SACF;KACF,EACD,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,CAC5D,CAAC;IAEF,OAAO,CACL;QACE,8BAAC,sBAAM,IACL,SAAS,EAAE,8BAAC,4BAAM,OAAG,EACrB,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,GAAG,EAAE;gBACZ,kBAAkB,CAAC,+BAAgB,CAAC,uBAAuB,CAAC,CAAC;YAC/D,CAAC,8BAGM;QACT,8BAAC,qBAAK,IACJ,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAC,iBAAiB,EACzB,OAAO,EAAE,2BAA2B,EACpC,iBAAiB,EAAC,0BAA0B,EAC5C,UAAU,QACV,SAAS,EAAE,wBAAwB,GACnC;QAEF,8BAAC,qBAAW,IACV,UAAU,EAAE,MAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,YAAY,mCAAI,EAAE,EAC1D,IAAI,EAAE,iCAAiC,EACvC,OAAO,EAAE,oCAAoC,EAC7C,QAAQ,EAAE,KAAK,IAAI,EAAE;;gBACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC3C,MAAM,aAAa,CAAC,wBAAwB,CAC1C,WAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,EAAE,mCAAI,EAAE,CACrC,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,2BAA2B,GACpC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,uBAAuB,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 {\n SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Table,\n} from \"@itwin/itwinui-react\";\nimport React, { useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport { PropertyMenuView } from \"./PropertyMenu\";\nimport type { CellProps } from \"react-table\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { CalculatedProperty } from \"@itwin/insights-client\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nexport type ICalculatedPropertyTyped =\n CreateTypeFromInterface<CalculatedProperty>;\n\ninterface CalculatedPropertyTableProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<ICalculatedPropertyTyped | undefined>>;\n setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;\n onCalculatedPropertyModify: (value: CellProps<ICalculatedPropertyTyped>) => void;\n isLoadingCalculatedProperties: boolean;\n calculatedProperties: ICalculatedPropertyTyped[];\n refreshCalculatedProperties: () => Promise<void>;\n selectedCalculatedProperty?: ICalculatedPropertyTyped;\n}\n\nconst CalculatedPropertyTable = ({\n iModelId,\n mappingId,\n groupId,\n setSelectedCalculatedProperty,\n setGroupModifyView,\n onCalculatedPropertyModify,\n isLoadingCalculatedProperties: isLoadingGroupProperties,\n calculatedProperties,\n refreshCalculatedProperties,\n selectedCalculatedProperty,\n}: CalculatedPropertyTableProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [\n showCalculatedPropertyDeleteModal,\n setShowCalculatedPropertyDeleteModal,\n ] = useState<boolean>(false);\n\n const calculatedPropertiesColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"propertyName\",\n Header: \"Calculated Property\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<ICalculatedPropertyTyped>) => (\n <div\n className='iui-anchor'\n onClick={() => onCalculatedPropertyModify(value)}\n >\n {value.row.original.propertyName}\n </div>\n ),\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<ICalculatedPropertyTyped>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) => [\n <MenuItem\n key={0}\n onClick={() => onCalculatedPropertyModify(value)}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n <MenuItem\n key={1}\n onClick={() => {\n setSelectedCalculatedProperty(value.row.original);\n setShowCalculatedPropertyDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ]}\n >\n <IconButton styleType='borderless'>\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n },\n ],\n [onCalculatedPropertyModify, setSelectedCalculatedProperty],\n );\n\n return (\n <>\n <Button\n startIcon={<SvgAdd />}\n styleType='high-visibility'\n onClick={() => {\n setGroupModifyView(PropertyMenuView.ADD_CALCULATED_PROPERTY);\n }}\n >\n Add Calculated Property\n </Button>\n <Table<ICalculatedPropertyTyped>\n data={calculatedProperties}\n density='extra-condensed'\n columns={calculatedPropertiesColumns}\n emptyTableContent='No Calculated Properties'\n isSortable\n isLoading={isLoadingGroupProperties}\n />\n\n <DeleteModal\n entityName={selectedCalculatedProperty?.propertyName ?? \"\"}\n show={showCalculatedPropertyDeleteModal}\n setShow={setShowCalculatedPropertyDeleteModal}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n selectedCalculatedProperty?.id ?? \"\",\n );\n }}\n refresh={refreshCalculatedProperties}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyTable;\n"]}
1
+ {"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAyE;AACzE,wDAI8B;AAC9B,+CAA2C;AAG3C,yE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;wCACZ,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;wCAC1C,KAAK,EAAE,CAAC;oCACV,CAAC,EACD,IAAI,EAAE,8BAAC,+BAAS,OAAG,aAGV;6BACZ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;4BAGrB,8BAAC,0BAAU,IAAC,SAAS,EAAC,YAAY;gCAChC,8BAAC,6BAAO,IACN,KAAK,EAAE;wCACL,KAAK,EAAE,MAAM;wCACb,MAAM,EAAE,MAAM;qCACf,GACD,CACS,CACA,CAChB,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,cAAc,GAAG,mBAAW,CAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,MAAM,aAAa,CAAC,wBAAwB,CAC1C,WAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,CACX,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;IAElE,OAAO,CACL,8BAAC,6BAAa,IACZ,YAAY,EAAC,YAAY,EACzB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,oBAAoB,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC;AA3GW,QAAA,uBAAuB,2BA2GlC","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 { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport {\n DropdownMenu,\n IconButton,\n MenuItem,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps } from \"react-table\";\nimport type { CalculatedProperty } from \"@itwin/insights-client\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport \"./CalculatedPropertyTable.scss\";\nimport { PropertyNameCell } from \"./PropertyNameCell\";\nimport { PropertyTable } from \"./PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nexport interface CalculatedPropertyTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: CalculatedProperty) => void;\n isLoading: boolean;\n calculatedProperties: CalculatedProperty[];\n refresh: () => Promise<void>;\n}\n\nexport const CalculatedPropertyTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n calculatedProperties,\n refresh,\n}: CalculatedPropertyTableProps) => {\n const mappingClient = useMappingClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: CalculatedProperty) => void) => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"propertyName\",\n Header: \"Calculated Property\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<CalculatedProperty>) => (\n <PropertyNameCell\n property={value.row.original}\n onClickModify={onClickModify}\n />\n ),\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<CalculatedProperty>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(\n value.row.original\n );\n close();\n }\n }\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n },\n ],\n [onClickModify]\n );\n\n const deleteProperty = useCallback(async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteCalculatedProperty(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n propertyId,\n );\n }, [getAccessToken, groupId, iModelId, mappingClient, mappingId]);\n\n return (\n <PropertyTable\n propertyType=\"Calculated\"\n columnsFactory={columnsFactory}\n data={calculatedProperties}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
@@ -0,0 +1,9 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .gmw-field-legend-container {
7
+ display: flex;
8
+ justify-content: space-between;
9
+ }
@@ -41,7 +41,7 @@ const ConfirmMappingImport = ({ sourceiModelId, selectedMappings, importing, set
41
41
  const [currentlyImporting, setCurrentlyImporting] = react_1.useState("");
42
42
  const [validator, showValidationMessage] = useValidator_1.default();
43
43
  const [errored, setErrored] = react_1.useState(false);
44
- const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };
44
+ const displayStrings = react_1.default.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
45
45
  react_1.useEffect(() => {
46
46
  setSelectedMappings((selectedMappings) => selectedMappings.map((mapping) => ({
47
47
  ...mapping,