@itwin/components-react 4.13.1 → 4.13.3

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 (235) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/lib/cjs/components-react/UiComponents.js +1 -1
  3. package/lib/cjs/components-react/UiComponents.js.map +1 -1
  4. package/lib/cjs/components-react/common/DateUtils.js.map +1 -1
  5. package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
  6. package/lib/cjs/components-react/common/ImageRenderer.js +1 -1
  7. package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
  8. package/lib/cjs/components-react/common/Links.js.map +1 -1
  9. package/lib/cjs/components-react/common/UseAsyncValue.js.map +1 -1
  10. package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  11. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  12. package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -1
  13. package/lib/cjs/components-react/common/countMatchesInString.js.map +1 -1
  14. package/lib/cjs/components-react/common/selection/SelectionHandler.js.map +1 -1
  15. package/lib/cjs/components-react/common/selection/SelectionModes.js +2 -2
  16. package/lib/cjs/components-react/common/selection/SelectionModes.js.map +1 -1
  17. package/lib/cjs/components-react/converters/BooleanTypeConverter.js +1 -1
  18. package/lib/cjs/components-react/converters/BooleanTypeConverter.js.map +1 -1
  19. package/lib/cjs/components-react/converters/CompositeTypeConverter.js.map +1 -1
  20. package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  21. package/lib/cjs/components-react/converters/EnumTypeConverter.js.map +1 -1
  22. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  23. package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
  24. package/lib/cjs/components-react/converters/TypeConverterManager.js +1 -1
  25. package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
  26. package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
  27. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  28. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  29. package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
  30. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  31. package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
  32. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  33. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  34. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  35. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  36. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  37. package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
  38. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  39. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  40. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  41. package/lib/cjs/components-react/editors/PropertyEditorManager.js +1 -1
  42. package/lib/cjs/components-react/editors/PropertyEditorManager.js.map +1 -1
  43. package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
  44. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  45. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  46. package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
  47. package/lib/cjs/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  48. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  49. package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js +1 -1
  50. package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -1
  51. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  52. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  53. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  54. package/lib/cjs/components-react/filter-builder/Operators.js +2 -2
  55. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  56. package/lib/cjs/components-react/filtering/FilteringInput.js +1 -1
  57. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  58. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  59. package/lib/cjs/components-react/iconpicker/IconPickerButton.js +1 -1
  60. package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
  61. package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
  62. package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
  63. package/lib/cjs/components-react/properties/ValueRendererManager.js +1 -1
  64. package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
  65. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  66. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  67. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  68. package/lib/cjs/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
  69. package/lib/cjs/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
  70. package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  71. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
  72. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  73. package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  74. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -1
  75. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  76. package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.js.map +1 -1
  77. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +1 -1
  78. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  79. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  80. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  81. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  82. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  83. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +1 -1
  84. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  85. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  86. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
  87. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
  88. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js +1 -1
  89. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
  90. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
  91. package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  92. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
  93. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
  94. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +1 -1
  95. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  96. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  97. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  98. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +3 -3
  99. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  100. package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
  101. package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
  102. package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
  103. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  104. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  105. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  106. package/lib/cjs/components-react/toolbar/utilities/Direction.js +4 -4
  107. package/lib/cjs/components-react/toolbar/utilities/Direction.js.map +1 -1
  108. package/lib/cjs/components-react/tree/HighlightingEngine.js +1 -1
  109. package/lib/cjs/components-react/tree/HighlightingEngine.js.map +1 -1
  110. package/lib/cjs/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
  111. package/lib/cjs/components-react/tree/TreeComponentTestId.js +1 -1
  112. package/lib/cjs/components-react/tree/TreeComponentTestId.js.map +1 -1
  113. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  114. package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
  115. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  116. package/lib/cjs/components-react/tree/controlled/TreeModelSource.js.map +1 -1
  117. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  118. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  119. package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  120. package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  121. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  122. package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  123. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  124. package/lib/cjs/components-react/useTranslation.js.map +1 -1
  125. package/lib/esm/components-react/UiComponents.js +1 -2
  126. package/lib/esm/components-react/UiComponents.js.map +1 -1
  127. package/lib/esm/components-react/common/DateUtils.js.map +1 -1
  128. package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
  129. package/lib/esm/components-react/common/ImageRenderer.js +1 -2
  130. package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
  131. package/lib/esm/components-react/common/Links.js.map +1 -1
  132. package/lib/esm/components-react/common/UseAsyncValue.js.map +1 -1
  133. package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
  134. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  135. package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -1
  136. package/lib/esm/components-react/common/countMatchesInString.js.map +1 -1
  137. package/lib/esm/components-react/common/selection/SelectionHandler.js.map +1 -1
  138. package/lib/esm/components-react/converters/BooleanTypeConverter.js +1 -2
  139. package/lib/esm/components-react/converters/BooleanTypeConverter.js.map +1 -1
  140. package/lib/esm/components-react/converters/CompositeTypeConverter.js.map +1 -1
  141. package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
  142. package/lib/esm/components-react/converters/EnumTypeConverter.js.map +1 -1
  143. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  144. package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
  145. package/lib/esm/components-react/converters/TypeConverterManager.js +1 -2
  146. package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
  147. package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
  148. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  149. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  150. package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
  151. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  152. package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
  153. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  154. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  155. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  156. package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
  157. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  158. package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
  159. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  160. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  161. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  162. package/lib/esm/components-react/editors/PropertyEditorManager.js +1 -2
  163. package/lib/esm/components-react/editors/PropertyEditorManager.js.map +1 -1
  164. package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
  165. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  166. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  167. package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
  168. package/lib/esm/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
  169. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  170. package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -1
  171. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
  172. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  173. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  174. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  175. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  176. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  177. package/lib/esm/components-react/iconpicker/IconPickerButton.js +1 -2
  178. package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
  179. package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
  180. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  181. package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
  182. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  183. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
  184. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  185. package/lib/esm/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
  186. package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
  187. package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
  188. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  189. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  190. package/lib/esm/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
  191. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  192. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  193. package/lib/esm/components-react/propertygrid/component/FlatItemNestedBorderWrapper.js.map +1 -1
  194. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +1 -2
  195. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  196. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  197. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  198. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
  199. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  200. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  201. package/lib/esm/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
  202. package/lib/esm/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
  203. package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
  204. package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
  205. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
  206. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
  207. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  208. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  209. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  210. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +1 -2
  211. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  212. package/lib/esm/components-react/toolbar/Items.js.map +1 -1
  213. package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
  214. package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
  215. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  216. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  217. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  218. package/lib/esm/components-react/toolbar/utilities/Direction.js +2 -4
  219. package/lib/esm/components-react/toolbar/utilities/Direction.js.map +1 -1
  220. package/lib/esm/components-react/tree/HighlightingEngine.js +1 -2
  221. package/lib/esm/components-react/tree/HighlightingEngine.js.map +1 -1
  222. package/lib/esm/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
  223. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
  224. package/lib/esm/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
  225. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  226. package/lib/esm/components-react/tree/controlled/TreeModelSource.js.map +1 -1
  227. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  228. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  229. package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
  230. package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
  231. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  232. package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
  233. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  234. package/lib/esm/components-react/useTranslation.js.map +1 -1
  235. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG;;GAEG;AAEH,+CAAmD;AACnD,qEAIuC;AAOvC,uEAAoE;AACpE,wDAAsD;AAmBtD;;;;GAIG;AACH,SAAgB,uCAAuC,CACrD,KAAmD;IAEnD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAA,qDAAiC,EAAC;QACpE,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,IAAA,wCAAoB,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,IAAA,+CAA2B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAElE,OAAO,CACL,8BAAC,qBAAqB,IAAC,kBAAkB,EAAE,UAAU,IAAI,CAAC,KAAK,IAC5D,KAAK,IAAI,CACR,8BAAC,iDAAuB,OAClB,KAAK,EACT,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GAC1B,CACH,CACqB,CACzB,CAAC;AACJ,CAAC;AArBD,0FAqBC;AAMD,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,kBAAkB,GACkC;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,CAAC;IACnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,kBAAkB,EAAE;YACvB,cAAc,CAAC,kBAAkB,CAAC,CAAC;YACnC,OAAO;SACR;QAED,8DAA8D;QAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACrC,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,8DAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAC,6CAA6C;QAC1D,8BAAC,8BAAc,IAAC,aAAa,QAAC,IAAI,EAAE,OAAO,GAAI,CAC3C,CACP,CAAC;AACJ,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 */\n\nimport React, { useEffect, useState } from \"react\";\nimport {\n usePropertyGridEventHandler,\n usePropertyGridModel,\n useTrackedPropertyGridModelSource,\n} from \"../internal/PropertyGridHooks\";\nimport type { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type { IPropertyDataProvider } from \"../PropertyDataProvider\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { VirtualizedPropertyGrid } from \"./VirtualizedPropertyGrid\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridWithDataProviderProps\n extends CommonPropertyGridProps {\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/**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]\n * @public\n */\nexport function VirtualizedPropertyGridWithDataProvider(\n props: VirtualizedPropertyGridWithDataProviderProps\n) {\n const { modelSource, inProgress } = useTrackedPropertyGridModelSource({\n dataProvider: props.dataProvider,\n });\n\n const model = usePropertyGridModel({ modelSource });\n const eventHandler = usePropertyGridEventHandler({ modelSource });\n\n return (\n <DelayedLoaderRenderer shouldRenderLoader={inProgress || !model}>\n {model && (\n <VirtualizedPropertyGrid\n {...props}\n model={model}\n eventHandler={eventHandler}\n />\n )}\n </DelayedLoaderRenderer>\n );\n}\n\ninterface DelayedLoaderRendererProps {\n shouldRenderLoader: boolean;\n}\n\nfunction DelayedLoaderRenderer({\n children,\n shouldRenderLoader,\n}: React.PropsWithChildren<DelayedLoaderRendererProps>) {\n const [showSpinner, setShowSpinner] = useState(shouldRenderLoader);\n useEffect(() => {\n if (!shouldRenderLoader) {\n setShowSpinner(shouldRenderLoader);\n return;\n }\n\n // only set a timeout when shouldRenderLoader is set to `true`\n const timeout = setTimeout(() => {\n setShowSpinner(shouldRenderLoader);\n }, 250);\n\n return () => clearTimeout(timeout);\n }, [shouldRenderLoader]);\n\n return !showSpinner ? (\n <>{children}</>\n ) : (\n <div className=\"components-virtualized-property-grid-loader\">\n <ProgressRadial indeterminate size={\"large\"} />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react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CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,8DAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAC,6CAA6C;QAC1D,8BAAC,8BAAc,IAAC,aAAa,QAAC,IAAI,EAAE,OAAO,GAAI,CAC3C,CACP,CAAC;AACJ,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 */\n\nimport React, { useEffect, useState } from \"react\";\nimport {\n usePropertyGridEventHandler,\n usePropertyGridModel,\n useTrackedPropertyGridModelSource,\n} from \"../internal/PropertyGridHooks\";\nimport type { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type { IPropertyDataProvider } from \"../PropertyDataProvider\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { VirtualizedPropertyGrid } from \"./VirtualizedPropertyGrid\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridWithDataProviderProps\n extends CommonPropertyGridProps {\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/**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]\n * @public\n */\nexport function VirtualizedPropertyGridWithDataProvider(\n props: VirtualizedPropertyGridWithDataProviderProps\n) {\n const { modelSource, inProgress } = useTrackedPropertyGridModelSource({\n dataProvider: props.dataProvider,\n });\n\n const model = usePropertyGridModel({ modelSource });\n const eventHandler = usePropertyGridEventHandler({ modelSource });\n\n return (\n <DelayedLoaderRenderer shouldRenderLoader={inProgress || !model}>\n {model && (\n <VirtualizedPropertyGrid\n {...props}\n model={model}\n eventHandler={eventHandler}\n />\n )}\n </DelayedLoaderRenderer>\n );\n}\n\ninterface DelayedLoaderRendererProps {\n shouldRenderLoader: boolean;\n}\n\nfunction DelayedLoaderRenderer({\n children,\n shouldRenderLoader,\n}: React.PropsWithChildren<DelayedLoaderRendererProps>) {\n const [showSpinner, setShowSpinner] = useState(shouldRenderLoader);\n useEffect(() => {\n if (!shouldRenderLoader) {\n setShowSpinner(shouldRenderLoader);\n return;\n }\n\n // only set a timeout when shouldRenderLoader is set to `true`\n const timeout = setTimeout(() => {\n setShowSpinner(shouldRenderLoader);\n }, 250);\n\n return () => clearTimeout(timeout);\n }, [shouldRenderLoader]);\n\n return !showSpinner ? (\n <>{children}</>\n ) : (\n <div className=\"components-virtualized-property-grid-loader\">\n <ProgressRadial indeterminate size={\"large\"} />\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FilteringDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/FilteringDataProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA4D;AAS5D,kEAAkE;AAqClE;;;GAGG;AACH,MAAa,6BAA6B;IASxC,YACU,aAAoC,EACpC,SAAgC;QADhC,kBAAa,GAAb,aAAa,CAAuB;QACpC,cAAS,GAAT,SAAS,CAAuB;QARnC,kBAAa,GAAG,IAAI,8CAAuB,EAAE,CAAC;QAC7C,0BAAqB,GAC3B,SAAS,CAAC;QAQV,IAAI,CAAC,6BAA6B;YAChC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,WAAW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ACnB,CAAC;QACJ,KAAK,oCAAmB,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,oCAAmB,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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B,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,CAAC;QAC1B,KAAK,oCAAmB,CAAC,SAAS;YAChC,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QACtB,KAAK,oCAAmB,CAAC,KAAK;YAC5B,OAAO;gBACL,WAAW,EAAE,oCAAmB,CAAC,KAAK;gBACtC,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,KAAK,EAAE,WAAW;aACnB,CAAC;QACJ,KAAK,oCAAmB,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,oCAAmB,CAAC,MAAM;gBACvC,OAAO;aACR,CAAC;IACN,CAAC;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"]}
