@itwin/grouping-mapping-widget 0.3.4 → 0.5.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 (197) hide show
  1. package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +12 -0
  2. package/lib/cjs/formula/FormulaDataTypeResolver.js +50 -0
  3. package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -0
  4. package/lib/cjs/formula/FormulaFunctionProvider.js +59 -59
  5. package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
  6. package/lib/cjs/formula/FormulaOperatorsProvider.js +7 -7
  7. package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
  8. package/lib/cjs/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
  9. package/lib/cjs/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +33 -31
  10. package/lib/cjs/formula/FormulaTokensDataTypeResolver.js.map +1 -0
  11. package/lib/cjs/formula/Types.d.ts +2 -2
  12. package/lib/cjs/formula/Types.js.map +1 -1
  13. package/lib/cjs/grouping-mapping-widget.d.ts +9 -0
  14. package/lib/cjs/grouping-mapping-widget.js +9 -1
  15. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  16. package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -4
  17. package/lib/cjs/widget/GroupingMappingWidget.js +3 -4
  18. package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
  19. package/lib/cjs/widget/IMappingClient.d.ts +327 -0
  20. package/lib/cjs/widget/IMappingClient.js +7 -0
  21. package/lib/cjs/widget/IMappingClient.js.map +1 -0
  22. package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -6
  23. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  24. package/lib/cjs/widget/components/CalculatedPropertyTable.js +6 -5
  25. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  26. package/lib/cjs/widget/components/ConfirmMappingsImport.js +6 -5
  27. package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
  28. package/lib/cjs/widget/components/CustomCalculationAction.js +8 -7
  29. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  30. package/lib/cjs/widget/components/CustomCalculationTable.js +6 -5
  31. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  32. package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
  33. package/lib/cjs/widget/components/GroupAction.js +21 -14
  34. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  35. package/lib/cjs/widget/components/GroupPropertyAction.js +19 -10
  36. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  37. package/lib/cjs/widget/components/GroupPropertyTable.js +6 -5
  38. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  39. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +8 -5
  40. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  41. package/lib/cjs/widget/components/GroupTile.d.ts +13 -0
  42. package/lib/cjs/widget/components/GroupTile.js +18 -0
  43. package/lib/cjs/widget/components/GroupTile.js.map +1 -0
  44. package/lib/cjs/widget/components/GroupTile.scss +32 -0
  45. package/lib/cjs/widget/components/Grouping.js +215 -166
  46. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  47. package/lib/cjs/widget/components/Grouping.scss +39 -4
  48. package/lib/cjs/widget/components/GroupingMapping.d.ts +18 -11
  49. package/lib/cjs/widget/components/GroupingMapping.js +24 -15
  50. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  51. package/lib/cjs/widget/components/Mapping.js +20 -17
  52. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  53. package/lib/cjs/widget/components/MappingAction.js +8 -7
  54. package/lib/cjs/widget/components/MappingAction.js.map +1 -1
  55. package/lib/cjs/widget/components/PropertyMenu.js +34 -26
  56. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  57. package/lib/cjs/widget/components/QueryBuilder.d.ts +10 -4
  58. package/lib/cjs/widget/components/QueryBuilder.js +223 -141
  59. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  60. package/lib/cjs/widget/components/SelectIModel.js +13 -4
  61. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  62. package/lib/cjs/widget/components/SelectMappings.js +9 -8
  63. package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
  64. package/lib/cjs/widget/components/SelectProject.js +13 -4
  65. package/lib/cjs/widget/components/SelectProject.js.map +1 -1
  66. package/lib/cjs/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
  67. package/lib/cjs/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
  68. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  69. package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  70. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +37 -0
  71. package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  72. package/lib/cjs/widget/components/context/MappingClientContext.d.ts +7 -0
  73. package/lib/cjs/widget/components/context/MappingClientContext.js +30 -0
  74. package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -0
  75. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  76. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +5 -5
  77. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  78. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  79. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  80. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  81. package/lib/cjs/widget/components/property-grid/PropertyView.js +14 -6
  82. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  83. package/lib/cjs/widget/components/utils.d.ts +6 -0
  84. package/lib/cjs/widget/components/utils.js +9 -1
  85. package/lib/cjs/widget/components/utils.js.map +1 -1
  86. package/lib/cjs/widget/components/utils.scss +12 -3
  87. package/lib/cjs/widget/components/viewerUtils.d.ts +19 -0
  88. package/lib/cjs/widget/components/viewerUtils.js +224 -3
  89. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  90. package/lib/cjs/widget/hooks/useFormulaValidation.d.ts +1 -1
  91. package/lib/cjs/widget/hooks/useFormulaValidation.js +7 -6
  92. package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
  93. package/lib/esm/formula/FormulaDataTypeResolver.d.ts +12 -0
  94. package/lib/esm/formula/FormulaDataTypeResolver.js +46 -0
  95. package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -0
  96. package/lib/esm/formula/FormulaFunctionProvider.js +59 -59
  97. package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
  98. package/lib/esm/formula/FormulaOperatorsProvider.js +7 -7
  99. package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
  100. package/lib/esm/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
  101. package/lib/esm/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +31 -29
  102. package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -0
  103. package/lib/esm/formula/Types.d.ts +2 -2
  104. package/lib/esm/formula/Types.js.map +1 -1
  105. package/lib/esm/grouping-mapping-widget.d.ts +9 -0
  106. package/lib/esm/grouping-mapping-widget.js +6 -0
  107. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  108. package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -4
  109. package/lib/esm/widget/GroupingMappingWidget.js +3 -4
  110. package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
  111. package/lib/esm/widget/IMappingClient.d.ts +327 -0
  112. package/lib/esm/widget/IMappingClient.js +6 -0
  113. package/lib/esm/widget/IMappingClient.js.map +1 -0
  114. package/lib/esm/widget/components/CalculatedPropertyAction.js +8 -7
  115. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  116. package/lib/esm/widget/components/CalculatedPropertyTable.js +7 -6
  117. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  118. package/lib/esm/widget/components/ConfirmMappingsImport.js +7 -6
  119. package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
  120. package/lib/esm/widget/components/CustomCalculationAction.js +9 -8
  121. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  122. package/lib/esm/widget/components/CustomCalculationTable.js +7 -6
  123. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  124. package/lib/esm/widget/components/GroupAction.d.ts +2 -1
  125. package/lib/esm/widget/components/GroupAction.js +23 -16
  126. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  127. package/lib/esm/widget/components/GroupPropertyAction.js +20 -11
  128. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  129. package/lib/esm/widget/components/GroupPropertyTable.js +7 -6
  130. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  131. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +8 -5
  132. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  133. package/lib/esm/widget/components/GroupTile.d.ts +13 -0
  134. package/lib/esm/widget/components/GroupTile.js +11 -0
  135. package/lib/esm/widget/components/GroupTile.js.map +1 -0
  136. package/lib/esm/widget/components/GroupTile.scss +32 -0
  137. package/lib/esm/widget/components/Grouping.js +220 -171
  138. package/lib/esm/widget/components/Grouping.js.map +1 -1
  139. package/lib/esm/widget/components/Grouping.scss +39 -4
  140. package/lib/esm/widget/components/GroupingMapping.d.ts +18 -11
  141. package/lib/esm/widget/components/GroupingMapping.js +25 -15
  142. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  143. package/lib/esm/widget/components/Mapping.js +21 -18
  144. package/lib/esm/widget/components/Mapping.js.map +1 -1
  145. package/lib/esm/widget/components/MappingAction.js +9 -8
  146. package/lib/esm/widget/components/MappingAction.js.map +1 -1
  147. package/lib/esm/widget/components/PropertyMenu.js +36 -28
  148. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  149. package/lib/esm/widget/components/QueryBuilder.d.ts +10 -4
  150. package/lib/esm/widget/components/QueryBuilder.js +224 -142
  151. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  152. package/lib/esm/widget/components/SelectIModel.js +14 -5
  153. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  154. package/lib/esm/widget/components/SelectMappings.js +10 -9
  155. package/lib/esm/widget/components/SelectMappings.js.map +1 -1
  156. package/lib/esm/widget/components/SelectProject.js +14 -5
  157. package/lib/esm/widget/components/SelectProject.js.map +1 -1
  158. package/lib/esm/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
  159. package/lib/esm/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
  160. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
  161. package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
  162. package/lib/esm/widget/components/context/GroupingApiConfigContext.js +14 -0
  163. package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -0
  164. package/lib/esm/widget/components/context/MappingClientContext.d.ts +7 -0
  165. package/lib/esm/widget/components/context/MappingClientContext.js +25 -0
  166. package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -0
  167. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  168. package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
  169. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  170. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
  171. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +2 -2
  172. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  173. package/lib/esm/widget/components/property-grid/PropertyView.js +14 -6
  174. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  175. package/lib/esm/widget/components/utils.d.ts +6 -0
  176. package/lib/esm/widget/components/utils.js +6 -0
  177. package/lib/esm/widget/components/utils.js.map +1 -1
  178. package/lib/esm/widget/components/utils.scss +12 -3
  179. package/lib/esm/widget/components/viewerUtils.d.ts +19 -0
  180. package/lib/esm/widget/components/viewerUtils.js +207 -3
  181. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  182. package/lib/esm/widget/hooks/useFormulaValidation.d.ts +1 -1
  183. package/lib/esm/widget/hooks/useFormulaValidation.js +7 -6
  184. package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
  185. package/package.json +30 -30
  186. package/lib/cjs/formula/FormulaTokensValidator.d.ts +0 -5
  187. package/lib/cjs/formula/FormulaTokensValidator.js.map +0 -1
  188. package/lib/cjs/formula/FormulaValidator.d.ts +0 -3
  189. package/lib/cjs/formula/FormulaValidator.js +0 -35
  190. package/lib/cjs/formula/FormulaValidator.js.map +0 -1
  191. package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +0 -1
  192. package/lib/esm/formula/FormulaTokensValidator.d.ts +0 -5
  193. package/lib/esm/formula/FormulaTokensValidator.js.map +0 -1
  194. package/lib/esm/formula/FormulaValidator.d.ts +0 -3
  195. package/lib/esm/formula/FormulaValidator.js +0 -31
  196. package/lib/esm/formula/FormulaValidator.js.map +0 -1
  197. package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +0 -1
