@itwin/components-react 4.2.0 → 4.2.1

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 (166) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/cjs/components-react/common/DelayedSpinner.js +3 -2
  3. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  4. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +2 -1
  5. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  6. package/lib/cjs/components-react/converters/NumericTypeConverter.js +4 -2
  7. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  8. package/lib/cjs/components-react/converters/TypeConverter.js +2 -1
  9. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  10. package/lib/cjs/components-react/editors/CustomNumberEditor.js +8 -6
  11. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  12. package/lib/cjs/components-react/editors/DateTimeEditor.js +3 -2
  13. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  14. package/lib/cjs/components-react/editors/PopupButton.js +4 -3
  15. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  16. package/lib/cjs/components-react/editors/TextEditor.js +4 -2
  17. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  18. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  19. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  20. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  21. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  22. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  23. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  24. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  25. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  26. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  27. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  28. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  29. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  30. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +3 -2
  31. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  32. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  33. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  34. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +2 -1
  35. package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  36. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +6 -3
  37. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  38. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +2 -1
  39. package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  40. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  41. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  42. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  43. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  44. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  45. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  46. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  47. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  48. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  49. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  50. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +54 -48
  51. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  52. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  53. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  54. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  55. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  56. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  57. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  58. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  59. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  60. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  61. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  62. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  63. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  64. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  65. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  66. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  67. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  68. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -5
  69. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  70. package/lib/cjs/components-react/selectable-content/SelectableContent.js +3 -2
  71. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  72. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +4 -3
  73. package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  74. package/lib/cjs/components-react/tree/controlled/TreeModel.js +8 -7
  75. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  76. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  77. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  78. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.d.ts +2 -0
  79. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.d.ts.map +1 -1
  80. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +5 -6
  81. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  82. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
  83. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  84. package/lib/esm/components-react/common/DelayedSpinner.js +3 -2
  85. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  86. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +2 -1
  87. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  88. package/lib/esm/components-react/converters/NumericTypeConverter.js +4 -2
  89. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  90. package/lib/esm/components-react/converters/TypeConverter.js +2 -1
  91. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  92. package/lib/esm/components-react/editors/CustomNumberEditor.js +8 -6
  93. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  94. package/lib/esm/components-react/editors/DateTimeEditor.js +3 -2
  95. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  96. package/lib/esm/components-react/editors/PopupButton.js +4 -3
  97. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  98. package/lib/esm/components-react/editors/TextEditor.js +4 -2
  99. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  100. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  101. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  102. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  103. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  104. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  105. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  106. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  107. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  108. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  109. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  110. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  111. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  112. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +3 -2
  113. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  114. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  115. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  116. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +2 -1
  117. package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
  118. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +6 -3
  119. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  120. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +2 -1
  121. package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
  122. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  123. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  124. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  125. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  126. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  127. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  128. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  129. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  130. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  131. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  132. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +54 -48
  133. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  134. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  135. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  136. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  137. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  138. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  139. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  140. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  141. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  142. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  143. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  144. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  145. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  146. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  147. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  148. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  149. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  150. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -5
  151. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  152. package/lib/esm/components-react/selectable-content/SelectableContent.js +3 -2
  153. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  154. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +4 -3
  155. package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  156. package/lib/esm/components-react/tree/controlled/TreeModel.js +8 -7
  157. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  158. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  159. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  160. package/lib/esm/components-react/tree/controlled/internal/SparseTree.d.ts +2 -0
  161. package/lib/esm/components-react/tree/controlled/internal/SparseTree.d.ts.map +1 -1
  162. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +5 -6
  163. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  164. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
  165. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  166. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyCategoryBlock.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyCategoryBlock.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAmB/D;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAAqC;IACpF,YAAY,KAAiC;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAC;QAQP,kBAAa,GAAG,CAAC,YAAqB,EAAQ,EAAE;YACtD,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC,CAAC;IATF,CAAC;IAEO,eAAe;QACrB,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB;YAC/B,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAMD,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,KAAK,EAAE,GACnE,IAAI,CAAC,KAAK,CAAC;QACb,MAAM,gBAAgB,GACpB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI;YACxB,SAAS,EAAE,eAAe,EAAE,yBAAyB;YACnD,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,cAAc;YAC1C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CACxB,oBAAC,eAAe,IACd,IAAI,EAAE,QAAQ,CAAC,KAAK,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,SAAS,CAAC,eAAe,GACrC,CACH,CAAC,CAAC,CAAC,CACF,QAAQ,CAAC,KAAK,CACf,CAAC;QACF,OAAO,CACL,oBAAC,eAAe,IACd,UAAU,EAAE,QAAQ,CAAC,MAAM,EAC3B,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,KACR,KAAK,IAER,QAAQ,CAAC,MAAM,IAAI,QAAQ,CACZ,CACnB,CAAC;IACJ,CAAC;CACF","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { ExpandableBlock } from \"@itwin/itwinui-react\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyCategory } from \"../PropertyDataProvider\";\n\n/**\n * Properties for the [[PropertyCategoryBlock]] React component\n * @public\n */\nexport interface PropertyCategoryBlockProps extends CommonProps {\n /** Category of the properties */\n category: PropertyCategory;\n /** Callback to when PropertyCategoryBlock gets expended or collapsed */\n onExpansionToggled?: (categoryName: string) => void;\n /** Properties used for highlighting */\n highlight?: HighlightingComponentProps;\n /** Content */\n children?: React.ReactNode;\n}\n\n/**\n * PropertyCategoryBlock React component\n * @public\n */\nexport class PropertyCategoryBlock extends React.Component<PropertyCategoryBlockProps> {\n constructor(props: PropertyCategoryBlockProps) {\n super(props);\n }\n\n private toggleExpansion() {\n if (this.props.onExpansionToggled)\n this.props.onExpansionToggled(this.props.category.name);\n }\n\n private _handleToggle = (_isExpanding: boolean): void => {\n this.toggleExpansion();\n };\n\n /** @internal */\n public override render() {\n const { highlight, category, children, onExpansionToggled, ...props } =\n this.props;\n const activeMatchIndex =\n this.props.category.name ===\n highlight?.activeHighlight?.highlightedItemIdentifier\n ? highlight.activeHighlight.highlightIndex\n : undefined;\n const label = highlight ? (\n <HighlightedText\n text={category.label}\n activeMatchIndex={activeMatchIndex}\n searchText={highlight.highlightedText}\n />\n ) : (\n category.label\n );\n return (\n <ExpandableBlock\n isExpanded={category.expand}\n onToggle={this._handleToggle}\n title={label}\n size=\"small\"\n {...props}\n >\n {category.expand && children}\n </ExpandableBlock>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyCategoryBlock.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyCategoryBlock.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAmB/D;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK,CAAC,SAAqC;IACpF,YAAY,KAAiC;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAC;QAQP,kBAAa,GAAG,CAAC,YAAqB,EAAQ,EAAE;YACtD,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,CAAC,CAAC;IATF,CAAC;IAEO,eAAe;QACrB,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB;YAC/B,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAMD,gBAAgB;IACA,MAAM;;QACpB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,KAAK,EAAE,GACnE,IAAI,CAAC,KAAK,CAAC;QACb,MAAM,gBAAgB,GACpB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI;aACxB,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,0CAAE,yBAAyB,CAAA;YACnD,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,cAAc;YAC1C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CACxB,oBAAC,eAAe,IACd,IAAI,EAAE,QAAQ,CAAC,KAAK,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,SAAS,CAAC,eAAe,GACrC,CACH,CAAC,CAAC,CAAC,CACF,QAAQ,CAAC,KAAK,CACf,CAAC;QACF,OAAO,CACL,oBAAC,eAAe,IACd,UAAU,EAAE,QAAQ,CAAC,MAAM,EAC3B,QAAQ,EAAE,IAAI,CAAC,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,KACR,KAAK,IAER,QAAQ,CAAC,MAAM,IAAI,QAAQ,CACZ,CACnB,CAAC;IACJ,CAAC;CACF","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { ExpandableBlock } from \"@itwin/itwinui-react\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyCategory } from \"../PropertyDataProvider\";\n\n/**\n * Properties for the [[PropertyCategoryBlock]] React component\n * @public\n */\nexport interface PropertyCategoryBlockProps extends CommonProps {\n /** Category of the properties */\n category: PropertyCategory;\n /** Callback to when PropertyCategoryBlock gets expended or collapsed */\n onExpansionToggled?: (categoryName: string) => void;\n /** Properties used for highlighting */\n highlight?: HighlightingComponentProps;\n /** Content */\n children?: React.ReactNode;\n}\n\n/**\n * PropertyCategoryBlock React component\n * @public\n */\nexport class PropertyCategoryBlock extends React.Component<PropertyCategoryBlockProps> {\n constructor(props: PropertyCategoryBlockProps) {\n super(props);\n }\n\n private toggleExpansion() {\n if (this.props.onExpansionToggled)\n this.props.onExpansionToggled(this.props.category.name);\n }\n\n private _handleToggle = (_isExpanding: boolean): void => {\n this.toggleExpansion();\n };\n\n /** @internal */\n public override render() {\n const { highlight, category, children, onExpansionToggled, ...props } =\n this.props;\n const activeMatchIndex =\n this.props.category.name ===\n highlight?.activeHighlight?.highlightedItemIdentifier\n ? highlight.activeHighlight.highlightIndex\n : undefined;\n const label = highlight ? (\n <HighlightedText\n text={category.label}\n activeMatchIndex={activeMatchIndex}\n searchText={highlight.highlightedText}\n />\n ) : (\n category.label\n );\n return (\n <ExpandableBlock\n isExpanded={category.expand}\n onToggle={this._handleToggle}\n title={label}\n size=\"small\"\n {...props}\n >\n {category.expand && children}\n </ExpandableBlock>\n );\n }\n}\n"]}