@@ -17,7 +17,7 @@ var CompositeFilterType;
17
17
  (function (CompositeFilterType) {
18
18
  CompositeFilterType[CompositeFilterType["And"] = 0] = "And";
19
19
  CompositeFilterType[CompositeFilterType["Or"] = 1] = "Or";
20
- })(CompositeFilterType = exports.CompositeFilterType || (exports.CompositeFilterType = {}));
20
+ })(CompositeFilterType || (exports.CompositeFilterType = CompositeFilterType = {}));
21
21
  /**
22
22
  * Composite PropertyData filter which can join two filters using logic operators
23
23
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH,yEAAsE;AAEtE;;;GAGG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,yDAAE,CAAA;AACJ,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAED;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,mDAAwB;IACzE,YACU,aAAoC,EACpC,SAA8B,EAC9B,cAAqC;QAE7C,KAAK,E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,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,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 } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport type {\n FilteredType,\n IPropertyDataFilterer,\n PropertyDataFilterResult,\n} from \"./PropertyDataFiltererBase\";\nimport { PropertyDataFiltererBase } from \"./PropertyDataFiltererBase\";\n\n/**\n * Logical operator for composite filterer.\n * @public\n */\nexport enum CompositeFilterType {\n And,\n Or,\n}\n\n/**\n * Composite PropertyData filter which can join two filters using logic operators\n * @public\n */\nexport class CompositePropertyDataFilterer extends PropertyDataFiltererBase {\n public constructor(\n private _leftFilterer: IPropertyDataFilterer,\n private _operator: CompositeFilterType,\n private _rightFilterer: IPropertyDataFilterer\n ) {\n super();\n this._leftFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n this._rightFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n }\n\n public get isActive() {\n return this._leftFilterer.isActive || this._rightFilterer.isActive;\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.recordMatchesFilter(node, parents),\n this._rightFilterer.recordMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.categoryMatchesFilter(node, parents),\n this._rightFilterer.categoryMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n private getFiltererResult(\n lhs: PropertyDataFilterResult,\n rhs: PropertyDataFilterResult\n ) {\n const matchesFilter =\n this._operator === CompositeFilterType.And\n ? lhs.matchesFilter && rhs.matchesFilter\n : lhs.matchesFilter || rhs.matchesFilter;\n if (!matchesFilter) return { matchesFilter: false };\n\n const filteredTypes = joinNullableArrays(\n lhs.matchesFilter ? lhs.filteredTypes : undefined,\n rhs.matchesFilter ? rhs.filteredTypes : undefined\n );\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents:\n lhs.shouldExpandNodeParents || rhs.shouldExpandNodeParents,\n shouldForceIncludeDescendants:\n lhs.shouldForceIncludeDescendants || rhs.shouldForceIncludeDescendants,\n matchesCount: sumNullableNumbers(lhs.matchesCount, rhs.matchesCount),\n filteredTypes,\n };\n }\n}\n\nfunction sumNullableNumbers(lhs: number | undefined, rhs: number | undefined) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return (lhs ?? 0) + (rhs ?? 0);\n}\n\nfunction joinNullableArrays(\n lhs: FilteredType[] | undefined,\n rhs: FilteredType[] | undefined\n) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return [...(lhs ?? []), ...(rhs ?? [])];\n}\n"]}
1
+ {"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AASH,yEAAsE;AAEtE;;;GAGG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,yDAAE,CAAA;AACJ,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B;AAED;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,mDAAwB;IACzE,YACU,aAAoC,EACpC,SAA8B,EAC9B,cAAqC;QAE7C,KAAK,EAAE,CAAC;QAJA,kBAAa,GAAb,aAAa,CAAuB;QACpC,cAAS,GAAT,SAAS,CAAqB;QAC9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------------------------------------------\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 { PropertyCategory } from \"../../PropertyDataProvider\";\nimport type {\n FilteredType,\n IPropertyDataFilterer,\n PropertyDataFilterResult,\n} from \"./PropertyDataFiltererBase\";\nimport { PropertyDataFiltererBase } from \"./PropertyDataFiltererBase\";\n\n/**\n * Logical operator for composite filterer.\n * @public\n */\nexport enum CompositeFilterType {\n And,\n Or,\n}\n\n/**\n * Composite PropertyData filter which can join two filters using logic operators\n * @public\n */\nexport class CompositePropertyDataFilterer extends PropertyDataFiltererBase {\n public constructor(\n private _leftFilterer: IPropertyDataFilterer,\n private _operator: CompositeFilterType,\n private _rightFilterer: IPropertyDataFilterer\n ) {\n super();\n this._leftFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n this._rightFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n }\n\n public get isActive() {\n return this._leftFilterer.isActive || this._rightFilterer.isActive;\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.recordMatchesFilter(node, parents),\n this._rightFilterer.recordMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.categoryMatchesFilter(node, parents),\n this._rightFilterer.categoryMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n private getFiltererResult(\n lhs: PropertyDataFilterResult,\n rhs: PropertyDataFilterResult\n ) {\n const matchesFilter =\n this._operator === CompositeFilterType.And\n ? lhs.matchesFilter && rhs.matchesFilter\n : lhs.matchesFilter || rhs.matchesFilter;\n if (!matchesFilter) return { matchesFilter: false };\n\n const filteredTypes = joinNullableArrays(\n lhs.matchesFilter ? lhs.filteredTypes : undefined,\n rhs.matchesFilter ? rhs.filteredTypes : undefined\n );\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents:\n lhs.shouldExpandNodeParents || rhs.shouldExpandNodeParents,\n shouldForceIncludeDescendants:\n lhs.shouldForceIncludeDescendants || rhs.shouldForceIncludeDescendants,\n matchesCount: sumNullableNumbers(lhs.matchesCount, rhs.matchesCount),\n filteredTypes,\n };\n }\n}\n\nfunction sumNullableNumbers(lhs: number | undefined, rhs: number | undefined) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return (lhs ?? 0) + (rhs ?? 0);\n}\n\nfunction joinNullableArrays(\n lhs: FilteredType[] | undefined,\n rhs: FilteredType[] | undefined\n) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return [...(lhs ?? []), ...(rhs ?? [])];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA4D;AAC5D,+EAA4E;AAE5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,gCAAiC,SAAQ,yDAA8B;IAGlF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,IAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF;AA5CD,4EA4CC","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 { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * Property data filterer which matches on Primitive Property Record display value text.\n * @public\n */\nexport class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n if (node.value.valueFormat !== PropertyValueFormat.Primitive)\n return { matchesFilter: false };\n\n const displayValue = node.value.displayValue?.toLowerCase() ?? \"\";\n const matchesCount = countMatchesInString(displayValue, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n matchesCount,\n filteredTypes: [FilteredType.Value],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA4D;AAC5D,+EAA4E;AAE5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,gCAAiC,SAAQ,yDAA8B;IAGlF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,IAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS;YAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF;AA5CD,4EA4CC","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 { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * Property data filterer which matches on Primitive Property Record display value text.\n * @public\n */\nexport class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n if (node.value.valueFormat !== PropertyValueFormat.Primitive)\n return { matchesFilter: false };\n\n const displayValue = node.value.displayValue?.toLowerCase() ?? \"\";\n const matchesCount = countMatchesInString(displayValue, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n matchesCount,\n filteredTypes: [FilteredType.Value],\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LabelPropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,+EAA4E;AAE5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,yDAA8B;IAG3E,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,IAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,6BAA6B,EAAE,IAAI;YACnC,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF;AAzCD,8DAyCC","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 { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * PropertyData filter which matches on any record type label and includes descendant nodes on match\n * @public\n */\nexport class LabelPropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.property.displayLabel.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Label],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"LabelPropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,+EAA4E;AAE5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,yDAA8B;IAG3E,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,IAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,6BAA6B,EAAE,IAAI;YACnC,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF;AAzCD,8DAyCC","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 { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * PropertyData filter which matches on any record type label and includes descendant nodes on match\n * @public\n */\nexport class LabelPropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.property.displayLabel.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Label],\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyCategoryLabelFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+EAA4E;AAG5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,2DAAgC;IAGjF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE;YAClC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,6BAA6B,EAAE,IAAI;YACnC,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,QAAQ,CAAC;SACvC,CAAC;IACJ,CAAC;CACF;AA1CD,sEA0CC","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 { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyCategoryDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * PropertyData filterer which matches on PropertyCategory's label.\n * @public\n */\nexport class PropertyCategoryLabelFilterer extends PropertyCategoryDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.label.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Category],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyCategoryLabelFilterer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+EAA4E;AAG5E,yEAGoC;AAEpC;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,2DAAgC;IAGjF,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QAHF,gBAAW,GAAW,EAAE,CAAC;QAI/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,6BAA6B,EAAE,IAAI;YACnC,YAAY;YACZ,aAAa,EAAE,CAAC,uCAAY,CAAC,QAAQ,CAAC;SACvC,CAAC;IACJ,CAAC;CACF;AA1CD,sEA0CC","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 { countMatchesInString } from \"../../../common/countMatchesInString\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase\";\nimport {\n FilteredType,\n PropertyCategoryDataFiltererBase,\n} from \"./PropertyDataFiltererBase\";\n\n/**\n * PropertyData filterer which matches on PropertyCategory's label.\n * @public\n */\nexport class PropertyCategoryLabelFilterer extends PropertyCategoryDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.label.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Category],\n };\n }\n}\n"]}
@@ -18,7 +18,7 @@ var FilteredType;
18
18
  FilteredType[FilteredType["Category"] = 0] = "Category";
