@itwin/grouping-mapping-widget 0.11.0 → 0.12.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 (205) hide show
  1. package/lib/cjs/grouping-mapping-widget.d.ts +4 -1
  2. package/lib/cjs/grouping-mapping-widget.js +7 -1
  3. package/lib/cjs/grouping-mapping-widget.js.map +1 -1
  4. package/lib/cjs/test/WidgetHeader.test.js +3 -3
  5. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  6. package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +7 -9
  7. package/lib/cjs/widget/components/CalculatedPropertyAction.js +49 -24
  8. package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
  9. package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +9 -16
  10. package/lib/cjs/widget/components/CalculatedPropertyTable.js +29 -31
  11. package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
  12. package/lib/cjs/widget/components/CalculatedPropertyTable.scss +9 -0
  13. package/lib/cjs/widget/components/CustomCalculationAction.d.ts +6 -9
  14. package/lib/cjs/widget/components/CustomCalculationAction.js +79 -9
  15. package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
  16. package/lib/cjs/widget/components/CustomCalculationTable.d.ts +8 -16
  17. package/lib/cjs/widget/components/CustomCalculationTable.js +22 -29
  18. package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
  19. package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
  20. package/lib/cjs/widget/components/DeleteModal.js +9 -13
  21. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  22. package/lib/cjs/widget/components/GroupAction.js +1 -0
  23. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  24. package/lib/cjs/widget/components/GroupInformationPanel.d.ts +10 -0
  25. package/lib/cjs/widget/components/GroupInformationPanel.js +23 -0
  26. package/lib/cjs/widget/components/GroupInformationPanel.js.map +1 -0
  27. package/lib/cjs/widget/components/GroupInformationPanel.scss +13 -0
  28. package/lib/cjs/widget/components/GroupPropertyAction.d.ts +6 -9
  29. package/lib/cjs/widget/components/GroupPropertyAction.js +26 -15
  30. package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
  31. package/lib/cjs/widget/components/GroupPropertyTable.d.ts +8 -15
  32. package/lib/cjs/widget/components/GroupPropertyTable.js +23 -28
  33. package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
  34. package/lib/cjs/widget/components/Grouping.d.ts +2 -1
  35. package/lib/cjs/widget/components/Grouping.js +12 -15
  36. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  37. package/lib/cjs/widget/components/Grouping.scss +2 -9
  38. package/lib/cjs/widget/components/GroupingMapping.js +1 -2
  39. package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
  40. package/lib/cjs/widget/components/GroupingMappingContent.js +8 -4
  41. package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
  42. package/lib/cjs/widget/components/GroupingMappingContext.js +17 -1
  43. package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
  44. package/lib/cjs/widget/components/GroupingMappingHeader.js +2 -2
  45. package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
  46. package/lib/cjs/widget/components/GroupingMappingRouter.js +23 -2
  47. package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
  48. package/lib/cjs/widget/components/GroupsAddButton.d.ts +9 -0
  49. package/lib/cjs/widget/components/GroupsAddButton.js +17 -0
  50. package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -0
  51. package/lib/cjs/widget/components/GroupsAddButton.scss +7 -0
  52. package/lib/cjs/widget/components/Mapping.js +5 -11
  53. package/lib/cjs/widget/components/Mapping.js.map +1 -1
  54. package/lib/cjs/widget/components/PropertyMenu.d.ts +12 -17
  55. package/lib/cjs/widget/components/PropertyMenu.js +52 -155
  56. package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
  57. package/lib/cjs/widget/components/PropertyMenu.scss +4 -28
  58. package/lib/cjs/widget/components/PropertyNameCell.d.ts +11 -0
  59. package/lib/cjs/widget/components/PropertyNameCell.js +15 -0
  60. package/lib/cjs/widget/components/PropertyNameCell.js.map +1 -0
  61. package/lib/cjs/widget/components/PropertyTable.d.ts +18 -0
  62. package/lib/cjs/widget/components/PropertyTable.js +54 -0
  63. package/lib/cjs/widget/components/PropertyTable.js.map +1 -0
  64. package/lib/cjs/widget/components/PropertyTable.scss +11 -0
  65. package/lib/cjs/widget/components/PropertyTableToolbar.d.ts +10 -0
  66. package/lib/cjs/widget/components/PropertyTableToolbar.js +23 -0
  67. package/lib/cjs/widget/components/PropertyTableToolbar.js.map +1 -0
  68. package/lib/cjs/widget/components/PropertyTableToolbar.scss +12 -0
  69. package/lib/cjs/widget/components/ToggleGroupVisibility.d.ts +9 -0
  70. package/lib/cjs/widget/components/ToggleGroupVisibility.js +16 -0
  71. package/lib/cjs/widget/components/ToggleGroupVisibility.js.map +1 -0
  72. package/lib/cjs/widget/components/ToggleGroupVisibility.scss +9 -0
  73. package/lib/cjs/widget/components/WidgetHeader.d.ts +9 -0
  74. package/lib/cjs/widget/components/WidgetHeader.js +22 -0
  75. package/lib/cjs/widget/components/WidgetHeader.js.map +1 -0
  76. package/lib/cjs/widget/components/WidgetHeader.scss +36 -0
  77. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  78. package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  79. package/lib/cjs/widget/components/context/PropertiesContext.d.ts +15 -0
  80. package/lib/cjs/widget/components/context/PropertiesContext.js +43 -0
  81. package/lib/cjs/widget/components/context/PropertiesContext.js.map +1 -0
  82. package/lib/cjs/widget/components/groupsHelpers.d.ts +6 -3
  83. package/lib/cjs/widget/components/groupsHelpers.js +43 -40
  84. package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
  85. package/lib/cjs/widget/components/property-grid/PropertyRender.js +2 -1
  86. package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +1 -1
  87. package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +8 -0
  88. package/lib/cjs/widget/components/property-grid/countMatchesInString.js +32 -0
  89. package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +1 -0
  90. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +10 -0
  91. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +65 -0
  92. package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +1 -0
  93. package/lib/cjs/widget/components/utils.d.ts +0 -6
  94. package/lib/cjs/widget/components/utils.js +1 -9
  95. package/lib/cjs/widget/components/utils.js.map +1 -1
  96. package/lib/cjs/widget/components/utils.scss +0 -29
  97. package/lib/cjs/widget/components/viewerUtils.d.ts +4 -2
  98. package/lib/cjs/widget/components/viewerUtils.js +4 -22
  99. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  100. package/lib/cjs/widget/hooks/useFetchData.d.ts +3 -5
  101. package/lib/cjs/widget/hooks/useFetchData.js +9 -7
  102. package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
  103. package/lib/esm/grouping-mapping-widget.d.ts +4 -1
  104. package/lib/esm/grouping-mapping-widget.js +3 -0
  105. package/lib/esm/grouping-mapping-widget.js.map +1 -1
  106. package/lib/esm/test/WidgetHeader.test.js +1 -1
  107. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  108. package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +7 -9
  109. package/lib/esm/widget/components/CalculatedPropertyAction.js +50 -27
  110. package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
  111. package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +9 -16
  112. package/lib/esm/widget/components/CalculatedPropertyTable.js +30 -31
  113. package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
  114. package/lib/esm/widget/components/CalculatedPropertyTable.scss +9 -0
  115. package/lib/esm/widget/components/CustomCalculationAction.d.ts +6 -9
  116. package/lib/esm/widget/components/CustomCalculationAction.js +79 -11
  117. package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
  118. package/lib/esm/widget/components/CustomCalculationTable.d.ts +8 -16
  119. package/lib/esm/widget/components/CustomCalculationTable.js +23 -29
  120. package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
  121. package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
  122. package/lib/esm/widget/components/DeleteModal.js +9 -13
  123. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  124. package/lib/esm/widget/components/GroupAction.js +1 -0
  125. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  126. package/lib/esm/widget/components/GroupInformationPanel.d.ts +10 -0
  127. package/lib/esm/widget/components/GroupInformationPanel.js +16 -0
  128. package/lib/esm/widget/components/GroupInformationPanel.js.map +1 -0
  129. package/lib/esm/widget/components/GroupInformationPanel.scss +13 -0
  130. package/lib/esm/widget/components/GroupPropertyAction.d.ts +6 -9
  131. package/lib/esm/widget/components/GroupPropertyAction.js +25 -15
  132. package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
  133. package/lib/esm/widget/components/GroupPropertyTable.d.ts +8 -15
  134. package/lib/esm/widget/components/GroupPropertyTable.js +24 -28
  135. package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
  136. package/lib/esm/widget/components/Grouping.d.ts +2 -1
  137. package/lib/esm/widget/components/Grouping.js +14 -17
  138. package/lib/esm/widget/components/Grouping.js.map +1 -1
  139. package/lib/esm/widget/components/Grouping.scss +2 -9
  140. package/lib/esm/widget/components/GroupingMapping.js +1 -2
  141. package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
  142. package/lib/esm/widget/components/GroupingMappingContent.js +9 -5
  143. package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
  144. package/lib/esm/widget/components/GroupingMappingContext.js +17 -1
  145. package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
  146. package/lib/esm/widget/components/GroupingMappingHeader.js +1 -1
  147. package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
  148. package/lib/esm/widget/components/GroupingMappingRouter.js +23 -2
  149. package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
  150. package/lib/esm/widget/components/GroupsAddButton.d.ts +9 -0
  151. package/lib/esm/widget/components/GroupsAddButton.js +10 -0
  152. package/lib/esm/widget/components/GroupsAddButton.js.map +1 -0
  153. package/lib/esm/widget/components/GroupsAddButton.scss +7 -0
  154. package/lib/esm/widget/components/Mapping.js +5 -11
  155. package/lib/esm/widget/components/Mapping.js.map +1 -1
  156. package/lib/esm/widget/components/PropertyMenu.d.ts +12 -17
  157. package/lib/esm/widget/components/PropertyMenu.js +54 -154
  158. package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
  159. package/lib/esm/widget/components/PropertyMenu.scss +4 -28
  160. package/lib/esm/widget/components/PropertyNameCell.d.ts +11 -0
  161. package/lib/esm/widget/components/PropertyNameCell.js +8 -0
  162. package/lib/esm/widget/components/PropertyNameCell.js.map +1 -0
  163. package/lib/esm/widget/components/PropertyTable.d.ts +18 -0
  164. package/lib/esm/widget/components/PropertyTable.js +28 -0
  165. package/lib/esm/widget/components/PropertyTable.js.map +1 -0
  166. package/lib/esm/widget/components/PropertyTable.scss +11 -0
  167. package/lib/esm/widget/components/PropertyTableToolbar.d.ts +10 -0
  168. package/lib/esm/widget/components/PropertyTableToolbar.js +16 -0
  169. package/lib/esm/widget/components/PropertyTableToolbar.js.map +1 -0
  170. package/lib/esm/widget/components/PropertyTableToolbar.scss +12 -0
  171. package/lib/esm/widget/components/ToggleGroupVisibility.d.ts +9 -0
  172. package/lib/esm/widget/components/ToggleGroupVisibility.js +9 -0
  173. package/lib/esm/widget/components/ToggleGroupVisibility.js.map +1 -0
  174. package/lib/esm/widget/components/ToggleGroupVisibility.scss +9 -0
  175. package/lib/esm/widget/components/WidgetHeader.d.ts +9 -0
  176. package/lib/esm/widget/components/WidgetHeader.js +15 -0
  177. package/lib/esm/widget/components/WidgetHeader.js.map +1 -0
  178. package/lib/esm/widget/components/WidgetHeader.scss +36 -0
  179. package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
  180. package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
  181. package/lib/esm/widget/components/context/PropertiesContext.d.ts +15 -0
  182. package/lib/esm/widget/components/context/PropertiesContext.js +20 -0
  183. package/lib/esm/widget/components/context/PropertiesContext.js.map +1 -0
  184. package/lib/esm/widget/components/groupsHelpers.d.ts +6 -3
  185. package/lib/esm/widget/components/groupsHelpers.js +41 -40
  186. package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
  187. package/lib/esm/widget/components/property-grid/PropertyRender.js +2 -1
  188. package/lib/esm/widget/components/property-grid/PropertyRender.js.map +1 -1
  189. package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +8 -0
  190. package/lib/esm/widget/components/property-grid/countMatchesInString.js +28 -0
  191. package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +1 -0
  192. package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +10 -0
  193. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +42 -0
  194. package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +1 -0
  195. package/lib/esm/widget/components/utils.d.ts +0 -6
  196. package/lib/esm/widget/components/utils.js +0 -7
  197. package/lib/esm/widget/components/utils.js.map +1 -1
  198. package/lib/esm/widget/components/utils.scss +0 -29
  199. package/lib/esm/widget/components/viewerUtils.d.ts +4 -2
  200. package/lib/esm/widget/components/viewerUtils.js +3 -20
  201. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  202. package/lib/esm/widget/hooks/useFetchData.d.ts +3 -5
  203. package/lib/esm/widget/hooks/useFetchData.js +9 -7
  204. package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
  205. package/package.json +1 -1
