@itwin/grouping-mapping-widget 0.3.3 → 0.4.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 (149) hide show
  1. package/lib/cjs/formula/FormulaTokensValidator.d.ts +1 -1
  2. package/lib/cjs/formula/FormulaTokensValidator.js +3 -1
  3. package/lib/cjs/formula/FormulaTokensValidator.js.map +1 -1
  4. package/lib/cjs/formula/FormulaValidator.d.ts +1 -1
  5. package/lib/cjs/formula/FormulaValidator.js +2 -2
  6. package/lib/cjs/formula/FormulaValidator.js.map +1 -1
  7. package/lib/cjs/grouping-mapping-widget.d.ts +4 -0
  8. package/lib/cjs/grouping-mapping-widget.js +6 -1
  9. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  10. package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -1
  11. package/lib/cjs/widget/GroupingMappingWidget.js +3 -2
  12. package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
  13. package/lib/cjs/widget/IMappingClient.d.ts +327 -0
  14. package/lib/cjs/widget/IMappingClient.js +7 -0
  15. package/lib/cjs/widget/IMappingClient.js.map +1 -0
  16. package/lib/cjs/widget/components/BlockingOverlay.d.ts +7 -0
  17. package/lib/cjs/widget/components/BlockingOverlay.js +21 -0
  18. package/lib/cjs/widget/components/BlockingOverlay.js.map +1 -0
  19. package/lib/cjs/widget/components/BlockingOverlay.scss +26 -0
  20. package/lib/cjs/widget/components/CalculatedPropertyAction.js +3 -4
  21. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  22. package/lib/cjs/widget/components/CalculatedPropertyTable.js +2 -3
  23. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  24. package/lib/cjs/widget/components/ConfirmMappingsImport.js +2 -3
  25. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  26. package/lib/cjs/widget/components/CustomCalculationAction.js +4 -5
  27. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  28. package/lib/cjs/widget/components/CustomCalculationTable.js +2 -3
  29. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  30. package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
  31. package/lib/cjs/widget/components/GroupAction.js +15 -10
  32. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  33. package/lib/cjs/widget/components/GroupPropertyAction.js +5 -7
  34. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  35. package/lib/cjs/widget/components/GroupPropertyTable.js +2 -3
  36. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  37. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +1 -0
  38. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  39. package/lib/cjs/widget/components/GroupQueryBuilderContext.d.ts +1 -0
  40. package/lib/cjs/widget/components/GroupQueryBuilderContext.js +1 -0
  41. package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +1 -1
  42. package/lib/cjs/widget/components/GroupTile.d.ts +13 -0
  43. package/lib/cjs/widget/components/GroupTile.js +18 -0
  44. package/lib/cjs/widget/components/GroupTile.js.map +1 -0
  45. package/lib/cjs/widget/components/GroupTile.scss +32 -0
  46. package/lib/cjs/widget/components/Grouping.js +224 -164
  47. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  48. package/lib/cjs/widget/components/Grouping.scss +39 -4
  49. package/lib/cjs/widget/components/GroupingMapping.d.ts +15 -3
  50. package/lib/cjs/widget/components/GroupingMapping.js +29 -5
  51. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  52. package/lib/cjs/widget/components/Mapping.js +33 -12
  53. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  54. package/lib/cjs/widget/components/MappingAction.js +10 -5
  55. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  56. package/lib/cjs/widget/components/PropertyMenu.js +26 -19
  57. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  58. package/lib/cjs/widget/components/QueryBuilder.d.ts +11 -5
  59. package/lib/cjs/widget/components/QueryBuilder.js +229 -141
  60. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  61. package/lib/cjs/widget/components/SelectMappings.js +5 -6
  62. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  63. package/lib/cjs/widget/components/property-grid/PropertyView.js +5 -0
  64. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  65. package/lib/cjs/widget/components/utils.d.ts +6 -0
  66. package/lib/cjs/widget/components/utils.js +9 -1
  67. package/lib/cjs/widget/components/utils.js.map +1 -1
  68. package/lib/cjs/widget/components/utils.scss +12 -3
  69. package/lib/cjs/widget/components/viewerUtils.d.ts +19 -0
  70. package/lib/cjs/widget/components/viewerUtils.js +224 -3
  71. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  72. package/lib/cjs/widget/hooks/useFormulaValidation.d.ts +1 -1
  73. package/lib/cjs/widget/hooks/useFormulaValidation.js +5 -5
  74. package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
  75. package/lib/esm/formula/FormulaTokensValidator.d.ts +1 -1
  76. package/lib/esm/formula/FormulaTokensValidator.js +3 -1
  77. package/lib/esm/formula/FormulaTokensValidator.js.map +1 -1
  78. package/lib/esm/formula/FormulaValidator.d.ts +1 -1
  79. package/lib/esm/formula/FormulaValidator.js +2 -2
  80. package/lib/esm/formula/FormulaValidator.js.map +1 -1
  81. package/lib/esm/grouping-mapping-widget.d.ts +4 -0
  82. package/lib/esm/grouping-mapping-widget.js +4 -0
  83. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  84. package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -1
  85. package/lib/esm/widget/GroupingMappingWidget.js +3 -2
  86. package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
  87. package/lib/esm/widget/IMappingClient.d.ts +327 -0
  88. package/lib/esm/widget/IMappingClient.js +6 -0
  89. package/lib/esm/widget/IMappingClient.js.map +1 -0
  90. package/lib/esm/widget/components/BlockingOverlay.d.ts +7 -0
  91. package/lib/esm/widget/components/BlockingOverlay.js +14 -0
  92. package/lib/esm/widget/components/BlockingOverlay.js.map +1 -0
  93. package/lib/esm/widget/components/BlockingOverlay.scss +26 -0
  94. package/lib/esm/widget/components/CalculatedPropertyAction.js +4 -5
  95. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  96. package/lib/esm/widget/components/CalculatedPropertyTable.js +3 -4
  97. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  98. package/lib/esm/widget/components/ConfirmMappingsImport.js +3 -4
  99. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  100. package/lib/esm/widget/components/CustomCalculationAction.js +5 -6
  101. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  102. package/lib/esm/widget/components/CustomCalculationTable.js +3 -4
  103. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  104. package/lib/esm/widget/components/GroupAction.d.ts +2 -1
  105. package/lib/esm/widget/components/GroupAction.js +17 -12
  106. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  107. package/lib/esm/widget/components/GroupPropertyAction.js +6 -8
  108. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  109. package/lib/esm/widget/components/GroupPropertyTable.js +3 -4
  110. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  111. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +1 -0
  112. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  113. package/lib/esm/widget/components/GroupQueryBuilderContext.d.ts +1 -0
  114. package/lib/esm/widget/components/GroupQueryBuilderContext.js +1 -0
  115. package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +1 -1
  116. package/lib/esm/widget/components/GroupTile.d.ts +13 -0
  117. package/lib/esm/widget/components/GroupTile.js +11 -0
  118. package/lib/esm/widget/components/GroupTile.js.map +1 -0
  119. package/lib/esm/widget/components/GroupTile.scss +32 -0
  120. package/lib/esm/widget/components/Grouping.js +230 -170
  121. package/lib/esm/widget/components/Grouping.js.map +1 -1
  122. package/lib/esm/widget/components/Grouping.scss +39 -4
  123. package/lib/esm/widget/components/GroupingMapping.d.ts +15 -3
  124. package/lib/esm/widget/components/GroupingMapping.js +27 -4
  125. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  126. package/lib/esm/widget/components/Mapping.js +35 -14
  127. package/lib/esm/widget/components/Mapping.js.map +1 -1
  128. package/lib/esm/widget/components/MappingAction.js +12 -7
  129. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  130. package/lib/esm/widget/components/PropertyMenu.js +28 -21
  131. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  132. package/lib/esm/widget/components/QueryBuilder.d.ts +11 -5
  133. package/lib/esm/widget/components/QueryBuilder.js +230 -142
  134. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  135. package/lib/esm/widget/components/SelectMappings.js +6 -7
  136. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  137. package/lib/esm/widget/components/property-grid/PropertyView.js +5 -0
  138. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  139. package/lib/esm/widget/components/utils.d.ts +6 -0
  140. package/lib/esm/widget/components/utils.js +6 -0
  141. package/lib/esm/widget/components/utils.js.map +1 -1
  142. package/lib/esm/widget/components/utils.scss +12 -3
  143. package/lib/esm/widget/components/viewerUtils.d.ts +19 -0
  144. package/lib/esm/widget/components/viewerUtils.js +207 -3
  145. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  146. package/lib/esm/widget/hooks/useFormulaValidation.d.ts +1 -1
  147. package/lib/esm/widget/hooks/useFormulaValidation.js +5 -5
  148. package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
  149. package/package.json +30 -30