19
19
  FilteredType[FilteredType["Label"] = 1] = "Label";
20
20
  FilteredType[FilteredType["Value"] = 2] = "Value";
21
- })(FilteredType = exports.FilteredType || (exports.FilteredType = {}));
21
+ })(FilteredType || (exports.FilteredType = FilteredType = {}));
22
22
  /**
23
23
  * An event broadcasted when property filter changes
24
24
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyDataFiltererBase.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAA8C;AAG9C;;;GAGG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,iDAAK,CAAA;IACL,iDAAK,CAAA;AACP,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAuCD;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,sBAAsC;CAAG;AAAxF,8DAAwF;AAoBxF;;;GAGG;AACH,MAAsB,wBAAwB;IAA9C;QAGS,oBAAe,GACpB,IAAI,yBAAyB,EAAE,CAAC;IAUpC,CAAC;CAAA;AAdD,4DAcC;AAED;;;;GAIG;AACH,MAAsB,gCAAiC,SAAQ,wBAAwB;IAC9E,KAAK,CAAC,mBAAmB;QAC9B,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAJD,4EAIC;AAED;;;;GAIG;AACH,MAAsB,8BAA+B,SAAQ,wBAAwB;IAC5E,KAAK,CAAC,qBAAqB;QAChC,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAJD,wEAIC","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 { BeEvent } from \"@itwin/core-bentley\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\n\n/**\n * Enumeration of possible component filtered types\n * @public\n */\nexport enum FilteredType {\n Category,\n Label,\n Value,\n}\n\n/**\n * Data structure for storing [[IPropertyDataFilterer]] matching results\n * @public\n */\nexport interface PropertyDataFilterResult {\n /** Indicates whether provided item matched filter */\n matchesFilter: boolean;\n\n /**\n * Indicates whether descendants nodes should be forcefully included in filtered results.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldForceIncludeDescendants?: boolean;\n\n /**\n * Indicates whether parents of node should be expanded up to this match node.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldExpandNodeParents?: boolean;\n\n /**\n * Indicates how many times filter was matched in the provided item.\n */\n matchesCount?: number;\n\n /**\n * Indicates what item types were matched.\n */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * A signature for property data change listeners\n * @public\n */\nexport declare type PropertyFilterChangesListener = () => void;\n\n/**\n * An event broadcasted when property filter changes\n * @public\n */\nexport class PropertyFilterChangeEvent extends BeEvent<PropertyFilterChangesListener> {}\n\n/**\n * An interface for a filterer that filters [[PropertyData]] based on content of [[PropertyRecord]]\n * and [[PropertyCategory]] objects.\n * @public\n */\nexport interface IPropertyDataFilterer {\n readonly isActive: boolean;\n recordMatchesFilter: (\n node: PropertyRecord,\n parents: PropertyRecord[]\n ) => Promise<PropertyDataFilterResult>;\n categoryMatchesFilter: (\n node: PropertyCategory,\n parents: PropertyCategory[]\n ) => Promise<PropertyDataFilterResult>;\n onFilterChanged: PropertyFilterChangeEvent;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] to share common behavior between different implementations.\n * @public\n */\nexport abstract class PropertyDataFiltererBase\n implements IPropertyDataFilterer\n{\n public onFilterChanged: PropertyFilterChangeEvent =\n new PropertyFilterChangeEvent();\n public abstract get isActive(): boolean;\n public abstract recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult>;\n public abstract categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult>;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyCategory]] content.\n * @public\n */\nexport abstract class PropertyCategoryDataFiltererBase extends PropertyDataFiltererBase {\n public async recordMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyRecord]] content.\n * @public\n */\nexport abstract class PropertyRecordDataFiltererBase extends PropertyDataFiltererBase {\n public async categoryMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyDataFiltererBase.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAA8C;AAG9C;;;GAGG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,iDAAK,CAAA;IACL,iDAAK,CAAA;AACP,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAuCD;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,sBAAsC;CAAG;AAAxF,8DAAwF;AAoBxF;;;GAGG;AACH,MAAsB,wBAAwB;IAA9C;QAGS,oBAAe,GACpB,IAAI,yBAAyB,EAAE,CAAC;IAUpC,CAAC;CAAA;AAdD,4DAcC;AAED;;;;GAIG;AACH,MAAsB,gCAAiC,SAAQ,wBAAwB;IAC9E,KAAK,CAAC,mBAAmB;QAC9B,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAJD,4EAIC;AAED;;;;GAIG;AACH,MAAsB,8BAA+B,SAAQ,wBAAwB;IAC5E,KAAK,CAAC,qBAAqB;QAChC,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAJD,wEAIC","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 { BeEvent } from \"@itwin/core-bentley\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\n\n/**\n * Enumeration of possible component filtered types\n * @public\n */\nexport enum FilteredType {\n Category,\n Label,\n Value,\n}\n\n/**\n * Data structure for storing [[IPropertyDataFilterer]] matching results\n * @public\n */\nexport interface PropertyDataFilterResult {\n /** Indicates whether provided item matched filter */\n matchesFilter: boolean;\n\n /**\n * Indicates whether descendants nodes should be forcefully included in filtered results.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldForceIncludeDescendants?: boolean;\n\n /**\n * Indicates whether parents of node should be expanded up to this match node.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldExpandNodeParents?: boolean;\n\n /**\n * Indicates how many times filter was matched in the provided item.\n */\n matchesCount?: number;\n\n /**\n * Indicates what item types were matched.\n */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * A signature for property data change listeners\n * @public\n */\nexport declare type PropertyFilterChangesListener = () => void;\n\n/**\n * An event broadcasted when property filter changes\n * @public\n */\nexport class PropertyFilterChangeEvent extends BeEvent<PropertyFilterChangesListener> {}\n\n/**\n * An interface for a filterer that filters [[PropertyData]] based on content of [[PropertyRecord]]\n * and [[PropertyCategory]] objects.\n * @public\n */\nexport interface IPropertyDataFilterer {\n readonly isActive: boolean;\n recordMatchesFilter: (\n node: PropertyRecord,\n parents: PropertyRecord[]\n ) => Promise<PropertyDataFilterResult>;\n categoryMatchesFilter: (\n node: PropertyCategory,\n parents: PropertyCategory[]\n ) => Promise<PropertyDataFilterResult>;\n onFilterChanged: PropertyFilterChangeEvent;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] to share common behavior between different implementations.\n * @public\n */\nexport abstract class PropertyDataFiltererBase\n implements IPropertyDataFilterer\n{\n public onFilterChanged: PropertyFilterChangeEvent =\n new PropertyFilterChangeEvent();\n public abstract get isActive(): boolean;\n public abstract recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult>;\n public abstract categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult>;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyCategory]] content.\n * @public\n */\nexport abstract class PropertyCategoryDataFiltererBase extends PropertyDataFiltererBase {\n public async recordMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyRecord]] content.\n * @public\n */\nexport abstract class PropertyRecordDataFiltererBase extends PropertyDataFiltererBase {\n public async categoryMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGridModel.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/PropertyGridModel.ts"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,iCAAkC;AA+BlC;;;GAGG;AACH,MAAa,wBAAwB;IAMnC,YACE,YAA0B,EAClB,gBAAyC;QAAzC,qBAAgB,GAAhB,gBAAgB,CAAyB;QAL5C,QAAW,GAAG,IAAI,CAAC;QAOxB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,CAC5C,CAAC,QAA0B,EAAE,EAAE,CAC7B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,YAAoB;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI;YACP,MAAM,IAAI,KAAK,CAAC,wCAAwC,YAAY,EAAE,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACK,QAAQ,CACd,KAA6B,EAC7B,YAAoB;QAEpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,2IAA2I;YAC3I,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;gBAAE,SAAS;YAE1D,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY;gBAAE,OAAO,IAAI,CAAC;YAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC;YAClE,IAAI,SAAS;gBAAE,OAAO,SAAS,CAAC;SACjC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,MAAM,QAAQ,GAA2B,EAAE,CAAC;QAC5C,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CACnD,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,MAAM,YAAY,GAA2B,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,YAAY,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,4BAA4B,EAAE,CAAC,CAC9D,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AApFD,4DAoFC;KAjFS,iBAAS","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 */\nimport { immerable } from \"immer\";\nimport type { PropertyCategory, PropertyData } from \"../PropertyDataProvider\";\nimport type { FlatGridItem, GridCategoryItem } from \"./flat-items/FlatGridItem\";\nimport type {\n IMutableFlatGridItem,\n IMutableGridCategoryItem,\n} from \"./flat-items/MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory\";\n\n/**\n * PropertyGridModel interface for working with immutable FlatGridItems\n * @public\n */\nexport interface IPropertyGridModel {\n getItem: (selectionKey: string) => FlatGridItem;\n getRootCategories: () => GridCategoryItem[];\n getFlatGrid: () => FlatGridItem[];\n getVisibleFlatGrid: () => FlatGridItem[];\n}\n\n/**\n * PropertyGridModel interface for working with mutable FlatGridItems\n * @public\n */\nexport interface IMutablePropertyGridModel {\n getItem: (selectionKey: string) => IMutableFlatGridItem;\n getRootCategories: () => IMutableGridCategoryItem[];\n getFlatGrid: () => IMutableFlatGridItem[];\n getVisibleFlatGrid: () => IMutableFlatGridItem[];\n}\n\n/**\n * Implementation of PropertyGridModel for working with and converting PropertyData to mutable FlatGridItems\n * @public\n */\nexport class MutablePropertyGridModel\n implements IPropertyGridModel, IMutablePropertyGridModel\n{\n public [immerable] = true;\n\n private _categories: IMutableGridCategoryItem[];\n public constructor(\n propertyData: PropertyData,\n private _gridItemFactory: IMutableGridItemFactory\n ) {\n this._categories = propertyData.categories.map(\n (category: PropertyCategory) =>\n this._gridItemFactory.createGridCategory(category, propertyData.records)\n );\n }\n\n /**\n * Retrieves grid item from model.\n * @param selectionKey unique key for identifying item to retrieve.\n */\n public getItem(selectionKey: string) {\n const item = this.findItem(this._categories, selectionKey);\n if (!item)\n throw new Error(`Grid item at provided key not found: ${selectionKey}`);\n\n return item;\n }\n\n /**\n * Walks the grid item hierarchy and finds item matching key\n * @param items items and their descendants to check\n * @param selectionKey unique key for identifying item\n * @returns FlatGridItem if items with key exists, undefined otherwise\n */\n private findItem(\n items: IMutableFlatGridItem[],\n selectionKey: string\n ): IMutableFlatGridItem | undefined {\n for (const item of items) {\n // Each items key is prefixed with it's parent key, so we can ignore the ones that aren't prefixed to reduce checking unnecessary branches.\n if (!selectionKey.startsWith(item.selectionKey)) continue;\n\n if (item.selectionKey === selectionKey) return item;\n\n const foundItem = this.findItem(item.getChildren(), selectionKey);\n if (foundItem) return foundItem;\n }\n\n return undefined;\n }\n\n /**\n * Gets all GridCategoryItems that do not have parent categories.\n * @returns array of GridCategoryItems\n */\n public getRootCategories(): IMutableGridCategoryItem[] {\n return this._categories;\n }\n\n /**\n * Gets an array of all FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getFlatGrid(): IMutableFlatGridItem[] {\n const flatGrid: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n flatGrid.push(...category.getDescendantsAndSelf())\n );\n\n return flatGrid;\n }\n\n /**\n * Gets an array of all currently visible FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getVisibleFlatGrid(): IMutableFlatGridItem[] {\n const visibleItems: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n visibleItems.push(...category.getVisibleDescendantsAndSelf())\n );\n\n return visibleItems;\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyGridModel.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/PropertyGridModel.ts"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,iCAAkC;AA+BlC;;;GAGG;AACH,MAAa,wBAAwB;IAMnC,YACE,YAA0B,EAClB,gBAAyC;QAAzC,qBAAgB,GAAhB,gBAAgB,CAAyB;QAL5C,QAAW,GAAG,IAAI,CAAC;QAOxB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,CAC5C,CAAC,QAA0B,EAAE,EAAE,CAC7B,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,YAAoB;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI;YACP,MAAM,IAAI,KAAK,CAAC,wCAAwC,YAAY,EAAE,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACK,QAAQ,CACd,KAA6B,EAC7B,YAAoB;QAEpB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,2IAA2I;YAC3I,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;gBAAE,SAAS;YAE1D,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY;gBAAE,OAAO,IAAI,CAAC;YAEpD,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC;YAClE,IAAI,SAAS;gBAAE,OAAO,SAAS,CAAC;QAClC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,MAAM,QAAQ,GAA2B,EAAE,CAAC;QAC5C,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CACnD,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,MAAM,YAAY,GAA2B,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,YAAY,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,4BAA4B,EAAE,CAAC,CAC9D,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AApFD,4DAoFC;KAjFS,iBAAS","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 */\nimport { immerable } from \"immer\";\nimport type { PropertyCategory, PropertyData } from \"../PropertyDataProvider\";\nimport type { FlatGridItem, GridCategoryItem } from \"./flat-items/FlatGridItem\";\nimport type {\n IMutableFlatGridItem,\n IMutableGridCategoryItem,\n} from \"./flat-items/MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory\";\n\n/**\n * PropertyGridModel interface for working with immutable FlatGridItems\n * @public\n */\nexport interface IPropertyGridModel {\n getItem: (selectionKey: string) => FlatGridItem;\n getRootCategories: () => GridCategoryItem[];\n getFlatGrid: () => FlatGridItem[];\n getVisibleFlatGrid: () => FlatGridItem[];\n}\n\n/**\n * PropertyGridModel interface for working with mutable FlatGridItems\n * @public\n */\nexport interface IMutablePropertyGridModel {\n getItem: (selectionKey: string) => IMutableFlatGridItem;\n getRootCategories: () => IMutableGridCategoryItem[];\n getFlatGrid: () => IMutableFlatGridItem[];\n getVisibleFlatGrid: () => IMutableFlatGridItem[];\n}\n\n/**\n * Implementation of PropertyGridModel for working with and converting PropertyData to mutable FlatGridItems\n * @public\n */\nexport class MutablePropertyGridModel\n implements IPropertyGridModel, IMutablePropertyGridModel\n{\n public [immerable] = true;\n\n private _categories: IMutableGridCategoryItem[];\n public constructor(\n propertyData: PropertyData,\n private _gridItemFactory: IMutableGridItemFactory\n ) {\n this._categories = propertyData.categories.map(\n (category: PropertyCategory) =>\n this._gridItemFactory.createGridCategory(category, propertyData.records)\n );\n }\n\n /**\n * Retrieves grid item from model.\n * @param selectionKey unique key for identifying item to retrieve.\n */\n public getItem(selectionKey: string) {\n const item = this.findItem(this._categories, selectionKey);\n if (!item)\n throw new Error(`Grid item at provided key not found: ${selectionKey}`);\n\n return item;\n }\n\n /**\n * Walks the grid item hierarchy and finds item matching key\n * @param items items and their descendants to check\n * @param selectionKey unique key for identifying item\n * @returns FlatGridItem if items with key exists, undefined otherwise\n */\n private findItem(\n items: IMutableFlatGridItem[],\n selectionKey: string\n ): IMutableFlatGridItem | undefined {\n for (const item of items) {\n // Each items key is prefixed with it's parent key, so we can ignore the ones that aren't prefixed to reduce checking unnecessary branches.\n if (!selectionKey.startsWith(item.selectionKey)) continue;\n\n if (item.selectionKey === selectionKey) return item;\n\n const foundItem = this.findItem(item.getChildren(), selectionKey);\n if (foundItem) return foundItem;\n }\n\n return undefined;\n }\n\n /**\n * Gets all GridCategoryItems that do not have parent categories.\n * @returns array of GridCategoryItems\n */\n public getRootCategories(): IMutableGridCategoryItem[] {\n return this._categories;\n }\n\n /**\n * Gets an array of all FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getFlatGrid(): IMutableFlatGridItem[] {\n const flatGrid: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n flatGrid.push(...category.getDescendantsAndSelf())\n );\n\n return flatGrid;\n }\n\n /**\n * Gets an array of all currently visible FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getVisibleFlatGrid(): IMutableFlatGridItem[] {\n const visibleItems: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n visibleItems.push(...category.getVisibleDescendantsAndSelf())\n );\n\n return visibleItems;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGridModelSource.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/PropertyGridModelSource.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAgC;AAQhC,2DAA+D;AAC/D,iFAA8E;AAU9E;;;;GAIG;AACH,MAAa,uBAAuB;IAKlC,YAA2B,YAAqC;QAArC,iBAAY,GAAZ,YAAY,CAAyB;QAHhE,kEAAkE;QAC3D,mBAAc,GAAG,IAAI,2DAA4B,EAAE,CAAC;IAEQ,CAAC;IAE5D,eAAe,CACrB,SAAiC;QAEjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAgC,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE;YAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAA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ACF;AA3DD,0DA2DC","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 { produce } from \"immer\";\nimport type { PropertyData } from \"../PropertyDataProvider\";\nimport type { IMutableFlatGridItem } from \"./flat-items/MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory\";\nimport type {\n IMutablePropertyGridModel,\n IPropertyGridModel,\n} from \"./PropertyGridModel\";\nimport { MutablePropertyGridModel } from \"./PropertyGridModel\";\nimport { PropertyGridModelChangeEvent } from \"./PropertyGridModelChangeEvent\";\n\n/** @public */\nexport interface IPropertyGridModelSource {\n onModelChanged: PropertyGridModelChangeEvent;\n setPropertyData: (data: PropertyData) => void;\n modifyModel(callback: (model: IMutablePropertyGridModel) => void): void;\n getModel(): IPropertyGridModel | undefined;\n}\n\n/**\n * Controls property grid model.\n * It is used to modify property grid model model and inform when the model changes.\n * @public\n */\nexport class PropertyGridModelSource implements IPropertyGridModelSource {\n private _model?: IMutablePropertyGridModel;\n /** Event that is emitted every time property model is changed. */\n public onModelChanged = new PropertyGridModelChangeEvent();\n\n public constructor(private _gridFactory: IMutableGridItemFactory) {}\n\n private getFullModelMap(\n fullModel: IMutableFlatGridItem[]\n ): Map<string, IMutableFlatGridItem> {\n const fullModelMap = new Map<string, IMutableFlatGridItem>();\n for (const item of fullModel) {\n const key = item.selectionKey;\n fullModelMap.set(key, item);\n }\n\n return fullModelMap;\n }\n\n private moveOldModelState(\n oldModel: IMutablePropertyGridModel,\n newModel: IMutablePropertyGridModel\n ) {\n const oldModelMap = this.getFullModelMap(oldModel.getFlatGrid());\n const flatGrid = newModel.getFlatGrid();\n\n flatGrid.forEach((gridItem) => {\n const oldGridItem = oldModelMap.get(gridItem.selectionKey);\n // istanbul ignore else\n if (oldGridItem) gridItem.isExpanded = oldGridItem.isExpanded;\n });\n }\n\n public setPropertyData(data: PropertyData) {\n const newModel = new MutablePropertyGridModel(data, this._gridFactory);\n if (this._model !== undefined && data.reusePropertyDataState)\n this.moveOldModelState(this._model, newModel);\n\n this._model = newModel;\n this.onModelChanged.raiseEvent();\n }\n\n /**\n * Modifies property grid model using provided callback.\n * If changes to model are detected, onModelChanged emits an event to all subscribers.\n */\n public modifyModel(\n callback: (model: IMutablePropertyGridModel) => void\n ): void {\n if (!this._model) return;\n\n this._model = produce(this._model, callback);\n this.onModelChanged.raiseEvent();\n }\n\n /** Returns property grid model. */\n public getModel(): IPropertyGridModel | undefined {\n return this._model;\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyGridModelSource.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/PropertyGridModelSource.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAgC;AAQhC,2DAA+D;AAC/D,iFAA8E;AAU9E;;;;GAIG;AACH,MAAa,uBAAuB;IAKlC,YAA2B,YAAqC;QAArC,iBAAY,GAAZ,YAAY,CAAyB;QAHhE,kEAAkE;QAC3D,mBAAc,GAAG,IAAI,2DAA4B,EAAE,CAAC;IAEQ,CAAC;IAE5D,eAAe,CACrB,SAAiC;QAEjC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAgC,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;YAC9B,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,iBAAiB,CACvB,QAAmC,EACnC,QAAmC;QAEnC,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAExC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC5B,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC3D,uBAAuB;YACvB,IAAI,WAAW;gBAAE,QAAQ,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,eAAe,CAAC,IAAkB;QACvC,MAAM,QAAQ,GAAG,IAAI,4CAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACvE,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,sBAAsB;YAC1D,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEhD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,WAAW,CAChB,QAAoD;QAEpD,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEzB,IAAI,CAAC,MAAM,GAAG,IAAA,eAAO,EAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED,mCAAmC;IAC5B,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AA3DD,0DA2DC","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 { produce } from \"immer\";\nimport type { PropertyData } from \"../PropertyDataProvider\";\nimport type { IMutableFlatGridItem } from \"./flat-items/MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory\";\nimport type {\n IMutablePropertyGridModel,\n IPropertyGridModel,\n} from \"./PropertyGridModel\";\nimport { MutablePropertyGridModel } from \"./PropertyGridModel\";\nimport { PropertyGridModelChangeEvent } from \"./PropertyGridModelChangeEvent\";\n\n/** @public */\nexport interface IPropertyGridModelSource {\n onModelChanged: PropertyGridModelChangeEvent;\n setPropertyData: (data: PropertyData) => void;\n modifyModel(callback: (model: IMutablePropertyGridModel) => void): void;\n getModel(): IPropertyGridModel | undefined;\n}\n\n/**\n * Controls property grid model.\n * It is used to modify property grid model model and inform when the model changes.\n * @public\n */\nexport class PropertyGridModelSource implements IPropertyGridModelSource {\n private _model?: IMutablePropertyGridModel;\n /** Event that is emitted every time property model is changed. */\n public onModelChanged = new PropertyGridModelChangeEvent();\n\n public constructor(private _gridFactory: IMutableGridItemFactory) {}\n\n private getFullModelMap(\n fullModel: IMutableFlatGridItem[]\n ): Map<string, IMutableFlatGridItem> {\n const fullModelMap = new Map<string, IMutableFlatGridItem>();\n for (const item of fullModel) {\n const key = item.selectionKey;\n fullModelMap.set(key, item);\n }\n\n return fullModelMap;\n }\n\n private moveOldModelState(\n oldModel: IMutablePropertyGridModel,\n newModel: IMutablePropertyGridModel\n ) {\n const oldModelMap = this.getFullModelMap(oldModel.getFlatGrid());\n const flatGrid = newModel.getFlatGrid();\n\n flatGrid.forEach((gridItem) => {\n const oldGridItem = oldModelMap.get(gridItem.selectionKey);\n // istanbul ignore else\n if (oldGridItem) gridItem.isExpanded = oldGridItem.isExpanded;\n });\n }\n\n public setPropertyData(data: PropertyData) {\n const newModel = new MutablePropertyGridModel(data, this._gridFactory);\n if (this._model !== undefined && data.reusePropertyDataState)\n this.moveOldModelState(this._model, newModel);\n\n this._model = newModel;\n this.onModelChanged.raiseEvent();\n }\n\n /**\n * Modifies property grid model using provided callback.\n * If changes to model are detected, onModelChanged emits an event to all subscribers.\n */\n public modifyModel(\n callback: (model: IMutablePropertyGridModel) => void\n ): void {\n if (!this._model) return;\n\n this._model = produce(this._model, callback);\n this.onModelChanged.raiseEvent();\n }\n\n /** Returns property grid model. */\n public getModel(): IPropertyGridModel | undefined {\n return this._model;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableCategorizedArrayProperty.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAUhG,+DAG+B;AAG/B;;;GAGG;AACH,MAAa,+BACX,SAAQ,gDAA0B;IAMlC,YACE,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,eAAwC,EACxC,YAAqB,EACrB,oBAA6B;QAE7B,KAAK,CACH,sCAAgB,CAAC,KAAK,EACtB,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAChE,MAAM,aAAa,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAChE,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;YAClD,MAAM,eAAe,GAAG,IAAI,KAAK,GAAG,CAAC,GAAG,CAAC;YACzC,OAAO,eAAe,CAAC,yBAAyB,CAC9C,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,0BAA0B,EAC1B,aAAa,EACb,OAAO,EACP,eAAe,CAChB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAW,IAAI;QACb,OAAO,sCAAgB,CAAC,KAAK,CAAC;IAChC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEe,qBAAqB;QACnC,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAC/B,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,CAAC;IAEe,qBAAqB;QACnC,MAAM,WAAW,GAA2B,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACzC,wFAAwF;YACxF,qCAAqC;YACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAC1D,CAAC;SACH;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACtC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACnC,CAAC;CACF;AAxED,0EAwEC","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 type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\n\n/**\n * Mutable wrapper object for PropertyRecord with array valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedArrayProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Array,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((child, index) => {\n const newName = `${child.property.name}_${index}`;\n const newDisplayLabel = `[${index + 1}]`;\n return gridItemFactory.createCategorizedProperty(\n child,\n this.selectionKey,\n parentCategorySelectionKey,\n childrenDepth,\n newName,\n newDisplayLabel\n );\n });\n }\n\n public get type(): FlatGridItemType.Array {\n return FlatGridItemType.Array;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
1
+ {"version":3,"file":"MutableCategorizedArrayProperty.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAUhG,+DAG+B;AAG/B;;;GAGG;AACH,MAAa,+BACX,SAAQ,gDAA0B;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YAAY,EAAE,CAAC;YAC1C,wFAAwF;YACxF,qCAAqC;YACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAC1D,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACtC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACnC,CAAC;CACF;AAxED,0EAwEC","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 type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\n\n/**\n * Mutable wrapper object for PropertyRecord with array valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedArrayProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Array,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((child, index) => {\n const newName = `${child.property.name}_${index}`;\n const newDisplayLabel = `[${index + 1}]`;\n return gridItemFactory.createCategorizedProperty(\n child,\n this.selectionKey,\n parentCategorySelectionKey,\n childrenDepth,\n newName,\n newDisplayLabel\n );\n });\n }\n\n public get type(): FlatGridItemType.Array {\n return FlatGridItemType.Array;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableCategorizedStructProperty.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAUhG,+DAG+B;AAG/B;;;GAGG;AACH,MAAa,gCACX,SAAQ,gDAA0B;IAMlC,YACE,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,eAAwC,EACxC,YAAqB,EACrB,oBAA6B;QAE7B,KAAK,CACH,sCAAgB,CAAC,MAAM,EACvB,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAChE,MAAM,aAAa,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,OAAO,eAAe,CAAC,yBAAyB,CAC9C,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,0BAA0B,EAC/B,aAAa,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAW,IAAI;QACb,OAAO,sCAAgB,CAAC,MAAM,CAAC;IACjC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEe,qBAAqB;QACnC,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAC/B,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,CAAC;IAEe,qBAAqB;QACnC,MAAM,WAAW,GAA2B,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACzC,wFAAwF;YACxF,qCAAqC;YACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAC1D,CAAC;SACH;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACtC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACnC,CAAC;CACF;AApED,4EAoEC","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 type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\n\n/**\n * Mutable wrapper object for PropertyRecord with struct valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedStructProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Struct,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((value) => {\n return gridItemFactory.createCategorizedProperty(\n value,\n this.selectionKey,\n this.parentCategorySelectionKey,\n childrenDepth\n );\n });\n }\n\n public get type(): FlatGridItemType.Struct {\n return FlatGridItemType.Struct;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
1
+ {"version":3,"file":"MutableCategorizedStructProperty.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAUhG,+DAG+B;AAG/B;;;GAGG;AACH,MAAa,gCACX,SAAQ,gDAA0B;IAMlC,YACE,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,eAAwC,EACxC,YAAqB,EACrB,oBAA6B;QAE7B,KAAK,CACH,sCAAgB,CAAC,MAAM,EACvB,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAChE,MAAM,aAAa,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACzD,OAAO,eAAe,CAAC,yBAAyB,CAC9C,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,0BAA0B,EAC/B,aAAa,CACd,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAW,IAAI;QACb,OAAO,sCAAgB,CAAC,MAAM,CAAC;IACjC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEe,qBAAqB;QACnC,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAC/B,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,CAAC;IAEe,qBAAqB;QACnC,MAAM,WAAW,GAA2B,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,wFAAwF;YACxF,qCAAqC;YACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAC1D,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACtC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACnC,CAAC;CACF;AApED,4EAoEC","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 type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory\";\n\n/**\n * Mutable wrapper object for PropertyRecord with struct valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedStructProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Struct,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((value) => {\n return gridItemFactory.createCategorizedProperty(\n value,\n this.selectionKey,\n this.parentCategorySelectionKey,\n childrenDepth\n );\n });\n }\n\n public get type(): FlatGridItemType.Struct {\n return FlatGridItemType.Struct;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
@@ -27,7 +27,7 @@ var FlatGridItemType;
27
27
  FlatGridItemType[FlatGridItemType["Primitive"] = 1] = "Primitive";
28
28
  FlatGridItemType[FlatGridItemType["Array"] = 2] = "Array";
29
29
  FlatGridItemType[FlatGridItemType["Struct"] = 3] = "Struct";
30
- })(FlatGridItemType = exports.FlatGridItemType || (exports.FlatGridItemType = {}));
30
+ })(FlatGridItemType || (exports.FlatGridItemType = FlatGridItemType = {}));
31
31
  /**
32
32
  * Base class for all FlatPropertyGrid items
33
33
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":";;;;;;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,iCAAk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,iBAAiB,CACvB,MAAsB,EACtB,4BAAiD;QAEjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAzHD,gEAyHC","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 */\nimport { immerable } from \"immer\";\nimport shortid from \"shortid\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\n\n/**\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\n * Category for PropertyCategory\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\n * @public\n */\nexport enum FlatGridItemType {\n Category,\n Primitive,\n Array,\n Struct,\n}\n\n/**\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\n * @public\n */\nexport type CategorizedPropertyTypes =\n | FlatGridItemType.Array\n | FlatGridItemType.Primitive\n | FlatGridItemType.Struct;\n\n/**\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\n * @public\n */\nexport interface IMutableFlatPropertyGridItem {\n readonly type: FlatGridItemType;\n readonly key: string;\n readonly selectionKey: string;\n readonly parentSelectionKey: string | undefined;\n readonly parentCategorySelectionKey: string | undefined;\n readonly depth: number;\n readonly label: string;\n lastInNumberOfCategories: number;\n isLastInRootCategory: boolean;\n isExpanded: boolean;\n getDescendantsAndSelf(): IMutableFlatGridItem[];\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\n getChildren(): IMutableFlatGridItem[];\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\n}\n\n/**\n * Base class for all FlatPropertyGrid items\n * @public\n */\nexport abstract class MutableFlatPropertyGridItem\n implements IMutableFlatPropertyGridItem\n{\n public [immerable] = true;\n\n public readonly key: string = shortid.generate();\n protected _isExpanded: boolean = false;\n protected _lastInNumberOfCategories: number = 0;\n protected _isLastInRootCategory: boolean = false;\n\n public constructor(\n private _depth: number,\n private _parentSelectionKey: string | undefined,\n private _parentCategorySelectionKey: string | undefined\n ) {\n if (this._depth < 0) throw new Error(\"Depth cannot be negative\");\n }\n\n public abstract type: FlatGridItemType;\n public abstract label: string;\n public abstract selectionKey: string;\n\n public get depth() {\n return this._depth;\n }\n\n public get parentSelectionKey() {\n return this._parentSelectionKey;\n }\n\n public get parentCategorySelectionKey() {\n return this._parentCategorySelectionKey;\n }\n\n public get isExpanded() {\n return this._isExpanded;\n }\n\n public set isExpanded(value: boolean) {\n this._isExpanded = value;\n }\n\n public abstract getChildren(): IMutableFlatGridItem[];\n public abstract getSelf(): IMutableFlatGridItem;\n\n protected getDescendants() {\n const descendants: IMutableFlatGridItem[] = [];\n this.getChildren().forEach((child) =>\n descendants.push(...child.getDescendantsAndSelf())\n );\n\n return descendants;\n }\n\n /**\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\n */\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getDescendants()];\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\n */\n public getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded)\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n return descendants;\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\n */\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getVisibleDescendants()];\n }\n\n /**\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\n */\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\n if (!this.isExpanded) return this.getSelf();\n\n const children = this.getChildren();\n if (children.length < 1) return this.getSelf();\n\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\n }\n\n /**\n * Sets lastInNumberOfCategories value and sends it down to this items last child\n * @internal\n */\n public get lastInNumberOfCategories(): number {\n if (this.isExpanded && this.getChildren().length > 0) return 0;\n\n return this._lastInNumberOfCategories;\n }\n\n public set lastInNumberOfCategories(value: number) {\n this._lastInNumberOfCategories = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].lastInNumberOfCategories = value;\n }\n\n /**\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\n * @internal\n */\n public get isLastInRootCategory(): boolean {\n if (this.isExpanded && this.getChildren().length > 0) return false;\n\n return this._isLastInRootCategory;\n }\n\n public set isLastInRootCategory(value: boolean) {\n this._isLastInRootCategory = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].isLastInRootCategory = value;\n }\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\n * @public\n */\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\n type: FlatGridItemType.Category;\n name: string;\n derivedCategory: PropertyCategory;\n isRootCategory: boolean;\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\n * @public\n */\nexport interface IMutableCategorizedPropertyItem\n extends IMutableFlatPropertyGridItem {\n readonly type: CategorizedPropertyTypes;\n readonly derivedRecord: PropertyRecord;\n readonly parentCategorySelectionKey: string;\n readonly parentSelectionKey: string;\n\n getChildren(): IMutableCategorizedPropertyItem[];\n}\n\n/**\n * Type which describes mutable GridCategoryItem or CategorizedProperty\n * @public\n */\nexport type IMutableFlatGridItem =\n | IMutableCategorizedPropertyItem\n | IMutableGridCategoryItem;\n\n/**\n * Base class for all Mutable CategorizedProperties\n * @public\n */\nexport abstract class MutableCategorizedProperty\n extends MutableFlatPropertyGridItem\n implements Partial<IMutableCategorizedPropertyItem>\n{\n private _derivedRecord: PropertyRecord;\n private _selectionKey: string;\n\n public constructor(\n type: CategorizedPropertyTypes,\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(depth, parentSelectionKey, parentCategorySelectionKey);\n\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\n if (recordType !== type) {\n const expectedTypeStr = FlatGridItemType[type];\n const actualTypeStr = FlatGridItemType[recordType];\n throw Error(\n `Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`\n );\n }\n\n const overridenProperty = this.makeOverridenProperty(\n record.property,\n overrideName,\n overrideDisplayLabel\n );\n this._derivedRecord = this.makeDerivedRecord(record, overridenProperty);\n\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\n this._isExpanded = !!record.autoExpand;\n }\n\n public abstract override type: CategorizedPropertyTypes;\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\n\n /**\n * Maps PropertyRecord valueFormat to FlatGridItemType\n * @param valueType valueFormat to map\n * @returns mapped FlatGridItemType\n */\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\n switch (valueType) {\n case PropertyValueFormat.Primitive:\n return FlatGridItemType.Primitive;\n case PropertyValueFormat.Array:\n return FlatGridItemType.Array;\n case PropertyValueFormat.Struct:\n return FlatGridItemType.Struct;\n /* istanbul ignore next */\n default:\n const unhandledType: never = valueType;\n throw Error(`Property Value Format not handled: ${unhandledType}`);\n }\n }\n\n /**\n * Make new property description with overriden fields.\n * @param propertyDescription property description to override.\n * @param overrideName property description name to override.\n * @param overrideDisplay property description display name to override.\n */\n private makeOverridenProperty(\n propertyDescription: PropertyDescription,\n overrideName?: string,\n overrideDisplay?: string\n ): PropertyDescription {\n const { name, displayLabel, ...property } = { ...propertyDescription };\n const newName = overrideName ?? name;\n const newDisplayLabel = overrideDisplay ?? displayLabel;\n\n return { ...property, name: newName, displayLabel: newDisplayLabel };\n }\n\n /**\n * Gets derived property record that has it's property description field overriden\n */\n private makeDerivedRecord(\n record: PropertyRecord,\n overridenPropertyDescription: PropertyDescription\n ) {\n const { value, property, ...others } = record;\n const newRecord = new PropertyRecord(value, overridenPropertyDescription);\n\n return Object.assign(newRecord, others);\n }\n\n public getSelf(): IMutableCategorizedPropertyItem {\n return this;\n }\n\n public override get parentCategorySelectionKey() {\n return super.parentCategorySelectionKey!;\n }\n\n public override get parentSelectionKey() {\n return super.parentSelectionKey!;\n }\n\n /**\n * Unique selection key made of parent selectionKey and this property name.\n */\n public get selectionKey() {\n return this._selectionKey;\n }\n\n public get label() {\n return this._derivedRecord.property.displayLabel;\n }\n\n /**\n * Record with overriden property description.\n */\n public get derivedRecord() {\n return this._derivedRecord;\n }\n}\n"]}
1
+ {"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":";;;;;;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,iCAAkC;AAClC,sDAA8B;AAE9B,0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,MAAsB,EACtB,4BAAiD;QAEjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAE1E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAzHD,gEAyHC","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 */\nimport { immerable } from \"immer\";\nimport shortid from \"shortid\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\n\n/**\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\n * Category for PropertyCategory\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\n * @public\n */\nexport enum FlatGridItemType {\n Category,\n Primitive,\n Array,\n Struct,\n}\n\n/**\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\n * @public\n */\nexport type CategorizedPropertyTypes =\n | FlatGridItemType.Array\n | FlatGridItemType.Primitive\n | FlatGridItemType.Struct;\n\n/**\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\n * @public\n */\nexport interface IMutableFlatPropertyGridItem {\n readonly type: FlatGridItemType;\n readonly key: string;\n readonly selectionKey: string;\n readonly parentSelectionKey: string | undefined;\n readonly parentCategorySelectionKey: string | undefined;\n readonly depth: number;\n readonly label: string;\n lastInNumberOfCategories: number;\n isLastInRootCategory: boolean;\n isExpanded: boolean;\n getDescendantsAndSelf(): IMutableFlatGridItem[];\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\n getChildren(): IMutableFlatGridItem[];\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\n}\n\n/**\n * Base class for all FlatPropertyGrid items\n * @public\n */\nexport abstract class MutableFlatPropertyGridItem\n implements IMutableFlatPropertyGridItem\n{\n public [immerable] = true;\n\n public readonly key: string = shortid.generate();\n protected _isExpanded: boolean = false;\n protected _lastInNumberOfCategories: number = 0;\n protected _isLastInRootCategory: boolean = false;\n\n public constructor(\n private _depth: number,\n private _parentSelectionKey: string | undefined,\n private _parentCategorySelectionKey: string | undefined\n ) {\n if (this._depth < 0) throw new Error(\"Depth cannot be negative\");\n }\n\n public abstract type: FlatGridItemType;\n public abstract label: string;\n public abstract selectionKey: string;\n\n public get depth() {\n return this._depth;\n }\n\n public get parentSelectionKey() {\n return this._parentSelectionKey;\n }\n\n public get parentCategorySelectionKey() {\n return this._parentCategorySelectionKey;\n }\n\n public get isExpanded() {\n return this._isExpanded;\n }\n\n public set isExpanded(value: boolean) {\n this._isExpanded = value;\n }\n\n public abstract getChildren(): IMutableFlatGridItem[];\n public abstract getSelf(): IMutableFlatGridItem;\n\n protected getDescendants() {\n const descendants: IMutableFlatGridItem[] = [];\n this.getChildren().forEach((child) =>\n descendants.push(...child.getDescendantsAndSelf())\n );\n\n return descendants;\n }\n\n /**\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\n */\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getDescendants()];\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\n */\n public getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded)\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n return descendants;\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\n */\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getVisibleDescendants()];\n }\n\n /**\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\n */\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\n if (!this.isExpanded) return this.getSelf();\n\n const children = this.getChildren();\n if (children.length < 1) return this.getSelf();\n\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\n }\n\n /**\n * Sets lastInNumberOfCategories value and sends it down to this items last child\n * @internal\n */\n public get lastInNumberOfCategories(): number {\n if (this.isExpanded && this.getChildren().length > 0) return 0;\n\n return this._lastInNumberOfCategories;\n }\n\n public set lastInNumberOfCategories(value: number) {\n this._lastInNumberOfCategories = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].lastInNumberOfCategories = value;\n }\n\n /**\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\n * @internal\n */\n public get isLastInRootCategory(): boolean {\n if (this.isExpanded && this.getChildren().length > 0) return false;\n\n return this._isLastInRootCategory;\n }\n\n public set isLastInRootCategory(value: boolean) {\n this._isLastInRootCategory = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].isLastInRootCategory = value;\n }\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\n * @public\n */\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\n type: FlatGridItemType.Category;\n name: string;\n derivedCategory: PropertyCategory;\n isRootCategory: boolean;\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\n * @public\n */\nexport interface IMutableCategorizedPropertyItem\n extends IMutableFlatPropertyGridItem {\n readonly type: CategorizedPropertyTypes;\n readonly derivedRecord: PropertyRecord;\n readonly parentCategorySelectionKey: string;\n readonly parentSelectionKey: string;\n\n getChildren(): IMutableCategorizedPropertyItem[];\n}\n\n/**\n * Type which describes mutable GridCategoryItem or CategorizedProperty\n * @public\n */\nexport type IMutableFlatGridItem =\n | IMutableCategorizedPropertyItem\n | IMutableGridCategoryItem;\n\n/**\n * Base class for all Mutable CategorizedProperties\n * @public\n */\nexport abstract class MutableCategorizedProperty\n extends MutableFlatPropertyGridItem\n implements Partial<IMutableCategorizedPropertyItem>\n{\n private _derivedRecord: PropertyRecord;\n private _selectionKey: string;\n\n public constructor(\n type: CategorizedPropertyTypes,\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(depth, parentSelectionKey, parentCategorySelectionKey);\n\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\n if (recordType !== type) {\n const expectedTypeStr = FlatGridItemType[type];\n const actualTypeStr = FlatGridItemType[recordType];\n throw Error(\n `Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`\n );\n }\n\n const overridenProperty = this.makeOverridenProperty(\n record.property,\n overrideName,\n overrideDisplayLabel\n );\n this._derivedRecord = this.makeDerivedRecord(record, overridenProperty);\n\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\n this._isExpanded = !!record.autoExpand;\n }\n\n public abstract override type: CategorizedPropertyTypes;\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\n\n /**\n * Maps PropertyRecord valueFormat to FlatGridItemType\n * @param valueType valueFormat to map\n * @returns mapped FlatGridItemType\n */\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\n switch (valueType) {\n case PropertyValueFormat.Primitive:\n return FlatGridItemType.Primitive;\n case PropertyValueFormat.Array:\n return FlatGridItemType.Array;\n case PropertyValueFormat.Struct:\n return FlatGridItemType.Struct;\n /* istanbul ignore next */\n default:\n const unhandledType: never = valueType;\n throw Error(`Property Value Format not handled: ${unhandledType}`);\n }\n }\n\n /**\n * Make new property description with overriden fields.\n * @param propertyDescription property description to override.\n * @param overrideName property description name to override.\n * @param overrideDisplay property description display name to override.\n */\n private makeOverridenProperty(\n propertyDescription: PropertyDescription,\n overrideName?: string,\n overrideDisplay?: string\n ): PropertyDescription {\n const { name, displayLabel, ...property } = { ...propertyDescription };\n const newName = overrideName ?? name;\n const newDisplayLabel = overrideDisplay ?? displayLabel;\n\n return { ...property, name: newName, displayLabel: newDisplayLabel };\n }\n\n /**\n * Gets derived property record that has it's property description field overriden\n */\n private makeDerivedRecord(\n record: PropertyRecord,\n overridenPropertyDescription: PropertyDescription\n ) {\n const { value, property, ...others } = record;\n const newRecord = new PropertyRecord(value, overridenPropertyDescription);\n\n return Object.assign(newRecord, others);\n }\n\n public getSelf(): IMutableCategorizedPropertyItem {\n return this;\n }\n\n public override get parentCategorySelectionKey() {\n return super.parentCategorySelectionKey!;\n }\n\n public override get parentSelectionKey() {\n return super.parentSelectionKey!;\n }\n\n /**\n * Unique selection key made of parent selectionKey and this property name.\n */\n public get selectionKey() {\n return this._selectionKey;\n }\n\n public get label() {\n return this._derivedRecord.property.displayLabel;\n }\n\n /**\n * Record with overriden property description.\n */\n public get derivedRecord() {\n return this._derivedRecord;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MutableGridItemFactory.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.ts"],"names":[],"mappings":";;;AAQA,0DAA4D;AAE5D,uFAAoF;AACpF,+FAA4F;AAC5F,yFAAsF;AACtF,2EAAw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B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;YACJ,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAI,CAAC,oBAAoB,CAC9B,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;YACJ,0BAA0B;YAC1B;gBACE,MAAM,mBAAmB,GAAU,WAAW,CAAC;gBAC/C,MAAM,IAAI,KAAK,CACb,yDAAyD,mBAAmB,EAAE,CAC/E,CAAC;SACL;IACH,CAAC;IAED;;;;;;;OAOG;IACI,kBAAkB,CACvB,QAA0B,EAC1B,WAAgC,EAChC,kBAA2B,EAC3B,KAAc;QAEd,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;YACjC,OAAO,IAAI,qDAAyB,CAClC,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,kBAAkB,EAClB,KAAK,IAAI,CAAC,CACX,CAAC;QAEJ,IAAI,kBAAkB,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;YACzD,OAAO,IAAI,yCAAmB,CAC5B,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,kBAAkB,EAClB,KAAK,CACN,CAAC;QAEJ,OAAO,IAAI,yCAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;CACF;AAnJD,wDAmJC","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 */\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { MutableCategorizedArrayProperty } from \"./MutableCategorizedArrayProperty\";\nimport { MutableCategorizedPrimitiveProperty } from \"./MutableCategorizedPrimitiveProperty\";\nimport { MutableCategorizedStructProperty } from \"./MutableCategorizedStructProperty\";\nimport { MutableCustomGridCategory } from \"./MutableCustomGridCategory\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableGridCategoryItem,\n} from \"./MutableFlatGridItem\";\nimport type { CategoryRecordsDict } from \"./MutableGridCategory\";\nimport { MutableGridCategory } from \"./MutableGridCategory\";\n\n/**\n * IMutableGridItemFactory interface for creating MutableGridItem objects\n * @public\n */\nexport interface IMutableGridItemFactory {\n createCategorizedProperty: (\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) => IMutableCategorizedPropertyItem;\n\n createGridCategory: (\n category: PropertyCategory,\n recordsDict: CategoryRecordsDict,\n parentSelectionKey?: string,\n depth?: number\n ) => IMutableGridCategoryItem;\n}\n\n/**\n * Implementation of IMutableGridItemFactory for creating MutableGridItem objects.\n * @public\n */\nexport class MutableGridItemFactory implements IMutableGridItemFactory {\n protected createPrimitiveProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedPrimitiveProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n protected createArrayProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedArrayProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n this,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n protected createStructProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedStructProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n this,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n /**\n * Converts record into FlatGridItem.\n * @param record record to convert to a FlatGridItem.\n * @param parentSelectionKey parent selection key of provided `record`.\n * @param parentCategorySelectionKey parent category selection key of provided `record`.\n * @param depth current depth counting from parent category.\n * @param overrideName property name that overrides original record property name.\n * @param overrideDisplayLabel property display label that overrides original record property display label.\n * @returns converted CategorizedProperty.\n */\n public createCategorizedProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ): IMutableCategorizedPropertyItem {\n const valueFormat = record.value.valueFormat;\n switch (valueFormat) {\n case PropertyValueFormat.Primitive:\n return this.createPrimitiveProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n case PropertyValueFormat.Array:\n return this.createArrayProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n case PropertyValueFormat.Struct:\n return this.createStructProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n /* istanbul ignore next */\n default:\n const unhandledRecordType: never = valueFormat;\n throw new Error(\n `Unhandled property record type. Was a new type added? ${unhandledRecordType}`\n );\n }\n }\n\n /**\n * Converts category into GridCategoryItem.\n * @param category PropertyCategory to convert.\n * @param recordsDict dictionary of category records.\n * @param parentSelectionKey parent selection key of this category.\n * @param depth current depth counting from root category.\n * @returns converted GridCategory.\n */\n public createGridCategory(\n category: PropertyCategory,\n recordsDict: CategoryRecordsDict,\n parentSelectionKey?: string,\n depth?: number\n ): IMutableGridCategoryItem {\n if (category.renderer !== undefined)\n return new MutableCustomGridCategory(\n category,\n recordsDict,\n this,\n parentSelectionKey,\n depth ?? 0\n );\n\n if (parentSelectionKey !== undefined && depth !== undefined)\n return new MutableGridCategory(\n category,\n recordsDict,\n this,\n parentSelectionKey,\n depth\n );\n\n return new MutableGridCategory(category, recordsDict, this);\n }\n}\n"]}
1
+ {"version":3,"file":"MutableGridItemFactory.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.ts"],"names":[],"mappings":";;;AAQA,0DAA4D;AAE5D,uFAAoF;AACpF,+FAA4F;AAC5F,yFAAsF;AACtF,2EAAwE;AAMxE,+DAA4D;AAwB5D;;;GAGG;AACH,MAAa,sBAAsB;IACvB,uBAAuB,CAC/B,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,YAAqB,EACrB,oBAA6B;QAE7B,OAAO,IAAI,yEAAmC,CAC5C,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAES,mBAAmB,CAC3B,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,YAAqB,EACrB,oBAA6B;QAE7B,OAAO,IAAI,iEAA+B,CACxC,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAES,oBAAoB,CAC5B,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,YAAqB,EACrB,oBAA6B;QAE7B,OAAO,IAAI,mEAAgC,CACzC,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACI,yBAAyB,CAC9B,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,YAAqB,EACrB,oBAA6B;QAE7B,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7C,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,oCAAmB,CAAC,SAAS;gBAChC,OAAO,IAAI,CAAC,uBAAuB,CACjC,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;YACJ,KAAK,oCAAmB,CAAC,KAAK;gBAC5B,OAAO,IAAI,CAAC,mBAAmB,CAC7B,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;YACJ,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAI,CAAC,oBAAoB,CAC9B,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;YACJ,0BAA0B;YAC1B;gBACE,MAAM,mBAAmB,GAAU,WAAW,CAAC;gBAC/C,MAAM,IAAI,KAAK,CACb,yDAAyD,mBAAmB,EAAE,CAC/E,CAAC;QACN,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACI,kBAAkB,CACvB,QAA0B,EAC1B,WAAgC,EAChC,kBAA2B,EAC3B,KAAc;QAEd,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS;YACjC,OAAO,IAAI,qDAAyB,CAClC,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,kBAAkB,EAClB,KAAK,IAAI,CAAC,CACX,CAAC;QAEJ,IAAI,kBAAkB,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS;YACzD,OAAO,IAAI,yCAAmB,CAC5B,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,kBAAkB,EAClB,KAAK,CACN,CAAC;QAEJ,OAAO,IAAI,yCAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;CACF;AAnJD,wDAmJC","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 */\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { MutableCategorizedArrayProperty } from \"./MutableCategorizedArrayProperty\";\nimport { MutableCategorizedPrimitiveProperty } from \"./MutableCategorizedPrimitiveProperty\";\nimport { MutableCategorizedStructProperty } from \"./MutableCategorizedStructProperty\";\nimport { MutableCustomGridCategory } from \"./MutableCustomGridCategory\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableGridCategoryItem,\n} from \"./MutableFlatGridItem\";\nimport type { CategoryRecordsDict } from \"./MutableGridCategory\";\nimport { MutableGridCategory } from \"./MutableGridCategory\";\n\n/**\n * IMutableGridItemFactory interface for creating MutableGridItem objects\n * @public\n */\nexport interface IMutableGridItemFactory {\n createCategorizedProperty: (\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) => IMutableCategorizedPropertyItem;\n\n createGridCategory: (\n category: PropertyCategory,\n recordsDict: CategoryRecordsDict,\n parentSelectionKey?: string,\n depth?: number\n ) => IMutableGridCategoryItem;\n}\n\n/**\n * Implementation of IMutableGridItemFactory for creating MutableGridItem objects.\n * @public\n */\nexport class MutableGridItemFactory implements IMutableGridItemFactory {\n protected createPrimitiveProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedPrimitiveProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n protected createArrayProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedArrayProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n this,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n protected createStructProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n return new MutableCategorizedStructProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n this,\n overrideName,\n overrideDisplayLabel\n );\n }\n\n /**\n * Converts record into FlatGridItem.\n * @param record record to convert to a FlatGridItem.\n * @param parentSelectionKey parent selection key of provided `record`.\n * @param parentCategorySelectionKey parent category selection key of provided `record`.\n * @param depth current depth counting from parent category.\n * @param overrideName property name that overrides original record property name.\n * @param overrideDisplayLabel property display label that overrides original record property display label.\n * @returns converted CategorizedProperty.\n */\n public createCategorizedProperty(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ): IMutableCategorizedPropertyItem {\n const valueFormat = record.value.valueFormat;\n switch (valueFormat) {\n case PropertyValueFormat.Primitive:\n return this.createPrimitiveProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n case PropertyValueFormat.Array:\n return this.createArrayProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n case PropertyValueFormat.Struct:\n return this.createStructProperty(\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n /* istanbul ignore next */\n default:\n const unhandledRecordType: never = valueFormat;\n throw new Error(\n `Unhandled property record type. Was a new type added? ${unhandledRecordType}`\n );\n }\n }\n\n /**\n * Converts category into GridCategoryItem.\n * @param category PropertyCategory to convert.\n * @param recordsDict dictionary of category records.\n * @param parentSelectionKey parent selection key of this category.\n * @param depth current depth counting from root category.\n * @returns converted GridCategory.\n */\n public createGridCategory(\n category: PropertyCategory,\n recordsDict: CategoryRecordsDict,\n parentSelectionKey?: string,\n depth?: number\n ): IMutableGridCategoryItem {\n if (category.renderer !== undefined)\n return new MutableCustomGridCategory(\n category,\n recordsDict,\n this,\n parentSelectionKey,\n depth ?? 0\n );\n\n if (parentSelectionKey !== undefined && depth !== undefined)\n return new MutableGridCategory(\n category,\n recordsDict,\n this,\n parentSelectionKey,\n depth\n );\n\n return new MutableGridCategory(category, recordsDict, this);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4D;AAC5D,kDAAgD;AAGhD,sEAAmE;AACnE,iGAA8F;AAG9F,mFAAwF;AAExF,yFAAsF;AACtF,6GAA0G;AAmC1G;;GAEG;AACI,MAAM,oBAAoB,GAAwC,CACvE,KAAK,EACL,EAAE;IACF,MAAM,EACJ,QAAQ,EACR,4BAA4B,EAC5B,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,SAAS,EACT,GAAG,gBAAgB,EACpB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CACjC,oBAAC,YAAY,IACX,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAC7B,QAAQ,EAAE,QAAQ,EAClB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,gBAAgB,CAAC,UAAU,EACvC,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,EACvD,eAAe,EAAE,eAAe,EAChC,SAA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,OAAO,IAAI,SAAS,EAAE;YAClD,eAAe,EAAE,CAAC,WAAW,KAAK,wBAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACnE;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../../editors/EditorContainer\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer\";\nimport { CustomizablePropertyRenderer } from \"../../../properties/renderers/CustomizablePropertyRenderer\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const {\n category,\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n onHeightChanged,\n highlight,\n ...passthroughProps\n } = props;\n\n const valueElementRenderer = () => (\n <DisplayValue\n propertyRecord={passthroughProps.propertyRecord}\n orientation={passthroughProps.orientation}\n columnRatio={passthroughProps.columnRatio}\n width={passthroughProps.width}\n category={category}\n propertyValueRendererManager={propertyValueRendererManager}\n isEditing={isEditing}\n onEditCommit={onEditCommit}\n onEditCancel={onEditCancel}\n isExpanded={passthroughProps.isExpanded}\n onExpansionToggled={passthroughProps.onExpansionToggled}\n onHeightChanged={onHeightChanged}\n highlight={highlight}\n indentation={props.indentation}\n />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n\n const rendererManager =\n propertyValueRendererManager ?? PropertyValueRendererManager.defaultManager;\n const hasCustomRenderer = rendererManager.hasCustomRenderer(\n passthroughProps.propertyRecord\n );\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty or has a custom renderer registered, render it as a customizable property\n if (props.propertyRecord.value.items.length === 0 || hasCustomRenderer)\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n // If a custom renderer is registered for the struct property, render it as a customizable property\n if (hasCustomRenderer) {\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n }\n\n return (\n <FlatNonPrimitivePropertyRenderer\n {...primitiveRendererProps}\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n valueElement={undefined}\n valueElementRenderer={undefined}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n\n category?: PropertyCategory;\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props) => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n if (props.isEditing) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n /* istanbul ignore else */\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? /* istanbul ignore next */ (() => {})}\n setFocus={true}\n />\n );\n }\n\n return (\n <>\n {CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n )}\n </>\n );\n};\n\nfunction useResetHeightOnEdit(\n orientation: Orientation,\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(orientation === Orientation.Vertical ? 48 : 28);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}
1
+ {"version":3,"file":"FlatPropertyRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4D;AAC5D,kDAAgD;AAGhD,sEAAmE;AACnE,iGAA8F;AAG9F,mFAAwF;AAExF,yFAAsF;AACtF,6GAA0G;AAmC1G;;GAEG;AACI,MAAM,oBAAoB,GAAwC,CACvE,KAAK,EACL,EAAE;IACF,MAAM,EACJ,QAAQ,EACR,4BAA4B,EAC5B,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,SAAS,EACT,GAAG,gBAAgB,EACpB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CACjC,oBAAC,YAAY,IACX,cAAc,EAAE,gBAAgB,CAAC,cAAc,EAC/C,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,KAAK,EAAE,gBAAgB,CAAC,KAAK,EAC7B,QAAQ,EAAE,QAAQ,EAClB,4BAA4B,EAAE,4BAA4B,EAC1D,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,gBAAgB,CAAC,UAAU,EACvC,kBAAkB,EAAE,gBAAgB,CAAC,kBAAkB,EACvD,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,GA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AAS,EAAE,CAAC;YACnD,eAAe,EAAE,CAAC,WAAW,KAAK,wBAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,wBAAwB,CAAC,OAAO,GAAG,SAAS,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../../editors/EditorContainer\";\nimport { CommonPropertyRenderer } from \"../../../properties/renderers/CommonPropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"../../../properties/renderers/PrimitivePropertyRenderer\";\nimport type { SharedRendererProps } from \"../../../properties/renderers/PropertyRenderer\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider\";\nimport { FlatNonPrimitivePropertyRenderer } from \"./FlatNonPrimitivePropertyRenderer\";\nimport { CustomizablePropertyRenderer } from \"../../../properties/renderers/CustomizablePropertyRenderer\";\n\n/** Properties of [[FlatPropertyRenderer]] React component\n * @internal\n */\nexport interface FlatPropertyRendererProps extends SharedRendererProps {\n category?: PropertyCategory;\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Whether property value is displayed in expanded state. */\n isExpanded: boolean;\n /** Called when toggling between expanded and collapsed property value display state. */\n onExpansionToggled: () => void;\n /** Reports property height changes. */\n onHeightChanged?: (newHeight: number) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n\n children?: never;\n}\n\n/** A React component that renders flat properties\n * @internal\n */\nexport const FlatPropertyRenderer: React.FC<FlatPropertyRendererProps> = (\n props\n) => {\n const {\n category,\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n onHeightChanged,\n highlight,\n ...passthroughProps\n } = props;\n\n const valueElementRenderer = () => (\n <DisplayValue\n propertyRecord={passthroughProps.propertyRecord}\n orientation={passthroughProps.orientation}\n columnRatio={passthroughProps.columnRatio}\n width={passthroughProps.width}\n category={category}\n propertyValueRendererManager={propertyValueRendererManager}\n isEditing={isEditing}\n onEditCommit={onEditCommit}\n onEditCancel={onEditCancel}\n isExpanded={passthroughProps.isExpanded}\n onExpansionToggled={passthroughProps.onExpansionToggled}\n onHeightChanged={onHeightChanged}\n highlight={highlight}\n indentation={props.indentation}\n />\n );\n\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...passthroughProps,\n valueElementRenderer,\n indentation: props.indentation,\n };\n\n const rendererManager =\n propertyValueRendererManager ?? PropertyValueRendererManager.defaultManager;\n const hasCustomRenderer = rendererManager.hasCustomRenderer(\n passthroughProps.propertyRecord\n );\n\n switch (props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n case PropertyValueFormat.Array:\n // If array is empty or has a custom renderer registered, render it as a customizable property\n if (props.propertyRecord.value.items.length === 0 || hasCustomRenderer)\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n // If a custom renderer is registered for the struct property, render it as a customizable property\n if (hasCustomRenderer) {\n return (\n <CustomizablePropertyRenderer\n highlight={highlight?.applyOnLabel ? highlight : undefined}\n {...primitiveRendererProps}\n />\n );\n }\n\n return (\n <FlatNonPrimitivePropertyRenderer\n {...primitiveRendererProps}\n isExpanded={props.isExpanded}\n onExpandToggled={props.onExpansionToggled}\n valueElement={undefined}\n valueElementRenderer={undefined}\n />\n );\n }\n};\n\ninterface DisplayValueProps {\n isEditing?: boolean;\n propertyRecord: PropertyRecord;\n\n orientation: Orientation;\n columnRatio?: number;\n /** Pass width to rerender component as property grid width changes */\n width?: number;\n indentation?: number;\n propertyValueRendererManager?: PropertyValueRendererManager;\n isExpanded?: boolean;\n onExpansionToggled?: () => void;\n onHeightChanged?: (newHeight: number) => void;\n\n category?: PropertyCategory;\n onEditCancel?: () => void;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n };\n}\n\nconst DisplayValue: React.FC<DisplayValueProps> = (props) => {\n useResetHeightOnEdit(\n props.orientation,\n props.isEditing,\n props.onHeightChanged\n );\n\n if (props.isEditing) {\n const _onEditCommit = (args: PropertyUpdatedArgs) => {\n /* istanbul ignore else */\n if (props.category) props.onEditCommit?.(args, props.category);\n };\n\n return (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={_onEditCommit}\n onCancel={props.onEditCancel ?? /* istanbul ignore next */ (() => {})}\n setFocus={true}\n />\n );\n }\n\n return (\n <>\n {CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n props.isExpanded,\n props.onExpansionToggled,\n props.onHeightChanged,\n props.highlight\n )}\n </>\n );\n};\n\nfunction useResetHeightOnEdit(\n orientation: Orientation,\n isEditing?: boolean,\n onHeightChanged?: (newHeight: number) => void\n) {\n const previousEditingStatusRef = React.useRef(isEditing);\n React.useEffect(() => {\n if (!previousEditingStatusRef.current && isEditing) {\n onHeightChanged?.(orientation === Orientation.Vertical ? 48 : 28);\n }\n\n previousEditingStatusRef.current = isEditing;\n });\n}\n"]}