@@ -10,10 +10,10 @@ import { matchLinks } from "../../common/Links";
10
10
  /** @internal */
11
11
  class PropertyGridCommons {
12
12
  static getCurrentOrientation(width, preferredOrientation, isOrientationFixed, horizontalOrientationMinWidth) {
13
- const orientation = preferredOrientation ?? Orientation.Horizontal;
13
+ const orientation = preferredOrientation !== null && preferredOrientation !== void 0 ? preferredOrientation : Orientation.Horizontal;
14
14
  if (isOrientationFixed)
15
15
  return orientation;
16
- horizontalOrientationMinWidth = horizontalOrientationMinWidth ?? 300;
16
+ horizontalOrientationMinWidth = horizontalOrientationMinWidth !== null && horizontalOrientationMinWidth !== void 0 ? horizontalOrientationMinWidth : 300;
17
17
  // Switch to Vertical if width too small
18
18
  if (width < horizontalOrientationMinWidth)
19
19
  return Orientation.Vertical;
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGridCommons.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;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,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;SAhDS,mBAAmB","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { matchLinks } from \"../../common/Links\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport type { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type { PropertyCategory } from \"../PropertyDataProvider\";\n\n/** Arguments for the Property Editing event callback\n * @public\n */\nexport interface PropertyEditingArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** Unique key of currently edited property */\n propertyKey?: string;\n}\n\n/** Arguments for `PropertyGridProps.onPropertyContextMenu` callback\n * @public\n */\nexport interface PropertyGridContextMenuArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** An event which caused the context menu callback */\n event: React.MouseEvent;\n}\n\n/**\n * Common Property Grid Props to be used by Property Grid Variants\n * @public\n */\nexport interface CommonPropertyGridProps extends CommonProps {\n /** Grid orientation. When not defined, it is chosen automatically based on width of the grid. */\n orientation?: Orientation;\n\n /** Enables/disables property hovering effect */\n isPropertyHoverEnabled?: boolean;\n\n /** Called to show a context menu when properties are right-clicked */\n onPropertyContextMenu?: (args: PropertyGridContextMenuArgs) => void;\n\n /** Enables/disables property selection */\n isPropertySelectionEnabled?: boolean;\n /** Enables/disables property selection with right click */\n isPropertySelectionOnRightClickEnabled?: boolean;\n /** Callback to property selection */\n onPropertySelectionChanged?: (property: PropertyRecord) => void;\n\n /** Enables/disables property editing */\n isPropertyEditingEnabled?: boolean;\n /** Callback for when properties are being edited */\n onPropertyEditing?: (\n args: PropertyEditingArgs,\n category: PropertyCategory\n ) => void;\n /** Callback for when properties are updated */\n onPropertyUpdated?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => Promise<boolean>;\n\n /** Custom property value renderer manager */\n propertyValueRendererManager?: PropertyValueRendererManager;\n\n /** Indicates whether the orientation is fixed and does not auto-switch to Vertical when the width is too narrow. Defaults to false. */\n isOrientationFixed?: boolean;\n /** The minimum width before the auto-switch to Vertical when the width is too narrow. Defaults to 300. */\n horizontalOrientationMinWidth?: number;\n\n /** Minimum allowed label column width, after which resizing stops */\n minLabelWidth?: number;\n /** Minimum allowed value column width, after which resizing stops */\n minValueWidth?: number;\n /** Fixed action button column width */\n actionButtonWidth?: number;\n\n /**\n * Array of action button renderers. Each renderer is called for each property and can decide\n * to render an action button for the property or not.\n */\n actionButtonRenderers?: ActionButtonRenderer[];\n}\n\n/**\n * Properties for highlighting text in property grid.\n * @public\n */\nexport interface PropertyGridContentHighlightProps\n extends HighlightingComponentProps {\n /**\n * Specifies what the highlighting should be applied on - category labels, property labels and / or property values.\n * Defaults to \"nowhere\".\n */\n filteredTypes?: FilteredType[];\n}\n\n/** @internal */\nexport class PropertyGridCommons {\n public static getCurrentOrientation(\n width: number,\n preferredOrientation?: Orientation,\n isOrientationFixed?: boolean,\n horizontalOrientationMinWidth?: number\n ): Orientation {\n const orientation = preferredOrientation ?? Orientation.Horizontal;\n if (isOrientationFixed) return orientation;\n\n horizontalOrientationMinWidth = horizontalOrientationMinWidth ?? 300;\n // Switch to Vertical if width too small\n if (width < horizontalOrientationMinWidth) return Orientation.Vertical;\n\n return orientation;\n }\n\n /**\n * Helper method to handle link clicks\n * @internal\n */\n public static handleLinkClick(text: string) {\n const linksArray = matchLinks(text);\n if (linksArray.length <= 0) return;\n const foundLink = linksArray[0];\n // istanbul ignore else\n if (foundLink && foundLink.url) {\n if (foundLink.schema === \"mailto:\" || foundLink.schema === \"pw:\")\n location.href = foundLink.url;\n else {\n const windowOpen = window.open(foundLink.url, \"_blank\");\n if (windowOpen) windowOpen.focus();\n }\n }\n }\n\n /**\n * A helper method to get links from string.\n * @internal\n */\n public static getLinks = (\n value: string\n ): Array<{ start: number; end: number }> => {\n return matchLinks(value).map(\n (linkInfo: { index: number; lastIndex: number }) => {\n return { start: linkInfo.index, end: linkInfo.lastIndex };\n }\n );\n };\n}\n"]}
1
+ {"version":3,"file":"PropertyGridCommons.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGridCommons.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgGhD,gBAAgB;AAChB,MAAa,mBAAmB;IACvB,MAAM,CAAC,qBAAqB,CACjC,KAAa,EACb,oBAAkC,EAClC,kBAA4B,EAC5B,6BAAsC;QAEtC,MAAM,WAAW,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,WAAW,CAAC,UAAU,CAAC;QACnE,IAAI,kBAAkB;YAAE,OAAO,WAAW,CAAC;QAE3C,6BAA6B,GAAG,6BAA6B,aAA7B,6BAA6B,cAA7B,6BAA6B,GAAI,GAAG,CAAC;QACrE,wCAAwC;QACxC,IAAI,KAAK,GAAG,6BAA6B;YAAE,OAAO,WAAW,CAAC,QAAQ,CAAC;QAEvE,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,eAAe,CAAC,IAAY;QACxC,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO;QACnC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAChC,uBAAuB;QACvB,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,EAAE;YAC9B,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,KAAK;gBAC9D,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC;iBAC3B;gBACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;gBACxD,IAAI,UAAU;oBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;aACpC;SACF;IACH,CAAC;;AAED;;;GAGG;AACW,4BAAQ,GAAG,CACvB,KAAa,EAC0B,EAAE;IACzC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAC1B,CAAC,QAA8C,EAAE,EAAE;QACjD,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC5D,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;SAhDS,mBAAmB","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/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { matchLinks } from \"../../common/Links\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport type { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type { PropertyCategory } from \"../PropertyDataProvider\";\n\n/** Arguments for the Property Editing event callback\n * @public\n */\nexport interface PropertyEditingArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** Unique key of currently edited property */\n propertyKey?: string;\n}\n\n/** Arguments for `PropertyGridProps.onPropertyContextMenu` callback\n * @public\n */\nexport interface PropertyGridContextMenuArgs {\n /** PropertyRecord being edited */\n propertyRecord: PropertyRecord;\n /** An event which caused the context menu callback */\n event: React.MouseEvent;\n}\n\n/**\n * Common Property Grid Props to be used by Property Grid Variants\n * @public\n */\nexport interface CommonPropertyGridProps extends CommonProps {\n /** Grid orientation. When not defined, it is chosen automatically based on width of the grid. */\n orientation?: Orientation;\n\n /** Enables/disables property hovering effect */\n isPropertyHoverEnabled?: boolean;\n\n /** Called to show a context menu when properties are right-clicked */\n onPropertyContextMenu?: (args: PropertyGridContextMenuArgs) => void;\n\n /** Enables/disables property selection */\n isPropertySelectionEnabled?: boolean;\n /** Enables/disables property selection with right click */\n isPropertySelectionOnRightClickEnabled?: boolean;\n /** Callback to property selection */\n onPropertySelectionChanged?: (property: PropertyRecord) => void;\n\n /** Enables/disables property editing */\n isPropertyEditingEnabled?: boolean;\n /** Callback for when properties are being edited */\n onPropertyEditing?: (\n args: PropertyEditingArgs,\n category: PropertyCategory\n ) => void;\n /** Callback for when properties are updated */\n onPropertyUpdated?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => Promise<boolean>;\n\n /** Custom property value renderer manager */\n propertyValueRendererManager?: PropertyValueRendererManager;\n\n /** Indicates whether the orientation is fixed and does not auto-switch to Vertical when the width is too narrow. Defaults to false. */\n isOrientationFixed?: boolean;\n /** The minimum width before the auto-switch to Vertical when the width is too narrow. Defaults to 300. */\n horizontalOrientationMinWidth?: number;\n\n /** Minimum allowed label column width, after which resizing stops */\n minLabelWidth?: number;\n /** Minimum allowed value column width, after which resizing stops */\n minValueWidth?: number;\n /** Fixed action button column width */\n actionButtonWidth?: number;\n\n /**\n * Array of action button renderers. Each renderer is called for each property and can decide\n * to render an action button for the property or not.\n */\n actionButtonRenderers?: ActionButtonRenderer[];\n}\n\n/**\n * Properties for highlighting text in property grid.\n * @public\n */\nexport interface PropertyGridContentHighlightProps\n extends HighlightingComponentProps {\n /**\n * Specifies what the highlighting should be applied on - category labels, property labels and / or property values.\n * Defaults to \"nowhere\".\n */\n filteredTypes?: FilteredType[];\n}\n\n/** @internal */\nexport class PropertyGridCommons {\n public static getCurrentOrientation(\n width: number,\n preferredOrientation?: Orientation,\n isOrientationFixed?: boolean,\n horizontalOrientationMinWidth?: number\n ): Orientation {\n const orientation = preferredOrientation ?? Orientation.Horizontal;\n if (isOrientationFixed) return orientation;\n\n horizontalOrientationMinWidth = horizontalOrientationMinWidth ?? 300;\n // Switch to Vertical if width too small\n if (width < horizontalOrientationMinWidth) return Orientation.Vertical;\n\n return orientation;\n }\n\n /**\n * Helper method to handle link clicks\n * @internal\n */\n public static handleLinkClick(text: string) {\n const linksArray = matchLinks(text);\n if (linksArray.length <= 0) return;\n const foundLink = linksArray[0];\n // istanbul ignore else\n if (foundLink && foundLink.url) {\n if (foundLink.schema === \"mailto:\" || foundLink.schema === \"pw:\")\n location.href = foundLink.url;\n else {\n const windowOpen = window.open(foundLink.url, \"_blank\");\n if (windowOpen) windowOpen.focus();\n }\n }\n }\n\n /**\n * A helper method to get links from string.\n * @internal\n */\n public static getLinks = (\n value: string\n ): Array<{ start: number; end: number }> => {\n return matchLinks(value).map(\n (linkInfo: { index: number; lastIndex: number }) => {\n return { start: linkInfo.index, end: linkInfo.lastIndex };\n }\n );\n };\n}\n"]}
@@ -33,6 +33,7 @@ const ACTION_BUTTON_DEFAULT_WIDTH = 90;
33
33
  export class VirtualizedPropertyGrid extends React.Component {
34
34
  /** @internal */
35
35
  constructor(props) {
36
+ var _a;
36
37
  super(props);
37
38
  this._listRef = React.createRef();
38
39
  this._handleNodeHeightChange = (index, key, newHeight) => {
@@ -66,13 +67,14 @@ export class VirtualizedPropertyGrid extends React.Component {
66
67
  };
67
68
  this.state = {
68
69
  gridItems: [],
69
- orientation: props.orientation ?? Orientation.Horizontal,
70
+ orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : Orientation.Horizontal,
70
71
  dynamicNodeHeights: new Map(),
71
72
  resetIndex: 0,
72
73
  };
73
74
  }
74
75
  /** @internal */
75
76
  componentDidUpdate(prevProps, prevState) {
77
+ var _a;
76
78
  if (this.props.orientation !== prevProps.orientation ||
77
79
  this.props.isOrientationFixed !== prevProps.isOrientationFixed ||
78
80
  this.props.horizontalOrientationMinWidth !==
@@ -85,7 +87,7 @@ export class VirtualizedPropertyGrid extends React.Component {
85
87
  this._listRef.current.resetAfterIndex(0);
86
88
  }
87
89
  if (this.props.highlight !== prevProps.highlight &&
88
- this.props.highlight?.activeHighlight &&
90
+ ((_a = this.props.highlight) === null || _a === void 0 ? void 0 : _a.activeHighlight) &&
89
91
  this.state.gridItems.length !== 0) {
90
92
  let index = 0;
91
93
  let foundMatchingItem = false;
@@ -173,51 +175,55 @@ export class VirtualizedPropertyGrid extends React.Component {
173
175
  }
174
176
  /** @internal */
175
177
  render() {
176
- const defaultActionButtonWidth = (this.props.actionButtonRenderers?.length ?? 0) > 0
178
+ var _a, _b;
179
+ const defaultActionButtonWidth = ((_b = (_a = this.props.actionButtonRenderers) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0
177
180
  ? ACTION_BUTTON_DEFAULT_WIDTH
178
181
  : undefined;
179
182
  return (React.createElement(ColumnResizingPropertyListPropsSupplier, { orientation: this.state.orientation, width: this.props.width, minLabelWidth: this.props.minLabelWidth, minValueWidth: this.props.minValueWidth, actionButtonWidth: this.props.actionButtonWidth !== undefined
180
183
  ? this.props.actionButtonWidth
181
- : defaultActionButtonWidth, maxPropertyDepth: this._getMaxItemDepth() }, (columnResizeContext) => (React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: this.props.isPropertySelectionEnabled ?? false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged, isPropertyHoverEnabled: this.props.isPropertyHoverEnabled ?? false }, (selectionContext) => {
182
- const gridContext = {
183
- orientation: columnResizeContext.orientation,
184
- gridWidth: this.props.width,
185
- isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,
186
- isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,
187
- selectedPropertyKey: selectionContext.selectedPropertyKey,
188
- onPropertyClicked: selectionContext.onPropertyClicked,
189
- onPropertyRightClicked: selectionContext.onPropertyRightClicked,
190
- onPropertyContextMenu: selectionContext.onPropertyContextMenu,
191
- editingPropertyKey: selectionContext.editingPropertyKey,
192
- onEditCommit: selectionContext.onEditCommit,
193
- onEditCancel: selectionContext.onEditCancel,
194
- eventHandler: this.props.eventHandler,
195
- dataProvider: this.props.dataProvider,
196
- actionButtonRenderers: this.props.actionButtonRenderers,
197
- propertyValueRendererManager: this.props.propertyValueRendererManager,
198
- propertyCategoryRendererManager: this.props.propertyCategoryRendererManager,
199
- columnRatio: columnResizeContext.columnRatio,
200
- columnInfo: columnResizeContext.columnInfo,
201
- isResizeHandleBeingDragged: columnResizeContext.isResizeHandleBeingDragged,
202
- isResizeHandleHovered: columnResizeContext.isResizeHandleHovered,
203
- onColumnRatioChanged: columnResizeContext.onColumnChanged,
204
- onResizeHandleDragChanged: columnResizeContext.onResizeHandleDragChanged,
205
- onResizeHandleHoverChanged: columnResizeContext.onResizeHandleHoverChanged,
206
- highlight: this.props.highlight,
207
- };
208
- const renderContext = {
209
- gridItems: this.state.gridItems,
210
- gridEventHandler: this.props.eventHandler,
211
- gridModel: this.props.model,
212
- style: this.props.style,
213
- className: this.props.className,
214
- onItemHeightChanged: this._handleNodeHeightChange,
215
- gridContext,
216
- };
217
- return (React.createElement(PropertyGridInternalContextProvider, { value: renderContext },
218
- React.createElement("div", { className: classnames("components-virtualized-property-grid", "components-smallEditor-host") },
219
- React.createElement(VariableSizeList, { className: classnames("components-property-grid-wrapper", "ReactWindow__VariableSizeList", this.props.className), width: this.props.width, height: this.props.height, itemCount: this.state.gridItems.length, itemSize: this._calculateNodeHeightByIndex, estimatedItemSize: this.calculateEstimatedHeight(), overscanCount: 10, layout: "vertical", style: this.props.style, itemKey: this._getNodeKey, ref: this._listRef }, FlatGridItemNode))));
220
- }))));
184
+ : defaultActionButtonWidth, maxPropertyDepth: this._getMaxItemDepth() }, (columnResizeContext) => {
185
+ var _a, _b;
186
+ return (React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: (_a = this.props.isPropertySelectionEnabled) !== null && _a !== void 0 ? _a : false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged, isPropertyHoverEnabled: (_b = this.props.isPropertyHoverEnabled) !== null && _b !== void 0 ? _b : false }, (selectionContext) => {
187
+ const gridContext = {
188
+ orientation: columnResizeContext.orientation,
189
+ gridWidth: this.props.width,
190
+ isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,
191
+ isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled,
192
+ selectedPropertyKey: selectionContext.selectedPropertyKey,
193
+ onPropertyClicked: selectionContext.onPropertyClicked,
194
+ onPropertyRightClicked: selectionContext.onPropertyRightClicked,
195
+ onPropertyContextMenu: selectionContext.onPropertyContextMenu,
196
+ editingPropertyKey: selectionContext.editingPropertyKey,
197
+ onEditCommit: selectionContext.onEditCommit,
198
+ onEditCancel: selectionContext.onEditCancel,
199
+ eventHandler: this.props.eventHandler,
200
+ dataProvider: this.props.dataProvider,
201
+ actionButtonRenderers: this.props.actionButtonRenderers,
202
+ propertyValueRendererManager: this.props.propertyValueRendererManager,
203
+ propertyCategoryRendererManager: this.props.propertyCategoryRendererManager,
204
+ columnRatio: columnResizeContext.columnRatio,
205
+ columnInfo: columnResizeContext.columnInfo,
206
+ isResizeHandleBeingDragged: columnResizeContext.isResizeHandleBeingDragged,
207
+ isResizeHandleHovered: columnResizeContext.isResizeHandleHovered,
208
+ onColumnRatioChanged: columnResizeContext.onColumnChanged,
209
+ onResizeHandleDragChanged: columnResizeContext.onResizeHandleDragChanged,
210
+ onResizeHandleHoverChanged: columnResizeContext.onResizeHandleHoverChanged,
211
+ highlight: this.props.highlight,
212
+ };
213
+ const renderContext = {
214
+ gridItems: this.state.gridItems,
215
+ gridEventHandler: this.props.eventHandler,
216
+ gridModel: this.props.model,
217
+ style: this.props.style,
218
+ className: this.props.className,
219
+ onItemHeightChanged: this._handleNodeHeightChange,
220
+ gridContext,
221
+ };
222
+ return (React.createElement(PropertyGridInternalContextProvider, { value: renderContext },
223
+ React.createElement("div", { className: classnames("components-virtualized-property-grid", "components-smallEditor-host") },
224
+ React.createElement(VariableSizeList, { className: classnames("components-property-grid-wrapper", "ReactWindow__VariableSizeList", this.props.className), width: this.props.width, height: this.props.height, itemCount: this.state.gridItems.length, itemSize: this._calculateNodeHeightByIndex, estimatedItemSize: this.calculateEstimatedHeight(), overscanCount: 10, layout: "vertical", style: this.props.style, itemKey: this._getNodeKey, ref: this._listRef }, FlatGridItemNode))));
225
+ }));
226
+ }));
221
227
  }
