@itwin/grouping-mapping-widget 0.2.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 (305) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +26 -0
  3. package/lib/cjs/api/GroupQueryBuilderApi.d.ts +15 -0
  4. package/lib/cjs/api/GroupQueryBuilderApi.js +27 -0
  5. package/lib/cjs/api/GroupQueryBuilderApi.js.map +1 -0
  6. package/lib/cjs/api/generated/api.d.ts +3222 -0
  7. package/lib/cjs/api/generated/api.js +5291 -0
  8. package/lib/cjs/api/generated/api.js.map +1 -0
  9. package/lib/cjs/api/generated/configuration.d.ts +56 -0
  10. package/lib/cjs/api/generated/configuration.js +30 -0
  11. package/lib/cjs/api/generated/configuration.js.map +1 -0
  12. package/lib/cjs/api/generated/index.d.ts +14 -0
  13. package/lib/cjs/api/generated/index.js +31 -0
  14. package/lib/cjs/api/generated/index.js.map +1 -0
  15. package/lib/cjs/api/reportingClient.d.ts +34 -0
  16. package/lib/cjs/api/reportingClient.js +177 -0
  17. package/lib/cjs/api/reportingClient.js.map +1 -0
  18. package/lib/cjs/decorators/BboxDimensionsDecorator.d.ts +82 -0
  19. package/lib/cjs/decorators/BboxDimensionsDecorator.js +418 -0
  20. package/lib/cjs/decorators/BboxDimensionsDecorator.js.map +1 -0
  21. package/lib/cjs/grouping-mapping-widget.d.ts +7 -0
  22. package/lib/cjs/grouping-mapping-widget.js +27 -0
  23. package/lib/cjs/grouping-mapping-widget.js.map +1 -0
  24. package/lib/cjs/widget/GroupingMappingWidget.d.ts +7 -0
  25. package/lib/cjs/widget/GroupingMappingWidget.js +51 -0
  26. package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -0
  27. package/lib/cjs/widget/components/ActionPanel.d.ts +11 -0
  28. package/lib/cjs/widget/components/ActionPanel.js +37 -0
  29. package/lib/cjs/widget/components/ActionPanel.js.map +1 -0
  30. package/lib/cjs/widget/components/ActionPanel.scss +12 -0
  31. package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +14 -0
  32. package/lib/cjs/widget/components/CalculatedPropertyAction.js +160 -0
  33. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -0
  34. package/lib/cjs/widget/components/CalculatedPropertyAction.scss +27 -0
  35. package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +18 -0
  36. package/lib/cjs/widget/components/CalculatedPropertyTable.js +109 -0
  37. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -0
  38. package/lib/cjs/widget/components/ConfirmMappingsImport.d.ts +16 -0
  39. package/lib/cjs/widget/components/ConfirmMappingsImport.js +112 -0
  40. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -0
  41. package/lib/cjs/widget/components/ConfirmMappingsImport.scss +84 -0
  42. package/lib/cjs/widget/components/CustomCalculationAction.d.ts +14 -0
  43. package/lib/cjs/widget/components/CustomCalculationAction.js +103 -0
  44. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -0
  45. package/lib/cjs/widget/components/CustomCalculationAction.scss +16 -0
  46. package/lib/cjs/widget/components/CustomCalculationTable.d.ts +18 -0
  47. package/lib/cjs/widget/components/CustomCalculationTable.js +114 -0
  48. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -0
  49. package/lib/cjs/widget/components/DeleteModal.d.ts +12 -0
  50. package/lib/cjs/widget/components/DeleteModal.js +64 -0
  51. package/lib/cjs/widget/components/DeleteModal.js.map +1 -0
  52. package/lib/cjs/widget/components/DeleteModal.scss +12 -0
  53. package/lib/cjs/widget/components/GroupAction.d.ts +12 -0
  54. package/lib/cjs/widget/components/GroupAction.js +166 -0
  55. package/lib/cjs/widget/components/GroupAction.js.map +1 -0
  56. package/lib/cjs/widget/components/GroupAction.scss +19 -0
  57. package/lib/cjs/widget/components/GroupPropertyAction.d.ts +17 -0
  58. package/lib/cjs/widget/components/GroupPropertyAction.js +372 -0
  59. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -0
  60. package/lib/cjs/widget/components/GroupPropertyAction.scss +36 -0
  61. package/lib/cjs/widget/components/GroupPropertyTable.d.ts +18 -0
  62. package/lib/cjs/widget/components/GroupPropertyTable.js +109 -0
  63. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -0
  64. package/lib/cjs/widget/components/GroupQueryBuilder.scss +24 -0
  65. package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
  66. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +66 -0
  67. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -0
  68. package/lib/cjs/widget/components/GroupQueryBuilderContext.d.ts +13 -0
  69. package/lib/cjs/widget/components/GroupQueryBuilderContext.js +37 -0
  70. package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +1 -0
  71. package/lib/cjs/widget/components/Grouping.d.ts +12 -0
  72. package/lib/cjs/widget/components/Grouping.js +214 -0
  73. package/lib/cjs/widget/components/Grouping.js.map +1 -0
  74. package/lib/cjs/widget/components/Grouping.scss +15 -0
  75. package/lib/cjs/widget/components/GroupingMapping.d.ts +5 -0
  76. package/lib/cjs/widget/components/GroupingMapping.js +34 -0
  77. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -0
  78. package/lib/cjs/widget/components/GroupingMapping.scss +24 -0
  79. package/lib/cjs/widget/components/Mapping.d.ts +7 -0
  80. package/lib/cjs/widget/components/Mapping.js +162 -0
  81. package/lib/cjs/widget/components/Mapping.js.map +1 -0
  82. package/lib/cjs/widget/components/Mapping.scss +26 -0
  83. package/lib/cjs/widget/components/MappingAction.d.ts +11 -0
  84. package/lib/cjs/widget/components/MappingAction.js +98 -0
  85. package/lib/cjs/widget/components/MappingAction.js.map +1 -0
  86. package/lib/cjs/widget/components/MappingAction.scss +16 -0
  87. package/lib/cjs/widget/components/MappingImportWizardModal.d.ts +10 -0
  88. package/lib/cjs/widget/components/MappingImportWizardModal.js +102 -0
  89. package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -0
  90. package/lib/cjs/widget/components/MappingImportWizardModal.scss +21 -0
  91. package/lib/cjs/widget/components/PropertyMenu.d.ts +24 -0
  92. package/lib/cjs/widget/components/PropertyMenu.js +141 -0
  93. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -0
  94. package/lib/cjs/widget/components/PropertyMenu.scss +48 -0
  95. package/lib/cjs/widget/components/QueryBuilder.d.ts +39 -0
  96. package/lib/cjs/widget/components/QueryBuilder.js +345 -0
  97. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -0
  98. package/lib/cjs/widget/components/SelectIModel.d.ts +12 -0
  99. package/lib/cjs/widget/components/SelectIModel.js +42 -0
  100. package/lib/cjs/widget/components/SelectIModel.js.map +1 -0
  101. package/lib/cjs/widget/components/SelectIModel.scss +20 -0
  102. package/lib/cjs/widget/components/SelectMapping.scss +17 -0
  103. package/lib/cjs/widget/components/SelectMappings.d.ts +12 -0
  104. package/lib/cjs/widget/components/SelectMappings.js +82 -0
  105. package/lib/cjs/widget/components/SelectMappings.js.map +1 -0
  106. package/lib/cjs/widget/components/SelectProject.d.ts +10 -0
  107. package/lib/cjs/widget/components/SelectProject.js +71 -0
  108. package/lib/cjs/widget/components/SelectProject.js.map +1 -0
  109. package/lib/cjs/widget/components/SelectProject.scss +38 -0
  110. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
  111. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +92 -0
  112. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
  113. package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
  114. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
  115. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +58 -0
  116. package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
  117. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +67 -0
  118. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +198 -0
  119. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -0
  120. package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +71 -0
  121. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
  122. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +67 -0
  123. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
  124. package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +69 -0
  125. package/lib/cjs/widget/components/property-grid/PropertyList.js +87 -0
  126. package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -0
  127. package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +92 -0
  128. package/lib/cjs/widget/components/property-grid/PropertyRender.js +111 -0
  129. package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +1 -0
  130. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +20 -0
  131. package/lib/cjs/widget/components/property-grid/PropertyView.js +218 -0
  132. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -0
  133. package/lib/cjs/widget/components/property-grid/PropertyView.scss +111 -0
  134. package/lib/cjs/widget/components/utils.d.ts +14 -0
  135. package/lib/cjs/widget/components/utils.js +82 -0
  136. package/lib/cjs/widget/components/utils.js.map +1 -0
  137. package/lib/cjs/widget/components/utils.scss +36 -0
  138. package/lib/cjs/widget/components/viewerUtils.d.ts +9 -0
  139. package/lib/cjs/widget/components/viewerUtils.js +115 -0
  140. package/lib/cjs/widget/components/viewerUtils.js.map +1 -0
  141. package/lib/cjs/widget/hooks/useFetchAccessToken.d.ts +3 -0
  142. package/lib/cjs/widget/hooks/useFetchAccessToken.js +22 -0
  143. package/lib/cjs/widget/hooks/useFetchAccessToken.js.map +1 -0
  144. package/lib/cjs/widget/hooks/useValidator.d.ts +45 -0
  145. package/lib/cjs/widget/hooks/useValidator.js +53 -0
  146. package/lib/cjs/widget/hooks/useValidator.js.map +1 -0
  147. package/lib/cjs/widget/icons/DatabaseInfo.d.ts +5 -0
  148. package/lib/cjs/widget/icons/DatabaseInfo.js +19 -0
  149. package/lib/cjs/widget/icons/DatabaseInfo.js.map +1 -0
  150. package/lib/cjs/widget/icons/DatabaseInfo.scss +12 -0
  151. package/lib/cjs/widget/utils.d.ts +4 -0
  152. package/lib/cjs/widget/utils.js +3 -0
  153. package/lib/cjs/widget/utils.js.map +1 -0
  154. package/lib/esm/api/GroupQueryBuilderApi.d.ts +15 -0
  155. package/lib/esm/api/GroupQueryBuilderApi.js +23 -0
  156. package/lib/esm/api/GroupQueryBuilderApi.js.map +1 -0
  157. package/lib/esm/api/generated/api.d.ts +3222 -0
  158. package/lib/esm/api/generated/api.js +5248 -0
  159. package/lib/esm/api/generated/api.js.map +1 -0
  160. package/lib/esm/api/generated/configuration.d.ts +56 -0
  161. package/lib/esm/api/generated/configuration.js +26 -0
  162. package/lib/esm/api/generated/configuration.js.map +1 -0
  163. package/lib/esm/api/generated/index.d.ts +14 -0
  164. package/lib/esm/api/generated/index.js +19 -0
  165. package/lib/esm/api/generated/index.js.map +1 -0
  166. package/lib/esm/api/reportingClient.d.ts +34 -0
  167. package/lib/esm/api/reportingClient.js +173 -0
  168. package/lib/esm/api/reportingClient.js.map +1 -0
  169. package/lib/esm/decorators/BboxDimensionsDecorator.d.ts +82 -0
  170. package/lib/esm/decorators/BboxDimensionsDecorator.js +414 -0
  171. package/lib/esm/decorators/BboxDimensionsDecorator.js.map +1 -0
  172. package/lib/esm/grouping-mapping-widget.d.ts +7 -0
  173. package/lib/esm/grouping-mapping-widget.js +11 -0
  174. package/lib/esm/grouping-mapping-widget.js.map +1 -0
  175. package/lib/esm/widget/GroupingMappingWidget.d.ts +7 -0
  176. package/lib/esm/widget/GroupingMappingWidget.js +25 -0
  177. package/lib/esm/widget/GroupingMappingWidget.js.map +1 -0
  178. package/lib/esm/widget/components/ActionPanel.d.ts +11 -0
  179. package/lib/esm/widget/components/ActionPanel.js +16 -0
  180. package/lib/esm/widget/components/ActionPanel.js.map +1 -0
  181. package/lib/esm/widget/components/ActionPanel.scss +12 -0
  182. package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +14 -0
  183. package/lib/esm/widget/components/CalculatedPropertyAction.js +136 -0
  184. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -0
  185. package/lib/esm/widget/components/CalculatedPropertyAction.scss +27 -0
  186. package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +18 -0
  187. package/lib/esm/widget/components/CalculatedPropertyTable.js +85 -0
  188. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -0
  189. package/lib/esm/widget/components/ConfirmMappingsImport.d.ts +16 -0
  190. package/lib/esm/widget/components/ConfirmMappingsImport.js +91 -0
  191. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -0
  192. package/lib/esm/widget/components/ConfirmMappingsImport.scss +84 -0
  193. package/lib/esm/widget/components/CustomCalculationAction.d.ts +14 -0
  194. package/lib/esm/widget/components/CustomCalculationAction.js +79 -0
  195. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -0
  196. package/lib/esm/widget/components/CustomCalculationAction.scss +16 -0
  197. package/lib/esm/widget/components/CustomCalculationTable.d.ts +18 -0
  198. package/lib/esm/widget/components/CustomCalculationTable.js +90 -0
  199. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -0
  200. package/lib/esm/widget/components/DeleteModal.d.ts +12 -0
  201. package/lib/esm/widget/components/DeleteModal.js +41 -0
  202. package/lib/esm/widget/components/DeleteModal.js.map +1 -0
  203. package/lib/esm/widget/components/DeleteModal.scss +12 -0
  204. package/lib/esm/widget/components/GroupAction.d.ts +12 -0
  205. package/lib/esm/widget/components/GroupAction.js +142 -0
  206. package/lib/esm/widget/components/GroupAction.js.map +1 -0
  207. package/lib/esm/widget/components/GroupAction.scss +19 -0
  208. package/lib/esm/widget/components/GroupPropertyAction.d.ts +17 -0
  209. package/lib/esm/widget/components/GroupPropertyAction.js +347 -0
  210. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -0
  211. package/lib/esm/widget/components/GroupPropertyAction.scss +36 -0
  212. package/lib/esm/widget/components/GroupPropertyTable.d.ts +18 -0
  213. package/lib/esm/widget/components/GroupPropertyTable.js +85 -0
  214. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -0
  215. package/lib/esm/widget/components/GroupQueryBuilder.scss +24 -0
  216. package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +4 -0
  217. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +43 -0
  218. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -0
  219. package/lib/esm/widget/components/GroupQueryBuilderContext.d.ts +13 -0
  220. package/lib/esm/widget/components/GroupQueryBuilderContext.js +15 -0
  221. package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +1 -0
  222. package/lib/esm/widget/components/Grouping.d.ts +12 -0
  223. package/lib/esm/widget/components/Grouping.js +188 -0
  224. package/lib/esm/widget/components/Grouping.js.map +1 -0
  225. package/lib/esm/widget/components/Grouping.scss +15 -0
  226. package/lib/esm/widget/components/GroupingMapping.d.ts +5 -0
  227. package/lib/esm/widget/components/GroupingMapping.js +13 -0
  228. package/lib/esm/widget/components/GroupingMapping.js.map +1 -0
  229. package/lib/esm/widget/components/GroupingMapping.scss +24 -0
  230. package/lib/esm/widget/components/Mapping.d.ts +7 -0
  231. package/lib/esm/widget/components/Mapping.js +136 -0
  232. package/lib/esm/widget/components/Mapping.js.map +1 -0
  233. package/lib/esm/widget/components/Mapping.scss +26 -0
  234. package/lib/esm/widget/components/MappingAction.d.ts +11 -0
  235. package/lib/esm/widget/components/MappingAction.js +74 -0
  236. package/lib/esm/widget/components/MappingAction.js.map +1 -0
  237. package/lib/esm/widget/components/MappingAction.scss +16 -0
  238. package/lib/esm/widget/components/MappingImportWizardModal.d.ts +10 -0
  239. package/lib/esm/widget/components/MappingImportWizardModal.js +76 -0
  240. package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -0
  241. package/lib/esm/widget/components/MappingImportWizardModal.scss +21 -0
  242. package/lib/esm/widget/components/PropertyMenu.d.ts +24 -0
  243. package/lib/esm/widget/components/PropertyMenu.js +115 -0
  244. package/lib/esm/widget/components/PropertyMenu.js.map +1 -0
  245. package/lib/esm/widget/components/PropertyMenu.scss +48 -0
  246. package/lib/esm/widget/components/QueryBuilder.d.ts +39 -0
  247. package/lib/esm/widget/components/QueryBuilder.js +341 -0
  248. package/lib/esm/widget/components/QueryBuilder.js.map +1 -0
  249. package/lib/esm/widget/components/SelectIModel.d.ts +12 -0
  250. package/lib/esm/widget/components/SelectIModel.js +18 -0
  251. package/lib/esm/widget/components/SelectIModel.js.map +1 -0
  252. package/lib/esm/widget/components/SelectIModel.scss +20 -0
  253. package/lib/esm/widget/components/SelectMapping.scss +17 -0
  254. package/lib/esm/widget/components/SelectMappings.d.ts +12 -0
  255. package/lib/esm/widget/components/SelectMappings.js +61 -0
  256. package/lib/esm/widget/components/SelectMappings.js.map +1 -0
  257. package/lib/esm/widget/components/SelectProject.d.ts +10 -0
  258. package/lib/esm/widget/components/SelectProject.js +47 -0
  259. package/lib/esm/widget/components/SelectProject.js.map +1 -0
  260. package/lib/esm/widget/components/SelectProject.scss +38 -0
  261. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +33 -0
  262. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +69 -0
  263. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -0
  264. package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +16 -0
  265. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +26 -0
  266. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +35 -0
  267. package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +1 -0
  268. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +67 -0
  269. package/lib/esm/widget/components/property-grid/PropertyGrid.js +172 -0
  270. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -0
  271. package/lib/esm/widget/components/property-grid/PropertyGrid.scss +71 -0
  272. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +17 -0
  273. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +44 -0
  274. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -0
  275. package/lib/esm/widget/components/property-grid/PropertyList.d.ts +69 -0
  276. package/lib/esm/widget/components/property-grid/PropertyList.js +60 -0
  277. package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -0
  278. package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +92 -0
  279. package/lib/esm/widget/components/property-grid/PropertyRender.js +88 -0
  280. package/lib/esm/widget/components/property-grid/PropertyRender.js.map +1 -0
  281. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +20 -0
  282. package/lib/esm/widget/components/property-grid/PropertyView.js +195 -0
  283. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -0
  284. package/lib/esm/widget/components/property-grid/PropertyView.scss +111 -0
  285. package/lib/esm/widget/components/utils.d.ts +14 -0
  286. package/lib/esm/widget/components/utils.js +72 -0
  287. package/lib/esm/widget/components/utils.js.map +1 -0
  288. package/lib/esm/widget/components/utils.scss +36 -0
  289. package/lib/esm/widget/components/viewerUtils.d.ts +9 -0
  290. package/lib/esm/widget/components/viewerUtils.js +106 -0
  291. package/lib/esm/widget/components/viewerUtils.js.map +1 -0
  292. package/lib/esm/widget/hooks/useFetchAccessToken.d.ts +3 -0
  293. package/lib/esm/widget/hooks/useFetchAccessToken.js +20 -0
  294. package/lib/esm/widget/hooks/useFetchAccessToken.js.map +1 -0
  295. package/lib/esm/widget/hooks/useValidator.d.ts +45 -0
  296. package/lib/esm/widget/hooks/useValidator.js +47 -0
  297. package/lib/esm/widget/hooks/useValidator.js.map +1 -0
  298. package/lib/esm/widget/icons/DatabaseInfo.d.ts +5 -0
  299. package/lib/esm/widget/icons/DatabaseInfo.js +14 -0
  300. package/lib/esm/widget/icons/DatabaseInfo.js.map +1 -0
  301. package/lib/esm/widget/icons/DatabaseInfo.scss +12 -0
  302. package/lib/esm/widget/utils.d.ts +4 -0
  303. package/lib/esm/widget/utils.js +2 -0
  304. package/lib/esm/widget/utils.js.map +1 -0
  305. package/package.json +116 -0
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ /*---------------------------------------------------------------------------------------------
23
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
24
+ * See LICENSE.md in the project root for license terms and full copyright notice.
25
+ *--------------------------------------------------------------------------------------------*/
26
+ const itwinui_react_1 = require("@itwin/itwinui-react");
27
+ const React = __importStar(require("react"));
28
+ require("./ActionPanel.scss");
29
+ const ActionPanel = ({ onSave, onCancel, disabled = false, isLoading = false, }) => {
30
+ return (React.createElement("div", { id: 'action', className: 'action-panel-container' },
31
+ React.createElement("div", { className: 'action-panel' },
32
+ isLoading ? (React.createElement(itwinui_react_1.IconButton, { styleType: 'high-visibility' },
33
+ React.createElement(itwinui_react_1.ProgressRadial, { size: "small", indeterminate: true }))) : (React.createElement(itwinui_react_1.Button, { disabled: disabled, styleType: 'high-visibility', id: 'save-app', onClick: onSave }, "Save")),
34
+ React.createElement(itwinui_react_1.Button, { styleType: 'default', type: 'button', id: 'cancel', onClick: onCancel, disabled: isLoading }, "Cancel"))));
35
+ };
36
+ exports.default = ActionPanel;
37
+ //# sourceMappingURL=ActionPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionPanel.js","sourceRoot":"","sources":["../../../../src/widget/components/ActionPanel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAA0E;AAC1E,6CAA+B;AAC/B,8BAA4B;AAS5B,MAAM,WAAW,GAAG,CAAC,EACnB,MAAM,EACN,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,GACA,EAAe,EAAE;IAClC,OAAO,CACL,6BAAK,EAAE,EAAC,QAAQ,EAAC,SAAS,EAAC,wBAAwB;QACjD,6BAAK,SAAS,EAAC,cAAc;YAC1B,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,0BAAU,IAAC,SAAS,EAAC,iBAAiB;gBACrC,oBAAC,8BAAc,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CAClC,CACd,CAAC,CAAC,CAAC,CACF,oBAAC,sBAAM,IACL,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAC,iBAAiB,EAC3B,EAAE,EAAC,UAAU,EACb,OAAO,EAAE,MAAM,WAGR,CACV;YACD,oBAAC,sBAAM,IACL,SAAS,EAAC,SAAS,EACnB,IAAI,EAAC,QAAQ,EACb,EAAE,EAAC,QAAQ,EACX,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,SAAS,aAGZ,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,WAAW,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 { Button, IconButton, ProgressRadial } from \"@itwin/itwinui-react\";\nimport * as React from \"react\";\nimport \"./ActionPanel.scss\";\n\nexport interface ActionPanelProps {\n onSave: () => void;\n onCancel: () => void;\n disabled?: boolean;\n isLoading?: boolean;\n}\n\nconst ActionPanel = ({\n onSave,\n onCancel,\n disabled = false,\n isLoading = false,\n}: ActionPanelProps): JSX.Element => {\n return (\n <div id='action' className='action-panel-container'>\n <div className='action-panel'>\n {isLoading ? (\n <IconButton styleType='high-visibility'>\n <ProgressRadial size=\"small\" indeterminate />\n </IconButton>\n ) : (\n <Button\n disabled={disabled}\n styleType='high-visibility'\n id='save-app'\n onClick={onSave}\n >\n Save\n </Button>\n )}\n <Button\n styleType='default'\n type='button'\n id='cancel'\n onClick={onCancel}\n disabled={isLoading}\n >\n Cancel\n </Button>\n </div>\n </div>\n );\n};\n\nexport default ActionPanel;\n"]}
@@ -0,0 +1,12 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import '~@itwin/itwinui-css/scss/variables';
6
+
7
+ .action-panel {
8
+ display: flex;
9
+ justify-content: right;
10
+ padding: $iui-baseline * 2 $iui-m $iui-baseline;
11
+ gap: $iui-s;
12
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import "./CalculatedPropertyAction.scss";
3
+ import type { CalculatedProperty } from "./CalculatedPropertyTable";
4
+ interface CalculatedPropertyActionProps {
5
+ iModelId: string;
6
+ mappingId: string;
7
+ groupId: string;
8
+ property?: CalculatedProperty;
9
+ ids: string[];
10
+ returnFn: () => Promise<void>;
11
+ }
12
+ declare const CalculatedPropertyAction: ({ iModelId, mappingId, groupId, property, ids, returnFn, }: CalculatedPropertyActionProps) => JSX.Element;
13
+ export default CalculatedPropertyAction;
14
+ //# sourceMappingURL=CalculatedPropertyAction.d.ts.map
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ /*---------------------------------------------------------------------------------------------
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
+ *--------------------------------------------------------------------------------------------*/
29
+ const core_frontend_1 = require("@itwin/core-frontend");
30
+ const itwinui_react_1 = require("@itwin/itwinui-react");
31
+ const react_1 = __importStar(require("react"));
32
+ const reportingClient_1 = require("../../api/reportingClient");
33
+ const ActionPanel_1 = __importDefault(require("./ActionPanel"));
34
+ const BboxDimensionsDecorator_1 = require("../../decorators/BboxDimensionsDecorator");
35
+ const useValidator_1 = __importStar(require("../hooks/useValidator"));
36
+ const utils_1 = require("./utils");
37
+ const viewerUtils_1 = require("./viewerUtils");
38
+ require("./CalculatedPropertyAction.scss");
39
+ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids, returnFn, }) => {
40
+ var _a, _b, _c;
41
+ const [propertyName, setPropertyName] = react_1.useState((_a = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _a !== void 0 ? _a : "");
42
+ const [type, setType] = react_1.useState((_b = property === null || property === void 0 ? void 0 : property.type) !== null && _b !== void 0 ? _b : "");
43
+ const [bboxDecorator, setBboxDecorator] = react_1.useState();
44
+ const [isLoading, setIsLoading] = react_1.useState(false);
45
+ const [inferredSpatialData, setInferredSpatialData] = react_1.useState();
46
+ const [validator, showValidationMessage] = useValidator_1.default();
47
+ react_1.useEffect(() => {
48
+ const decorator = new BboxDimensionsDecorator_1.BboxDimensionsDecorator();
49
+ core_frontend_1.IModelApp.viewManager.addDecorator(decorator);
50
+ setBboxDecorator(decorator);
51
+ return () => {
52
+ core_frontend_1.IModelApp.viewManager.dropDecorator(decorator);
53
+ };
54
+ }, []);
55
+ react_1.useEffect(() => {
56
+ viewerUtils_1.visualizeElements([ids[0]], "red");
57
+ void viewerUtils_1.zoomToElements([ids[0]]);
58
+ }, [ids]);
59
+ react_1.useEffect(() => {
60
+ const setContext = async () => {
61
+ if (bboxDecorator) {
62
+ await bboxDecorator.setContext(ids[0]);
63
+ setInferredSpatialData(bboxDecorator.getInferredSpatialData());
64
+ }
65
+ };
66
+ void setContext();
67
+ }, [bboxDecorator, ids]);
68
+ react_1.useEffect(() => {
69
+ if (bboxDecorator && type && inferredSpatialData) {
70
+ inferredSpatialData.has(BboxDimensionsDecorator_1.BboxDimension[type])
71
+ ? bboxDecorator.drawContext(BboxDimensionsDecorator_1.BboxDimension[type])
72
+ : bboxDecorator.clearContext();
73
+ }
74
+ }, [bboxDecorator, inferredSpatialData, type]);
75
+ // TODO ERRORED STATE
76
+ const onSave = async () => {
77
+ var _a;
78
+ if (!validator.allValid()) {
79
+ showValidationMessage(true);
80
+ return;
81
+ }
82
+ try {
83
+ setIsLoading(true);
84
+ const calculatedProperty = {
85
+ propertyName,
86
+ type,
87
+ };
88
+ property
89
+ ? await reportingClient_1.reportingClientApi.updateCalculatedProperty(iModelId, mappingId, groupId, (_a = property.id) !== null && _a !== void 0 ? _a : "", calculatedProperty)
90
+ : await reportingClient_1.reportingClientApi.createCalculatedProperty(iModelId, mappingId, groupId, calculatedProperty);
91
+ await returnFn();
92
+ }
93
+ catch {
94
+ setIsLoading(false);
95
+ }
96
+ };
97
+ const getSpatialData = (value) => {
98
+ var _a;
99
+ 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`));
100
+ };
101
+ return (react_1.default.createElement(react_1.default.Fragment, null,
102
+ react_1.default.createElement(utils_1.WidgetHeader, { title: property
103
+ ? `${(_c = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _c !== void 0 ? _c : ""}`
104
+ : "Create Calculated Property", returnFn: returnFn }),
105
+ react_1.default.createElement("div", { className: 'calculated-properties-action-container' },
106
+ react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Calculated Property Details', className: 'details-form' },
107
+ react_1.default.createElement(itwinui_react_1.Small, { className: 'field-legend' }, "Asterisk * indicates mandatory fields."),
108
+ react_1.default.createElement(itwinui_react_1.LabeledInput, { value: propertyName, required: true, name: 'name', label: 'Name', onChange: (event) => {
109
+ setPropertyName(event.target.value);
110
+ validator.showMessageFor("name");
111
+ }, message: validator.message("name", propertyName, useValidator_1.NAME_REQUIREMENTS), status: validator.message("name", propertyName, useValidator_1.NAME_REQUIREMENTS)
112
+ ? "negative"
113
+ : undefined, onBlur: () => {
114
+ validator.showMessageFor("name");
115
+ }, onBlurCapture: (event) => {
116
+ setPropertyName(event.target.value);
117
+ validator.showMessageFor("name");
118
+ } }),
119
+ react_1.default.createElement(itwinui_react_1.LabeledSelect, { label: 'Quantity Type', required: true, options: [
120
+ { value: "Length", label: "Length" },
121
+ { value: "Area", label: "Area" },
122
+ { value: "Volume", label: "Volume" },
123
+ {
124
+ value: "BoundingBoxLongestEdgeLength",
125
+ label: "Longest Edge Length",
126
+ },
127
+ {
128
+ value: "BoundingBoxIntermediateEdgeLength",
129
+ label: "Intermediate Edge Length",
130
+ },
131
+ {
132
+ value: "BoundingBoxShortestEdgeLength",
133
+ label: "Shortest Edge Length",
134
+ },
135
+ {
136
+ value: "BoundingBoxDiagonalLength",
137
+ label: "Diagonal Length",
138
+ },
139
+ {
140
+ value: "BoundingBoxLongestFaceDiagonalLength",
141
+ label: "Longest Face Diagonal Length",
142
+ },
143
+ {
144
+ value: "BoundingBoxIntermediateFaceDiagonalLength",
145
+ label: "Intermediate Face Diagonal Length",
146
+ },
147
+ {
148
+ value: "BoundingBoxShortestFaceDiagonalLength",
149
+ label: "Shortest Face Diagonal Length",
150
+ },
151
+ ], value: type, onChange: setType, itemRenderer: (option) => (react_1.default.createElement(itwinui_react_1.MenuItem, null,
152
+ react_1.default.createElement("div", { className: 'menu-item' },
153
+ react_1.default.createElement("div", null, option.label),
154
+ getSpatialData(option.value)))), selectedItemRenderer: (option) => (react_1.default.createElement("div", { className: 'select-item' },
155
+ react_1.default.createElement("div", null, option.label),
156
+ getSpatialData(option.value))), onShow: () => { }, onHide: () => { } }))),
157
+ react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: returnFn, disabled: !(type && propertyName), isLoading: isLoading })));
158
+ };
159
+ exports.default = CalculatedPropertyAction;
160
+ //# sourceMappingURL=CalculatedPropertyAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAGjD,wDAM8B;AAC9B,+CAAmD;AAEnD,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I,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CAC9C,8BAAC,wBAAQ;wBACP,uCAAK,SAAS,EAAC,WAAW;4BACxB,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,aAAa;wBAC1B,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,QAAQ,EAClB,QAAQ,EAAE,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,EACjC,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} 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 type { CalculatedPropertyCreateReportingAPI } from \"../../api/generated/api\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport ActionPanel from \"./ActionPanel\";\nimport {\n BboxDimension,\n BboxDimensionsDecorator,\n} from \"../../decorators/BboxDimensionsDecorator\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { WidgetHeader } from \"./utils\";\nimport { visualizeElements, zoomToElements } from \"./viewerUtils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { CalculatedProperty } from \"./CalculatedPropertyTable\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: CalculatedProperty;\n ids: string[];\n returnFn: () => Promise<void>;\n}\n\nconst CalculatedPropertyAction = ({\n iModelId,\n mappingId,\n groupId,\n property,\n ids,\n returnFn,\n}: CalculatedPropertyActionProps) => {\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<string>(property?.type ?? \"\");\n const [bboxDecorator, setBboxDecorator] = useState<\n BboxDimensionsDecorator | undefined\n >();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [inferredSpatialData, setInferredSpatialData] = useState<\n Map<BboxDimension, number> | undefined\n >();\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 visualizeElements([ids[0]], \"red\");\n void zoomToElements([ids[0]]);\n }, [ids]);\n\n useEffect(() => {\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 // TODO ERRORED STATE\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n try {\n setIsLoading(true);\n\n const calculatedProperty: CalculatedPropertyCreateReportingAPI = {\n propertyName,\n type,\n };\n\n property\n ? await reportingClientApi.updateCalculatedProperty(\n iModelId,\n mappingId,\n groupId,\n property.id ?? \"\",\n calculatedProperty,\n )\n : await reportingClientApi.createCalculatedProperty(\n iModelId,\n mappingId,\n groupId,\n calculatedProperty,\n );\n await returnFn();\n } catch {\n setIsLoading(false);\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 return (\n <>\n <WidgetHeader\n title={\n property\n ? `${property?.propertyName ?? \"\"}`\n : \"Create Calculated Property\"\n }\n returnFn={returnFn}\n />\n <div className='calculated-properties-action-container'>\n <Fieldset legend='Calculated Property Details' className='details-form'>\n <Small className='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<string>\n label='Quantity Type'\n required\n options={[\n { value: \"Length\", label: \"Length\" },\n { value: \"Area\", label: \"Area\" },\n { value: \"Volume\", label: \"Volume\" },\n {\n value: \"BoundingBoxLongestEdgeLength\",\n label: \"Longest Edge Length\",\n },\n {\n value: \"BoundingBoxIntermediateEdgeLength\",\n label: \"Intermediate Edge Length\",\n },\n {\n value: \"BoundingBoxShortestEdgeLength\",\n label: \"Shortest Edge Length\",\n },\n {\n value: \"BoundingBoxDiagonalLength\",\n label: \"Diagonal Length\",\n },\n {\n value: \"BoundingBoxLongestFaceDiagonalLength\",\n label: \"Longest Face Diagonal Length\",\n },\n {\n value: \"BoundingBoxIntermediateFaceDiagonalLength\",\n label: \"Intermediate Face Diagonal Length\",\n },\n {\n value: \"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='menu-item'>\n <div>{option.label}</div>\n {getSpatialData(option.value)}\n </div>\n </MenuItem>\n )}\n selectedItemRenderer={(option: SelectOption<string>) => (\n <div className='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={returnFn}\n disabled={!(type && propertyName)}\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyAction;\n"]}
@@ -0,0 +1,27 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import '~@itwin/itwinui-css/scss/variables';
6
+
7
+ .calculated-properties-action-container {
8
+ overflow-x: auto;
9
+ height: 100%;
10
+
11
+ .details-form {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: $iui-baseline;
15
+
16
+ .menu-item {
17
+ display: flex;
18
+ justify-content: space-between;
19
+ }
20
+
21
+ .select-item {
22
+ display: flex;
23
+ justify-content: space-between;
24
+ width: 100%;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { CalculatedPropertyReportingAPI } from "../../api/generated/api";
3
+ import type { CreateTypeFromInterface } from "../utils";
4
+ import { PropertyMenuView } from "./PropertyMenu";
5
+ import type { CellProps } from "react-table";
6
+ export declare type CalculatedProperty = CreateTypeFromInterface<CalculatedPropertyReportingAPI>;
7
+ interface CalculatedPropertyTableProps {
8
+ iModelId: string;
9
+ mappingId: string;
10
+ groupId: string;
11
+ setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<CreateTypeFromInterface<CalculatedPropertyReportingAPI> | undefined>>;
12
+ setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;
13
+ onCalculatedPropertyModify: (value: CellProps<CalculatedProperty>) => void;
14
+ selectedCalculatedProperty?: CalculatedProperty;
15
+ }
16
+ declare const CalculatedPropertyTable: ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, selectedCalculatedProperty, }: CalculatedPropertyTableProps) => JSX.Element;
17
+ export default CalculatedPropertyTable;
18
+ //# sourceMappingURL=CalculatedPropertyTable.d.ts.map
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ /*---------------------------------------------------------------------------------------------
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
+ *--------------------------------------------------------------------------------------------*/
29
+ const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
30
+ const itwinui_react_1 = require("@itwin/itwinui-react");
31
+ const react_1 = __importStar(require("react"));
32
+ const reportingClient_1 = require("../../api/reportingClient");
33
+ const PropertyMenu_1 = require("./PropertyMenu");
34
+ const DeleteModal_1 = __importDefault(require("./DeleteModal"));
35
+ const fetchCalculatedProperties = async (setCalculatedProperties, iModelId, mappingId, groupId, setIsLoading) => {
36
+ var _a;
37
+ try {
38
+ setIsLoading(true);
39
+ const calculatedProperties = await reportingClient_1.reportingClientApi.getCalculatedProperties(iModelId, mappingId, groupId);
40
+ setCalculatedProperties((_a = calculatedProperties.properties) !== null && _a !== void 0 ? _a : []);
41
+ }
42
+ catch {
43
+ // TODO Toaster
44
+ }
45
+ finally {
46
+ setIsLoading(false);
47
+ }
48
+ };
49
+ const useFetchCalculatedProperties = (iModelId, mappingId, groupId, setIsLoading) => {
50
+ const [calculatedProperties, setCalculatedProperties] = react_1.useState([]);
51
+ react_1.useEffect(() => {
52
+ void fetchCalculatedProperties(setCalculatedProperties, iModelId, mappingId, groupId, setIsLoading);
53
+ }, [groupId, iModelId, mappingId, setIsLoading]);
54
+ return [calculatedProperties, setCalculatedProperties];
55
+ };
56
+ const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, selectedCalculatedProperty, }) => {
57
+ var _a;
58
+ const [isLoading, setIsLoading] = react_1.useState(true);
59
+ const [calculatedProperties, setCalculatedProperties] = useFetchCalculatedProperties(iModelId, mappingId, groupId, setIsLoading);
60
+ const [showCalculatedPropertyDeleteModal, setShowCalculatedPropertyDeleteModal,] = react_1.useState(false);
61
+ const refresh = react_1.useCallback(async () => {
62
+ setCalculatedProperties([]);
63
+ await fetchCalculatedProperties(setCalculatedProperties, iModelId, mappingId, groupId, setIsLoading);
64
+ }, [groupId, iModelId, mappingId, setCalculatedProperties]);
65
+ const calculatedPropertiesColumns = react_1.useMemo(() => [
66
+ {
67
+ Header: "Table",
68
+ columns: [
69
+ {
70
+ id: "propertyName",
71
+ Header: "Calculated Property",
72
+ accessor: "propertyName",
73
+ Cell: (value) => (react_1.default.createElement("div", { className: 'iui-anchor', onClick: () => onCalculatedPropertyModify(value) }, value.row.original.propertyName)),
74
+ },
75
+ {
76
+ id: "dropdown",
77
+ Header: "",
78
+ width: 80,
79
+ Cell: (value) => {
80
+ return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
81
+ 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"),
82
+ react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
83
+ setSelectedCalculatedProperty(value.row.original);
84
+ setShowCalculatedPropertyDeleteModal(true);
85
+ close();
86
+ }, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, "Remove"),
87
+ ] },
88
+ react_1.default.createElement(itwinui_react_1.IconButton, { styleType: 'borderless' },
89
+ react_1.default.createElement(itwinui_icons_react_1.SvgMore, { style: {
90
+ width: "16px",
91
+ height: "16px",
92
+ } }))));
93
+ },
94
+ },
95
+ ],
96
+ },
97
+ ], [onCalculatedPropertyModify, setSelectedCalculatedProperty]);
98
+ return (react_1.default.createElement(react_1.default.Fragment, null,
99
+ react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), styleType: 'high-visibility', onClick: () => {
100
+ setGroupModifyView(PropertyMenu_1.PropertyMenuView.ADD_CALCULATED_PROPERTY);
101
+ } }, "Add Calculated Property"),
102
+ react_1.default.createElement(itwinui_react_1.Table, { data: calculatedProperties, density: 'extra-condensed', columns: calculatedPropertiesColumns, emptyTableContent: 'No Calculated Properties', isSortable: true, isLoading: isLoading }),
103
+ 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 () => {
104
+ var _a;
105
+ await reportingClient_1.reportingClientApi.deleteCalculatedProperty(iModelId, mappingId, groupId, (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.id) !== null && _a !== void 0 ? _a : "");
106
+ }, refresh: refresh })));
107
+ };
108
+ exports.default = CalculatedPropertyTable;
109
+ //# sourceMappingURL=CalculatedPropertyTable.js.map
@@ -0,0 +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,+CAAyE;AAEzE,+DAA+D;AAE/D,iDAAkD;AAElD,gEAAwC;AAKxC,MAAM,yBAAyB,GAAG,KAAK,EACrC,uBAEC,EACD,QAAgB,EAChB,SAAiB,EACjB,OAAe,EACf,YAA2D,EAC3D,EAAE;;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,oBAAoB,GACxB,MAAM,oCAAkB,CAAC,uBAAuB,CAC9C,QAAQ,EACR,SAAS,EACT,OAAO,CACR,CAAC;QACJ,uBAAuB,CAAC,MAAA,oBAAoB,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC;KAChE;IAAC,MAAM;QACN,eAAe;KAChB;YAAS;QACR,YAAY,CAAC,KAAK,CAAC,CAAC;KACrB;AACH,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CACnC,QAAgB,EAChB,SAAiB,EACjB,OAAe,EACf,YAA2D,EAI3D,EAAE;IACF,MAAM,CAAC,oBAAoB,EAAE,uBAA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,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,SAAS,GACpB;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,oCAAkB,CAAC,wBAAwB,CAC/C,QAAQ,EACR,SAAS,EACT,OAAO,EACP,MAAA,0BAA0B,aAA1B,0BAA0B,uBAA1B,0BAA0B,CAAE,EAAE,mCAAI,EAAE,CACrC,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB,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, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CalculatedPropertyReportingAPI } from \"../../api/generated/api\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport type { CreateTypeFromInterface } from \"../utils\";\nimport { PropertyMenuView } from \"./PropertyMenu\";\nimport type { CellProps } from \"react-table\";\nimport DeleteModal from \"./DeleteModal\";\n\nexport type CalculatedProperty =\n CreateTypeFromInterface<CalculatedPropertyReportingAPI>;\n\nconst fetchCalculatedProperties = async (\n setCalculatedProperties: React.Dispatch<\n React.SetStateAction<CalculatedProperty[]>\n >,\n iModelId: string,\n mappingId: string,\n groupId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n) => {\n try {\n setIsLoading(true);\n const calculatedProperties =\n await reportingClientApi.getCalculatedProperties(\n iModelId,\n mappingId,\n groupId,\n );\n setCalculatedProperties(calculatedProperties.properties ?? []);\n } catch {\n // TODO Toaster\n } finally {\n setIsLoading(false);\n }\n};\n\nconst useFetchCalculatedProperties = (\n iModelId: string,\n mappingId: string,\n groupId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n): [\n CalculatedProperty[],\n React.Dispatch<React.SetStateAction<CalculatedProperty[]>>,\n] => {\n const [calculatedProperties, setCalculatedProperties] = useState<\n CalculatedProperty[]\n >([]);\n\n useEffect(() => {\n void fetchCalculatedProperties(\n setCalculatedProperties,\n iModelId,\n mappingId,\n groupId,\n setIsLoading,\n );\n }, [groupId, iModelId, mappingId, setIsLoading]);\n\n return [calculatedProperties, setCalculatedProperties];\n};\n\ninterface CalculatedPropertyTableProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n\n setSelectedCalculatedProperty: React.Dispatch<\n React.SetStateAction<\n CreateTypeFromInterface<CalculatedPropertyReportingAPI> | undefined\n >\n >;\n setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;\n onCalculatedPropertyModify: (value: CellProps<CalculatedProperty>) => void;\n selectedCalculatedProperty?: CalculatedProperty;\n}\n\nconst CalculatedPropertyTable = ({\n iModelId,\n mappingId,\n groupId,\n setSelectedCalculatedProperty,\n setGroupModifyView,\n onCalculatedPropertyModify,\n selectedCalculatedProperty,\n}: CalculatedPropertyTableProps) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [calculatedProperties, setCalculatedProperties] =\n useFetchCalculatedProperties(iModelId, mappingId, groupId, setIsLoading);\n const [\n showCalculatedPropertyDeleteModal,\n setShowCalculatedPropertyDeleteModal,\n ] = useState<boolean>(false);\n\n const refresh = useCallback(async () => {\n setCalculatedProperties([]);\n await fetchCalculatedProperties(\n setCalculatedProperties,\n iModelId,\n mappingId,\n groupId,\n setIsLoading,\n );\n }, [groupId, iModelId, mappingId, setCalculatedProperties]);\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<CalculatedProperty>) => (\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<CalculatedProperty>) => {\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<CalculatedProperty>\n data={calculatedProperties}\n density='extra-condensed'\n columns={calculatedPropertiesColumns}\n emptyTableContent='No Calculated Properties'\n isSortable\n isLoading={isLoading}\n />\n\n <DeleteModal\n entityName={selectedCalculatedProperty?.propertyName ?? \"\"}\n show={showCalculatedPropertyDeleteModal}\n setShow={setShowCalculatedPropertyDeleteModal}\n onDelete={async () => {\n await reportingClientApi.deleteCalculatedProperty(\n iModelId,\n mappingId,\n groupId,\n selectedCalculatedProperty?.id ?? \"\",\n );\n }}\n refresh={refresh}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyTable;\n"]}
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import type { Mapping } from "./Mapping";
3
+ import "./ConfirmMappingsImport.scss";
4
+ interface ConfirmMappingImportProps {
5
+ sourceiModelId: string;
6
+ selectedMappings: Mapping[];
7
+ importing: boolean;
8
+ setImporting: React.Dispatch<React.SetStateAction<boolean>>;
9
+ setSelectedMappings: React.Dispatch<React.SetStateAction<Mapping[]>>;
10
+ backFn: () => void;
11
+ onCancel: () => void;
12
+ onFinish: () => void;
13
+ }
14
+ declare const ConfirmMappingImport: ({ sourceiModelId, selectedMappings, importing, setImporting, setSelectedMappings, backFn, onCancel, onFinish, }: ConfirmMappingImportProps) => JSX.Element;
15
+ export default ConfirmMappingImport;
16
+ //# sourceMappingURL=ConfirmMappingsImport.d.ts.map
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ /*---------------------------------------------------------------------------------------------
23
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
24
+ * See LICENSE.md in the project root for license terms and full copyright notice.
25
+ *--------------------------------------------------------------------------------------------*/
26
+ const itwinui_react_1 = require("@itwin/itwinui-react");
27
+ const react_1 = __importStar(require("react"));
28
+ require("./ConfirmMappingsImport.scss");
29
+ const reportingClient_1 = require("../../api/reportingClient");
30
+ const appui_react_1 = require("@itwin/appui-react");
31
+ const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
32
+ const useValidator_1 = __importStar(require("../hooks/useValidator"));
33
+ const ConfirmMappingImport = ({ sourceiModelId, selectedMappings, importing, setImporting, setSelectedMappings, backFn, onCancel, onFinish, }) => {
34
+ var _a;
35
+ const iModelId = (_a = appui_react_1.useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iModelId;
36
+ const [importCount, setImportCount] = react_1.useState(0);
37
+ const [currentlyImporting, setCurrentlyImporting] = react_1.useState("");
38
+ const [validator, showValidationMessage] = useValidator_1.default();
39
+ react_1.useEffect(() => {
40
+ setSelectedMappings((selectedMappings) => selectedMappings.map((mapping) => ({
41
+ ...mapping,
42
+ mappingName: `${mapping.mappingName}_Copy`,
43
+ })));
44
+ }, [setSelectedMappings]);
45
+ const handleChange = (e, index) => {
46
+ const newState = [...selectedMappings];
47
+ newState[index] = {
48
+ ...newState[index],
49
+ mappingName: e.target.value,
50
+ };
51
+ setSelectedMappings(newState);
52
+ };
53
+ const onImport = async () => {
54
+ var _a, _b, _c;
55
+ if (!validator.allValid()) {
56
+ showValidationMessage(true);
57
+ return;
58
+ }
59
+ setImporting(true);
60
+ for (const selectedMapping of selectedMappings) {
61
+ setCurrentlyImporting((_a = selectedMapping.mappingName) !== null && _a !== void 0 ? _a : "");
62
+ await reportingClient_1.reportingClientApi.copyMapping(sourceiModelId, (_b = selectedMapping.id) !== null && _b !== void 0 ? _b : "", {
63
+ targetIModelId: iModelId,
64
+ mappingName: (_c = selectedMapping.mappingName) !== null && _c !== void 0 ? _c : "",
65
+ });
66
+ setImportCount((importCount) => importCount + 1);
67
+ }
68
+ };
69
+ return (react_1.default.createElement(react_1.default.Fragment, null, importing ? (react_1.default.createElement("div", { className: 'import-progress-container' },
70
+ react_1.default.createElement("div", { className: 'import-progress-bar' },
71
+ react_1.default.createElement("div", { className: 'import-progress-bar-description' }, importCount !== selectedMappings.length ? (react_1.default.createElement(react_1.default.Fragment, null,
72
+ react_1.default.createElement(itwinui_react_1.Text, { variant: 'title' }, "Importing"),
73
+ react_1.default.createElement(itwinui_react_1.Text, null, "We are currently importing the mappings."))) : (react_1.default.createElement(react_1.default.Fragment, null,
74
+ react_1.default.createElement(itwinui_react_1.Text, { variant: 'title' }, "Done!"),
75
+ react_1.default.createElement(itwinui_react_1.Text, null, "Your mapping(s) are ready.")))),
76
+ react_1.default.createElement(itwinui_react_1.ProgressLinear, { value: (importCount / selectedMappings.length) * 100, labels: importCount === selectedMappings.length
77
+ ? ["Import done!", react_1.default.createElement(itwinui_icons_react_1.SvgStatusSuccessHollow, { key: '0' })]
78
+ : [
79
+ react_1.default.createElement(react_1.default.Fragment, null,
80
+ react_1.default.createElement(itwinui_react_1.Text, null, "Copying"),
81
+ react_1.default.createElement(itwinui_react_1.MiddleTextTruncation, { text: currentlyImporting })),
82
+ `${importCount}/${selectedMappings.length}`,
83
+ ], status: importCount === selectedMappings.length ? "positive" : undefined })),
84
+ react_1.default.createElement("div", { className: 'finish-bar' },
85
+ react_1.default.createElement(itwinui_react_1.Button, { styleType: 'high-visibility', disabled: importCount !== selectedMappings.length, onClick: () => onFinish() }, "Close")))) : (react_1.default.createElement("div", { className: 'rename-confirm-container ' },
86
+ react_1.default.createElement("div", { className: 'mapping-rename-container' },
87
+ react_1.default.createElement("div", { className: 'mapping-row-header-container' },
88
+ react_1.default.createElement("div", { className: 'mapping-row' },
89
+ react_1.default.createElement(itwinui_react_1.Text, { variant: 'leading' }, "Mapping "),
90
+ react_1.default.createElement(itwinui_react_1.Text, { variant: 'leading' }, "Description"))),
91
+ react_1.default.createElement("div", { className: 'mapping-row-body' }, selectedMappings.map((mapping, index) => (react_1.default.createElement("div", { className: 'mapping-row-container', key: mapping.id },
92
+ react_1.default.createElement("div", { className: 'mapping-row' },
93
+ react_1.default.createElement(itwinui_react_1.LabeledInput, { value: mapping.mappingName, name: `mapping_${mapping.id}`, required: true, onChange: (event) => {
94
+ handleChange(event, index);
95
+ validator.showMessageFor(`mapping_${mapping.id}`);
96
+ }, message: validator.message(`mapping_${mapping.id}`, mapping.mappingName, useValidator_1.NAME_REQUIREMENTS), status: validator.message(`mapping_${mapping.id}`, mapping.mappingName, useValidator_1.NAME_REQUIREMENTS)
97
+ ? "negative"
98
+ : undefined, onBlur: () => {
99
+ validator.showMessageFor(`mapping_${mapping.id}`);
100
+ }, onBlurCapture: (event) => {
101
+ handleChange(event, index);
102
+ validator.showMessageFor(`mapping_${mapping.id}`);
103
+ } }),
104
+ react_1.default.createElement("div", null, mapping.description)),
105
+ react_1.default.createElement("div", { className: 'border-div' })))))),
106
+ react_1.default.createElement("div", { className: 'import-action-panel' },
107
+ react_1.default.createElement(itwinui_react_1.Button, { onClick: backFn }, "Back"),
108
+ react_1.default.createElement(itwinui_react_1.Button, { styleType: 'high-visibility', onClick: async () => onImport() }, "Import"),
109
+ react_1.default.createElement(itwinui_react_1.Button, { onClick: onCancel }, "Cancel"))))));
110
+ };
111
+ exports.default = ConfirmMappingImport;
112
+ //# sourceMappingURL=ConfirmMappingsImport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmMappingsImport.js","sourceRoot":"","sources":["../../../../src/widget/components/ConfirmMappingsImport.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAmD;AAEnD,wCAAsC;AACtC,+DAA+D;AAC/D,oDAA+D;AAC/D,oEAAoE;AACpE,sEAAwE;AA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,MAAM,EACJ,SAAS,CAAC,OAAO,CACf,WAAW,OAAO,CAAC,EAAE,EAAE,EACvB,OAAO,CAAC,WAAW,EACnB,gCAAiB,CAClB;4BACC,CAAC,CAAC,UAAU;4BACZ,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,GAAG,EAAE;4BACX,SAAS,CAAC,cAAc,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpD,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;4BACvB,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;4BAC3B,SAAS,CAAC,cAAc,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpD,CAAC,GACD;oBACF,2CAAM,OAAO,CAAC,WAAW,CAAO,CAC5B;gBACN,uCAAK,SAAS,EAAC,YAAY,GAAG,CAC1B,CACP,CAAC,CACE,CACF;QACN,uCAAK,SAAS,EAAC,qBAAqB;YAClC,8BAAC,sBAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,8BAAC,sBAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,aAE1D;YACT,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,oBAAoB,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 Button,\n LabeledInput,\n MiddleTextTruncation,\n ProgressLinear,\n Text,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport type { Mapping } from \"./Mapping\";\nimport \"./ConfirmMappingsImport.scss\";\nimport { reportingClientApi } from \"../../api/reportingClient\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { SvgStatusSuccessHollow } from \"@itwin/itwinui-icons-react\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\n\ninterface ConfirmMappingImportProps {\n sourceiModelId: string;\n selectedMappings: Mapping[];\n importing: boolean;\n setImporting: React.Dispatch<React.SetStateAction<boolean>>;\n setSelectedMappings: React.Dispatch<React.SetStateAction<Mapping[]>>;\n backFn: () => void;\n onCancel: () => void;\n onFinish: () => void;\n}\n\nconst ConfirmMappingImport = ({\n sourceiModelId,\n selectedMappings,\n importing,\n setImporting,\n setSelectedMappings,\n backFn,\n onCancel,\n onFinish,\n}: ConfirmMappingImportProps) => {\n const iModelId = useActiveIModelConnection()?.iModelId as string;\n\n const [importCount, setImportCount] = useState<number>(0);\n const [currentlyImporting, setCurrentlyImporting] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n\n useEffect(() => {\n setSelectedMappings((selectedMappings) =>\n selectedMappings.map((mapping) => ({\n ...mapping,\n mappingName: `${mapping.mappingName}_Copy`,\n })),\n );\n }, [setSelectedMappings]);\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement>,\n index: number,\n ) => {\n const newState = [...selectedMappings];\n newState[index] = {\n ...newState[index],\n mappingName: e.target.value,\n };\n setSelectedMappings(newState);\n };\n\n const onImport = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n setImporting(true);\n for (const selectedMapping of selectedMappings) {\n setCurrentlyImporting(selectedMapping.mappingName ?? \"\");\n await reportingClientApi.copyMapping(\n sourceiModelId,\n selectedMapping.id ?? \"\",\n {\n targetIModelId: iModelId,\n mappingName: selectedMapping.mappingName ?? \"\",\n },\n );\n setImportCount((importCount) => importCount + 1);\n }\n };\n\n return (\n <>\n {importing ? (\n <div className='import-progress-container'>\n <div className='import-progress-bar'>\n <div className='import-progress-bar-description'>\n {importCount !== selectedMappings.length ? (\n <>\n <Text variant='title'>Importing</Text>\n <Text>We are currently importing the mappings.</Text>\n </>\n ) : (\n <>\n <Text variant='title'>Done!</Text>\n <Text>Your mapping(s) are ready.</Text>\n </>\n )}\n </div>\n <ProgressLinear\n value={(importCount / selectedMappings.length) * 100}\n labels={\n importCount === selectedMappings.length\n ? [\"Import done!\", <SvgStatusSuccessHollow key='0' />]\n : [\n <>\n <Text>Copying</Text>\n <MiddleTextTruncation text={currentlyImporting} />\n </>,\n `${importCount}/${selectedMappings.length}`,\n ]\n }\n status={\n importCount === selectedMappings.length ? \"positive\" : undefined\n }\n />\n </div>\n <div className='finish-bar'>\n <Button\n styleType='high-visibility'\n disabled={importCount !== selectedMappings.length}\n onClick={() => onFinish()}\n >\n Close\n </Button>\n </div>\n </div>\n ) : (\n <div className='rename-confirm-container '>\n <div className='mapping-rename-container'>\n <div className='mapping-row-header-container'>\n <div className='mapping-row'>\n <Text variant='leading'>Mapping </Text>\n <Text variant='leading'>Description</Text>\n </div>\n </div>\n <div className='mapping-row-body'>\n {selectedMappings.map((mapping, index) => (\n <div className='mapping-row-container' key={mapping.id}>\n <div className='mapping-row'>\n <LabeledInput\n value={mapping.mappingName}\n name={`mapping_${mapping.id}`}\n required\n onChange={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n message={validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )}\n status={\n validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n onBlurCapture={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n />\n <div>{mapping.description}</div>\n </div>\n <div className='border-div' />\n </div>\n ))}\n </div>\n </div>\n <div className='import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button styleType='high-visibility' onClick={async () => onImport()}>\n Import\n </Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport default ConfirmMappingImport;\n"]}