@@ -0,0 +1,327 @@
1
+ import type { AccessToken } from "@itwin/core-bentley";
2
+ import type { CalculatedProperty, CalculatedPropertyCreate, CalculatedPropertySingle, CalculatedPropertyUpdate, CustomCalculation, CustomCalculationCreate, CustomCalculationSingle, CustomCalculationUpdate, Group, GroupCreate, GroupProperty, GroupPropertyCreate, GroupPropertySingle, GroupPropertyUpdate, GroupSingle, GroupUpdate, Mapping, MappingCopy, MappingCreate, MappingSingle, MappingUpdate } from "@itwin/insights-client";
3
+ export interface IMappingClient {
4
+ /**
5
+ * Gets all Mappings for an iModel.
6
+ *
7
+ * @summary Get Mappings.
8
+ * @param {string} iModelId The iModel Id.
9
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
10
+ * @memberof IMappingClient
11
+ * @see https://developer.bentley.com/apis/insights/operations/get-mappings/
12
+ */
13
+ getMappings(accessToken: AccessToken, iModelId: string): Promise<Mapping[]>;
14
+ /**
15
+ * Gets a Mapping for an iModel.
16
+ *
17
+ * @summary Get Mapping.
18
+ * @param {string} iModelId The iModel Id.
19
+ * @param {string} mappingId The Mapping Id.
20
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
21
+ * @memberof IMappingClient
22
+ * @see https://developer.bentley.com/apis/insights/operations/get-mapping/
23
+ */
24
+ getMapping(accessToken: AccessToken, mappingId: string, iModelId: string): Promise<MappingSingle>;
25
+ /**
26
+ * Creates a Mapping for an iModel.
27
+ *
28
+ * @summary Create Mapping.
29
+ * @param {string} iModelId Id of the iModel for which to create a new Mapping.
30
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
31
+ * @param {MappingCreate} mapping Request body.
32
+ * @memberof IMappingClient
33
+ * @see https://developer.bentley.com/apis/insights/operations/create-mapping/
34
+ */
35
+ createMapping(accessToken: AccessToken, iModelId: string, mapping: MappingCreate): Promise<MappingSingle>;
36
+ /**
37
+ * Updates a Mapping for an iModel.
38
+ *
39
+ * @summary Update Mapping.
40
+ * @param {string} iModelId The iModel Id.
41
+ * @param {string} mappingId Id of the Mapping to be updated.
42
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
43
+ * @param {MappingUpdate} mapping Request body.
44
+ * @memberof IMappingClient
45
+ * @see https://developer.bentley.com/apis/insights/operations/update-mapping/
46
+ */
47
+ updateMapping(accessToken: AccessToken, iModelId: string, mappingId: string, mapping: MappingUpdate): Promise<MappingSingle>;
48
+ /**
49
+ * Deletes a Mapping for an iModel.
50
+ *
51
+ * @summary Delete Mapping.
52
+ * @param {string} iModelId The iModel Id.
53
+ * @param {string} mappingId Id of the Mapping to be deleted.
54
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
55
+ * @memberof IMappingClient
56
+ * @see https://developer.bentley.com/apis/insights/operations/delete-mapping/
57
+ */
58
+ deleteMapping(accessToken: AccessToken, iModelId: string, mappingId: string): Promise<Response>;
59
+ /**
60
+ * Copies a Mapping and all its Groups, GroupProperties, CalculatedProperties, and CustomCalculations to a target iModel.
61
+ *
62
+ * @summary Copy Mapping.
63
+ * @param {string} iModelId Id of the source Mapping's iModel.
64
+ * @param {string} mappingId Id of the source Mapping.
65
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
66
+ * @param {MappingCopy} mappingCopy Request body.
67
+ * @memberof IMappingClient
68
+ * @see https://developer.bentley.com/apis/insights/operations/copy-mapping/
69
+ */
70
+ copyMapping(accessToken: AccessToken, iModelId: string, mappingId: string, mappingCopy: MappingCopy): Promise<MappingSingle>;
71
+ /**
72
+ * Gets all Groups for a Mapping.
73
+ *
74
+ * @summary Get Groups.
75
+ * @param {string} iModelId The iModel Id.
76
+ * @param {string} mappingId The Mapping Id.
77
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
78
+ * @memberof IMappingClient
79
+ * @see https://developer.bentley.com/apis/insights/operations/get-groups/
80
+ */
81
+ getGroups(accessToken: AccessToken, iModelId: string, mappingId: string): Promise<Group[]>;
82
+ /**
83
+ * Creates a Group for an iModel data source Mapping.
84
+ *
85
+ * @summary Create Group
86
+ * @param {string} iModelId The iModel Id.
87
+ * @param {string} mappingId Id of the Mapping for which to create a new Group.
88
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
89
+ * @param {GroupCreate} group Request body.
90
+ * @memberof IMappingClient
91
+ * @see https://developer.bentley.com/apis/insights/operations/create-group/
92
+ */
93
+ createGroup(accessToken: AccessToken, iModelId: string, mappingId: string, group: GroupCreate): Promise<GroupSingle>;
94
+ /**
95
+ * Gets a Group for a Mapping.
96
+ *
97
+ * @summary Get Group.
98
+ * @param {string} iModelId The iModel Id.
99
+ * @param {string} mappingId The Mapping Id.
100
+ * @param {string} groupId The Group Id.
101
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
102
+ * @memberof IMappingClient
103
+ * @see https://developer.bentley.com/apis/insights/operations/get-group/
104
+ */
105
+ getGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<GroupSingle>;
106
+ /**
107
+ * Updates a Group for a Mapping.
108
+ *
109
+ * @summary Update Group.
110
+ * @param {string} iModelId Globally Unique Identifier of the target iModel.
111
+ * @param {string} mappingId Globally Unique Identifier of the target Mapping.
112
+ * @param {string} groupId Id of the Group to be updated.
113
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
114
+ * @param {GroupUpdate} group Request body.
115
+ * @memberof IMappingClient
116
+ * @see https://developer.bentley.com/apis/insights/operations/update-group/
117
+ */
118
+ updateGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, group: GroupUpdate): Promise<GroupSingle>;
119
+ /**
120
+ * Deletes a Group for a Mapping.
121
+ *
122
+ * @summary Delete Group.
123
+ * @param {string} iModelId The iModel Id.
124
+ * @param {string} mappingId The Mapping Id.
125
+ * @param {string} groupId Id of the Group to be deleted.
126
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
127
+ * @memberof IMappingClient
128
+ * @see https://developer.bentley.com/apis/insights/operations/delete-group/
129
+ */
130
+ deleteGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<Response>;
131
+ /**
132
+ * Gets all GroupProperties for a Group.
133
+ *
134
+ * @summary Get GroupProperties.
135
+ * @param {string} iModelId The iModel Id.
136
+ * @param {string} mappingId The Mapping Id.
137
+ * @param {string} groupId The Group Id.
138
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
139
+ * @memberof IMappingClient
140
+ * @see https://developer.bentley.com/apis/insights/operations/get-groupproperties/
141
+ */
142
+ getGroupProperties(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<GroupProperty[]>;
143
+ /**
144
+ * Gets a GroupProperty for a Group.
145
+ *
146
+ * @summary Get GroupProperty.
147
+ * @param {string} iModelId The iModel Id.
148
+ * @param {string} mappingId The Mapping Id.
149
+ * @param {string} groupId The Group Id.
150
+ * @param {string} propertyId The GroupProperty Id.
151
+ * @param {string} accessToken access token with scope `insights:read`.
152
+ * @memberof IMappingClient
153
+ * @see https://developer.bentley.com/apis/insights/operations/get-groupproperty/
154
+ */
155
+ getGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<GroupPropertySingle>;
156
+ /**
157
+ * Creates a GroupProperty for a Group.
158
+ *
159
+ * @summary Create GroupProperty.
160
+ * @param {string} iModelId The iModel Id.
161
+ * @param {string} mappingId The Mapping Id.
162
+ * @param {string} groupId Id of the Group for which to create a new GroupProperty.
163
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
164
+ * @param {GroupPropertyCreate} groupProperty Request body.
165
+ * @memberof IMappingClient
166
+ * @see https://developer.bentley.com/apis/insights/operations/create-groupproperty/
167
+ */
168
+ createGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupProperty: GroupPropertyCreate): Promise<GroupPropertySingle>;
169
+ /**
170
+ * Updates a GroupProperty for a Group.
171
+ *
172
+ * @summary Update GroupProperty.
173
+ * @param {string} iModelId The iModel Id.
174
+ * @param {string} mappingId The Mapping Id.
175
+ * @param {string} groupId The Group Id.
176
+ * @param {string} propertyId Id of the GroupProperty to be updated.
177
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
178
+ * @param {GroupPropertyUpdate} groupProperty Request body.
179
+ * @memberof IMappingClient
180
+ * @see https://developer.bentley.com/apis/insights/operations/update-groupproperty/
181
+ */
182
+ updateGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupPropertyId: string, groupProperty: GroupPropertyUpdate): Promise<GroupPropertySingle>;
183
+ /**
184
+ * Deletes a GroupProperty from a Group.
185
+ *
186
+ * @summary Delete GroupProperty.
187
+ * @param {string} iModelId The iModel Id.
188
+ * @param {string} mappingId The Mapping Id.
189
+ * @param {string} groupId The Group Id.
190
+ * @param {string} groupPropertyId Id of the GroupProperty to be deleted.
191
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
192
+ * @memberof IMappingClient
193
+ * @see https://developer.bentley.com/apis/insights/operations/delete-groupproperty/
194
+ */
195
+ deleteGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupPropertyId: string): Promise<Response>;
196
+ /**
197
+ * Gets all CalculatedProperties for a Group.
198
+ *
199
+ * @summary Get CalculatedProperties.
200
+ * @param {string} iModelId The iModel Id.
201
+ * @param {string} mappingId The Mapping Id.
202
+ * @param {string} groupId The Group Id.
203
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
204
+ * @memberof IMappingClient
205
+ * @see https://developer.bentley.com/apis/insights/operations/get-calculatedproperties/
206
+ */
207
+ getCalculatedProperties(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<CalculatedProperty[]>;
208
+ /**
209
+ * Gets a CalculatedProperty for a Group.
210
+ *
211
+ * @summary Get CalculatedProperty.
212
+ * @param {string} iModelId The iModel Id.
213
+ * @param {string} mappingId The Mapping Id.
214
+ * @param {string} groupId The Group Id.
215
+ * @param {string} propertyId The CalculatedProperty Id.
216
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
217
+ * @memberof IMappingClient
218
+ * @see https://developer.bentley.com/apis/insights/operations/get-calculatedproperty/
219
+ */
220
+ getCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<CalculatedPropertySingle>;
221
+ /**
222
+ * Creates a CalculatedProperty for a Group.
223
+ *
224
+ * @summary Create CalculatedProperty.
225
+ * @param {string} iModelId The iModel Id.
226
+ * @param {string} mappingId The Mapping Id.
227
+ * @param {string} groupId Id of the Group for which to create a new CalculatedProperty.
228
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
229
+ * @param {CalculatedPropertyCreate} property Request body.
230
+ * @memberof IMappingClient
231
+ * @see https://developer.bentley.com/apis/insights/operations/create-calculatedproperty/
232
+ */
233
+ createCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, property: CalculatedPropertyCreate): Promise<CalculatedPropertySingle>;
234
+ /**
235
+ * Updates a CalculatedProperty for a Group.
236
+ *
237
+ * @summary Update CalculatedProperty.
238
+ * @param {string} iModelId The iModel Id.
239
+ * @param {string} mappingId The Mapping Id.
240
+ * @param {string} groupId The Group Id.
241
+ * @param {string} propertyId Id of the CalculatedProperty to be updated.
242
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
243
+ * @param {CalculatedPropertyUpdate} property Request body.
244
+ * @memberof IMappingClient
245
+ * @see https://developer.bentley.com/apis/insights/operations/update-calculatedproperty/
246
+ */
247
+ updateCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string, property: CalculatedPropertyUpdate): Promise<CalculatedPropertySingle>;
248
+ /**
249
+ * Deletes a CalculatedProperty from a Group.
250
+ *
251
+ * @summary Delete CalculatedProperty.
252
+ * @param {string} iModelId The iModel Id.
253
+ * @param {string} mappingId The Mapping Id.
254
+ * @param {string} groupId The Group Id.
255
+ * @param {string} propertyId Id of the CalculatedProperty to be deleted.
256
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
257
+ * @memberof IMappingClient
258
+ * @see https://developer.bentley.com/apis/insights/operations/delete-calculatedproperty/
259
+ */
260
+ deleteCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<Response>;
261
+ /**
262
+ * Gets all CustomCalculations for a Group.
263
+ *
264
+ * @summary Get CustomCalculations.
265
+ * @param {string} iModelId The iModel Id.
266
+ * @param {string} mappingId The Mapping Id.
267
+ * @param {string} groupId The Group Id.
268
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
269
+ * @memberof IMappingClient
270
+ * @see https://developer.bentley.com/apis/insights/operations/get-customcalculations/
271
+ */
272
+ getCustomCalculations(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<CustomCalculation[]>;
273
+ /**
274
+ * Gets a CustomCalculation for a Group.
275
+ *
276
+ * @summary Get CustomCalculation.
277
+ * @param {string} iModelId The iModel Id.
278
+ * @param {string} mappingId The Mapping Id.
279
+ * @param {string} groupId The Group Id.
280
+ * @param {string} propertyId The CustomCalculation Id.
281
+ * @param {string} accessToken OAuth access token with scope `insights:read`.
282
+ * @memberof IMappingClient
283
+ * @see https://developer.bentley.com/apis/insights/operations/get-customcalculation/
284
+ */
285
+ getCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<CustomCalculationSingle>;
286
+ /**
287
+ * Creates a CustomCalculation for a Group.
288
+ *
289
+ * @summary Create CustomCalculation.
290
+ * @param {string} iModelId The iModel Id.
291
+ * @param {string} mappingId The Mapping Id.
292
+ * @param {string} groupId Id of the Group for which to create a new CustomCalculation.
293
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
294
+ * @param {CustomCalculationCreate} property Request body.
295
+ * @memberof IMappingClient
296
+ * @see https://developer.bentley.com/apis/insights/operations/create-customcalculation/
297
+ */
298
+ createCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, property: CustomCalculationCreate): Promise<CustomCalculationSingle>;
299
+ /**
300
+ * Updates a CustomCalculation for a Group.
301
+ *
302
+ * @summary Update CustomCalculation.
303
+ * @param {string} iModelId The iModel Id.
304
+ * @param {string} mappingId The Mapping Id.
305
+ * @param {string} groupId The Group Id.
306
+ * @param {string} propertyId Id of the CustomCalculation to be updated.
307
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
308
+ * @param {CustomCalculationUpdate} property Request body.
309
+ * @memberof IMappingClient
310
+ * @see https://developer.bentley.com/apis/insights/operations/update-customcalculation/
311
+ */
312
+ updateCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string, property: CustomCalculationUpdate): Promise<CustomCalculationSingle>;
313
+ /**
314
+ * Deletes a CustomCalculation from a Group.
315
+ *
316
+ * @summary Delete CustomCalculation.
317
+ * @param {string} iModelId The iModel Id.
318
+ * @param {string} mappingId The Mapping Id.
319
+ * @param {string} groupId The Group Id.
320
+ * @param {string} propertyId Id of the CustomCalculation to be deleted.
321
+ * @param {string} accessToken OAuth access token with scope `insights:modify`.
322
+ * @memberof IMappingClient
323
+ * @see https://developer.bentley.com/apis/insights/operations/delete-customcalculation/
324
+ */
325
+ deleteCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<Response>;
326
+ }
327
+ //# sourceMappingURL=IMappingClient.d.ts.map
@@ -0,0 +1,6 @@
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
+ export {};
6
+ //# sourceMappingURL=IMappingClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMappingClient.js","sourceRoot":"","sources":["../../../src/widget/IMappingClient.ts"],"names":[],"mappings":"AAAA;;;+FAG+F","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport type { CalculatedProperty, CalculatedPropertyCreate, CalculatedPropertySingle, CalculatedPropertyUpdate, CustomCalculation, CustomCalculationCreate, CustomCalculationSingle, CustomCalculationUpdate, Group, GroupCreate, GroupProperty, GroupPropertyCreate, GroupPropertySingle, GroupPropertyUpdate, GroupSingle, GroupUpdate, Mapping, MappingCopy, MappingCreate, MappingSingle, MappingUpdate } from \"@itwin/insights-client\";\n\nexport interface IMappingClient {\n /**\n * Gets all Mappings for an iModel.\n *\n * @summary Get Mappings.\n * @param {string} iModelId The iModel Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-mappings/\n */\n getMappings(accessToken: AccessToken, iModelId: string): Promise<Mapping[]>;\n\n /**\n * Gets a Mapping for an iModel.\n *\n * @summary Get Mapping.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-mapping/\n */\n getMapping(accessToken: AccessToken, mappingId: string, iModelId: string): Promise<MappingSingle>;\n\n /**\n * Creates a Mapping for an iModel.\n *\n * @summary Create Mapping.\n * @param {string} iModelId Id of the iModel for which to create a new Mapping.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {MappingCreate} mapping Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/create-mapping/\n */\n createMapping(accessToken: AccessToken, iModelId: string, mapping: MappingCreate): Promise<MappingSingle>;\n\n /**\n * Updates a Mapping for an iModel.\n *\n * @summary Update Mapping.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId Id of the Mapping to be updated.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {MappingUpdate} mapping Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/update-mapping/\n */\n updateMapping(accessToken: AccessToken, iModelId: string, mappingId: string, mapping: MappingUpdate): Promise<MappingSingle>;\n\n /**\n * Deletes a Mapping for an iModel.\n *\n * @summary Delete Mapping.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId Id of the Mapping to be deleted.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/delete-mapping/\n */\n deleteMapping(accessToken: AccessToken, iModelId: string, mappingId: string): Promise<Response>;\n\n /**\n * Copies a Mapping and all its Groups, GroupProperties, CalculatedProperties, and CustomCalculations to a target iModel.\n *\n * @summary Copy Mapping.\n * @param {string} iModelId Id of the source Mapping's iModel.\n * @param {string} mappingId Id of the source Mapping.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {MappingCopy} mappingCopy Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/copy-mapping/\n */\n copyMapping(accessToken: AccessToken, iModelId: string, mappingId: string, mappingCopy: MappingCopy): Promise<MappingSingle>;\n\n /**\n * Gets all Groups for a Mapping.\n *\n * @summary Get Groups.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-groups/\n */\n getGroups(accessToken: AccessToken, iModelId: string, mappingId: string): Promise<Group[]>;\n\n /**\n * Creates a Group for an iModel data source Mapping.\n *\n * @summary Create Group\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId Id of the Mapping for which to create a new Group.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {GroupCreate} group Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/create-group/\n */\n createGroup(accessToken: AccessToken, iModelId: string, mappingId: string, group: GroupCreate): Promise<GroupSingle>;\n\n /**\n * Gets a Group for a Mapping.\n *\n * @summary Get Group.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-group/\n */\n getGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<GroupSingle>;\n\n /**\n * Updates a Group for a Mapping.\n *\n * @summary Update Group.\n * @param {string} iModelId Globally Unique Identifier of the target iModel.\n * @param {string} mappingId Globally Unique Identifier of the target Mapping.\n * @param {string} groupId Id of the Group to be updated.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {GroupUpdate} group Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/update-group/\n */\n updateGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, group: GroupUpdate): Promise<GroupSingle>;\n\n /**\n * Deletes a Group for a Mapping.\n *\n * @summary Delete Group.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId Id of the Group to be deleted.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/delete-group/\n */\n deleteGroup(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<Response>;\n\n /**\n * Gets all GroupProperties for a Group.\n *\n * @summary Get GroupProperties.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-groupproperties/\n */\n getGroupProperties(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<GroupProperty[]>;\n\n /**\n * Gets a GroupProperty for a Group.\n *\n * @summary Get GroupProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId The GroupProperty Id.\n * @param {string} accessToken access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-groupproperty/\n */\n getGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<GroupPropertySingle>;\n\n /**\n * Creates a GroupProperty for a Group.\n *\n * @summary Create GroupProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId Id of the Group for which to create a new GroupProperty.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {GroupPropertyCreate} groupProperty Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/create-groupproperty/\n */\n createGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupProperty: GroupPropertyCreate): Promise<GroupPropertySingle>;\n\n /**\n * Updates a GroupProperty for a Group.\n *\n * @summary Update GroupProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId Id of the GroupProperty to be updated.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {GroupPropertyUpdate} groupProperty Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/update-groupproperty/\n */\n updateGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupPropertyId: string, groupProperty: GroupPropertyUpdate): Promise<GroupPropertySingle>;\n\n /**\n * Deletes a GroupProperty from a Group.\n *\n * @summary Delete GroupProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} groupPropertyId Id of the GroupProperty to be deleted.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/delete-groupproperty/\n */\n deleteGroupProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, groupPropertyId: string): Promise<Response>;\n\n /**\n * Gets all CalculatedProperties for a Group.\n *\n * @summary Get CalculatedProperties.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-calculatedproperties/\n */\n getCalculatedProperties(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<CalculatedProperty[]>;\n\n /**\n * Gets a CalculatedProperty for a Group.\n *\n * @summary Get CalculatedProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId The CalculatedProperty Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-calculatedproperty/\n */\n getCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<CalculatedPropertySingle>;\n\n /**\n * Creates a CalculatedProperty for a Group.\n *\n * @summary Create CalculatedProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId Id of the Group for which to create a new CalculatedProperty.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {CalculatedPropertyCreate} property Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/create-calculatedproperty/\n */\n createCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, property: CalculatedPropertyCreate): Promise<CalculatedPropertySingle>;\n\n /**\n * Updates a CalculatedProperty for a Group.\n *\n * @summary Update CalculatedProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId Id of the CalculatedProperty to be updated.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {CalculatedPropertyUpdate} property Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/update-calculatedproperty/\n */\n updateCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string, property: CalculatedPropertyUpdate): Promise<CalculatedPropertySingle>;\n\n /**\n * Deletes a CalculatedProperty from a Group.\n *\n * @summary Delete CalculatedProperty.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId Id of the CalculatedProperty to be deleted.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/delete-calculatedproperty/\n */\n deleteCalculatedProperty(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<Response>;\n\n /**\n * Gets all CustomCalculations for a Group.\n *\n * @summary Get CustomCalculations.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-customcalculations/\n */\n getCustomCalculations(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string): Promise<CustomCalculation[]>;\n\n /**\n * Gets a CustomCalculation for a Group.\n *\n * @summary Get CustomCalculation.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId The CustomCalculation Id.\n * @param {string} accessToken OAuth access token with scope `insights:read`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/get-customcalculation/\n */\n getCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<CustomCalculationSingle>;\n\n /**\n * Creates a CustomCalculation for a Group.\n *\n * @summary Create CustomCalculation.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId Id of the Group for which to create a new CustomCalculation.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {CustomCalculationCreate} property Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/create-customcalculation/\n */\n createCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, property: CustomCalculationCreate): Promise<CustomCalculationSingle>;\n\n /**\n * Updates a CustomCalculation for a Group.\n *\n * @summary Update CustomCalculation.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId Id of the CustomCalculation to be updated.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @param {CustomCalculationUpdate} property Request body.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/update-customcalculation/\n */\n updateCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string, property: CustomCalculationUpdate): Promise<CustomCalculationSingle>;\n\n /**\n * Deletes a CustomCalculation from a Group.\n *\n * @summary Delete CustomCalculation.\n * @param {string} iModelId The iModel Id.\n * @param {string} mappingId The Mapping Id.\n * @param {string} groupId The Group Id.\n * @param {string} propertyId Id of the CustomCalculation to be deleted.\n * @param {string} accessToken OAuth access token with scope `insights:modify`.\n * @memberof IMappingClient\n * @see https://developer.bentley.com/apis/insights/operations/delete-customcalculation/\n */\n deleteCustomCalculation(accessToken: AccessToken, iModelId: string, mappingId: string, groupId: string, propertyId: string): Promise<Response>;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import "./BlockingOverlay.scss";
3
+ export interface BlockingOverlayProps {
4
+ isVisible: boolean;
5
+ }
6
+ export declare const BlockingOverlay: ({ isVisible }: BlockingOverlayProps) => JSX.Element;
7
+ //# sourceMappingURL=BlockingOverlay.d.ts.map
@@ -0,0 +1,14 @@
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 classnames from "classnames";
6
+ import React from "react";
7
+ import { LoadingSpinner } from "./utils";
8
+ import "./BlockingOverlay.scss";
9
+ export const BlockingOverlay = ({ isVisible }) => {
10
+ return (React.createElement("div", { className: classnames("group-mapping-blocking-overlay", isVisible && "visible") },
11
+ React.createElement("div", { className: "group-mapping-blocking-overlay-spinner" },
12
+ React.createElement(LoadingSpinner, null))));
13
+ };
14
+ //# sourceMappingURL=BlockingOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockingOverlay.js","sourceRoot":"","sources":["../../../../src/widget/components/BlockingOverlay.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,wBAAwB,CAAC;AAMhC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAwB,EAAE,EAAE;IACrE,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,gCAAgC,EAAE,SAAS,IAAI,SAAS,CAAC;QAClF,6BAAK,SAAS,EAAC,wCAAwC;YACrD,oBAAC,cAAc,OAAG,CACd,CACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport { LoadingSpinner } from \"./utils\";\nimport \"./BlockingOverlay.scss\";\n\nexport interface BlockingOverlayProps {\n isVisible: boolean;\n}\n\nexport const BlockingOverlay = ({ isVisible }: BlockingOverlayProps) => {\n return (\n <div className={classnames(\"group-mapping-blocking-overlay\", isVisible && \"visible\")}>\n <div className=\"group-mapping-blocking-overlay-spinner\">\n <LoadingSpinner />\n </div>\n </div>\n );\n};\n"]}
@@ -0,0 +1,26 @@
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
+ .group-mapping-blocking-overlay {
8
+ background-color: black;
9
+ position: absolute;
10
+ height: inherit;
11
+ right: 6px;
12
+ left: 6px;
13
+ opacity: 60%;
14
+ z-index: 9999;
15
+ visibility: hidden;
16
+
17
+ &.visible {
18
+ visibility: visible;
19
+ }
20
+ }
21
+
22
+ .group-mapping-blocking-overlay-spinner {
23
+ display: flex;
24
+ justify-content: center;
25
+ height: inherit;
26
+ }
@@ -11,11 +11,11 @@ import useValidator, { NAME_REQUIREMENTS } from "../hooks/useValidator";
11
11
  import { handleError, WidgetHeader } from "./utils";