@@ -30,6 +30,7 @@ const components_react_1 = require("@itwin/components-react");
30
30
  const NonPrimitivePropertyRenderer_1 = require("./NonPrimitivePropertyRenderer");
31
31
  const PrimitivePropertyRenderer_1 = require("./PrimitivePropertyRenderer");
32
32
  const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
33
+ const createNewDisplayValue_1 = require("./createNewDisplayValue");
33
34
  /** A React component that renders properties
34
35
  * @public
35
36
  */
@@ -61,7 +62,7 @@ class PropertyRenderer extends React.Component {
61
62
  this.updateDisplayValueAsEditor(props);
62
63
  return;
63
64
  }
64
- const displayValue = CommonPropertyRenderer_1.CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
65
+ const displayValue = createNewDisplayValue_1.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
65
66
  this.setState({ displayValue });
66
67
  }
67
68
  /** Display property record value in an editor */
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyRender.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyRender.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,0DAA4D;AAQ5D,8DAGiC;AAEjC,iFAA8E;AAC9E,2EAAwE;AAGxE,yIAAsI;AAsEtI;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAoC;YAChE,YAAY,EAAE,+BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,CAAC;QAiCM,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC;QAEM,kBAAa,GAAG,GAAG,EAAE;YAC3B,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC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AAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAChD;YACA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,MAAM,sBAAsB,GAA2B;YACrD,GAAG,KAAK;YACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACpC,CAAC;QAEF,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,KAAK,oCAAmB,CAAC,SAAS;gBAChC,OAAO,CACL,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACJ,KAAK,oCAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF;AAnHD,4CAmHC","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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number,\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth,\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n ) {\n this.updateDisplayValue(this.props);\n }\n }\n\n /** @internal */\n public override render() {\n const { ...props } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyRender.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyRender.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,0DAA4D;AAQ5D,8DAGiC;AAEjC,iFAA8E;AAC9E,2EAAwE;AAGxE,yIAAsI;AACtI,mEAAgE;AAsEhE;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAoC;YAChE,Y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B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF;AAnHD,4CAmHC","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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { createNewDisplayValue } from \"./createNewDisplayValue\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number,\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth,\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n ) {\n this.updateDisplayValue(this.props);\n }\n }\n\n /** @internal */\n public override render() {\n const { ...props } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /** @packageDocumentation
2
+ * @module Common
3
+ */
4
+ /** Counts how many times string 'lookup' is repeated in string 'str'.
5
+ * @internal
6
+ */
7
+ export declare function countMatchesInString(str: string, lookup: string): number;
8
+ //# sourceMappingURL=countMatchesInString.d.ts.map
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /* @author Vitim.us https://gist.github.com/victornpb/7736865 */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.countMatchesInString = void 0;
9
+ /** @packageDocumentation
10
+ * @module Common
11
+ */
12
+ /** Counts how many times string 'lookup' is repeated in string 'str'.
13
+ * @internal
14
+ */
15
+ function countMatchesInString(str, lookup) {
16
+ if (!str.length || !lookup.length)
17
+ return 0;
18
+ let n = 0, pos = 0;
19
+ const step = lookup.length;
20
+ while (true) {
21
+ pos = str.indexOf(lookup, pos);
22
+ if (pos >= 0) {
23
+ ++n;
24
+ pos += step;
25
+ }
26
+ else
27
+ break;
28
+ }
29
+ return n;
30
+ }
31
+ exports.countMatchesInString = countMatchesInString;
32
+ //# sourceMappingURL=countMatchesInString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countMatchesInString.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/countMatchesInString.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F,gEAAgE;;;AAEhE;;GAEG;AAEH;;GAEG;AACH,SAAgB,oBAAoB,CAAC,GAAW,EAAE,MAAc;IAC9D,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM;QAC/B,OAAO,CAAC,CAAC;IAEX,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IACnB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAE3B,OAAO,IAAI,EAAE;QACX,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,IAAI,CAAC,EAAE;YACZ,EAAE,CAAC,CAAC;YACJ,GAAG,IAAI,IAAI,CAAC;SACb;;YACC,MAAM;KACT;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAhBD,oDAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* @author Vitim.us https://gist.github.com/victornpb/7736865 */\n\n/** @packageDocumentation\n * @module Common\n */\n\n/** Counts how many times string 'lookup' is repeated in string 'str'.\n * @internal\n */\nexport function countMatchesInString(str: string, lookup: string) {\n if (!str.length || !lookup.length)\n return 0;\n\n let n = 0, pos = 0;\n const step = lookup.length;\n\n while (true) {\n pos = str.indexOf(lookup, pos);\n if (pos >= 0) {\n ++n;\n pos += step;\n } else\n break;\n }\n return n;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { PropertyRecord } from "@itwin/appui-abstract";
2
+ import type { HighlightingComponentProps } from "@itwin/components-react";
3
+ import { PropertyValueRendererManager } from "@itwin/components-react";
4
+ import { Orientation } from "@itwin/core-react";
5
+ import * as React from "react";
6
+ export declare function createNewDisplayValue(orientation: Orientation, propertyRecord: PropertyRecord, indentation?: number, propertyValueRendererManager?: PropertyValueRendererManager, isExpanded?: boolean, onExpansionToggled?: () => void, onHeightChanged?: (newHeight: number) => void, highlight?: HighlightingComponentProps & {
7
+ applyOnLabel: boolean;
8
+ applyOnValue: boolean;
9
+ }): React.ReactNode;
10
+ //# sourceMappingURL=createNewDisplayValue.d.ts.map
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.createNewDisplayValue = void 0;
23
+ const components_react_1 = require("@itwin/components-react");
24
+ const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
25
+ const core_react_1 = require("@itwin/core-react");
26
+ const React = __importStar(require("react"));
27
+ const countMatchesInString_1 = require("./countMatchesInString");
28
+ function createHighlightCallback(highlight, propertyRecord) {
29
+ var _a;
30
+ const activeMatch = highlight.activeHighlight;
31
+ const propertyName = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightedItemIdentifier;
32
+ const matchIndex = (_a = activeMatch === null || activeMatch === void 0 ? void 0 : activeMatch.highlightIndex) !== null && _a !== void 0 ? _a : 0;
33
+ let labelMatches;
34
+ if (highlight.applyOnLabel) {
35
+ labelMatches = countMatchesInString_1.countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);
36
+ }
37
+ else {
38
+ labelMatches = 0;
39
+ }
40
+ const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;
41
+ const highlightCallback = (text) => (React.createElement(components_react_1.HighlightedText, { text: text, activeMatchIndex: activeMatchIndex, searchText: highlight.highlightedText }));
42
+ return highlightCallback;
43
+ }
44
+ function createNewDisplayValue(orientation, propertyRecord, indentation, propertyValueRendererManager, isExpanded, onExpansionToggled, onHeightChanged, highlight) {
45
+ const highlightCallback = (highlight === null || highlight === void 0 ? void 0 : highlight.applyOnValue) ? (createHighlightCallback(highlight, propertyRecord)) : undefined;
46
+ const rendererContext = {
47
+ orientation,
48
+ containerType: components_react_1.PropertyContainerType.PropertyPane,
49
+ isExpanded,
50
+ onExpansionToggled,
51
+ onHeightChanged,
52
+ textHighlighter: highlightCallback,
53
+ };
54
+ let displayValue;
55
+ if (propertyValueRendererManager)
56
+ displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);
57
+ else
58
+ displayValue = components_react_1.PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);
59
+ // Align value with label if orientation is vertical
60
+ if (orientation === core_react_1.Orientation.Vertical)
61
+ displayValue = React.createElement("span", { style: { paddingLeft: CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation) } }, displayValue);
62
+ return displayValue;
63
+ }
64
+ exports.createNewDisplayValue = createNewDisplayValue;
65
+ //# sourceMappingURL=createNewDisplayValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNewDisplayValue.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/createNewDisplayValue.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,8DAA+G;AAC/G,yIAAsI;AACtI,kDAAgD;AAChD,6CAA+B;AAC/B,iEAA8D;AAE9D,SAAS,uBAAuB,CAAC,SAAiE,EAAE,cAA8B;;IAChI,MAAM,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC;IAC9C,MAAM,YAAY,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,yBAAyB,CAAC;IAC5D,MAAM,UAAU,GAAG,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,mCAAI,CAAC,CAAC;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EAAE,eAAe,CAAC,CAAC;;QAEpF,YAAY,GAAG,+CAA4B,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAErG,oDAAoD;IACpD,IAAI,WAAW,KAAK,wBAAW,CAAC,QAAQ;QACtC,YAAY,GAAG,8BAAM,KAAK,EAAE,EAAE,WAAW,EAAE,+CAAsB,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAG,YAAY,CAAQ,CAAC;IAEtI,OAAO,YAAY,CAAC;AACtB,CAAC;AA/BD,sDA+BC","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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { HighlightingComponentProps, PropertyValueRendererContext } from \"@itwin/components-react\";\nimport { HighlightedText, PropertyContainerType, PropertyValueRendererManager } from \"@itwin/components-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { Orientation } from \"@itwin/core-react\";\nimport * as React from \"react\";\nimport { countMatchesInString } from \"./countMatchesInString\";\n\nfunction createHighlightCallback(highlight: HighlightingComponentProps & { applyOnLabel: boolean }, propertyRecord: PropertyRecord) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(propertyRecord.property.displayLabel.toLowerCase(), highlight.highlightedText);\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex = (propertyRecord.property.name === propertyName) && ((matchIndex - labelMatches) >= 0) ? (matchIndex - labelMatches) : undefined;\n const highlightCallback = (text: string) => (<HighlightedText text={text} activeMatchIndex={activeMatchIndex} searchText={highlight.highlightedText} />);\n\n return highlightCallback;\n}\n\nexport function createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & { applyOnLabel: boolean, applyOnValue: boolean }\n) {\n const highlightCallback = highlight?.applyOnValue ? (createHighlightCallback(highlight, propertyRecord)) : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(propertyRecord, rendererContext);\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(propertyRecord, rendererContext);\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = <span style={{ paddingLeft: CommonPropertyRenderer.getLabelOffset(indentation, orientation) }}>{displayValue}</span>;\n\n return displayValue;\n}\n"]}
@@ -1,12 +1,6 @@
1
1
  import "./utils.scss";