222
228
  }
223
229
  const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) => {
@@ -226,17 +232,17 @@ const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) =>
226
232
  const onExpansionToggled = React.useCallback(() => gridEventHandler.onExpansionToggled(node.selectionKey), [gridEventHandler, node.selectionKey]);
227
233
  const onHeightChanged = React.useCallback((newHeight) => onItemHeightChanged(index, node.key, newHeight), [onItemHeightChanged, index, node.key]);
228
234
  function getDisplayNode() {
235
+ var _a, _b, _c, _d, _e, _f, _g;
229
236
  const lastInNumberOfCategories = node.lastInNumberOfCategories;
230
237
  switch (node.type) {
231
238
  case FlatGridItemType.Category:
232
- const categoryRendererManager = gridContext.propertyCategoryRendererManager ??
233
- PropertyCategoryRendererManager.defaultManager;
239
+ const categoryRendererManager = (_a = gridContext.propertyCategoryRendererManager) !== null && _a !== void 0 ? _a : PropertyCategoryRendererManager.defaultManager;
234
240
  const customRenderer = categoryRendererManager.getCategoryComponent(node);
235
241
  const wrapperClassName = classnames("virtualized-grid-node-content", customRenderer !== undefined
236
242
  ? "virtualized-grid-node-custom-category"
237
243
  : "virtualized-grid-node-category");
238
244
  return (React.createElement(FlatItemNestedBorderWrapper, { borderCount: node.depth, bottomBorderCount: lastInNumberOfCategories, className: wrapperClassName },
239
- React.createElement(PropertyCategoryBlock, { className: className, style: style, category: node.derivedCategory, onExpansionToggled: onExpansionToggled, highlight: gridContext.highlight?.filteredTypes?.includes(FilteredType.Category)
245
+ React.createElement(PropertyCategoryBlock, { className: className, style: style, category: node.derivedCategory, onExpansionToggled: onExpansionToggled, highlight: ((_c = (_b = gridContext.highlight) === null || _b === void 0 ? void 0 : _b.filteredTypes) === null || _c === void 0 ? void 0 : _c.includes(FilteredType.Category))
240
246
  ? gridContext.highlight
241
247
  : undefined }, customRenderer !== undefined && (React.createElement(CustomCategoryContent, { renderer: customRenderer, categoryItem: node, gridContext: gridContext, onHeightChanged: onHeightChanged })))));
242
248
  case FlatGridItemType.Array:
@@ -251,8 +257,8 @@ const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) =>
251
257
  ? gridContext.onPropertyRightClicked
252
258
  : undefined, onContextMenu: gridContext.onPropertyContextMenu, category: parentCategoryItem.derivedCategory, isEditing: selectionKey === gridContext.editingPropertyKey, onEditCommit: gridContext.onEditCommit, onEditCancel: gridContext.onEditCancel, isExpanded: node.isExpanded, onExpansionToggled: onExpansionToggled, onHeightChanged: onHeightChanged, actionButtonRenderers: gridContext.actionButtonRenderers, propertyValueRendererManager: gridContext.propertyValueRendererManager, columnRatio: gridContext.columnRatio, columnInfo: gridContext.columnInfo, isResizeHandleBeingDragged: gridContext.isResizeHandleBeingDragged, isResizeHandleHovered: gridContext.isResizeHandleHovered, onColumnRatioChanged: gridContext.onColumnRatioChanged, onResizeHandleDragChanged: gridContext.onResizeHandleDragChanged, onResizeHandleHoverChanged: gridContext.onResizeHandleHoverChanged, highlight: gridContext.highlight
253
259
  ? {
254
- applyOnLabel: gridContext.highlight.filteredTypes?.includes(FilteredType.Label) ?? false,
255
- applyOnValue: gridContext.highlight.filteredTypes?.includes(FilteredType.Value) ?? false,
260
+ applyOnLabel: (_e = (_d = gridContext.highlight.filteredTypes) === null || _d === void 0 ? void 0 : _d.includes(FilteredType.Label)) !== null && _e !== void 0 ? _e : false,
261
+ applyOnValue: (_g = (_f = gridContext.highlight.filteredTypes) === null || _f === void 0 ? void 0 : _f.includes(FilteredType.Value)) !== null && _g !== void 0 ? _g : false,
256
262
  ...gridContext.highlight,
257
263
  }
258
264
  : undefined })));
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,O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AM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,6BAAK,GAAG,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ListChildComponentProps } from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { RatioChangeResult } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(\n prevProps: VirtualizedPropertyGridProps,\n prevState: VirtualizedPropertyGridState\n ) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return (\n getPropertyHeight(this.state) +\n node.lastInNumberOfCategories * bottomBorderPadding\n );\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return (\n categoryHeaderHeight +\n categoryHeaderPadding +\n (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0)\n );\n }\n\n return (\n dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0)\n );\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (\n state.orientation === Orientation.Vertical &&\n node.type === FlatGridItemType.Primitive\n ) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n /** @internal */\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n this.props.className\n )}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyClicked\n : undefined\n }\n onRightClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyRightClicked\n : undefined\n }\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
1
+ {"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAKnF,OAAO,EAAE,mCAAmC,EAAE,MAAM,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M,qBAAqB,GAAyC,CAAC,KAAK,EAAE,EAAE;IAC5E,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE;QACzB,MAAM,CAAC,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,6BAAK,GAAG,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ListChildComponentProps } from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { RatioChangeResult } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(\n prevProps: VirtualizedPropertyGridProps,\n prevState: VirtualizedPropertyGridState\n ) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return (\n getPropertyHeight(this.state) +\n node.lastInNumberOfCategories * bottomBorderPadding\n );\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return (\n categoryHeaderHeight +\n categoryHeaderPadding +\n (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0)\n );\n }\n\n return (\n dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0)\n );\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (\n state.orientation === Orientation.Vertical &&\n node.type === FlatGridItemType.Primitive\n ) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n /** @internal */\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n this.props.className\n )}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyClicked\n : undefined\n }\n onRightClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyRightClicked\n : undefined\n }\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
@@ -80,8 +80,9 @@ export class FilteringPropertyDataProvider {
80
80
  }
81
81
  }
