@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
@@ -1,7 +1,164 @@
1
- import { EmphasizeElements, IModelApp, } from "@itwin/core-frontend";
2
- import { ColorDef, FeatureOverrideType, } from "@itwin/core-common";
1
+ import { EmphasizeElements, IModelApp } from "@itwin/core-frontend";
2
+ import { ColorDef, FeatureOverrideType } from "@itwin/core-common";
3
3
  import { KeySet } from "@itwin/presentation-common";
4
4
  import { HiliteSetProvider } from "@itwin/presentation-frontend";
5
+ export const isolateElementsByKeys = async (keySet, replace = false) => {
6
+ if (!IModelApp.viewManager.selectedView) {
7
+ return [];
8
+ }
9
+ const vp = IModelApp.viewManager.selectedView;
10
+ const hiliteProvider = HiliteSetProvider.create({
11
+ imodel: vp.iModel,
12
+ });
13
+ const set = await hiliteProvider.getHiliteSet(keySet);
14
+ if (set.elements) {
15
+ const ids = [...set.elements];
16
+ isolateElements(ids, replace);
17
+ return ids;
18
+ }
19
+ return [];
20
+ };
21
+ export const isolateElementsById = async (elementIds, iModelConnection, replace = false) => {
22
+ if (!IModelApp.viewManager.selectedView) {
23
+ return [];
24
+ }
25
+ const vp = IModelApp.viewManager.selectedView;
26
+ const keySet = await manufactureKeys(elementIds, iModelConnection);
27
+ const hiliteProvider = HiliteSetProvider.create({
28
+ imodel: vp.iModel,
29
+ });
30
+ const set = await hiliteProvider.getHiliteSet(keySet);
31
+ if (set.elements) {
32
+ const ids = [...set.elements];
33
+ isolateElements(ids, replace);
34
+ return ids;
35
+ }
36
+ return [];
37
+ };
38
+ export const isolateElements = (hilitedIds, replace = false) => {
39
+ if (!IModelApp.viewManager.selectedView) {
40
+ return;
41
+ }
42
+ const vp = IModelApp.viewManager.selectedView;
43
+ const emph = EmphasizeElements.getOrCreate(vp);
44
+ emph.isolateElements(hilitedIds, vp, replace);
45
+ };
46
+ export const clearIsolatedElements = () => {
47
+ if (!IModelApp.viewManager.selectedView) {
48
+ return;
49
+ }
50
+ const vp = IModelApp.viewManager.selectedView;
51
+ const emph = EmphasizeElements.getOrCreate(vp);
52
+ emph.clearIsolatedElements(vp);
53
+ };
54
+ export const hideElementsById = async (elementIds, iModelConnection, replace = false) => {
55
+ if (!IModelApp.viewManager.selectedView) {
56
+ return [];
57
+ }
58
+ const vp = IModelApp.viewManager.selectedView;
59
+ const keySet = await manufactureKeys(elementIds, iModelConnection);
60
+ const hiliteProvider = HiliteSetProvider.create({
61
+ imodel: vp.iModel,
62
+ });
63
+ const set = await hiliteProvider.getHiliteSet(keySet);
64
+ if (set.elements) {
65
+ const ids = [...set.elements];
66
+ hideElements(ids, replace);
67
+ return ids;
68
+ }
69
+ return [];
70
+ };
71
+ export const hideElements = (hilitedIds, replace = false) => {
72
+ if (!IModelApp.viewManager.selectedView) {
73
+ return;
74
+ }
75
+ const vp = IModelApp.viewManager.selectedView;
76
+ const emph = EmphasizeElements.getOrCreate(vp);
77
+ emph.hideElements(hilitedIds, vp, replace);
78
+ };
79
+ export const clearHiddenElements = () => {
80
+ if (!IModelApp.viewManager.selectedView) {
81
+ return;
82
+ }
83
+ const vp = IModelApp.viewManager.selectedView;
84
+ const emph = EmphasizeElements.getOrCreate(vp);
85
+ emph.clearHiddenElements(vp);
86
+ };
87
+ export const overrideElementsById = async (iModelConnection, elementIds, color, overrideType = FeatureOverrideType.ColorOnly) => {
88
+ if (!IModelApp.viewManager.selectedView) {
89
+ return [];
90
+ }
91
+ const vp = IModelApp.viewManager.selectedView;
92
+ const keySet = await manufactureKeys(elementIds, iModelConnection);
93
+ const hiliteProvider = HiliteSetProvider.create({
94
+ imodel: vp.iModel,
95
+ });
96
+ const set = await hiliteProvider.getHiliteSet(keySet);
97
+ if (set.elements) {
98
+ const ids = [...set.elements];
99
+ overrideElements(ids, color, overrideType);
100
+ return ids;
101
+ }
102
+ return [];
103
+ };
104
+ export const overrideElements = (hilitedIds, color, overrideType = FeatureOverrideType.ColorOnly) => {
105
+ if (!IModelApp.viewManager.selectedView) {
106
+ return;
107
+ }
108
+ const vp = IModelApp.viewManager.selectedView;
109
+ const emph = EmphasizeElements.getOrCreate(vp);
110
+ emph.overrideElements(hilitedIds, vp, ColorDef.fromString(color), overrideType, true);
111
+ };
112
+ export const clearOverriddenElements = () => {
113
+ if (!IModelApp.viewManager.selectedView) {
114
+ return;
115
+ }
116
+ const vp = IModelApp.viewManager.selectedView;
117
+ const emph = EmphasizeElements.getOrCreate(vp);
118
+ emph.clearOverriddenElements(vp);
119
+ };
120
+ export const emphasizeElements = (hilitedIds, defaultAppearance = undefined, replace = false) => {
121
+ if (!IModelApp.viewManager.selectedView) {
122
+ return;
123
+ }
124
+ const vp = IModelApp.viewManager.selectedView;
125
+ const emph = EmphasizeElements.getOrCreate(vp);
126
+ emph.wantEmphasis = true;
127
+ emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);
128
+ };
129
+ export const emphasisElementsById = async (iModelConnection, elementIds, defaultAppearance = undefined, replace = false) => {
130
+ if (!IModelApp.viewManager.selectedView) {
131
+ return [];
132
+ }
133
+ const vp = IModelApp.viewManager.selectedView;
134
+ const keySet = await manufactureKeys(elementIds, iModelConnection);
135
+ const hiliteProvider = HiliteSetProvider.create({
136
+ imodel: vp.iModel,
137
+ });
138
+ const set = await hiliteProvider.getHiliteSet(keySet);
139
+ if (set.elements) {
140
+ const ids = [...set.elements];
141
+ emphasizeElements(ids, defaultAppearance, replace);
142
+ return ids;
143
+ }
144
+ return [];
145
+ };
146
+ export const emphasizeElementsByKeys = async (keySet, defaultAppearance = undefined, replace = false) => {
147
+ if (!IModelApp.viewManager.selectedView) {
148
+ return [];
149
+ }
150
+ const vp = IModelApp.viewManager.selectedView;
151
+ const hiliteProvider = HiliteSetProvider.create({
152
+ imodel: vp.iModel,
153
+ });
154
+ const set = await hiliteProvider.getHiliteSet(keySet);
155
+ if (set.elements) {
156
+ const ids = [...set.elements];
157
+ emphasizeElements(ids, defaultAppearance, replace);
158
+ return ids;
159
+ }
160
+ return [];
161
+ };
5
162
  export const visualizeElementsById = async (elementIds, color, iModelConnection, replace = false, wantEmphasis = true) => {
6
163
  if (!IModelApp.viewManager.selectedView) {
7
164
  return [];
@@ -41,13 +198,27 @@ export const visualizeElements = (elementIds, color, replace = false, wantEmphas
41
198
  }
42
199
  const vp = IModelApp.viewManager.selectedView;
43
200
  const emph = EmphasizeElements.getOrCreate(vp);
44
- emph.overrideElements(elementIds, vp, ColorDef.fromString(color), FeatureOverrideType.ColorOnly, true);
201
+ emph.overrideElements(elementIds, vp, ColorDef.fromString(color), FeatureOverrideType.ColorAndAlpha, true);
45
202
  if (!wantEmphasis) {
46
203
  return;
47
204
  }
48
205
  emph.wantEmphasis = true;
49
206
  emph.emphasizeElements(elementIds, vp, undefined, replace);
50
207
  };
208
+ export const transparentOverriddenElements = () => {
209
+ var _a;
210
+ if (!IModelApp.viewManager.selectedView) {
211
+ return;
212
+ }
213
+ const vp = IModelApp.viewManager.selectedView;
214
+ const emph = EmphasizeElements.getOrCreate(vp);
215
+ const ids = (_a = emph.getOverriddenElements()) === null || _a === void 0 ? void 0 : _a.values();
216
+ if (ids) {
217
+ const toOverride = new Set();
218
+ Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));
219
+ emph.overrideElements(toOverride, vp, ColorDef.red.withAlpha(50), FeatureOverrideType.AlphaOnly, true);
220
+ }
221
+ };
51
222
  export const zoomToElements = async (elementIds) => {
52
223
  if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {
53
224
  return;
@@ -59,6 +230,21 @@ export const zoomToElements = async (elementIds) => {
59
230
  // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);
60
231
  await vp.zoomToElements(elementIds, { ...viewChangeOpts });
61
232
  };
233
+ export const getHiliteIds = async (elementIds, iModelConnection) => {
234
+ if (!IModelApp.viewManager.selectedView) {
235
+ return [];
236
+ }
237
+ const vp = IModelApp.viewManager.selectedView;
238
+ const keySet = await manufactureKeys(elementIds, iModelConnection);
239
+ const hiliteProvider = HiliteSetProvider.create({
240
+ imodel: vp.iModel,
241
+ });
242
+ const set = await hiliteProvider.getHiliteSet(keySet);
243
+ if (set.elements) {
244
+ return [...set.elements];
245
+ }
246
+ return [];
247
+ };
62
248
  export const manufactureKeys = async (elementIds, iModelConnection) => {
63
249
  // segment ids into batches
64
250
  const batches = [];
@@ -101,6 +287,24 @@ export const clearEmphasizedElements = () => {
101
287
  const vp = IModelApp.viewManager.selectedView;
102
288
  const emph = EmphasizeElements.getOrCreate(vp);
103
289
  emph.clearEmphasizedElements(vp);
290
+ };
291
+ export const clearEmphasizedOverriddenElements = () => {
292
+ if (!IModelApp.viewManager.selectedView) {
293
+ return;
294
+ }
295
+ const vp = IModelApp.viewManager.selectedView;
296
+ const emph = EmphasizeElements.getOrCreate(vp);
297
+ emph.clearEmphasizedElements(vp);
298
+ emph.clearOverriddenElements(vp);
299
+ };
300
+ export const clearAll = () => {
301
+ if (!IModelApp.viewManager.selectedView) {
302
+ return;
303
+ }
304
+ const vp = IModelApp.viewManager.selectedView;
305
+ const emph = EmphasizeElements.getOrCreate(vp);
306
+ emph.clearEmphasizedElements(vp);
104
307
  emph.clearOverriddenElements(vp);
308
+ emph.clearHiddenElements(vp);
105
309
  };
106
310
  //# sourceMappingURL=viewerUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,iBAAiB,EACjB,SAAS,GACV,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,QAAQ,EACR,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,UAAoB,EACpB,KAAa,EACb,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,IAAI,EACnB,EAAE;IACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,MAAM,GAAG,MAAM,eAAe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AAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;AACnC,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 type {\n IModelConnection,\n ViewChangeOptions,\n} from \"@itwin/core-frontend\";\nimport {\n EmphasizeElements,\n IModelApp,\n} from \"@itwin/core-frontend\";\nimport type {\n ElementProps,\n} from \"@itwin/core-common\";\nimport {\n ColorDef,\n FeatureOverrideType,\n} from \"@itwin/core-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const visualizeElementsById = async (\n elementIds: string[],\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorOnly,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const manufactureKeys = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n // segment ids into batches\n const batches: string[][] = [];\n let currBatch: string[] = [];\n const batchSize = 100000;\n for (const id of elementIds) {\n if (currBatch.length < batchSize) {\n currBatch.push(id);\n } else {\n batches.push(currBatch);\n currBatch = [id];\n }\n }\n if (currBatch.length > 0 && currBatch.length <= batchSize) {\n batches.push(currBatch);\n }\n\n // retrieve element properties in batches\n let elemProps: ElementProps[] = [];\n for (const batch of batches) {\n const props = await iModelConnection.elements.getProps(batch);\n elemProps = elemProps.concat(props);\n }\n\n const isElementId = (elem: {\n id: string | undefined;\n className: string;\n }): elem is {\n id: string;\n className: string;\n } => {\n return elem.id !== undefined;\n };\n\n // create keyset from the element properties\n const keys = elemProps\n .map((elem: ElementProps) => ({\n id: elem.id,\n className: elem.classFullName,\n }))\n .filter(isElementId);\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n"]}
1
+ {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAc,EACd,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,cAAc,GAAsB,iBAAiB,CAAC,MAAM,CAAC;QACjE,MAAM,EAAE,EAAE,CAAC,MAAM;KAClB,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,UAAoB,EACpB,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF,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I,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { ViewChangeOptions } from \"@itwin/core-frontend\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { EmphasizeElements, IModelApp } from \"@itwin/core-frontend\";\nimport type { ElementProps, FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType } from \"@itwin/core-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const isolateElementsByKeys = async (\n keySet: KeySet,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.isolateElements(hilitedIds, vp, replace);\n};\n\nexport const clearIsolatedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearIsolatedElements(vp);\n};\n\nexport const hideElementsById = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n hideElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const hideElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.hideElements(hilitedIds, vp, replace);\n};\n\nexport const clearHiddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearHiddenElements(vp);\n};\n\nexport const overrideElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n overrideElements(ids, color, overrideType);\n return ids;\n }\n return [];\n};\n\nexport const overrideElements = (\n hilitedIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n hilitedIds,\n vp,\n ColorDef.fromString(color),\n overrideType,\n true,\n );\n};\n\nexport const clearOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const emphasizeElements = (\n hilitedIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.wantEmphasis = true;\n emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);\n};\n\nexport const emphasisElementsById = async (\n iModelConnection: IModelConnection,\n elementIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const emphasizeElementsByKeys = async (\n keySet: KeySet,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsById = async (\n elementIds: string[],\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorAndAlpha,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const transparentOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n const ids = emph.getOverriddenElements()?.values();\n if (ids) {\n const toOverride = new Set<string>();\n Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));\n emph.overrideElements(\n toOverride,\n vp,\n ColorDef.red.withAlpha(50),\n FeatureOverrideType.AlphaOnly,\n true,\n );\n }\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const getHiliteIds = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(elementIds, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n return [...set.elements];\n }\n return [];\n};\n\nexport const manufactureKeys = async (\n elementIds: string[],\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n // segment ids into batches\n const batches: string[][] = [];\n let currBatch: string[] = [];\n const batchSize = 100000;\n for (const id of elementIds) {\n if (currBatch.length < batchSize) {\n currBatch.push(id);\n } else {\n batches.push(currBatch);\n currBatch = [id];\n }\n }\n if (currBatch.length > 0 && currBatch.length <= batchSize) {\n batches.push(currBatch);\n }\n\n // retrieve element properties in batches\n let elemProps: ElementProps[] = [];\n for (const batch of batches) {\n const props = await iModelConnection.elements.getProps(batch);\n elemProps = elemProps.concat(props);\n }\n\n const isElementId = (elem: {\n id: string | undefined;\n className: string;\n }): elem is {\n id: string;\n className: string;\n } => {\n return elem.id !== undefined;\n };\n\n // create keyset from the element properties\n const keys = elemProps\n .map((elem: ElementProps) => ({\n id: elem.id,\n className: elem.classFullName,\n }))\n .filter(isElementId);\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n};\n\nexport const clearEmphasizedOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const clearAll = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n emph.clearHiddenElements(vp);\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { PropertyMap } from "../../formula/Types";
2
- export declare function useFormulaValidation(formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void): {
2
+ export declare function useFormulaValidation(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void): {
3
3
  isValid: boolean;
4
4
  forceValidation: () => boolean;
5
5
  };
@@ -5,21 +5,21 @@
5
5
  import { useEffect, useState } from "react";
6
6
  import { validateFormula } from "../../formula/FormulaValidator";
7
7
  import { debounce } from "../utils";
8
- function validate(formula, properties, setFormulaErrorMessage, setIsValid) {
8
+ function validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) {
9
9
  if (!formula) {
10
10
  setFormulaErrorMessage("");
11
11
  setIsValid(false);
12
12
  return false;
13
13
  }
14
- const error = validateFormula(formula, properties);
14
+ const error = validateFormula(formulaName, formula, properties);
15
15
  setFormulaErrorMessage(error);
16
16
  setIsValid(!error);
17
17
  return !error;
18
18
  }
19
19
  const debouncedValidationFunc = debounce(validate, 1000);
20
- export function useFormulaValidation(formula, properties, setFormulaErrorMessage) {
20
+ export function useFormulaValidation(formulaName, formula, properties, setFormulaErrorMessage) {
21
21
  const [isValid, setIsValid] = useState(false);
22
- useEffect(() => debouncedValidationFunc(formula, properties, setFormulaErrorMessage, setIsValid), [formula, properties, setFormulaErrorMessage]);
23
- return { isValid, forceValidation: () => validate(formula, properties, setFormulaErrorMessage, setIsValid) };
22
+ useEffect(() => debouncedValidationFunc(formulaName, formula, properties, setFormulaErrorMessage, setIsValid), [formulaName, formula, properties, setFormulaErrorMessage]);
23
+ return { isValid, forceValidation: () => validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) };
24
24
  }
25
25
  //# sourceMappingURL=useFormulaValidation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFormulaValidation.js","sourceRoot":"","sources":["../../../../src/widget/hooks/useFormulaValidation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,SAAS,QAAQ,CAAC,OAAe,EAAE,UAAuB,EAAE,sBAA2C,EAAE,UAAgC;IACvI,IAAI,CAAC,OAAO,EAAE;QACZ,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC3B,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACnD,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9B,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,MAAM,uBAAuB,GAAG,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAEzD,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,UAAuB,EAAE,sBAA2C;IACxH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,SAAS,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;IACjJ,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC/G,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 { useEffect, useState } from \"react\";\nimport { validateFormula } from \"../../formula/FormulaValidator\";\nimport type { PropertyMap } from \"../../formula/Types\";\nimport { debounce } from \"../utils\";\n\nfunction validate(formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void, setIsValid: (b: boolean) => void): boolean {\n if (!formula) {\n setFormulaErrorMessage(\"\");\n setIsValid(false);\n return false;\n }\n\n const error = validateFormula(formula, properties);\n setFormulaErrorMessage(error);\n setIsValid(!error);\n return !error;\n}\n\nconst debouncedValidationFunc = debounce(validate, 1000);\n\nexport function useFormulaValidation(formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void) {\n const [isValid, setIsValid] = useState(false);\n useEffect(() => debouncedValidationFunc(formula, properties, setFormulaErrorMessage, setIsValid), [formula, properties, setFormulaErrorMessage]);\n return { isValid, forceValidation: () => validate(formula, properties, setFormulaErrorMessage, setIsValid) };\n}\n"]}
1
+ {"version":3,"file":"useFormulaValidation.js","sourceRoot":"","sources":["../../../../src/widget/hooks/useFormulaValidation.ts"],"names":[],"mappings":"A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entley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { useEffect, useState } from \"react\";\nimport { validateFormula } from \"../../formula/FormulaValidator\";\nimport type { PropertyMap } from \"../../formula/Types\";\nimport { debounce } from \"../utils\";\n\nfunction validate(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void, setIsValid: (b: boolean) => void): boolean {\n if (!formula) {\n setFormulaErrorMessage(\"\");\n setIsValid(false);\n return false;\n }\n\n const error = validateFormula(formulaName, formula, properties);\n setFormulaErrorMessage(error);\n setIsValid(!error);\n return !error;\n}\n\nconst debouncedValidationFunc = debounce(validate, 1000);\n\nexport function useFormulaValidation(formulaName: string, formula: string, properties: PropertyMap, setFormulaErrorMessage: (s: string) => void) {\n const [isValid, setIsValid] = useState(false);\n useEffect(() => debouncedValidationFunc(formulaName, formula, properties, setFormulaErrorMessage, setIsValid), [formulaName, formula, properties, setFormulaErrorMessage]);\n return { isValid, forceValidation: () => validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/grouping-mapping-widget",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Reporting Platform.",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -37,35 +37,35 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@itwin/imodel-browser-react": "^0.12.1",
40
- "@itwin/insights-client": "0.1.1",
40
+ "@itwin/insights-client": "0.2.1",
41
41
  "@itwin/itwinui-icons-react": "^1.7.0",
42
- "@itwin/itwinui-react": "^1.35.0",
42
+ "@itwin/itwinui-react": "~1.37.3",
43
43
  "classnames": "^2.3.1",
44
44
  "cross-fetch": "^3.1.4",
45
45
  "immer": "^9.0.7",
46
46
  "simple-react-validator": "^1.6.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@itwin/appui-abstract": "^3.0.0",
50
- "@itwin/appui-layout-react": "^3.0.0",
51
- "@itwin/appui-react": "^3.0.0",
52
- "@itwin/build-tools": "^3.0.0",
53
- "@itwin/components-react": "^3.0.0",
54
- "@itwin/core-bentley": "^3.0.0",
55
- "@itwin/core-common": "^3.0.0",
56
- "@itwin/core-frontend": "^3.0.0",
57
- "@itwin/core-geometry": "^3.0.0",
58
- "@itwin/core-i18n": "^3.0.0",
59
- "@itwin/core-markup": "^3.0.0",
60
- "@itwin/core-orbitgt": "^3.0.0",
61
- "@itwin/core-quantity": "^3.0.0",
62
- "@itwin/core-react": "^3.0.0",
63
- "@itwin/eslint-plugin": "^3.0.0",
64
- "@itwin/imodel-components-react": "^3.0.0",
65
- "@itwin/presentation-common": "^3.0.0",
66
- "@itwin/presentation-components": "^3.0.0",
67
- "@itwin/presentation-frontend": "^3.0.0",
68
- "@itwin/webgl-compatibility": "^3.0.0",
49
+ "@itwin/appui-abstract": "^3.2.0",
50
+ "@itwin/appui-layout-react": "^3.2.0",
51
+ "@itwin/appui-react": "^3.2.0",
52
+ "@itwin/build-tools": "^3.2.0",
53
+ "@itwin/components-react": "^3.2.0",
54
+ "@itwin/core-bentley": "^3.2.0",
55
+ "@itwin/core-common": "^3.2.0",
56
+ "@itwin/core-frontend": "^3.2.0",
57
+ "@itwin/core-geometry": "^3.2.0",
58
+ "@itwin/core-i18n": "^3.2.0",
59
+ "@itwin/core-markup": "^3.2.0",
60
+ "@itwin/core-orbitgt": "^3.2.0",
61
+ "@itwin/core-quantity": "^3.2.0",
62
+ "@itwin/core-react": "^3.2.0",
63
+ "@itwin/eslint-plugin": "^3.2.0",
64
+ "@itwin/imodel-components-react": "^3.2.0",
65
+ "@itwin/presentation-common": "^3.2.0",
66
+ "@itwin/presentation-components": "^3.2.0",
67
+ "@itwin/presentation-frontend": "^3.2.0",
68
+ "@itwin/webgl-compatibility": "^3.2.0",
69
69
  "@types/i18next": "^8.4.2",
70
70
  "@types/node": "^14.14.20",
71
71
  "@types/react": "^17.0.19",
@@ -87,13 +87,13 @@
87
87
  "typescript": "~4.3.0"
88
88
  },
89
89
  "peerDependencies": {
90
- "@itwin/appui-abstract": "^3.0.0",
91
- "@itwin/appui-react": "^3.0.0",
92
- "@itwin/components-react": "^3.0.0",
93
- "@itwin/core-frontend": "^3.0.0",
94
- "@itwin/core-react": "^3.0.0",
95
- "@itwin/presentation-components": "^3.0.0",
96
- "@itwin/presentation-frontend": "^3.0.0",
90
+ "@itwin/appui-abstract": "^3.2.0",
91
+ "@itwin/appui-react": "^3.2.0",
92
+ "@itwin/components-react": "^3.2.0",
93
+ "@itwin/core-frontend": "^3.2.0",
94
+ "@itwin/core-react": "^3.2.0",
95
+ "@itwin/presentation-components": "^3.2.0",
96
+ "@itwin/presentation-frontend": "^3.2.0",
97
97
  "react": "^17.0.2",
98
98
  "react-dom": "^17.0.2",
99
99
  "react-redux": "^7.2.0"