2
2
  import React from "react";
3
3
  import type { IModelConnection } from "@itwin/core-frontend";
4
- export interface WidgetHeaderProps {
5
- title: string;
6
- disabled?: boolean;
7
- returnFn?: () => void;
8
- }
9
- export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeaderProps) => JSX.Element;
10
4
  export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: React.Dispatch<React.SetStateAction<T>>) => void;
11
5
  export declare const fetchIdsFromQuery: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
12
6
  export declare const handleError: (errorStatus: number) => void;
@@ -3,23 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LoadingSpinner = exports.EmptyMessage = exports.LoadingOverlay = exports.handleError = exports.fetchIdsFromQuery = exports.handleInputChange = exports.WidgetHeader = void 0;
6
+ exports.LoadingSpinner = exports.EmptyMessage = exports.LoadingOverlay = exports.handleError = exports.fetchIdsFromQuery = exports.handleInputChange = void 0;
7
7
  /*---------------------------------------------------------------------------------------------
8
8
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
9
9
  * See LICENSE.md in the project root for license terms and full copyright notice.
10
10
  *--------------------------------------------------------------------------------------------*/
11
- const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
12
11
  const itwinui_react_1 = require("@itwin/itwinui-react");
13
12
  require("./utils.scss");
14
13
  const react_1 = __importDefault(require("react"));