82
82
  async function matchHierarchy(filterer, categories, records, newRecords, parentMatchInfo) {
83
+ var _a, _b, _c, _d, _e;
83
84
  const newCategories = [];
84
- newRecords = newRecords ?? {};
85
+ newRecords = newRecords !== null && newRecords !== void 0 ? newRecords : {};
85
86
  let matchesCount = 0;
86
87
  let allFilteredResultMatches = [];
87
88
  let allFilteredTypes = [];
@@ -90,27 +91,27 @@ async function matchHierarchy(filterer, categories, records, newRecords, parentM
90
91
  if (matchInfo.matchesFilter) {
91
92
  allFilteredResultMatches.push({
92
93
  id: category.name,
93
- matchesCount: matchInfo.matchesCount ?? 0,
94
+ matchesCount: (_a = matchInfo.matchesCount) !== null && _a !== void 0 ? _a : 0,
94
95
  });
95
- allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);
96
- matchesCount += matchInfo.matchesCount ?? 0;
96
+ allFilteredTypes = allFilteredTypes.concat((_b = matchInfo.filteredTypes) !== null && _b !== void 0 ? _b : []);
97
+ matchesCount += (_c = matchInfo.matchesCount) !== null && _c !== void 0 ? _c : 0;
97
98
  }
98
- const childRecords = records[category.name] ?? [];
99
+ const childRecords = (_d = records[category.name]) !== null && _d !== void 0 ? _d : [];
99
100
  const { filteredRecords, matchesCount: count, filteredResultMatches, filteredTypes, } = await matchRecordHierarchy(filterer, childRecords, []);
100
101
  allFilteredResultMatches = allFilteredResultMatches.concat(filteredResultMatches);
101
102
  allFilteredTypes = allFilteredTypes.concat(filteredTypes);
102
103
  matchesCount += count;
103
- const parentInfo = parentMatchInfo?.matchesFilter
104
+ const parentInfo = (parentMatchInfo === null || parentMatchInfo === void 0 ? void 0 : parentMatchInfo.matchesFilter)
104
105
  ? parentMatchInfo
105
106
  : matchInfo;
106
- const childCategories = category.childCategories ?? [];
107
+ const childCategories = (_e = category.childCategories) !== null && _e !== void 0 ? _e : [];
107
108
  const { filteredCategories, matchesCount: childCount, filteredResultMatches: childFilteredResultMatches, filteredTypes: childFilteredTypes, } = await matchHierarchy(filterer, childCategories, records, newRecords, parentInfo);
108
109
  allFilteredResultMatches = allFilteredResultMatches.concat(childFilteredResultMatches);
109
110
  allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);