@@ -1,10 +1,180 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clearEmphasizedElements = exports.manufactureKeys = exports.zoomToElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.visualizeElementsById = void 0;
3
+ exports.clearAll = exports.clearEmphasizedOverriddenElements = exports.clearEmphasizedElements = exports.manufactureKeys = exports.getHiliteIds = exports.zoomToElements = exports.transparentOverriddenElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.visualizeElementsById = exports.emphasizeElementsByKeys = exports.emphasisElementsById = exports.emphasizeElements = exports.clearOverriddenElements = exports.overrideElements = exports.overrideElementsById = exports.clearHiddenElements = exports.hideElements = exports.hideElementsById = exports.clearIsolatedElements = exports.isolateElements = exports.isolateElementsById = exports.isolateElementsByKeys = void 0;
4
4
  const core_frontend_1 = require("@itwin/core-frontend");
5
5
  const core_common_1 = require("@itwin/core-common");
6
6
  const presentation_common_1 = require("@itwin/presentation-common");
7
7
  const presentation_frontend_1 = require("@itwin/presentation-frontend");
8
+ const isolateElementsByKeys = async (keySet, replace = false) => {
9
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
10
+ return [];
11
+ }
12
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
13
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
14
+ imodel: vp.iModel,
15
+ });
16
+ const set = await hiliteProvider.getHiliteSet(keySet);
17
+ if (set.elements) {
18
+ const ids = [...set.elements];
19
+ exports.isolateElements(ids, replace);
20
+ return ids;
21
+ }
22
+ return [];
23
+ };
24
+ exports.isolateElementsByKeys = isolateElementsByKeys;
25
+ const isolateElementsById = async (elementIds, iModelConnection, replace = false) => {
26
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
27
+ return [];
28
+ }
29
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
30
+ const keySet = await exports.manufactureKeys(elementIds, iModelConnection);
31
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
32
+ imodel: vp.iModel,
33
+ });
34
+ const set = await hiliteProvider.getHiliteSet(keySet);
35
+ if (set.elements) {
36
+ const ids = [...set.elements];
37
+ exports.isolateElements(ids, replace);
38
+ return ids;
39
+ }
40
+ return [];
41
+ };
42
+ exports.isolateElementsById = isolateElementsById;
43
+ const isolateElements = (hilitedIds, replace = false) => {
44
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
45
+ return;
46
+ }
47
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
48
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
49
+ emph.isolateElements(hilitedIds, vp, replace);
50
+ };
51
+ exports.isolateElements = isolateElements;
52
+ const clearIsolatedElements = () => {
53
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
54
+ return;
55
+ }
56
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
57
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
58
+ emph.clearIsolatedElements(vp);
59
+ };
60
+ exports.clearIsolatedElements = clearIsolatedElements;
61
+ const hideElementsById = async (elementIds, iModelConnection, replace = false) => {
62
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
63
+ return [];
64
+ }
65
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
66
+ const keySet = await exports.manufactureKeys(elementIds, iModelConnection);
67
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
68
+ imodel: vp.iModel,
69
+ });
70
+ const set = await hiliteProvider.getHiliteSet(keySet);
71
+ if (set.elements) {
72
+ const ids = [...set.elements];
73
+ exports.hideElements(ids, replace);
74
+ return ids;
75
+ }
76
+ return [];
77
+ };
78
+ exports.hideElementsById = hideElementsById;
79
+ const hideElements = (hilitedIds, replace = false) => {
80
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
81
+ return;
82
+ }
83
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
84
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
85
+ emph.hideElements(hilitedIds, vp, replace);
86
+ };
87
+ exports.hideElements = hideElements;
88
+ const clearHiddenElements = () => {
89
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
90
+ return;
91
+ }
92
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
93
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
94
+ emph.clearHiddenElements(vp);
95
+ };
96
+ exports.clearHiddenElements = clearHiddenElements;
97
+ const overrideElementsById = async (iModelConnection, elementIds, color, overrideType = core_common_1.FeatureOverrideType.ColorOnly) => {
98
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
99
+ return [];
100
+ }
101
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
102
+ const keySet = await exports.manufactureKeys(elementIds, iModelConnection);
103
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
104
+ imodel: vp.iModel,
105
+ });
106
+ const set = await hiliteProvider.getHiliteSet(keySet);
107
+ if (set.elements) {
108
+ const ids = [...set.elements];
109
+ exports.overrideElements(ids, color, overrideType);
110
+ return ids;
111
+ }
112
+ return [];
113
+ };
114
+ exports.overrideElementsById = overrideElementsById;
115
+ const overrideElements = (hilitedIds, color, overrideType = core_common_1.FeatureOverrideType.ColorOnly) => {
116
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
117
+ return;
118
+ }
119
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
120
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
121
+ emph.overrideElements(hilitedIds, vp, core_common_1.ColorDef.fromString(color), overrideType, true);
122
+ };
123
+ exports.overrideElements = overrideElements;
124
+ const clearOverriddenElements = () => {
125
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
126
+ return;
127
+ }
128
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
129
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
130
+ emph.clearOverriddenElements(vp);
131
+ };
132
+ exports.clearOverriddenElements = clearOverriddenElements;
133
+ const emphasizeElements = (hilitedIds, defaultAppearance = undefined, replace = false) => {
134
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
135
+ return;
136
+ }
137
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
138
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
139
+ emph.wantEmphasis = true;
140
+ emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);
141
+ };
142
+ exports.emphasizeElements = emphasizeElements;
143
+ const emphasisElementsById = async (iModelConnection, elementIds, defaultAppearance = undefined, replace = false) => {
144
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
145
+ return [];
146
+ }
147
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
148
+ const keySet = await exports.manufactureKeys(elementIds, iModelConnection);
149
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
150
+ imodel: vp.iModel,
151
+ });
152
+ const set = await hiliteProvider.getHiliteSet(keySet);
153
+ if (set.elements) {
154
+ const ids = [...set.elements];
155
+ exports.emphasizeElements(ids, defaultAppearance, replace);
156
+ return ids;
157
+ }
158
+ return [];
159
+ };
160
+ exports.emphasisElementsById = emphasisElementsById;
161
+ const emphasizeElementsByKeys = async (keySet, defaultAppearance = undefined, replace = false) => {
162
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
163
+ return [];
164
+ }
165
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
166
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
167
+ imodel: vp.iModel,
168
+ });
169
+ const set = await hiliteProvider.getHiliteSet(keySet);
170
+ if (set.elements) {
171
+ const ids = [...set.elements];
172
+ exports.emphasizeElements(ids, defaultAppearance, replace);
173
+ return ids;
174
+ }
175
+ return [];
176
+ };
177
+ exports.emphasizeElementsByKeys = emphasizeElementsByKeys;
8
178
  const visualizeElementsById = async (elementIds, color, iModelConnection, replace = false, wantEmphasis = true) => {
9
179
  if (!core_frontend_1.IModelApp.viewManager.selectedView) {
10
180
  return [];
@@ -46,7 +216,7 @@ const visualizeElements = (elementIds, color, replace = false, wantEmphasis = tr
46
216
  }
47
217
  const vp = core_frontend_1.IModelApp.viewManager.selectedView;
48
218
  const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
49
- emph.overrideElements(elementIds, vp, core_common_1.ColorDef.fromString(color), core_common_1.FeatureOverrideType.ColorOnly, true);
219
+ emph.overrideElements(elementIds, vp, core_common_1.ColorDef.fromString(color), core_common_1.FeatureOverrideType.ColorAndAlpha, true);
50
220
  if (!wantEmphasis) {
51
221
  return;
52
222
  }
@@ -54,6 +224,21 @@ const visualizeElements = (elementIds, color, replace = false, wantEmphasis = tr
54
224
  emph.emphasizeElements(elementIds, vp, undefined, replace);
55
225
  };
56
226
  exports.visualizeElements = visualizeElements;
227
+ const transparentOverriddenElements = () => {
228
+ var _a;
229
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
230
+ return;
231
+ }
232
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
233
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
234
+ const ids = (_a = emph.getOverriddenElements()) === null || _a === void 0 ? void 0 : _a.values();
235
+ if (ids) {
236
+ const toOverride = new Set();
237
+ Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));
238
+ emph.overrideElements(toOverride, vp, core_common_1.ColorDef.red.withAlpha(50), core_common_1.FeatureOverrideType.AlphaOnly, true);
239
+ }
240
+ };
241
+ exports.transparentOverriddenElements = transparentOverriddenElements;
57
242
  const zoomToElements = async (elementIds) => {
58
243
  if (!core_frontend_1.IModelApp.viewManager.selectedView || elementIds.length === 0) {
59
244
  return;
@@ -66,6 +251,22 @@ const zoomToElements = async (elementIds) => {
66
251
  await vp.zoomToElements(elementIds, { ...viewChangeOpts });
67
252
  };
68
253
  exports.zoomToElements = zoomToElements;
254
+ const getHiliteIds = async (elementIds, iModelConnection) => {
255
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
256
+ return [];
257
+ }
258
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
259
+ const keySet = await exports.manufactureKeys(elementIds, iModelConnection);
260
+ const hiliteProvider = presentation_frontend_1.HiliteSetProvider.create({
261
+ imodel: vp.iModel,
262
+ });
263
+ const set = await hiliteProvider.getHiliteSet(keySet);
264
+ if (set.elements) {
265
+ return [...set.elements];
266
+ }
267
+ return [];
268
+ };
269
+ exports.getHiliteIds = getHiliteIds;
69
270
  const manufactureKeys = async (elementIds, iModelConnection) => {
70
271
  // segment ids into batches
71
272
  const batches = [];
@@ -109,7 +310,27 @@ const clearEmphasizedElements = () => {
109
310
  const vp = core_frontend_1.IModelApp.viewManager.selectedView;
110
311
  const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
111
312
  emph.clearEmphasizedElements(vp);
112
- emph.clearOverriddenElements(vp);
113
313
  };
114
314
  exports.clearEmphasizedElements = clearEmphasizedElements;
315
+ const clearEmphasizedOverriddenElements = () => {
316
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
317
+ return;
318
+ }
319
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
320
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
321
+ emph.clearEmphasizedElements(vp);
322
+ emph.clearOverriddenElements(vp);
323
+ };
324
+ exports.clearEmphasizedOverriddenElements = clearEmphasizedOverriddenElements;
325
+ const clearAll = () => {
326
+ if (!core_frontend_1.IModelApp.viewManager.selectedView) {
327
+ return;
328
+ }
329
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
330
+ const emph = core_frontend_1.EmphasizeElements.getOrCreate(vp);
331
+ emph.clearEmphasizedElements(vp);
332
+ emph.clearOverriddenElements(vp);
333
+ emph.clearHiddenElements(vp);
334
+ };
335
+ exports.clearAll = clearAll;
115
336
  //# sourceMappingURL=viewerUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":";;;AAQA,wDAG8B;AAI9B,oDAG4B;AAC5B,oEAAoD;AACpD,wEAAiE;AAE1D,MAAM,qBAAqB,GAAG,KAAK,EACxC,UAAoB,EACpB,KAAa,EACb,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,IAAI,EACnB,EAAE;IACF,IAAI,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,MAA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AAE;IAC1C,IAAI,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iCAAiB,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;AARW,QAAA,uBAAuB,2BAQlC","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":";;;AAKA,wDAAoE;AAEpE,oDAAmE;AACnE,oEAAoD;AACpD,wEAAiE;AAE1D,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAc,EACd,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,cAAc,GAAsB,yCAAiB,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,uBAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AApBW,QAAA,qBAAqB,yBAoBhC;AAEK,MAAM,mBAAmB,GAAG,KAAK,EACtC,UAAoB,EACpB,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,yBA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Y,CAAC;IAC9C,MAAM,IAAI,GAAG,iCAAiB,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;AARW,QAAA,iCAAiC,qCAQ5C;AAEK,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iCAAiB,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;AATW,QAAA,QAAQ,YASnB","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 { IModelConnection, ViewChangeOptions } 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
  };