15
14
  const core_common_1 = require("@itwin/core-common");
16
- const WidgetHeader = ({ title, disabled = false, returnFn, }) => {
17
- return (react_1.default.createElement("div", { className: 'gmw-widget-header-container' },
18
- returnFn && (react_1.default.createElement("div", { className: disabled ? "gmw-chevron-disabled" : "gmw-chevron", onClick: disabled ? undefined : returnFn },
19
- react_1.default.createElement(itwinui_icons_react_1.SvgChevronLeft, null))),
20
- react_1.default.createElement(itwinui_react_1.Text, { className: 'gmw-title', variant: 'title' }, title)));
21
- };
22
- exports.WidgetHeader = WidgetHeader;
23
15
  const handleInputChange = (e, values, setValues) => {
24
16
  const { name, value } = e.target;
25
17
  setValues({
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,oEAA4D;AAC5D,wDAAqE;AACrE,wBAAsB;AACtB,kDAA0B;AAE1B,oDAAoD;AAQ7C,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GACU,EAAE,EAAE;IACtB,OAAO,CACL,uCAAK,SAAS,EAAC,6BAA6B;QACzC,QAAQ,IAAI,CACX,uCACE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,sBAA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C,8BAAc,IAAC,aAAa,SAAG;IAChC,8BAAC,oBAAI,yBAAsB,CACvB,CACP,CAAC;AANW,QAAA,cAAc,kBAMzB;AAMK,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAqB,EAAE,EAAE,CAAC,CAC9D,uCAAK,SAAS,EAAC,oBAAoB;IACjC,8BAAC,oBAAI,QAAE,OAAO,CAAQ,CAClB,CACP,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CACL,uCAAK,SAAS,EAAC,qBAAqB;QAClC,8BAAC,8BAAc,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CACzC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => void;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='gmw-widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"gmw-chevron-disabled\" : \"gmw-chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='gmw-title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gmw-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gmw-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gmw-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":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;IACjC,8BAAC,oBAAI,QAAE,OAAO,CAAQ,CAClB,CACP,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CACL,uCAAK,SAAS,EAAC,qBAAqB;QAClC,8BAAC,8BAAc,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CACzC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gmw-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gmw-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gmw-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
@@ -6,35 +6,6 @@
6
6
  @import "~@itwin/itwinui-css/scss/icon/index";
7
7
  @import "~@itwin/itwinui-css/scss/button/index";
8
8
 
9
- .gmw-widget-header-container {
10
- display: flex;
11
- margin-bottom: $iui-baseline * 3;
12
-
13
- .gmw-chevron {
14
- @include iui-icons-large();
15
- cursor: pointer;
16
- align-self: center;
17
- margin-right: $iui-s;
18
- }
19
-
20
- .gmw-chevron-disabled {
21
- @include iui-icons-large();
22
- @include themed {
23
- fill: t(iui-icons-color-actionable-disabled);
24
- }
25
- cursor: not-allowed;
26
-
27
- align-self: center;
28
- margin-right: $iui-s;
29
- }
30
-
31
- .gmw-title {
32
- overflow: hidden;
33
- white-space: nowrap;
34
- text-overflow: ellipsis;
35
- }
36
- }
37
-
38
9
  .gmw-loading-spinner {
39
10
  display: flex;
40
11
  align-items: center;
@@ -6,7 +6,6 @@ export declare const isolateElementsByKeys: (keySet: KeySet, replace?: boolean)
6
6
  export declare const isolateElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
7
7
  export declare const isolateElements: (hilitedIds: string[], replace?: boolean) => void;
8
8
  export declare const clearIsolatedElements: () => void;
9
- export declare const hideElementsByQuery: (query: string, iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
10
9
  export declare const hideElements: (hilitedIds: string[], replace?: boolean) => void;
11
10
  export declare const clearHiddenElements: () => void;
12
11
  export declare const overrideElementsByQuery: (iModelConnection: IModelConnection, query: string, color: string, overrideType?: FeatureOverrideType) => Promise<string[]>;
@@ -20,7 +19,10 @@ export declare const visualizeElementsByKeys: (keySet: KeySet, color: string, re
20
19
  export declare const visualizeElements: (elementIds: string[], color: string, replace?: boolean, wantEmphasis?: boolean) => void;
21
20
  export declare const transparentOverriddenElements: () => void;
22
21
  export declare const zoomToElements: (elementIds: string[]) => Promise<void>;
23
- export declare const getHiliteIds: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
22
+ export declare const getHiliteIds: (query: string, iModelConnection: IModelConnection) => Promise<{
23
+ keySet: KeySet;
24
+ ids: string[];
25
+ }>;
24
26
  export declare const manufactureKeys: (query: string, iModelConnection: IModelConnection) => Promise<KeySet>;
25
27
  export declare const clearEmphasizedElements: () => void;
26
28
  export declare const clearEmphasizedOverriddenElements: () => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clearAll = exports.clearEmphasizedOverriddenElements = exports.clearEmphasizedElements = exports.manufactureKeys = exports.getHiliteIds = exports.zoomToElements = exports.transparentOverriddenElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.visualizeElementsByQuery = exports.emphasizeElementsByKeys = exports.emphasisElementsByQuery = exports.emphasizeElements = exports.clearOverriddenElements = exports.overrideElements = exports.overrideElementsByQuery = exports.clearHiddenElements = exports.hideElements = exports.hideElementsByQuery = exports.clearIsolatedElements = exports.isolateElements = exports.isolateElementsByQuery = exports.isolateElementsByKeys = void 0;
3
+ exports.clearAll = exports.clearEmphasizedOverriddenElements = exports.clearEmphasizedElements = exports.manufactureKeys = exports.getHiliteIds = exports.zoomToElements = exports.transparentOverriddenElements = exports.visualizeElements = exports.visualizeElementsByKeys = exports.visualizeElementsByQuery = exports.emphasizeElementsByKeys = exports.emphasisElementsByQuery = exports.emphasizeElements = exports.clearOverriddenElements = exports.overrideElements = exports.overrideElementsByQuery = exports.clearHiddenElements = exports.hideElements = exports.clearIsolatedElements = exports.isolateElements = exports.isolateElementsByQuery = 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");
@@ -58,24 +58,6 @@ const clearIsolatedElements = () => {
58
58
  emph.clearIsolatedElements(vp);
59
59
  };
60
60
  exports.clearIsolatedElements = clearIsolatedElements;
61
- const hideElementsByQuery = async (query, 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(query, 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.hideElementsByQuery = hideElementsByQuery;
79
61
  const hideElements = (hilitedIds, replace = false) => {
80
62
  if (!core_frontend_1.IModelApp.viewManager.selectedView) {
81
63
  return;
@@ -253,7 +235,7 @@ const zoomToElements = async (elementIds) => {
253
235
  exports.zoomToElements = zoomToElements;
254
236
  const getHiliteIds = async (query, iModelConnection) => {
255
237
  if (!core_frontend_1.IModelApp.viewManager.selectedView) {
256
- return [];
238
+ return ({ keySet: new presentation_common_1.KeySet(), ids: [] });
257
239
  }
258
240
  const vp = core_frontend_1.IModelApp.viewManager.selectedView;
259
241
  const keySet = await exports.manufactureKeys(query, iModelConnection);
@@ -262,9 +244,9 @@ const getHiliteIds = async (query, iModelConnection) => {
262
244
  });
263
245
  const set = await hiliteProvider.getHiliteSet(keySet);
264
246
  if (set.elements) {
265
- return [...set.elements];
247
+ return { keySet, ids: [...set.elements] };
266
248
  }
267
- return [];
249
+ return ({ keySet: new presentation_common_1.KeySet(), ids: [] });
268
250
  };
269
251
  exports.getHiliteIds = getHiliteIds;
270
252
  const manufactureKeys = async (query, iModelConnection) => {
@@ -1 +1 @@
1
- {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":";;;AAKA,wDAAoE;AAEpE,oDAAmF;AAEnF,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,sBAAsB,GAAG,KAAK,EACzC,KAAa,EACb,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF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B,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 { FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType, QueryRowFormat } from \"@itwin/core-common\";\nimport type { InstanceKey } from \"@itwin/presentation-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 isolateElementsByQuery = async (\n query: 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(query, 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 hideElementsByQuery = async (\n query: 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(query, 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 overrideElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: 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(query, 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 emphasisElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: 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(query, 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 visualizeElementsByQuery = async (\n query: 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(query, 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 query: 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(query, 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 query: string,\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n if (query === \"\") {\n return new KeySet();\n }\n const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;\n\n const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {\n rowFormat: QueryRowFormat.UseECSqlPropertyIndexes,\n });\n\n const keys: InstanceKey[] = [];\n\n for await (const value of rowIterator) {\n keys.push({ id: value[0], className: value[1] });\n }\n\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
+ {"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":";;;AAKA,wDAAoE;AAEpE,oDAAmF;AAEnF,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,sBAAsB,GAAG,KAAK,EACzC,KAAa,EACb,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,yBAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG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,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 { FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType, QueryRowFormat } from \"@itwin/core-common\";\nimport type { InstanceKey } from \"@itwin/presentation-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 isolateElementsByQuery = async (\n query: 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(query, 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 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 overrideElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: 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(query, 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 emphasisElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: 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(query, 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 visualizeElementsByQuery = async (\n query: 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(query, 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 query: string,\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return ({ keySet: new KeySet(), ids: [] });\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, 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 { keySet, ids: [...set.elements] };\n }\n return ({ keySet: new KeySet(), ids: [] });\n};\n\nexport const manufactureKeys = async (\n query: string,\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n if (query === \"\") {\n return new KeySet();\n }\n const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;\n\n const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {\n rowFormat: QueryRowFormat.UseECSqlPropertyIndexes,\n });\n\n const keys: InstanceKey[] = [];\n\n for await (const value of rowIterator) {\n keys.push({ id: value[0], className: value[1] });\n }\n\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,9 +1,7 @@
1
- import type React from "react";
2
- export declare const useFetchData: <T>(fetchFunc: () => Promise<T[] | undefined>, setIsLoading: React.Dispatch<React.SetStateAction<boolean>>) => [T[], React.Dispatch<React.SetStateAction<T[]>>];
3
- export declare const useRefreshData: <T>(setData: React.Dispatch<React.SetStateAction<T[]>>, fetchFunc: () => Promise<T[] | undefined>, setIsLoading: React.Dispatch<React.SetStateAction<boolean>>) => () => Promise<void>;
4
- export declare const useCombinedFetchRefresh: <T>(fetchFunc: () => Promise<T[] | undefined>) => {
1
+ export declare const useFetchData: <T>(fetchFunc: () => Promise<T[] | undefined>, setData: (data: T[]) => void, setIsLoading: (isLoading: boolean) => void) => void;
2
+ export declare const useRefreshData: <T>(setData: (data: T[]) => void, fetchFunc: () => Promise<T[] | undefined>, setIsLoading: (isLoading: boolean) => void) => () => Promise<void>;
3
+ export declare const useCombinedFetchRefresh: <T>(fetchFunc: () => Promise<T[] | undefined>, setData: (data: T[]) => void) => {
5
4
  isLoading: boolean;
6
- data: T[];
7
5
  refreshData: () => Promise<void>;
8
6
  };
9
7
  //# sourceMappingURL=useFetchData.d.ts.map
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useCombinedFetchRefresh = exports.useRefreshData = exports.useFetchData = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
4
8
  const react_1 = require("react");
5
9
  const utils_1 = require("../components/utils");
6
10
  const fetchData = async (setData, fetchFunc, setIsLoading) => {
@@ -16,12 +20,10 @@ const fetchData = async (setData, fetchFunc, setIsLoading) => {
16
20
  setIsLoading(false);
17
21
  }
18
22
  };
19
- const useFetchData = (fetchFunc, setIsLoading) => {
20
- const [data, setData] = react_1.useState([]);
23
+ const useFetchData = (fetchFunc, setData, setIsLoading) => {
21
24
  react_1.useEffect(() => {
22
25
  void fetchData(setData, fetchFunc, setIsLoading);
23
- }, [fetchFunc, setIsLoading]);
24
- return [data, setData];
26
+ }, [fetchFunc, setData, setIsLoading]);
25
27
  };
26
28
  exports.useFetchData = useFetchData;
27
29
  const useRefreshData = (setData, fetchFunc, setIsLoading) => {
@@ -31,11 +33,11 @@ const useRefreshData = (setData, fetchFunc, setIsLoading) => {
31
33
  }, [setData, fetchFunc, setIsLoading]);
32
34
  };
33
35
  exports.useRefreshData = useRefreshData;
34
- const useCombinedFetchRefresh = (fetchFunc) => {
36
+ const useCombinedFetchRefresh = (fetchFunc, setData) => {
35
37
  const [isLoading, setIsLoading] = react_1.useState(true);
36
- const [data, setData] = exports.useFetchData(fetchFunc, setIsLoading);
38
+ exports.useFetchData(fetchFunc, setData, setIsLoading);
37
39
  const refreshData = exports.useRefreshData(setData, fetchFunc, setIsLoading);
38
- return { isLoading, data, refreshData };
40
+ return { isLoading, refreshData };
39
41
  };
40
42
  exports.useCombinedFetchRefresh = useCombinedFetchRefresh;
41
43
  //# sourceMappingURL=useFetchData.js.map
@@ -1 +1 @@
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,kBAazB;AAEK,MAAM,uBAAuB,GAAG,CAAI,SAAyC,EAAE,EAAE;IACtF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,gBAAQ,CAAU,IAAI,CAAC,CAAC;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,oBAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,sBAAc,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACrE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC","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 React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { handleError } from \"../components/utils\";\n\nconst fetchData = async<T>(\n setData: React.Dispatch<React.SetStateAction<T[]>>,\n fetchFunc: () => Promise<T[] | undefined>,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n) => {\n try {\n setIsLoading(true);\n const data = await fetchFunc();\n setData(data ?? []);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nexport const useFetchData = <T>(\n fetchFunc: () => Promise<T[] | undefined>,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n): [T[], React.Dispatch<React.SetStateAction<T[]>>] => {\n const [data, setData] = useState<T[]>([]);\n\n useEffect(() => {\n void fetchData(\n setData,\n fetchFunc,\n setIsLoading,\n );\n }, [fetchFunc, setIsLoading]);\n\n return [data, setData];\n};\n\nexport const useRefreshData = <T>(\n setData: React.Dispatch<React.SetStateAction<T[]>>,\n fetchFunc: () => Promise<T[] | undefined>,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n): () => Promise<void> => {\n return useCallback(async () => {\n setData([]);\n await fetchData(\n setData,\n fetchFunc,\n setIsLoading,\n );\n }, [setData, fetchFunc, setIsLoading]);\n};\n\nexport const useCombinedFetchRefresh = <T>(fetchFunc: () => Promise<T[] | undefined>) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [data, setData] = useFetchData(fetchFunc, setIsLoading);\n const refreshData = useRefreshData(setData, fetchFunc, setIsLoading);\n return { isLoading, data, refreshData };\n};\n"]}
1
+ {"version":3,"file":"useFetchData.js","sourceRoot":"","sources":["../../../../src/widget/hooks/useFetchData.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,iCAAyD;AACzD,+CAAkD;AAElD,MAAM,SAAS,GAAG,KAAK,EACrB,OAA4B,EAC5B,SAAyC,EACzC,YAA0C,EAC1C,EAAE;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,IAAI,GAAG,MAAM,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC;KACrB;IAAC,OAAO,KAAU,EAAE;QACnB,mBAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC3B;YAAS;QACR,YAAY,CAAC,KAAK,CAAC,CAAC;KACrB;AACH,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAC1B,SAAyC,EACzC,OAA4B,EAC5B,YAA0C,EAC1C,EAAE;IAEF,iBAAS,CAAC,GAAG,EAAE;QACb,KAAK,SAAS,CACZ,OAAO,EACP,SAAS,EACT,YAAY,CACb,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB;AAEK,MAAM,cAAc,GAAG,CAC5B,OAA4B,EAC5B,SAAyC,EACzC,YAA0C,EACrB,EAAE;IACvB,OAAO,mBAAW,CAAC,KAAK,IAAI,EAAE;QAC5B,OAAO,CAAC,EAAE,CAAC,CAAC;QACZ,MAAM,SAAS,CACb,OAAO,EACP,SAAS,EACT,YAAY,CACb,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAbW,QAAA,cAAc,kBAazB;AAEK,MAAM,uBAAuB,GAAG,CAAI,SAAyC,EAAE,OAA4B,EAAE,EAAE;IACpH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,gBAAQ,CAAU,IAAI,CAAC,CAAC;IAC1D,oBAAY,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,sBAAc,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IACrE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC","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 { useCallback, useEffect, useState } from \"react\";\nimport { handleError } from \"../components/utils\";\n\nconst fetchData = async<T>(\n setData: (data: T[]) => void,\n fetchFunc: () => Promise<T[] | undefined>,\n setIsLoading: (isLoading: boolean) => void,\n) => {\n try {\n setIsLoading(true);\n const data = await fetchFunc();\n setData(data ?? []);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nexport const useFetchData = <T>(\n fetchFunc: () => Promise<T[] | undefined>,\n setData: (data: T[]) => void,\n setIsLoading: (isLoading: boolean) => void,\n) => {\n\n useEffect(() => {\n void fetchData(\n setData,\n fetchFunc,\n setIsLoading,\n );\n }, [fetchFunc, setData, setIsLoading]);\n};\n\nexport const useRefreshData = <T>(\n setData: (data: T[]) => void,\n fetchFunc: () => Promise<T[] | undefined>,\n setIsLoading: (isLoading: boolean) => void,\n): () => Promise<void> => {\n return useCallback(async () => {\n setData([]);\n await fetchData(\n setData,\n fetchFunc,\n setIsLoading,\n );\n }, [setData, fetchFunc, setIsLoading]);\n};\n\nexport const useCombinedFetchRefresh = <T>(fetchFunc: () => Promise<T[] | undefined>, setData: (data: T[]) => void) => {\n const [isLoading, setIsLoading] = useState<boolean>(true);\n useFetchData(fetchFunc, setData, setIsLoading);\n const refreshData = useRefreshData(setData, fetchFunc, setIsLoading);\n return { isLoading, refreshData };\n};\n"]}
@@ -10,7 +10,10 @@ export { MappingAction, MappingActionProps } from "./widget/components/MappingAc
10
10
  export { GroupingMappingContext, GroupingMappingContextProps } from "./widget/components/GroupingMappingContext";
11
11
  export { Groupings, GroupingProps } from "./widget/components/Grouping";
12
12
  export { GroupAction, GroupActionProps } from "./widget/components/GroupAction";
13
- export { PropertyMenu } from "./widget/components/PropertyMenu";
13
+ export { PropertyMenu, PropertyMenuProps } from "./widget/components/PropertyMenu";
14
+ export { GroupPropertyAction, GroupPropertyActionProps } from "./widget/components/GroupPropertyAction";
15
+ export { CalculatedPropertyAction, CalculatedPropertyActionProps } from "./widget/components/CalculatedPropertyAction";
16
+ export { CustomCalculationAction, CustomCalculationActionProps } from "./widget/components/CustomCalculationAction";
14
17
  export { SearchGroupingCustomUI } from "./widget/components/customUI/SearchGroupingCustomUI";
15
18
  export { ManualGroupingCustomUI } from "./widget/components/customUI/ManualGroupingCustomUI";
16
19
  export { GroupQueryBuilderCustomUI } from "./widget/components/customUI/GroupQueryBuilderCustomUI";
@@ -15,6 +15,9 @@ export { GroupingMappingContext } from "./widget/components/GroupingMappingConte
15
15
  export { Groupings } from "./widget/components/Grouping";
16
16
  export { GroupAction } from "./widget/components/GroupAction";
17
17
  export { PropertyMenu } from "./widget/components/PropertyMenu";
18
+ export { GroupPropertyAction } from "./widget/components/GroupPropertyAction";
19
+ export { CalculatedPropertyAction } from "./widget/components/CalculatedPropertyAction";
20
+ export { CustomCalculationAction } from "./widget/components/CustomCalculationAction";
18
21
  export { SearchGroupingCustomUI } from "./widget/components/customUI/SearchGroupingCustomUI";
19
22
  export { ManualGroupingCustomUI } from "./widget/components/customUI/ManualGroupingCustomUI";
20
23
  export { GroupQueryBuilderCustomUI } from "./widget/components/customUI/GroupQueryBuilderCustomUI";