12
12
  import { visualizeElements, zoomToElements } from "./viewerUtils";
13
13
  import "./CalculatedPropertyAction.scss";
14
- import { ReportingClient } from "@itwin/insights-client";
15
- import { ApiContext } from "./GroupingMapping";
14
+ import { ApiContext, MappingClientContext } from "./GroupingMapping";
16
15
  const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids, returnFn, }) => {
17
16
  var _a, _b, _c;
18
17
  const apiContext = useContext(ApiContext);
18
+ const mappingClient = useContext(MappingClientContext);
19
19
  const [propertyName, setPropertyName] = useState((_a = property === null || property === void 0 ? void 0 : property.propertyName) !== null && _a !== void 0 ? _a : "");
20
20
  const [type, setType] = useState((_b = property === null || property === void 0 ? void 0 : property.type) !== null && _b !== void 0 ? _b : "");
21
21
  const [bboxDecorator, setBboxDecorator] = useState();
@@ -64,13 +64,12 @@ const CalculatedPropertyAction = ({ iModelId, mappingId, groupId, property, ids,
64
64
  }
65
65
  try {
66
66
  setIsLoading(true);
67
- const reportingClientApi = new ReportingClient(apiContext.prefix);
68
67
  property
69
- ? await reportingClientApi.updateCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, (_a = property.id) !== null && _a !== void 0 ? _a : "", {
68
+ ? await mappingClient.updateCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, (_a = property.id) !== null && _a !== void 0 ? _a : "", {
70
69
  propertyName,
71
70
  type,
72
71
  })
73
- : await reportingClientApi.createCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, {
72
+ : await mappingClient.createCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, {
74
73
  propertyName,
75
74
  type,
76
75
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CalculatedPropertyAction.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,aAAa,EACb,uBAAuB,GACxB,MAAM,0CAA0C,CAAC;AAClD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAW/C,MAAM,wBAAwB,GAAG,CAAC,EAChC,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,EACH,QAAQ,GACsB,EAAE,EAAE;;IAClC,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,mCAAI,EAAE,CAC7B,CAAC;IACF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAS,MAAA,QAAQ,aAAR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BAC9B,iCAAM,MAAM,CAAC,KAAK,CAAO;4BACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,6BAAK,SAAS,EAAC,aAAa;wBAC1B,iCAAM,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,oBAAC,WAAW,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,eAAe,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, { useContext, 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 { CalculatedPropertyType } from \"./CalculatedPropertyTable\";\nimport { ReportingClient } from \"@itwin/insights-client\";\nimport { ApiContext } from \"./GroupingMapping\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: CalculatedPropertyType;\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 apiContext = useContext(ApiContext);\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<string>(property?.type ?? \"\");\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 reportingClientApi = new ReportingClient(apiContext.prefix);\n\n property\n ? await reportingClientApi.updateCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n property.id ?? \"\",\n {\n propertyName,\n type,\n },\n )\n : await reportingClientApi.createCalculatedProperty(\n apiContext.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='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='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='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,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAIjD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,aAAa,EACb,uBAAuB,GACxB,MAAM,0CAA0C,CAAC;AAClD,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,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KAAK,EAAE,+BAA+B;4BACtC,KAAK,EAAE,sBAAsB;yBAC9B;wBACD;4BACE,KAAK,EAAE,2BAA2B;4BAClC,KAAK,EAAE,iBAAiB;yBACzB;wBACD;4BACE,KAAK,EAAE,sCAAsC;4BAC7C,KAAK,EAAE,8BAA8B;yBACtC;wBACD;4BACE,KAAK,EAAE,2CAA2C;4BAClD,KAAK,EAAE,mCAAmC;yBAC3C;wBACD;4BACE,KAAK,EAAE,uCAAuC;4BAC9C,KAAK,EAAE,+BAA+B;yBACvC;qBACF,EACD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CAC9C,oBAAC,QAAQ;wBACP,6BAAK,SAAS,EAAC,iBAAiB;4BAC9B,iCAAM,MAAM,CAAC,KAAK,CAAO;4BACxB,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CACzB,CACG,CACZ,EACD,oBAAoB,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,CACtD,6BAAK,SAAS,EAAC,aAAa;wBAC1B,iCAAM,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,oBAAC,WAAW,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,eAAe,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, { useContext, 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 { CalculatedPropertyType } from \"./CalculatedPropertyTable\";\nimport { ApiContext, MappingClientContext } from \"./GroupingMapping\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n property?: CalculatedPropertyType;\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 apiContext = useContext(ApiContext);\n const mappingClient = useContext(MappingClientContext);\n const [propertyName, setPropertyName] = useState<string>(\n property?.propertyName ?? \"\",\n );\n const [type, setType] = useState<string>(property?.type ?? \"\");\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 property\n ? await mappingClient.updateCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n property.id ?? \"\",\n {\n propertyName,\n type,\n },\n )\n : await mappingClient.createCalculatedProperty(\n apiContext.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='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='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='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"]}
@@ -7,11 +7,11 @@ import { Button, DropdownMenu, IconButton, MenuItem, Table, } from "@itwin/itwin
7
7
  import React, { useContext, useMemo, useState } from "react";
8
8
  import { PropertyMenuView } from "./PropertyMenu";
9
9
  import DeleteModal from "./DeleteModal";
10
- import { ReportingClient } from "@itwin/insights-client";
11
- import { ApiContext } from "./GroupingMapping";
10
+ import { ApiContext, MappingClientContext } from "./GroupingMapping";
12
11
  const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalculatedProperty, setGroupModifyView, onCalculatedPropertyModify, isLoadingCalculatedProperties: isLoadingGroupProperties, calculatedProperties, refreshCalculatedProperties, selectedCalculatedProperty, }) => {
13
12
  var _a;
14
13
  const apiContext = useContext(ApiContext);
14
+ const mappingClient = useContext(MappingClientContext);
15
15
  const [showCalculatedPropertyDeleteModal, setShowCalculatedPropertyDeleteModal,] = useState(false);
16
16
  const calculatedPropertiesColumns = useMemo(() => [
17
17
  {
@@ -53,8 +53,7 @@ const CalculatedPropertyTable = ({ iModelId, mappingId, groupId, setSelectedCalc
53
53
  React.createElement(Table, { data: calculatedProperties, density: 'extra-condensed', columns: calculatedPropertiesColumns, emptyTableContent: 'No Calculated Properties', isSortable: true, isLoading: isLoadingGroupProperties }),
54
54
  React.createElement(DeleteModal, { entityName: (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.propertyName) !== null && _a !== void 0 ? _a : "", show: showCalculatedPropertyDeleteModal, setShow: setShowCalculatedPropertyDeleteModal, onDelete: async () => {
55
55
  var _a;
56
- const reportingClientApi = new ReportingClient(apiContext.prefix);
57
- await reportingClientApi.deleteCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.id) !== null && _a !== void 0 ? _a : "");
56
+ await mappingClient.deleteCalculatedProperty(apiContext.accessToken, iModelId, mappingId, groupId, (_a = selectedCalculatedProperty === null || selectedCalculatedProperty === void 0 ? void 0 : selectedCalculatedProperty.id) !== null && _a !== void 0 ? _a : "");
58
57
  }, refresh: refreshCalculatedProperties })));
59
58
  };
60
59
  export default CalculatedPropertyTable;
@@ -1 +1 @@
1
- {"version":3,"file":"CalculatedPropert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AiB,EAAC,0BAA0B,EAC5C,UAAU,QACV,SAAS,EAAE,wBAAwB,GACnC;QAEF,oBAAC,WAAW,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,kBAAkB,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAClE,MAAM,kBAAkB,CAAC,wBAAwB,CAC/C,UAAU,CAAC,WAAW,EACtB,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,eAAe,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, { useContext, 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 { ReportingClient } from \"@itwin/insights-client\";\nimport { ApiContext } from \"./GroupingMapping\";\n\nexport type CalculatedPropertyType =\n CreateTypeFromInterface<CalculatedProperty>;\n\ninterface CalculatedPropertyTableProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n setSelectedCalculatedProperty: React.Dispatch<\n React.SetStateAction<\n CreateTypeFromInterface<CalculatedPropertyType> | undefined\n >\n >;\n setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;\n onCalculatedPropertyModify: (value: CellProps<CalculatedPropertyType>) => void;\n isLoadingCalculatedProperties: boolean;\n calculatedProperties: CalculatedPropertyType[];\n refreshCalculatedProperties: () => Promise<void>;\n selectedCalculatedProperty?: CalculatedPropertyType;\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 apiContext = useContext(ApiContext);\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<CalculatedPropertyType>) => (\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<CalculatedPropertyType>) => {\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<CalculatedPropertyType>\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 reportingClientApi = new ReportingClient(apiContext.prefix);\n await reportingClientApi.deleteCalculatedProperty(\n apiContext.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;;;+FAG+F;AAC/F,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAkBrE,MAAM,uBAAuB,GAAG,CAAC,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C,CAAC;AAEF,eAAe,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, { useContext, 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 { ApiContext, MappingClientContext } from \"./GroupingMapping\";\n\nexport type CalculatedPropertyType =\n CreateTypeFromInterface<CalculatedProperty>;\n\ninterface CalculatedPropertyTableProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n setSelectedCalculatedProperty: React.Dispatch<React.SetStateAction<CreateTypeFromInterface<CalculatedPropertyType> | undefined>>;\n setGroupModifyView: React.Dispatch<React.SetStateAction<PropertyMenuView>>;\n onCalculatedPropertyModify: (value: CellProps<CalculatedPropertyType>) => void;\n isLoadingCalculatedProperties: boolean;\n calculatedProperties: CalculatedPropertyType[];\n refreshCalculatedProperties: () => Promise<void>;\n selectedCalculatedProperty?: CalculatedPropertyType;\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 apiContext = useContext(ApiContext);\n const mappingClient = useContext(MappingClientContext);\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<CalculatedPropertyType>) => (\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<CalculatedPropertyType>) => {\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<CalculatedPropertyType>\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 await mappingClient.deleteCalculatedProperty(\n apiContext.accessToken,\n iModelId,\n mappingId,\n groupId,\n selectedCalculatedProperty?.id ?? \"\",\n );\n }}\n refresh={refreshCalculatedProperties}\n />\n </>\n );\n};\n\nexport default CalculatedPropertyTable;\n"]}