@@ -6,24 +6,25 @@ exports.useFormulaValidation = void 0;
6
6
  * See LICENSE.md in the project root for license terms and full copyright notice.
7
7
  *--------------------------------------------------------------------------------------------*/
8
8
  const react_1 = require("react");
9
- const FormulaValidator_1 = require("../../formula/FormulaValidator");
9
+ const FormulaDataTypeResolver_1 = require("../../formula/FormulaDataTypeResolver");
10
10
  const utils_1 = require("../utils");
11
- function validate(formula, properties, setFormulaErrorMessage, setIsValid) {
11
+ function validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) {
12
+ var _a;
12
13
  if (!formula) {
13
14
  setFormulaErrorMessage("");
14
15
  setIsValid(false);
15
16
  return false;
16
17
  }
17
- const error = FormulaValidator_1.validateFormula(formula, properties);
18
+ const error = (_a = FormulaDataTypeResolver_1.resolveFormulaDataType(formulaName, formula, properties).errorMessage) !== null && _a !== void 0 ? _a : "";
18
19
  setFormulaErrorMessage(error);
19
20
  setIsValid(!error);
20
21
  return !error;
21
22
  }
22
23
  const debouncedValidationFunc = utils_1.debounce(validate, 1000);
23
- function useFormulaValidation(formula, properties, setFormulaErrorMessage) {
24
+ function useFormulaValidation(formulaName, formula, properties, setFormulaErrorMessage) {
24
25
  const [isValid, setIsValid] = react_1.useState(false);
25
- react_1.useEffect(() => debouncedValidationFunc(formula, properties, setFormulaErrorMessage, setIsValid), [formula, properties, setFormulaErrorMessage]);
26
- return { isValid, forceValidation: () => validate(formula, properties, setFormulaErrorMessage, setIsValid) };
26
+ react_1.useEffect(() => debouncedValidationFunc(formulaName, formula, properties, setFormulaErrorMessage, setIsValid), [formulaName, formula, properties, setFormulaErrorMessage]);
27
+ return { isValid, forceValidation: () => validate(formulaName, formula, properties, setFormulaErrorMessage, setIsValid) };
27
28
  }
28
29
  exports.useFormulaValidation = useFormulaValidation;
29
30
  //# 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,iCAA4C;AAC5C,qEAAiE;AAEjE,oCAAoC;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,kCAAe,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,gBAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAEzD,SAAgB,oBAAoB,CAAC,OAAe,EAAE,UAAuB,EAAE,sBAA2C;IACxH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,iBAAS,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;AAJD,oDAIC","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":";;;AAAA;;;+FAG+F;AAC/F,iCAA4C;AAC5C,mFAA+E;AAE/E,oCAAoC;AAEpC,SAAS,QAAQ,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C,EAAE,UAAgC;;IAC5J,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,MAAA,gDAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,YAAY,mCAAI,EAAE,CAAC;IAC1F,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9B,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;AAChB,CAAC;AAED,MAAM,uBAAuB,GAAG,gBAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAEzD,SAAgB,oBAAoB,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB,EAAE,sBAA2C;IAC7I,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,iBAAS,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC3K,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,CAAC,EAAE,CAAC;AAC5H,CAAC;AAJD,oDAIC","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 { resolveFormulaDataType } from \"../../formula/FormulaDataTypeResolver\";\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 = resolveFormulaDataType(formulaName, formula, properties).errorMessage ?? \"\";\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"]}
@@ -0,0 +1,12 @@
1
+ import type { IResult } from "./IResult";
2
+ import type { DataType, PropertyMap } from "./Types";
3
+ /**
4
+ * Resolves DataType of the given formula.
5
+ * @param formulaName Name of the current formula. Expected to be lowercase.
6
+ * @param formula The formula itself.
7
+ * @param properties All available properties or variables with their data types
8
+ * that could be used in formula. Names are expected to be lowercase.
9
+ * @returns `dataType` if formula is valid. `errorMessage` otherwise.
10
+ */
11
+ export declare function resolveFormulaDataType(formulaName: string, formula: string, properties: PropertyMap): IResult<DataType>;
12
+ //# sourceMappingURL=FormulaDataTypeResolver.d.ts.map
@@ -0,0 +1,46 @@
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 { splitFormula } from "./FormulaSplitter";
6
+ import { resolveTokensDataType } from "./FormulaTokensDataTypeResolver";
7
+ import { convertInfixToPostfix } from "./InfixToPostfixConverter";
8
+ import { ParenthesisState, validateParenthesis } from "./ParenthesisValidator";
9
+ /**
10
+ * Resolves DataType of the given formula.
11
+ * @param formulaName Name of the current formula. Expected to be lowercase.
12
+ * @param formula The formula itself.
13
+ * @param properties All available properties or variables with their data types
14
+ * that could be used in formula. Names are expected to be lowercase.
15
+ * @returns `dataType` if formula is valid. `errorMessage` otherwise.
16
+ */
17
+ export function resolveFormulaDataType(formulaName, formula, properties) {
18
+ var _a;
19
+ const parenthesisState = validateParenthesis(formula);
20
+ if (ParenthesisState.NotClosed === parenthesisState) {
21
+ return { errorMessage: "Opened but not closed parenthesis found." };
22
+ }
23
+ else if (ParenthesisState.NotOpened === parenthesisState) {
24
+ return { errorMessage: "Closed but not opened parenthesis found." };
25
+ }
26
+ let infixFormulaTokens;
27
+ try {
28
+ infixFormulaTokens = splitFormula(formula);
29
+ }
30
+ catch (ex) {
31
+ if (ex instanceof Error) {
32
+ return { errorMessage: ex.message };
33
+ }
34
+ else {
35
+ // eslint-disable-next-line no-console
36
+ console.error("Unknown error.", ex);
37
+ return { errorMessage: "Unknown error." };
38
+ }
39
+ }
40
+ const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);
41
+ if (undefined === postfixFormulaTokens.value) {
42
+ return { errorMessage: (_a = postfixFormulaTokens.errorMessage) !== null && _a !== void 0 ? _a : "Unknown error." };
43
+ }
44
+ return resolveTokensDataType(formulaName, postfixFormulaTokens.value, properties);
45
+ }
46
+ //# sourceMappingURL=FormulaDataTypeResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormulaDataTypeResolver.js","sourceRoot":"","sources":["../../../src/formula/FormulaDataTypeResolver.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG/E;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAuB;;IAClG,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QACnD,OAAO,EAAE,YAAY,EAAE,0CAA0C,EAAE,CAAC;KACrE;SAAM,IAAI,gBAAgB,CAAC,SAAS,KAAK,gBAAgB,EAAE;QAC1D,OAAO,EAAE,YAAY,EAAE,0CAA0C,EAAE,CAAC;KACrE;IAED,IAAI,kBAAkB,CAAC;IACvB,IAAI;QACF,kBAAkB,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;KAC5C;IAAC,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,YAAY,KAAK,EAAE;YACvB,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACrC;aAAM;YACL,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACpC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;SAC3C;KACF;IAED,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAEvE,IAAI,SAAS,KAAK,oBAAoB,CAAC,KAAK,EAAE;QAC5C,OAAO,EAAE,YAAY,EAAE,MAAA,oBAAoB,CAAC,YAAY,mCAAI,gBAAgB,EAAE,CAAC;KAChF;IAED,OAAO,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACpF,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 { splitFormula } from \"./FormulaSplitter\";\nimport { resolveTokensDataType } from \"./FormulaTokensDataTypeResolver\";\nimport { convertInfixToPostfix } from \"./InfixToPostfixConverter\";\nimport type { IResult } from \"./IResult\";\nimport { ParenthesisState, validateParenthesis } from \"./ParenthesisValidator\";\nimport type { DataType, PropertyMap } from \"./Types\";\n\n/**\n * Resolves DataType of the given formula.\n * @param formulaName Name of the current formula. Expected to be lowercase.\n * @param formula The formula itself.\n * @param properties All available properties or variables with their data types\n * that could be used in formula. Names are expected to be lowercase.\n * @returns `dataType` if formula is valid. `errorMessage` otherwise.\n */\nexport function resolveFormulaDataType(formulaName: string, formula: string, properties: PropertyMap): IResult<DataType> {\n const parenthesisState = validateParenthesis(formula);\n if (ParenthesisState.NotClosed === parenthesisState) {\n return { errorMessage: \"Opened but not closed parenthesis found.\" };\n } else if (ParenthesisState.NotOpened === parenthesisState) {\n return { errorMessage: \"Closed but not opened parenthesis found.\" };\n }\n\n let infixFormulaTokens;\n try {\n infixFormulaTokens = splitFormula(formula);\n } catch (ex) {\n if (ex instanceof Error) {\n return { errorMessage: ex.message };\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Unknown error.\", ex);\n return { errorMessage: \"Unknown error.\" };\n }\n }\n\n const postfixFormulaTokens = convertInfixToPostfix(infixFormulaTokens);\n\n if (undefined === postfixFormulaTokens.value) {\n return { errorMessage: postfixFormulaTokens.errorMessage ?? \"Unknown error.\" };\n }\n\n return resolveTokensDataType(formulaName, postfixFormulaTokens.value, properties);\n}\n"]}