110
111
  matchesCount += childCount;
111
112
  let expand = !(count === 0 && childCount === 0);
112
113
  if (matchInfo.matchesFilter ||
113
- (parentMatchInfo?.matchesFilter &&
114
+ ((parentMatchInfo === null || parentMatchInfo === void 0 ? void 0 : parentMatchInfo.matchesFilter) &&
114
115
  parentMatchInfo.shouldForceIncludeDescendants)) {
115
116
  newRecords[category.name] = records[category.name];
116
117
  if (matchInfo.matchesFilter) {
@@ -121,7 +122,7 @@ async function matchHierarchy(filterer, categories, records, newRecords, parentM
121
122
  }
122
123
  if ((filteredRecords.length !== 0 || filteredCategories.length !== 0) &&
123
124
  !matchInfo.matchesFilter &&
124
- !(parentMatchInfo?.shouldExpandNodeParents &&
125
+ !((parentMatchInfo === null || parentMatchInfo === void 0 ? void 0 : parentMatchInfo.shouldExpandNodeParents) &&
125
126
  parentMatchInfo.matchesFilter)) {
126
127
  const newCategory = copyPropertyCategory(category, filteredCategories, expand);
127
128
  newRecords[newCategory.name] = filteredRecords;
@@ -137,6 +138,7 @@ async function matchHierarchy(filterer, categories, records, newRecords, parentM
137
138
  };
138
139
  }
139
140
  async function matchRecordHierarchy(filterer, records, parents, forceIncludeItem = false) {
141
+ var _a, _b;
140
142
  const newMatchedRecords = [];
141
143
  let expandParent = false; // property passed back to parent to indicate whether it should be expanded
142
144
  let matchesCount = 0;
@@ -153,8 +155,8 @@ async function matchRecordHierarchy(filterer, records, parents, forceIncludeItem
153
155
  expandParent = expandParent || shouldExpandNodeParents;
154
156
  let newRecord;
155
157
  if (matchInfo.matchesFilter) {
156
- filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];
157
- const recordMatchesCount = matchInfo.matchesCount ?? 0;
158
+ filteredTypes = [...filteredTypes, ...((_a = matchInfo.filteredTypes) !== null && _a !== void 0 ? _a : [])];
159
+ const recordMatchesCount = (_b = matchInfo.matchesCount) !== null && _b !== void 0 ? _b : 0;
158
160
  matchesCount += recordMatchesCount;
159
161
  // Item is included if it matches filter
160
162
  // If at least one matched record from records list needs its parent expanded,
@@ -1 +1 @@
1
- {"version":3,"file":"FilteringDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/FilteringDataProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAqClE;;;GAGG;AACH,MAAM,OAAO,6BAA6B;IASxC,YACU,aAAoC,EACpC,SAAgC;QADhC,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SAAS;YAChC,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QACtB,KAAK,mBAAmB,CAAC,KAAK;YAC5B,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,KAAK;gBACtC,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,KAAK,EAAE,WAAW;aACnB,CAAC;QACJ,KAAK,mBAAmB,CAAC,MAAM;YAC7B,MAAM,OAAO,GAAuC,EAAE,CAAC;YACvD,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACvE,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,MAAM;gBACvC,OAAO;aACR,CAAC;KACL;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { IDisposable } from \"@itwin/core-bentley\";\nimport type { HighlightInfo } from \"../../common/HighlightingComponentProps\";\nimport type { CategoryRecordsDict } from \"../internal/flat-items/MutableGridCategory\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n PropertyData,\n} from \"../PropertyDataProvider\";\nimport { PropertyDataChangeEvent } from \"../PropertyDataProvider\";\nimport type {\n FilteredType,\n IPropertyDataFilterer,\n PropertyDataFilterResult,\n} from \"./filterers/PropertyDataFiltererBase\";\n\ninterface FilteredRecords {\n filteredRecords: PropertyRecord[];\n shouldExpandNodeParents: boolean;\n matchesCount: number;\n activeMatch?: HighlightInfo;\n filteredResultMatches: { id: string; matchesCount: number }[];\n filteredTypes: FilteredType[];\n}\n\n/**\n * Data returned by [[FilteringPropertyDataProvider]]\n * @public\n */\nexport interface FilteredPropertyData extends PropertyData {\n /**\n * Shows how many matches were found when filtering data.\n * `undefined` when filterer is not active\n */\n matchesCount?: number;\n\n /**\n * Function used for getting [[HighlightInfo]] by index from all the filtered matches.\n * `undefined` when filterer is not active\n */\n getMatchByIndex?: (index: number) => HighlightInfo | undefined;\n\n /** Types of objects that were used for filtering. */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * [[IPropertyDataProvider]] implementation which filters wrapped provider [[PropertyData]] using passed [[IPropertyDataFilterer]].\n * @public\n */\nexport class FilteringPropertyDataProvider\n implements IPropertyDataProvider, IDisposable\n{\n public onDataChanged = new PropertyDataChangeEvent();\n private _filteredPropertyData: Promise<FilteredPropertyData> | undefined =\n undefined;\n private _disposeFilterChangedListener: Function;\n private _disposeDataChangedListener: Function;\n\n public constructor(\n private _dataProvider: IPropertyDataProvider,\n private _filterer: IPropertyDataFilterer\n ) {\n this._disposeFilterChangedListener =\n this._filterer.onFilterChanged.addListener(() => {\n this._filteredPropertyData = undefined;\n this.onDataChanged.raiseEvent();\n });\n this._disposeDataChangedListener =\n this._dataProvider.onDataChanged.addListener(() => {\n this._filteredPropertyData = undefined;\n this.onDataChanged.raiseEvent();\n });\n }\n\n public dispose(): void {\n this._disposeDataChangedListener();\n this._disposeFilterChangedListener();\n }\n\n public async getData(): Promise<FilteredPropertyData> {\n if (this._filteredPropertyData) {\n return this._filteredPropertyData;\n }\n\n this._filteredPropertyData = this._dataProvider\n .getData()\n .then(async (propertyData) => {\n return this._filterer.isActive\n ? this.filterPropertyData(propertyData)\n : propertyData;\n });\n\n return this._filteredPropertyData;\n }\n\n private async filterPropertyData(propertyData: PropertyData) {\n const { categories, records, label, description } = { ...propertyData };\n const {\n filteredCategories,\n filteredRecords,\n matchesCount,\n filteredResultMatches,\n filteredTypes,\n } = await matchHierarchy(this._filterer, categories, records, undefined);\n\n const uniqueTypes = [...new Set(filteredTypes)];\n const getMatchByIndex = (index: number) => {\n let activeMatch: HighlightInfo | undefined;\n if (index <= 0) return undefined;\n\n let i = 1;\n for (const record of filteredResultMatches) {\n const fullMatchesCount = record.matchesCount;\n if (index < i + fullMatchesCount) {\n activeMatch = {\n highlightedItemIdentifier: record.id,\n highlightIndex: index - i,\n };\n break;\n }\n\n i += fullMatchesCount;\n }\n return activeMatch;\n };\n\n return {\n label,\n description,\n categories: filteredCategories,\n records: filteredRecords,\n reusePropertyDataState: false,\n matchesCount,\n getMatchByIndex,\n filteredTypes: uniqueTypes,\n };\n }\n}\n\nasync function matchHierarchy(\n filterer: IPropertyDataFilterer,\n categories: PropertyCategory[],\n records: CategoryRecordsDict,\n newRecords?: CategoryRecordsDict,\n parentMatchInfo?: PropertyDataFilterResult\n) {\n const newCategories: PropertyCategory[] = [];\n newRecords = newRecords ?? {};\n let matchesCount = 0;\n let allFilteredResultMatches: { id: string; matchesCount: number }[] = [];\n let allFilteredTypes: FilteredType[] = [];\n\n for (const category of categories) {\n const matchInfo = await filterer.categoryMatchesFilter(category, []);\n\n if (matchInfo.matchesFilter) {\n allFilteredResultMatches.push({\n id: category.name,\n matchesCount: matchInfo.matchesCount ?? 0,\n });\n allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);\n matchesCount += matchInfo.matchesCount ?? 0;\n }\n\n const childRecords = records[category.name] ?? [];\n const {\n filteredRecords,\n matchesCount: count,\n filteredResultMatches,\n filteredTypes,\n } = await matchRecordHierarchy(filterer, childRecords, []);\n allFilteredResultMatches = allFilteredResultMatches.concat(\n filteredResultMatches\n );\n allFilteredTypes = allFilteredTypes.concat(filteredTypes);\n matchesCount += count;\n\n const parentInfo = parentMatchInfo?.matchesFilter\n ? parentMatchInfo\n : matchInfo;\n\n const childCategories = category.childCategories ?? [];\n const {\n filteredCategories,\n matchesCount: childCount,\n filteredResultMatches: childFilteredResultMatches,\n filteredTypes: childFilteredTypes,\n } = await matchHierarchy(\n filterer,\n childCategories,\n records,\n newRecords,\n parentInfo\n );\n allFilteredResultMatches = allFilteredResultMatches.concat(\n childFilteredResultMatches\n );\n allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);\n matchesCount += childCount;\n\n let expand = !(count === 0 && childCount === 0);\n if (\n matchInfo.matchesFilter ||\n (parentMatchInfo?.matchesFilter &&\n parentMatchInfo.shouldForceIncludeDescendants)\n ) {\n newRecords[category.name] = records[category.name];\n if (matchInfo.matchesFilter) {\n expand = true;\n }\n const newCategory = copyPropertyCategory(\n category,\n filteredCategories,\n expand\n );\n newCategories.push(newCategory);\n }\n\n if (\n (filteredRecords.length !== 0 || filteredCategories.length !== 0) &&\n !matchInfo.matchesFilter &&\n !(\n parentMatchInfo?.shouldExpandNodeParents &&\n parentMatchInfo.matchesFilter\n )\n ) {\n const newCategory = copyPropertyCategory(\n category,\n filteredCategories,\n expand\n );\n newRecords[newCategory.name] = filteredRecords;\n newCategories.push(newCategory);\n }\n }\n\n return {\n filteredCategories: newCategories,\n filteredRecords: newRecords,\n matchesCount,\n filteredResultMatches: allFilteredResultMatches,\n filteredTypes: allFilteredTypes,\n };\n}\n\nasync function matchRecordHierarchy(\n filterer: IPropertyDataFilterer,\n records: PropertyRecord[],\n parents: PropertyRecord[],\n forceIncludeItem: boolean = false\n): Promise<FilteredRecords> {\n const newMatchedRecords: PropertyRecord[] = [];\n let expandParent = false; // property passed back to parent to indicate whether it should be expanded\n let matchesCount = 0;\n let filteredResultMatches: { id: string; matchesCount: number }[] = [];\n let filteredTypes: FilteredType[] = [];\n\n for (const record of records) {\n const matchInfo = await filterer.recordMatchesFilter(record, parents);\n const shouldForceIncludeDescendants =\n forceIncludeItem || matchInfo.shouldForceIncludeDescendants;\n const {\n filteredRecords: filteredChildren,\n shouldExpandNodeParents,\n matchesCount: childrenMatchesCount,\n filteredResultMatches: childrenResultMatches,\n filteredTypes: childrenFilteredTypes,\n } = await matchRecordHierarchy(\n filterer,\n record.getChildrenRecords(),\n [...parents, record],\n shouldForceIncludeDescendants\n );\n filteredResultMatches = filteredResultMatches.concat(childrenResultMatches);\n filteredTypes = [...filteredTypes, ...childrenFilteredTypes];\n matchesCount += childrenMatchesCount;\n // if child hierarchy indicates parents should be expanded, then it should be passed back up to the top parent\n expandParent = expandParent || shouldExpandNodeParents;\n\n let newRecord: PropertyRecord | undefined;\n if (matchInfo.matchesFilter) {\n filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];\n const recordMatchesCount = matchInfo.matchesCount ?? 0;\n matchesCount += recordMatchesCount;\n // Item is included if it matches filter\n // If at least one matched record from records list needs its parent expanded,\n // then `expandParent` should be set to true\n expandParent = expandParent || !!matchInfo.shouldExpandNodeParents;\n newRecord = copyPropertyRecord(\n record,\n filteredChildren,\n shouldExpandNodeParents\n );\n filteredResultMatches.push({\n id: newRecord.property.name,\n matchesCount: recordMatchesCount,\n });\n } else if (filteredChildren.length !== 0 || forceIncludeItem) {\n // Item is also included if it has at least one matched child or is forcefully included by its parent\n newRecord = copyPropertyRecord(\n record,\n filteredChildren,\n shouldExpandNodeParents\n );\n }\n\n if (newRecord) newMatchedRecords.push(newRecord);\n }\n\n return {\n filteredRecords: newMatchedRecords,\n shouldExpandNodeParents: expandParent,\n matchesCount,\n filteredResultMatches,\n filteredTypes,\n };\n}\n\nfunction copyPropertyCategory(\n propertyCategory: PropertyCategory,\n newChildren: PropertyCategory[],\n expand: boolean\n): PropertyCategory {\n return {\n ...propertyCategory,\n childCategories: newChildren,\n expand,\n };\n}\n\nfunction copyPropertyRecord(\n record: PropertyRecord,\n newChildren: PropertyRecord[],\n autoExpand: boolean\n) {\n const r = record.copyWithNewValue(\n createNewPropertyValue(record.value, newChildren)\n );\n r.autoExpand = autoExpand;\n return r;\n}\n\nfunction createNewPropertyValue(\n value: PropertyValue,\n newChildren: PropertyRecord[]\n): PropertyValue {\n switch (value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return { ...value };\n case PropertyValueFormat.Array:\n return {\n valueFormat: PropertyValueFormat.Array,\n itemsTypeName: value.itemsTypeName,\n items: newChildren,\n };\n case PropertyValueFormat.Struct:\n const members: { [name: string]: PropertyRecord } = {};\n newChildren.forEach((child) => (members[child.property.name] = child));\n return {\n valueFormat: PropertyValueFormat.Struct,\n members,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"FilteringDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/FilteringDataProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAS5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAqClE;;;GAGG;AACH,MAAM,OAAO,6BAA6B;IASxC,YACU,aAAoC,EACpC,SAAgC;QADhC,kBAAa,GAAb,aAAa,CAAuB;QACpC,cAAS,GAAT,SAAS,CAAuB;QARnC,kBAAa,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAC7C,0BAAqB,GAC3B,SAAS,CAAC;QAQV,IAAI,CAAC,6BAA6B;YAChC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE;gBAC9C,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;gBACvC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,2BAA2B;YAC9B,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE;gBAChD,IAAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;gBACvC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;YAClC,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAI,CAAC,6BAA6B,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,OAAO,IAAI,CAAC,qBAAqB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O;QACL,eAAe,EAAE,iBAAiB;QAClC,uBAAuB,EAAE,YAAY;QACrC,YAAY;QACZ,qBAAqB;QACrB,aAAa;KACd,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,gBAAkC,EAClC,WAA+B,EAC/B,MAAe;IAEf,OAAO;QACL,GAAG,gBAAgB;QACnB,eAAe,EAAE,WAAW;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAsB,EACtB,WAA6B,EAC7B,UAAmB;IAEnB,MAAM,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAC/B,sBAAsB,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAClD,CAAC;IACF,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;IAC1B,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,sBAAsB,CAC7B,KAAoB,EACpB,WAA6B;IAE7B,QAAQ,KAAK,CAAC,WAAW,EAAE;QACzB,KAAK,mBAAmB,CAAC,SAAS;YAChC,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QACtB,KAAK,mBAAmB,CAAC,KAAK;YAC5B,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,KAAK;gBACtC,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,KAAK,EAAE,WAAW;aACnB,CAAC;QACJ,KAAK,mBAAmB,CAAC,MAAM;YAC7B,MAAM,OAAO,GAAuC,EAAE,CAAC;YACvD,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACvE,OAAO;gBACL,WAAW,EAAE,mBAAmB,CAAC,MAAM;gBACvC,OAAO;aACR,CAAC;KACL;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { IDisposable } from \"@itwin/core-bentley\";\nimport type { HighlightInfo } from \"../../common/HighlightingComponentProps\";\nimport type { CategoryRecordsDict } from \"../internal/flat-items/MutableGridCategory\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n PropertyData,\n} from \"../PropertyDataProvider\";\nimport { PropertyDataChangeEvent } from \"../PropertyDataProvider\";\nimport type {\n FilteredType,\n IPropertyDataFilterer,\n PropertyDataFilterResult,\n} from \"./filterers/PropertyDataFiltererBase\";\n\ninterface FilteredRecords {\n filteredRecords: PropertyRecord[];\n shouldExpandNodeParents: boolean;\n matchesCount: number;\n activeMatch?: HighlightInfo;\n filteredResultMatches: { id: string; matchesCount: number }[];\n filteredTypes: FilteredType[];\n}\n\n/**\n * Data returned by [[FilteringPropertyDataProvider]]\n * @public\n */\nexport interface FilteredPropertyData extends PropertyData {\n /**\n * Shows how many matches were found when filtering data.\n * `undefined` when filterer is not active\n */\n matchesCount?: number;\n\n /**\n * Function used for getting [[HighlightInfo]] by index from all the filtered matches.\n * `undefined` when filterer is not active\n */\n getMatchByIndex?: (index: number) => HighlightInfo | undefined;\n\n /** Types of objects that were used for filtering. */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * [[IPropertyDataProvider]] implementation which filters wrapped provider [[PropertyData]] using passed [[IPropertyDataFilterer]].\n * @public\n */\nexport class FilteringPropertyDataProvider\n implements IPropertyDataProvider, IDisposable\n{\n public onDataChanged = new PropertyDataChangeEvent();\n private _filteredPropertyData: Promise<FilteredPropertyData> | undefined =\n undefined;\n private _disposeFilterChangedListener: Function;\n private _disposeDataChangedListener: Function;\n\n public constructor(\n private _dataProvider: IPropertyDataProvider,\n private _filterer: IPropertyDataFilterer\n ) {\n this._disposeFilterChangedListener =\n this._filterer.onFilterChanged.addListener(() => {\n this._filteredPropertyData = undefined;\n this.onDataChanged.raiseEvent();\n });\n this._disposeDataChangedListener =\n this._dataProvider.onDataChanged.addListener(() => {\n this._filteredPropertyData = undefined;\n this.onDataChanged.raiseEvent();\n });\n }\n\n public dispose(): void {\n this._disposeDataChangedListener();\n this._disposeFilterChangedListener();\n }\n\n public async getData(): Promise<FilteredPropertyData> {\n if (this._filteredPropertyData) {\n return this._filteredPropertyData;\n }\n\n this._filteredPropertyData = this._dataProvider\n .getData()\n .then(async (propertyData) => {\n return this._filterer.isActive\n ? this.filterPropertyData(propertyData)\n : propertyData;\n });\n\n return this._filteredPropertyData;\n }\n\n private async filterPropertyData(propertyData: PropertyData) {\n const { categories, records, label, description } = { ...propertyData };\n const {\n filteredCategories,\n filteredRecords,\n matchesCount,\n filteredResultMatches,\n filteredTypes,\n } = await matchHierarchy(this._filterer, categories, records, undefined);\n\n const uniqueTypes = [...new Set(filteredTypes)];\n const getMatchByIndex = (index: number) => {\n let activeMatch: HighlightInfo | undefined;\n if (index <= 0) return undefined;\n\n let i = 1;\n for (const record of filteredResultMatches) {\n const fullMatchesCount = record.matchesCount;\n if (index < i + fullMatchesCount) {\n activeMatch = {\n highlightedItemIdentifier: record.id,\n highlightIndex: index - i,\n };\n break;\n }\n\n i += fullMatchesCount;\n }\n return activeMatch;\n };\n\n return {\n label,\n description,\n categories: filteredCategories,\n records: filteredRecords,\n reusePropertyDataState: false,\n matchesCount,\n getMatchByIndex,\n filteredTypes: uniqueTypes,\n };\n }\n}\n\nasync function matchHierarchy(\n filterer: IPropertyDataFilterer,\n categories: PropertyCategory[],\n records: CategoryRecordsDict,\n newRecords?: CategoryRecordsDict,\n parentMatchInfo?: PropertyDataFilterResult\n) {\n const newCategories: PropertyCategory[] = [];\n newRecords = newRecords ?? {};\n let matchesCount = 0;\n let allFilteredResultMatches: { id: string; matchesCount: number }[] = [];\n let allFilteredTypes: FilteredType[] = [];\n\n for (const category of categories) {\n const matchInfo = await filterer.categoryMatchesFilter(category, []);\n\n if (matchInfo.matchesFilter) {\n allFilteredResultMatches.push({\n id: category.name,\n matchesCount: matchInfo.matchesCount ?? 0,\n });\n allFilteredTypes = allFilteredTypes.concat(matchInfo.filteredTypes ?? []);\n matchesCount += matchInfo.matchesCount ?? 0;\n }\n\n const childRecords = records[category.name] ?? [];\n const {\n filteredRecords,\n matchesCount: count,\n filteredResultMatches,\n filteredTypes,\n } = await matchRecordHierarchy(filterer, childRecords, []);\n allFilteredResultMatches = allFilteredResultMatches.concat(\n filteredResultMatches\n );\n allFilteredTypes = allFilteredTypes.concat(filteredTypes);\n matchesCount += count;\n\n const parentInfo = parentMatchInfo?.matchesFilter\n ? parentMatchInfo\n : matchInfo;\n\n const childCategories = category.childCategories ?? [];\n const {\n filteredCategories,\n matchesCount: childCount,\n filteredResultMatches: childFilteredResultMatches,\n filteredTypes: childFilteredTypes,\n } = await matchHierarchy(\n filterer,\n childCategories,\n records,\n newRecords,\n parentInfo\n );\n allFilteredResultMatches = allFilteredResultMatches.concat(\n childFilteredResultMatches\n );\n allFilteredTypes = allFilteredTypes.concat(childFilteredTypes);\n matchesCount += childCount;\n\n let expand = !(count === 0 && childCount === 0);\n if (\n matchInfo.matchesFilter ||\n (parentMatchInfo?.matchesFilter &&\n parentMatchInfo.shouldForceIncludeDescendants)\n ) {\n newRecords[category.name] = records[category.name];\n if (matchInfo.matchesFilter) {\n expand = true;\n }\n const newCategory = copyPropertyCategory(\n category,\n filteredCategories,\n expand\n );\n newCategories.push(newCategory);\n }\n\n if (\n (filteredRecords.length !== 0 || filteredCategories.length !== 0) &&\n !matchInfo.matchesFilter &&\n !(\n parentMatchInfo?.shouldExpandNodeParents &&\n parentMatchInfo.matchesFilter\n )\n ) {\n const newCategory = copyPropertyCategory(\n category,\n filteredCategories,\n expand\n );\n newRecords[newCategory.name] = filteredRecords;\n newCategories.push(newCategory);\n }\n }\n\n return {\n filteredCategories: newCategories,\n filteredRecords: newRecords,\n matchesCount,\n filteredResultMatches: allFilteredResultMatches,\n filteredTypes: allFilteredTypes,\n };\n}\n\nasync function matchRecordHierarchy(\n filterer: IPropertyDataFilterer,\n records: PropertyRecord[],\n parents: PropertyRecord[],\n forceIncludeItem: boolean = false\n): Promise<FilteredRecords> {\n const newMatchedRecords: PropertyRecord[] = [];\n let expandParent = false; // property passed back to parent to indicate whether it should be expanded\n let matchesCount = 0;\n let filteredResultMatches: { id: string; matchesCount: number }[] = [];\n let filteredTypes: FilteredType[] = [];\n\n for (const record of records) {\n const matchInfo = await filterer.recordMatchesFilter(record, parents);\n const shouldForceIncludeDescendants =\n forceIncludeItem || matchInfo.shouldForceIncludeDescendants;\n const {\n filteredRecords: filteredChildren,\n shouldExpandNodeParents,\n matchesCount: childrenMatchesCount,\n filteredResultMatches: childrenResultMatches,\n filteredTypes: childrenFilteredTypes,\n } = await matchRecordHierarchy(\n filterer,\n record.getChildrenRecords(),\n [...parents, record],\n shouldForceIncludeDescendants\n );\n filteredResultMatches = filteredResultMatches.concat(childrenResultMatches);\n filteredTypes = [...filteredTypes, ...childrenFilteredTypes];\n matchesCount += childrenMatchesCount;\n // if child hierarchy indicates parents should be expanded, then it should be passed back up to the top parent\n expandParent = expandParent || shouldExpandNodeParents;\n\n let newRecord: PropertyRecord | undefined;\n if (matchInfo.matchesFilter) {\n filteredTypes = [...filteredTypes, ...(matchInfo.filteredTypes ?? [])];\n const recordMatchesCount = matchInfo.matchesCount ?? 0;\n matchesCount += recordMatchesCount;\n // Item is included if it matches filter\n // If at least one matched record from records list needs its parent expanded,\n // then `expandParent` should be set to true\n expandParent = expandParent || !!matchInfo.shouldExpandNodeParents;\n newRecord = copyPropertyRecord(\n record,\n filteredChildren,\n shouldExpandNodeParents\n );\n filteredResultMatches.push({\n id: newRecord.property.name,\n matchesCount: recordMatchesCount,\n });\n } else if (filteredChildren.length !== 0 || forceIncludeItem) {\n // Item is also included if it has at least one matched child or is forcefully included by its parent\n newRecord = copyPropertyRecord(\n record,\n filteredChildren,\n shouldExpandNodeParents\n );\n }\n\n if (newRecord) newMatchedRecords.push(newRecord);\n }\n\n return {\n filteredRecords: newMatchedRecords,\n shouldExpandNodeParents: expandParent,\n matchesCount,\n filteredResultMatches,\n filteredTypes,\n };\n}\n\nfunction copyPropertyCategory(\n propertyCategory: PropertyCategory,\n newChildren: PropertyCategory[],\n expand: boolean\n): PropertyCategory {\n return {\n ...propertyCategory,\n childCategories: newChildren,\n expand,\n };\n}\n\nfunction copyPropertyRecord(\n record: PropertyRecord,\n newChildren: PropertyRecord[],\n autoExpand: boolean\n) {\n const r = record.copyWithNewValue(\n createNewPropertyValue(record.value, newChildren)\n );\n r.autoExpand = autoExpand;\n return r;\n}\n\nfunction createNewPropertyValue(\n value: PropertyValue,\n newChildren: PropertyRecord[]\n): PropertyValue {\n switch (value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return { ...value };\n case PropertyValueFormat.Array:\n return {\n valueFormat: PropertyValueFormat.Array,\n itemsTypeName: value.itemsTypeName,\n items: newChildren,\n };\n case PropertyValueFormat.Struct:\n const members: { [name: string]: PropertyRecord } = {};\n newChildren.forEach((child) => (members[child.property.name] = child));\n return {\n valueFormat: PropertyValueFormat.Struct,\n members,\n };\n }\n}\n"]}