@itwin/components-react 4.2.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +5 -4
  2. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  3. package/lib/cjs/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  4. package/lib/cjs/components-react/common/UseElementsScrollStorage.js +49 -0
  5. package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -0
  6. package/lib/cjs/components-react/datepicker/DatePicker.scss +3 -3
  7. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  8. package/lib/cjs/components-react/datepicker/TimeField.scss +3 -3
  9. package/lib/cjs/components-react/editors/BooleanEditor.scss +3 -3
  10. package/lib/cjs/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  11. package/lib/cjs/components-react/editors/IconEditor.scss +3 -3
  12. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  13. package/lib/cjs/components-react/editors/PopupButton.scss +3 -3
  14. package/lib/cjs/components-react/editors/ToggleEditor.scss +3 -3
  15. package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  16. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  17. package/lib/cjs/components-react/filtering/ResultSelector.scss +3 -3
  18. package/lib/cjs/components-react/iconpicker/IconPickerButton.scss +3 -3
  19. package/lib/cjs/components-react/properties/renderers/ActionButtonList.scss +3 -3
  20. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  21. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +3 -3
  22. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  23. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  24. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  25. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +11 -1
  26. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  27. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  28. package/lib/cjs/components-react/selectable-content/SelectableContent.scss +3 -3
  29. package/lib/cjs/components-react/toolbar/ItemWrapper.scss +3 -3
  30. package/lib/cjs/components-react/toolbar/Items.scss +3 -3
  31. package/lib/cjs/components-react/toolbar/Overflow.scss +3 -3
  32. package/lib/cjs/components-react/toolbar/OverflowPanel.scss +3 -3
  33. package/lib/cjs/components-react/toolbar/PopupItem.scss +3 -3
  34. package/lib/cjs/components-react/toolbar/_variables.scss +3 -3
  35. package/lib/cjs/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  36. package/lib/cjs/components-react/toolbar/groupPanel/Column.scss +3 -3
  37. package/lib/cjs/components-react/toolbar/groupPanel/Columns.scss +3 -3
  38. package/lib/cjs/components-react/toolbar/groupPanel/Panel.scss +3 -3
  39. package/lib/cjs/components-react/toolbar/groupPanel/Title.scss +3 -3
  40. package/lib/cjs/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  41. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  42. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  43. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +11 -1
  44. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  45. package/lib/cjs/components-react/tree/controlled/component/NodeContent.scss +3 -3
  46. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts +13 -0
  47. package/lib/esm/components-react/common/UseElementsScrollStorage.d.ts.map +1 -0
  48. package/lib/esm/components-react/common/UseElementsScrollStorage.js +45 -0
  49. package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -0
  50. package/lib/esm/components-react/datepicker/DatePicker.scss +3 -3
  51. package/lib/esm/components-react/datepicker/DatePickerPopupButton.scss +3 -3
  52. package/lib/esm/components-react/datepicker/TimeField.scss +3 -3
  53. package/lib/esm/components-react/editors/BooleanEditor.scss +3 -3
  54. package/lib/esm/components-react/editors/EnumButtonGroupEditor.scss +3 -3
  55. package/lib/esm/components-react/editors/IconEditor.scss +3 -3
  56. package/lib/esm/components-react/editors/ImageCheckBoxEditor.scss +3 -3
  57. package/lib/esm/components-react/editors/PopupButton.scss +3 -3
  58. package/lib/esm/components-react/editors/ToggleEditor.scss +3 -3
  59. package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +3 -3
  60. package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +3 -3
  61. package/lib/esm/components-react/filtering/ResultSelector.scss +3 -3
  62. package/lib/esm/components-react/iconpicker/IconPickerButton.scss +3 -3
  63. package/lib/esm/components-react/properties/renderers/ActionButtonList.scss +3 -3
  64. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.scss +3 -3
  65. package/lib/esm/components-react/properties/renderers/PropertyView.scss +3 -3
  66. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.scss +3 -3
  67. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +10 -0
  68. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  69. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +9 -0
  70. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  71. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +3 -3
  72. package/lib/esm/components-react/selectable-content/SelectableContent.scss +3 -3
  73. package/lib/esm/components-react/toolbar/ItemWrapper.scss +3 -3
  74. package/lib/esm/components-react/toolbar/Items.scss +3 -3
  75. package/lib/esm/components-react/toolbar/Overflow.scss +3 -3
  76. package/lib/esm/components-react/toolbar/OverflowPanel.scss +3 -3
  77. package/lib/esm/components-react/toolbar/PopupItem.scss +3 -3
  78. package/lib/esm/components-react/toolbar/_variables.scss +3 -3
  79. package/lib/esm/components-react/toolbar/groupPanel/BackArrow.scss +3 -3
  80. package/lib/esm/components-react/toolbar/groupPanel/Column.scss +3 -3
  81. package/lib/esm/components-react/toolbar/groupPanel/Columns.scss +3 -3
  82. package/lib/esm/components-react/toolbar/groupPanel/Panel.scss +3 -3
  83. package/lib/esm/components-react/toolbar/groupPanel/Title.scss +3 -3
  84. package/lib/esm/components-react/toolbar/groupPanel/tool/Tool.scss +3 -3
  85. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +10 -0
  86. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  87. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +9 -0
  88. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  89. package/lib/esm/components-react/tree/controlled/component/NodeContent.scss +3 -3
  90. package/package.json +5 -5
@@ -24,6 +24,7 @@ import { FlatItemNestedBorderWrapper } from "./FlatItemNestedBorderWrapper";
24
24
  import { PropertyCategoryBlock } from "./PropertyCategoryBlock";
25
25
  import { PropertyGridCommons } from "./PropertyGridCommons";
26
26
  import { PropertyGridEventsRelatedPropsSupplier } from "./PropertyGridEventsRelatedPropsSupplier";
27
+ import { useElementsScrollStorage } from "../../common/UseElementsScrollStorage";
27
28
  const [PropertyGridInternalContextProvider, _PropertyGridInternalContextConsumer, usePropertyGridInternalContext,] = createContextWithMandatoryProvider("PropertyGridInternalContext");
28
29
  const ACTION_BUTTON_DEFAULT_WIDTH = 90;
29
30
  /**
@@ -226,6 +227,14 @@ export class VirtualizedPropertyGrid extends React.Component {
226
227
  }));
227
228
  }
228
229
  }
230
+ /**
231
+ * Returns callbacks for persisting and restoring [[VirtualizedPropertyGrid]] layout state.
232
+ * Returned `ref` should be set on container containing [[VirtualizedPropertyGrid]].
233
+ * @public
234
+ */
235
+ export function useVirtualizedPropertyGridLayoutStorage() {
236
+ return useElementsScrollStorage("ReactWindow__VariableSizeList");
237
+ }
229
238
  const FlatGridItemNode = React.memo(({ index, style: virtualizedListStyle }) => {
230
239
  const { gridItems, gridEventHandler, gridModel, gridContext, className, style, onItemHeightChanged, } = usePropertyGridInternalContext(FlatGridItemNode);
231
240
  const node = gridItems[index];
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAKnF,OAAO,EAAE,mCAAmC,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAIxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAKrF,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,u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G,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ListChildComponentProps } from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { RatioChangeResult } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(\n prevProps: VirtualizedPropertyGridProps,\n prevState: VirtualizedPropertyGridState\n ) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return (\n getPropertyHeight(this.state) +\n node.lastInNumberOfCategories * bottomBorderPadding\n );\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return (\n categoryHeaderHeight +\n categoryHeaderPadding +\n (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0)\n );\n }\n\n return (\n dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0)\n );\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (\n state.orientation === Orientation.Vertical &&\n node.type === FlatGridItemType.Primitive\n ) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n /** @internal */\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n this.props.className\n )}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyClicked\n : undefined\n }\n onRightClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyRightClicked\n : undefined\n }\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
1
+ {"version":3,"file":"VirtualizedPropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,gCAAgC,CAAC;AACxC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAKlG,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AAKnF,OAAO,EAAE,mCAAmC,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAIxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAKrF,OAAO,EAAE,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBA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AG,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC;QACpE,eAAe,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,6BAAK,GAAG,EAAE,MAAM,IAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAO,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./VirtualizedPropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { ListChildComponentProps } from \"react-window\";\nimport { areEqual, VariableSizeList } from \"react-window\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { RatioChangeResult } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { createContextWithMandatoryProvider } from \"../../common/UseContextWithMandatoryProvider\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport type { ActionButtonRenderer } from \"../../properties/renderers/ActionButtonRenderer\";\nimport type { PropertyGridColumnInfo } from \"../../properties/renderers/PropertyGridColumns\";\nimport type { PropertyValueRendererManager } from \"../../properties/ValueRendererManager\";\nimport { FilteredType } from \"../dataproviders/filterers/PropertyDataFiltererBase\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"../internal/flat-items/FlatGridItem\";\nimport { MutableCategorizedPrimitiveProperty } from \"../internal/flat-items/MutableCategorizedPrimitiveProperty\";\nimport { MutableCustomGridCategory } from \"../internal/flat-items/MutableCustomGridCategory\";\nimport { FlatGridItemType } from \"../internal/flat-items/MutableFlatGridItem\";\nimport { MutableGridCategory } from \"../internal/flat-items/MutableGridCategory\";\nimport { FlatPropertyRenderer } from \"../internal/flat-properties/FlatPropertyRenderer\";\nimport type { IPropertyGridEventHandler } from \"../internal/PropertyGridEventHandler\";\nimport type { IPropertyGridModel } from \"../internal/PropertyGridModel\";\nimport type { PropertyCategoryRendererProps } from \"../PropertyCategoryRendererManager\";\nimport { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type {\n IPropertyDataProvider,\n PropertyCategory,\n} from \"../PropertyDataProvider\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { FlatItemNestedBorderWrapper } from \"./FlatItemNestedBorderWrapper\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\nimport { useElementsScrollStorage } from \"../../common/UseElementsScrollStorage\";\n\n/** Properties for [[VirtualizedPropertyGrid]] React component\n * @public\n */\nexport interface VirtualizedPropertyGridProps extends CommonPropertyGridProps {\n /** Property grid view model that defines what needs to be rendered */\n model: IPropertyGridModel;\n /** Handler of the events raised from the property grid */\n eventHandler: IPropertyGridEventHandler;\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/** State of [[VirtualizedPropertyGrid]] React component\n * @internal\n */\ninterface VirtualizedPropertyGridState {\n /** List of PropertyGrid categories */\n gridItems: FlatGridItem[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** Keeps record of dynamic node heights */\n dynamicNodeHeights: Map<string, number>;\n /** When resetting node height cache, marks the point at which heights have become stale */\n resetIndex: number;\n}\n\n/**\n * Context of [[VirtualizedPropertyGrid]] component.\n * @internal\n */\nexport interface PropertyGridInternalContext {\n gridItems: FlatGridItem[];\n gridEventHandler: IPropertyGridEventHandler;\n gridModel: IPropertyGridModel;\n\n style?: React.CSSProperties;\n className?: string;\n gridContext: VirtualizedPropertyGridContext;\n onItemHeightChanged: (index: number, key: string, height: number) => void;\n}\n\n/**\n * Context of the surrounding [VirtualizedPropertyGrid]($components-react) component.\n * @public\n */\nexport interface VirtualizedPropertyGridContext {\n orientation: Orientation;\n gridWidth: number;\n\n isPropertyHoverEnabled: boolean;\n isPropertySelectionEnabled: boolean;\n selectedPropertyKey?: string;\n\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (\n property: PropertyRecord,\n e: React.MouseEvent\n ) => void;\n\n editingPropertyKey?: string;\n onEditCommit?: (\n args: PropertyUpdatedArgs,\n category: PropertyCategory\n ) => void;\n onEditCancel?: () => void;\n\n eventHandler: IPropertyGridEventHandler;\n dataProvider: IPropertyDataProvider;\n\n actionButtonRenderers?: ActionButtonRenderer[];\n propertyValueRendererManager?: PropertyValueRendererManager;\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n\n columnRatio: number;\n columnInfo: PropertyGridColumnInfo;\n isResizeHandleBeingDragged: boolean;\n isResizeHandleHovered: boolean;\n onColumnRatioChanged: (ratio: number) => void | RatioChangeResult;\n onResizeHandleDragChanged: (newValue: boolean) => void;\n onResizeHandleHoverChanged: (newValue: boolean) => void;\n\n highlight?: PropertyGridContentHighlightProps;\n}\n\nconst [\n PropertyGridInternalContextProvider,\n _PropertyGridInternalContextConsumer,\n usePropertyGridInternalContext,\n] = createContextWithMandatoryProvider<PropertyGridInternalContext>(\n \"PropertyGridInternalContext\"\n);\n\nconst ACTION_BUTTON_DEFAULT_WIDTH = 90;\n\n/**\n * VirtualizedPropertyGrid React component.\n * @public\n */\nexport class VirtualizedPropertyGrid extends React.Component<\n VirtualizedPropertyGridProps,\n VirtualizedPropertyGridState\n> {\n private _listRef = React.createRef<VariableSizeList>();\n\n /** @internal */\n constructor(props: VirtualizedPropertyGridProps) {\n super(props);\n this.state = {\n gridItems: [],\n orientation: props.orientation ?? Orientation.Horizontal,\n dynamicNodeHeights: new Map(),\n resetIndex: 0,\n };\n }\n\n /** @internal */\n public override componentDidUpdate(\n prevProps: VirtualizedPropertyGridProps,\n prevState: VirtualizedPropertyGridState\n ) {\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth ||\n this.props.width !== prevProps.width\n )\n this.updateOrientation(this.props.width);\n\n if (this.props.model !== prevProps.model) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n\n if (\n this.props.highlight !== prevProps.highlight &&\n this.props.highlight?.activeHighlight &&\n this.state.gridItems.length !== 0\n ) {\n let index = 0;\n let foundMatchingItem = false;\n for (const item of this.state.gridItems) {\n if (\n (item instanceof MutableCategorizedPrimitiveProperty &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.derivedRecord.property.name) ||\n (item instanceof MutableGridCategory &&\n this.props.highlight.activeHighlight.highlightedItemIdentifier ===\n item.name)\n ) {\n foundMatchingItem = true;\n break;\n }\n index++;\n }\n if (foundMatchingItem) {\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.scrollToItem(index);\n }\n }\n\n if (this.state.dynamicNodeHeights !== prevState.dynamicNodeHeights) {\n // istanbul ignore else\n if (this._listRef.current)\n this._listRef.current.resetAfterIndex(this.state.resetIndex);\n }\n }\n\n /** @internal */\n public static getDerivedStateFromProps(\n props: VirtualizedPropertyGridProps,\n state: VirtualizedPropertyGridState\n ): VirtualizedPropertyGridState | null {\n return {\n ...state,\n gridItems: props.model.getVisibleFlatGrid(),\n };\n }\n\n private updateOrientation(width: number) {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (currentOrientation !== this.state.orientation) {\n this.setState({ orientation: currentOrientation });\n // istanbul ignore else\n if (this._listRef.current) this._listRef.current.resetAfterIndex(0);\n }\n }\n\n /**\n * Calculate given node height depending on it's type, position in category, parent category depth and current orientation.\n * @param node FlatGridItem node for which to calculate height\n * @returns current height of node.\n */\n private calculateNodeHeight(node: FlatGridItem) {\n const categoryHeaderHeight = 38;\n const categoryHeaderPadding = 4;\n const categoryPropertyHeight = 27;\n const bottomBorderPadding = 5;\n const verticalPrimitivePropertyHeight = 55;\n\n return (\n getPropertyHeight(this.state) +\n node.lastInNumberOfCategories * bottomBorderPadding\n );\n\n function getPropertyHeight(state: VirtualizedPropertyGridState) {\n const dynamicHeight = state.dynamicNodeHeights.get(node.key);\n if (dynamicHeight !== undefined) {\n if (node instanceof MutableCustomGridCategory) {\n return (\n categoryHeaderHeight +\n categoryHeaderPadding +\n (node.isExpanded ? dynamicHeight + bottomBorderPadding : 0)\n );\n }\n\n return (\n dynamicHeight + (state.orientation === Orientation.Vertical ? 28 : 0)\n );\n }\n\n if (node.type === FlatGridItemType.Category) {\n return categoryHeaderHeight + categoryHeaderPadding;\n }\n\n if (\n state.orientation === Orientation.Vertical &&\n node.type === FlatGridItemType.Primitive\n ) {\n return verticalPrimitivePropertyHeight;\n }\n\n return categoryPropertyHeight;\n }\n }\n\n private _handleNodeHeightChange = (\n index: number,\n key: string,\n newHeight: number\n ) => {\n if (this.state.dynamicNodeHeights.get(key) === newHeight) {\n return;\n }\n\n this.setState((state) => {\n return {\n ...state,\n dynamicNodeHeights: new Map(state.dynamicNodeHeights).set(\n key,\n newHeight\n ),\n resetIndex: index,\n };\n });\n };\n\n private _calculateNodeHeightByIndex = (index: number) => {\n const node = this.state.gridItems[index];\n return this.calculateNodeHeight(node);\n };\n\n private calculateEstimatedHeight() {\n let sum = 0;\n for (const node of this.state.gridItems)\n sum += this.calculateNodeHeight(node);\n\n return Math.ceil(sum / this.state.gridItems.length);\n }\n\n private _getNodeKey = (index: number) => {\n const node = this.state.gridItems[index];\n return node.key;\n };\n\n private _getMaxItemDepth = () => {\n let depth = 0;\n for (const item of this.state.gridItems) {\n if (depth < item.depth) {\n depth = item.depth;\n }\n }\n return depth + 1;\n };\n\n /** @internal */\n public override render() {\n const defaultActionButtonWidth =\n (this.props.actionButtonRenderers?.length ?? 0) > 0\n ? ACTION_BUTTON_DEFAULT_WIDTH\n : undefined;\n\n return (\n <ColumnResizingPropertyListPropsSupplier\n orientation={this.state.orientation}\n width={this.props.width}\n minLabelWidth={this.props.minLabelWidth}\n minValueWidth={this.props.minValueWidth}\n actionButtonWidth={\n this.props.actionButtonWidth !== undefined\n ? this.props.actionButtonWidth\n : defaultActionButtonWidth\n }\n maxPropertyDepth={this._getMaxItemDepth()}\n >\n {(columnResizeContext) => (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n >\n {(selectionContext) => {\n const gridContext: VirtualizedPropertyGridContext = {\n orientation: columnResizeContext.orientation,\n gridWidth: this.props.width,\n\n isPropertyHoverEnabled: selectionContext.isPropertyHoverEnabled,\n isPropertySelectionEnabled:\n selectionContext.isPropertySelectionEnabled,\n selectedPropertyKey: selectionContext.selectedPropertyKey,\n\n onPropertyClicked: selectionContext.onPropertyClicked,\n onPropertyRightClicked: selectionContext.onPropertyRightClicked,\n onPropertyContextMenu: selectionContext.onPropertyContextMenu,\n\n editingPropertyKey: selectionContext.editingPropertyKey,\n onEditCommit: selectionContext.onEditCommit,\n onEditCancel: selectionContext.onEditCancel,\n\n eventHandler: this.props.eventHandler,\n dataProvider: this.props.dataProvider,\n\n actionButtonRenderers: this.props.actionButtonRenderers,\n propertyValueRendererManager:\n this.props.propertyValueRendererManager,\n propertyCategoryRendererManager:\n this.props.propertyCategoryRendererManager,\n\n columnRatio: columnResizeContext.columnRatio,\n columnInfo: columnResizeContext.columnInfo,\n isResizeHandleBeingDragged:\n columnResizeContext.isResizeHandleBeingDragged,\n isResizeHandleHovered:\n columnResizeContext.isResizeHandleHovered,\n onColumnRatioChanged: columnResizeContext.onColumnChanged,\n onResizeHandleDragChanged:\n columnResizeContext.onResizeHandleDragChanged,\n onResizeHandleHoverChanged:\n columnResizeContext.onResizeHandleHoverChanged,\n\n highlight: this.props.highlight,\n };\n\n const renderContext: PropertyGridInternalContext = {\n gridItems: this.state.gridItems,\n gridEventHandler: this.props.eventHandler,\n gridModel: this.props.model,\n style: this.props.style,\n className: this.props.className,\n onItemHeightChanged: this._handleNodeHeightChange,\n gridContext,\n };\n\n return (\n <PropertyGridInternalContextProvider value={renderContext}>\n <div\n className={classnames(\n \"components-virtualized-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <VariableSizeList\n className={classnames(\n \"components-property-grid-wrapper\",\n \"ReactWindow__VariableSizeList\",\n this.props.className\n )}\n width={this.props.width}\n height={this.props.height}\n itemCount={this.state.gridItems.length}\n itemSize={this._calculateNodeHeightByIndex}\n estimatedItemSize={this.calculateEstimatedHeight()}\n overscanCount={10}\n layout=\"vertical\"\n style={this.props.style}\n itemKey={this._getNodeKey}\n ref={this._listRef}\n >\n {FlatGridItemNode}\n </VariableSizeList>\n </div>\n </PropertyGridInternalContextProvider>\n );\n }}\n </PropertyGridEventsRelatedPropsSupplier>\n )}\n </ColumnResizingPropertyListPropsSupplier>\n );\n }\n}\n\n/**\n * Returns callbacks for persisting and restoring [[VirtualizedPropertyGrid]] layout state.\n * Returned `ref` should be set on container containing [[VirtualizedPropertyGrid]].\n * @public\n */\nexport function useVirtualizedPropertyGridLayoutStorage<T extends Element>() {\n return useElementsScrollStorage<T>(\"ReactWindow__VariableSizeList\");\n}\n\nconst FlatGridItemNode = React.memo(\n ({ index, style: virtualizedListStyle }: ListChildComponentProps) => {\n const {\n gridItems,\n gridEventHandler,\n gridModel,\n gridContext,\n className,\n style,\n onItemHeightChanged,\n } = usePropertyGridInternalContext(FlatGridItemNode);\n const node = gridItems[index];\n\n const onExpansionToggled = React.useCallback(\n () => gridEventHandler.onExpansionToggled(node.selectionKey),\n [gridEventHandler, node.selectionKey]\n );\n const onHeightChanged = React.useCallback(\n (newHeight: number) => onItemHeightChanged(index, node.key, newHeight),\n [onItemHeightChanged, index, node.key]\n );\n\n function getDisplayNode() {\n const lastInNumberOfCategories = node.lastInNumberOfCategories;\n switch (node.type) {\n case FlatGridItemType.Category:\n const categoryRendererManager =\n gridContext.propertyCategoryRendererManager ??\n PropertyCategoryRendererManager.defaultManager;\n const customRenderer =\n categoryRendererManager.getCategoryComponent(node);\n const wrapperClassName = classnames(\n \"virtualized-grid-node-content\",\n customRenderer !== undefined\n ? \"virtualized-grid-node-custom-category\"\n : \"virtualized-grid-node-category\"\n );\n return (\n <FlatItemNestedBorderWrapper\n borderCount={node.depth}\n bottomBorderCount={lastInNumberOfCategories}\n className={wrapperClassName}\n >\n <PropertyCategoryBlock\n className={className}\n style={style}\n category={node.derivedCategory}\n onExpansionToggled={onExpansionToggled}\n highlight={\n gridContext.highlight?.filteredTypes?.includes(\n FilteredType.Category\n )\n ? gridContext.highlight\n : undefined\n }\n >\n {customRenderer !== undefined && (\n <CustomCategoryContent\n renderer={customRenderer}\n categoryItem={node}\n gridContext={gridContext}\n onHeightChanged={onHeightChanged}\n />\n )}\n </PropertyCategoryBlock>\n </FlatItemNestedBorderWrapper>\n );\n case FlatGridItemType.Array:\n case FlatGridItemType.Struct:\n case FlatGridItemType.Primitive:\n const selectionKey = node.selectionKey;\n const parentCategoryItem = gridModel.getItem(\n node.parentCategorySelectionKey\n ) as GridCategoryItem;\n\n return (\n <FlatItemNestedBorderWrapper\n borderCount={parentCategoryItem.depth + 1}\n bottomBorderCount={lastInNumberOfCategories}\n className=\"virtualized-grid-node-content\"\n >\n <FlatPropertyRenderer\n key={node.key}\n uniqueKey={selectionKey}\n propertyRecord={node.derivedRecord}\n orientation={gridContext.orientation}\n indentation={node.depth}\n width={gridContext.gridWidth}\n isHoverable={gridContext.isPropertyHoverEnabled}\n isSelectable={gridContext.isPropertySelectionEnabled}\n isSelected={selectionKey === gridContext.selectedPropertyKey}\n onClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyClicked\n : undefined\n }\n onRightClick={\n node.type === FlatGridItemType.Primitive\n ? gridContext.onPropertyRightClicked\n : undefined\n }\n onContextMenu={gridContext.onPropertyContextMenu}\n category={parentCategoryItem.derivedCategory}\n isEditing={selectionKey === gridContext.editingPropertyKey}\n onEditCommit={gridContext.onEditCommit}\n onEditCancel={gridContext.onEditCancel}\n isExpanded={node.isExpanded}\n onExpansionToggled={onExpansionToggled}\n onHeightChanged={onHeightChanged}\n actionButtonRenderers={gridContext.actionButtonRenderers}\n propertyValueRendererManager={\n gridContext.propertyValueRendererManager\n }\n columnRatio={gridContext.columnRatio}\n columnInfo={gridContext.columnInfo}\n isResizeHandleBeingDragged={\n gridContext.isResizeHandleBeingDragged\n }\n isResizeHandleHovered={gridContext.isResizeHandleHovered}\n onColumnRatioChanged={gridContext.onColumnRatioChanged}\n onResizeHandleDragChanged={\n gridContext.onResizeHandleDragChanged\n }\n onResizeHandleHoverChanged={\n gridContext.onResizeHandleHoverChanged\n }\n highlight={\n gridContext.highlight\n ? {\n applyOnLabel:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Label\n ) ?? false,\n applyOnValue:\n gridContext.highlight.filteredTypes?.includes(\n FilteredType.Value\n ) ?? false,\n ...gridContext.highlight,\n }\n : undefined\n }\n />\n </FlatItemNestedBorderWrapper>\n );\n }\n }\n\n return (\n <div className=\"virtualized-grid-node\" style={virtualizedListStyle}>\n {getDisplayNode()}\n </div>\n );\n },\n areEqual\n);\n\nFlatGridItemNode.displayName = \"FlatGridItemNode\";\n\ninterface CustomCategoryContentProps {\n categoryItem: GridCategoryItem;\n renderer: React.ComponentType<PropertyCategoryRendererProps>;\n gridContext: VirtualizedPropertyGridContext;\n onHeightChanged: (newHeight: number) => void;\n}\n\nconst CustomCategoryContent: React.FC<CustomCategoryContentProps> = (props) => {\n const { onHeightChanged } = props;\n const divRef = React.useRef<HTMLDivElement>(null);\n\n React.useLayoutEffect(() => {\n assert(divRef.current !== null);\n const contentHeight = divRef.current.getBoundingClientRect().height;\n onHeightChanged(contentHeight);\n }, [props.gridContext.orientation, onHeightChanged]);\n\n return <div ref={divRef}>{React.createElement(props.renderer, props)}</div>;\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/expandable/list";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/scrollbar";
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .components-selectable-content {
7
7
  display: flex;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-toolbar-item-container {
6
6
  position: relative;
7
7
  height: 100%;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  $separator-color: var(--iui-color-border-subtle);
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/z-index";
6
6
  @import "variables";
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-overflow-panel {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/z-index";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/geometry";
7
7
  @import "variables";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "~@itwin/core-react/lib/cjs/core-react/style/index";
6
6
 
7
7
  $components-desktop-item-width: 40px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @use "sass:math";
6
6
  @import "../../target";
7
7
  @import "variables";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-toolbar-item-expandable-group-column {
6
6
  > *:not(:last-child) {
7
7
  margin-bottom: 9px;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  .components-toolbar-item-expandable-group-columns {
6
6
  display: grid;
7
7
  grid-auto-columns: 1fr;
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-item-expandable-group-panel {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "variables";
6
6
 
7
7
  .components-toolbar-item-expandable-group-title {
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  @import "../../../target";
6
6
  @import "~@itwin/core-react/lib/cjs/core-react/typography";
7
7
  @import "variables";
@@ -55,4 +55,14 @@ export interface ControlledTreeProps extends CommonProps {
55
55
  * @public
56
56
  */
57
57
  export declare function ControlledTree(props: ControlledTreeProps): JSX.Element;
58
+ /**
59
+ * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.
60
+ * Returned `ref` should be set on container containing ControlledTree.
61
+ * @public
62
+ */
63
+ export declare function useControlledTreeLayoutStorage<T extends Element>(): {
64
+ ref: React.Ref<T>;
65
+ persist: () => void;
66
+ restore: () => void;
67
+ };
58
68
  //# sourceMappingURL=ControlledTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG5E;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,UAAU,EAAE,eAAe,CAAC;IAC5B,2BAA2B;IAC3B,aAAa,EAAE,UAAU,CAAC;IAC1B,wCAAwC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC3C,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC1C,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqDxD"}
1
+ {"version":3,"file":"ControlledTree.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,SAAS,EAIV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAI5E;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,iEAAiE;IACjE,UAAU,EAAE,eAAe,CAAC;IAC5B,2BAA2B;IAC3B,aAAa,EAAE,UAAU,CAAC;IAC1B,wCAAwC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAC;IAC/C,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,KAAK,CAAC,YAAY,CAAC;IAChE,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC3C,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,CAAC;IAC1C,kEAAkE;IAClE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAqDxD;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,OAAO;;;;EAE/D"}
@@ -14,6 +14,7 @@ import { TreeEventDispatcher } from "../TreeEventDispatcher";
14
14
  import { computeVisibleNodes, isTreeModelNode } from "../TreeModel";
15
15
  import { TreeNodeRenderer } from "./TreeNodeRenderer";
16
16
  import { TreeRenderer } from "./TreeRenderer";
17
+ import { useElementsScrollStorage } from "../../../common/UseElementsScrollStorage";
17
18
  /**
18
19
  * React tree component which rendering is fully controlled from outside.
19
20
  * @public
@@ -39,6 +40,14 @@ export function ControlledTree(props) {
39
40
  const noData = visibleNodes.getNumRootNodes() === 0;
40
41
  return (React.createElement(Loader, { loading: loading, noData: noData, spinnerRenderer: props.spinnerRenderer, noDataRenderer: props.noDataRenderer }, props.treeRenderer ? (props.treeRenderer(treeProps)) : (React.createElement(TreeRenderer, { ...treeProps }))));
41
42
  }
43
+ /**
44
+ * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.
45
+ * Returned `ref` should be set on container containing ControlledTree.
46
+ * @public
47
+ */
48
+ export function useControlledTreeLayoutStorage() {
49
+ return useElementsScrollStorage("ReactWindow__VariableSizeList");
50
+ }
42
51
  function useRootNodeLoader(visibleNodes, nodeLoader) {
43
52
  React.useEffect(() => {
44
53
  if (visibleNodes.getNumRootNodes() === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"ControlledTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ7D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA4C9C;;;GAGG;AACH,MAAM,UAA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,CAAC,CACxC,CAAC;IAEF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAe,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAEvC,OAAO,eAAe,CAAC;AACzB,CAAC;AAUD,SAAS,MAAM,CAAC,KAAkB;IAChC,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAC7B,KAAK,CAAC,eAAe,EAAE,CACxB,CAAC,CAAC,CAAC,CACF,6BAAK,SAAS,EAAC,kCAAkC;YAC/C,oBAAC,cAAc,IAAC,IAAI,EAAC,OAAO,GAAG,CAC3B,CACP,CAAC;KACH;IACD,IAAI,KAAK,CAAC,MAAM,EAAE;QAChB,OAAO,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAC5B,KAAK,CAAC,cAAc,EAAE,CACvB,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY;YACX,2BAAG,SAAS,EAAC,wCAAwC,IAClD,YAAY,CAAC,SAAS,CAAC,gBAAgB,CAAC,CACvC,CACS,CAChB,CAAC;KACH;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC;AAED,SAAS,aAAa,CACpB,mBAA4B;IAE5B,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,IAA8C,EAAU,EAAE;QACzD,MAAM,aAAa,GACjB,eAAe,CAAC,IAAI,CAAC,IAAI,mBAAmB,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW;YACtE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,uFAAuF;QACvF,OAAO,aAAa,GAAG,UAAU,CAAC;IACpC,CAAC,EACD,CAAC,mBAAmB,CAAC,CACtB,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/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../../common/DelayedSpinner\";\nimport type { SelectionMode } from \"../../../common/selection/SelectionModes\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type { HighlightableTreeProps } from \"../../HighlightingEngine\";\nimport { TreeImageLoader } from \"../../ImageLoader\";\nimport { TreeEventDispatcher } from \"../TreeEventDispatcher\";\nimport type { TreeEvents } from \"../TreeEvents\";\nimport type {\n TreeModel,\n TreeModelNode,\n TreeModelNodePlaceholder,\n VisibleTreeNodes,\n} from \"../TreeModel\";\nimport { computeVisibleNodes, isTreeModelNode } from \"../TreeModel\";\nimport type { ITreeNodeLoader } from \"../TreeNodeLoader\";\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer\";\nimport type { RenderedItemsRange, TreeRendererProps } from \"./TreeRenderer\";\nimport { TreeRenderer } from \"./TreeRenderer\";\n\n/**\n * Properties for [[ControlledTree]]\n * @public\n */\nexport interface ControlledTreeProps extends CommonProps {\n /** Model of the tree to display. */\n model: TreeModel;\n /** Node loader used to load root nodes and placeholder nodes. */\n nodeLoader: ITreeNodeLoader;\n /** Tree events handler. */\n eventsHandler: TreeEvents;\n /** Mode of nodes' selection in tree. */\n selectionMode: SelectionMode;\n /**\n * Specifies whether to show node description or not. It is used in default node renderer and to determine node height.\n * If custom node renderer and node height callbacks are used it does nothing.\n */\n descriptionsEnabled?: boolean;\n /**\n * Specifies whether to show node icon or not. It is used in default node renderer.\n * If custom node renderer is used it does nothing.\n */\n iconsEnabled?: boolean;\n /**\n * Used to highlight matches when filtering tree.\n * It is passed to treeRenderer.\n */\n nodeHighlightingProps?: HighlightableTreeProps;\n /** Custom renderer to be used to render a tree. */\n treeRenderer?: (props: TreeRendererProps) => React.ReactElement;\n /** Custom renderer to be used while root nodes is loading. */\n spinnerRenderer?: () => React.ReactElement;\n /** Custom renderer to be used when there is no data to show in tree. */\n noDataRenderer?: () => React.ReactElement;\n /** Callback that is invoked when rendered items range changes. */\n onItemsRendered?: (items: RenderedItemsRange) => void;\n /** Width of the tree renderer. */\n width: number;\n /** Height of the tree renderer. */\n height: number;\n}\n\n/**\n * React tree component which rendering is fully controlled from outside.\n * @public\n */\nexport function ControlledTree(props: ControlledTreeProps) {\n const nodeHeight = useNodeHeight(!!props.descriptionsEnabled);\n const imageLoader = React.useMemo(() => new TreeImageLoader(), []);\n const nodeRenderer = React.useCallback(\n (nodeProps: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...nodeProps}\n descriptionEnabled={props.descriptionsEnabled}\n imageLoader={props.iconsEnabled ? imageLoader : undefined}\n />\n ),\n [props.descriptionsEnabled, props.iconsEnabled, imageLoader]\n );\n\n const visibleNodes = React.useMemo(\n () => computeVisibleNodes(props.model),\n [props.model]\n );\n const eventDispatcher = useEventDispatcher(\n props.nodeLoader,\n props.eventsHandler,\n props.selectionMode,\n visibleNodes\n );\n\n const treeProps: TreeRendererProps = {\n nodeRenderer,\n nodeHeight,\n visibleNodes,\n treeActions: eventDispatcher,\n nodeLoader: props.nodeLoader,\n nodeHighlightingProps: props.nodeHighlightingProps,\n onItemsRendered: props.onItemsRendered,\n width: props.width,\n height: props.height,\n };\n\n const loading = useRootNodeLoader(visibleNodes, props.nodeLoader);\n const noData = visibleNodes.getNumRootNodes() === 0;\n return (\n <Loader\n loading={loading}\n noData={noData}\n spinnerRenderer={props.spinnerRenderer}\n noDataRenderer={props.noDataRenderer}\n >\n {props.treeRenderer ? (\n props.treeRenderer(treeProps)\n ) : (\n <TreeRenderer {...treeProps} />\n )}\n </Loader>\n );\n}\n\nfunction useRootNodeLoader(\n visibleNodes: VisibleTreeNodes,\n nodeLoader: ITreeNodeLoader\n): boolean {\n React.useEffect(() => {\n if (visibleNodes.getNumRootNodes() === undefined) {\n const subscription = nodeLoader\n .loadNode(visibleNodes.getModel().getRootNode(), 0)\n .subscribe();\n return () => subscription.unsubscribe();\n }\n\n return () => {};\n }, [visibleNodes, nodeLoader]);\n\n return visibleNodes.getNumRootNodes() === undefined;\n}\n\nfunction useEventDispatcher(\n nodeLoader: ITreeNodeLoader,\n treeEvents: TreeEvents,\n selectionMode: SelectionMode,\n visibleNodes: VisibleTreeNodes\n) {\n /* istanbul ignore next */\n const getVisibleNodes = React.useCallback(() => visibleNodes, [visibleNodes]);\n const eventDispatcher = React.useMemo(\n () => new TreeEventDispatcher(treeEvents, nodeLoader, selectionMode),\n [treeEvents, nodeLoader, selectionMode]\n );\n\n React.useEffect(() => {\n eventDispatcher.setVisibleNodes(getVisibleNodes);\n }, [eventDispatcher, getVisibleNodes]);\n\n return eventDispatcher;\n}\n\ninterface LoaderProps {\n loading: boolean;\n noData: boolean;\n spinnerRenderer?: () => React.ReactElement;\n noDataRenderer?: () => React.ReactElement;\n children: React.ReactElement;\n}\n\nfunction Loader(props: LoaderProps) {\n if (props.loading) {\n return props.spinnerRenderer ? (\n props.spinnerRenderer()\n ) : (\n <div className=\"components-controlledTree-loader\">\n <DelayedSpinner size=\"large\" />\n </div>\n );\n }\n if (props.noData) {\n return props.noDataRenderer ? (\n props.noDataRenderer()\n ) : (\n <FillCentered>\n <p className=\"components-controlledTree-errorMessage\">\n {UiComponents.translate(\"general.noData\")}\n </p>\n </FillCentered>\n );\n }\n\n return props.children;\n}\n\nfunction useNodeHeight(\n descriptionsEnabled: boolean\n): (node: TreeModelNode | TreeModelNodePlaceholder) => number {\n return React.useCallback(\n (node: TreeModelNode | TreeModelNodePlaceholder): number => {\n const contentHeight =\n isTreeModelNode(node) && descriptionsEnabled && node && node.description\n ? 43\n : 24;\n const borderSize = 1;\n // Not counting node's border size twice because we want neighboring borders to overlap\n return contentHeight + borderSize;\n },\n [descriptionsEnabled]\n );\n}\n"]}
1
+ {"version":3,"file":"ControlledTree.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/ControlledTree.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAQ7D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AA4CpF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CACpC,CAAC,SAAgC,EAAE,EAAE,CAAC,CACpC,oBAAC,gBAAgB,OACX,SAAS,EACb,kBAAkB,EAAE,KAAK,CAAC,mBAAmB,EAC7C,WAAW,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,GACzD,CACH,EACD,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,YAAY,EAAE,WAAW,CAAC,CA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,IAAI,EAAC,OAAO,GAAG,CAC3B,CACP,CAAC;KACH;IACD,IAAI,KAAK,CAAC,MAAM,EAAE;QAChB,OAAO,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAC5B,KAAK,CAAC,cAAc,EAAE,CACvB,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY;YACX,2BAAG,SAAS,EAAC,wCAAwC,IAClD,YAAY,CAAC,SAAS,CAAC,gBAAgB,CAAC,CACvC,CACS,CAChB,CAAC;KACH;IAED,OAAO,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC;AAED,SAAS,aAAa,CACpB,mBAA4B;IAE5B,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,IAA8C,EAAU,EAAE;QACzD,MAAM,aAAa,GACjB,eAAe,CAAC,IAAI,CAAC,IAAI,mBAAmB,IAAI,IAAI,IAAI,IAAI,CAAC,WAAW;YACtE,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,CAAC,CAAC;QACrB,uFAAuF;QACvF,OAAO,aAAa,GAAG,UAAU,CAAC;IACpC,CAAC,EACD,CAAC,mBAAmB,CAAC,CACtB,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/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FillCentered } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../../common/DelayedSpinner\";\nimport type { SelectionMode } from \"../../../common/selection/SelectionModes\";\nimport { UiComponents } from \"../../../UiComponents\";\nimport type { HighlightableTreeProps } from \"../../HighlightingEngine\";\nimport { TreeImageLoader } from \"../../ImageLoader\";\nimport { TreeEventDispatcher } from \"../TreeEventDispatcher\";\nimport type { TreeEvents } from \"../TreeEvents\";\nimport type {\n TreeModel,\n TreeModelNode,\n TreeModelNodePlaceholder,\n VisibleTreeNodes,\n} from \"../TreeModel\";\nimport { computeVisibleNodes, isTreeModelNode } from \"../TreeModel\";\nimport type { ITreeNodeLoader } from \"../TreeNodeLoader\";\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer\";\nimport type { RenderedItemsRange, TreeRendererProps } from \"./TreeRenderer\";\nimport { TreeRenderer } from \"./TreeRenderer\";\nimport { useElementsScrollStorage } from \"../../../common/UseElementsScrollStorage\";\n\n/**\n * Properties for [[ControlledTree]]\n * @public\n */\nexport interface ControlledTreeProps extends CommonProps {\n /** Model of the tree to display. */\n model: TreeModel;\n /** Node loader used to load root nodes and placeholder nodes. */\n nodeLoader: ITreeNodeLoader;\n /** Tree events handler. */\n eventsHandler: TreeEvents;\n /** Mode of nodes' selection in tree. */\n selectionMode: SelectionMode;\n /**\n * Specifies whether to show node description or not. It is used in default node renderer and to determine node height.\n * If custom node renderer and node height callbacks are used it does nothing.\n */\n descriptionsEnabled?: boolean;\n /**\n * Specifies whether to show node icon or not. It is used in default node renderer.\n * If custom node renderer is used it does nothing.\n */\n iconsEnabled?: boolean;\n /**\n * Used to highlight matches when filtering tree.\n * It is passed to treeRenderer.\n */\n nodeHighlightingProps?: HighlightableTreeProps;\n /** Custom renderer to be used to render a tree. */\n treeRenderer?: (props: TreeRendererProps) => React.ReactElement;\n /** Custom renderer to be used while root nodes is loading. */\n spinnerRenderer?: () => React.ReactElement;\n /** Custom renderer to be used when there is no data to show in tree. */\n noDataRenderer?: () => React.ReactElement;\n /** Callback that is invoked when rendered items range changes. */\n onItemsRendered?: (items: RenderedItemsRange) => void;\n /** Width of the tree renderer. */\n width: number;\n /** Height of the tree renderer. */\n height: number;\n}\n\n/**\n * React tree component which rendering is fully controlled from outside.\n * @public\n */\nexport function ControlledTree(props: ControlledTreeProps) {\n const nodeHeight = useNodeHeight(!!props.descriptionsEnabled);\n const imageLoader = React.useMemo(() => new TreeImageLoader(), []);\n const nodeRenderer = React.useCallback(\n (nodeProps: TreeNodeRendererProps) => (\n <TreeNodeRenderer\n {...nodeProps}\n descriptionEnabled={props.descriptionsEnabled}\n imageLoader={props.iconsEnabled ? imageLoader : undefined}\n />\n ),\n [props.descriptionsEnabled, props.iconsEnabled, imageLoader]\n );\n\n const visibleNodes = React.useMemo(\n () => computeVisibleNodes(props.model),\n [props.model]\n );\n const eventDispatcher = useEventDispatcher(\n props.nodeLoader,\n props.eventsHandler,\n props.selectionMode,\n visibleNodes\n );\n\n const treeProps: TreeRendererProps = {\n nodeRenderer,\n nodeHeight,\n visibleNodes,\n treeActions: eventDispatcher,\n nodeLoader: props.nodeLoader,\n nodeHighlightingProps: props.nodeHighlightingProps,\n onItemsRendered: props.onItemsRendered,\n width: props.width,\n height: props.height,\n };\n\n const loading = useRootNodeLoader(visibleNodes, props.nodeLoader);\n const noData = visibleNodes.getNumRootNodes() === 0;\n return (\n <Loader\n loading={loading}\n noData={noData}\n spinnerRenderer={props.spinnerRenderer}\n noDataRenderer={props.noDataRenderer}\n >\n {props.treeRenderer ? (\n props.treeRenderer(treeProps)\n ) : (\n <TreeRenderer {...treeProps} />\n )}\n </Loader>\n );\n}\n\n/**\n * Returns callbacks for persisting and restoring [[ControlledTree]] layout state.\n * Returned `ref` should be set on container containing ControlledTree.\n * @public\n */\nexport function useControlledTreeLayoutStorage<T extends Element>() {\n return useElementsScrollStorage<T>(\"ReactWindow__VariableSizeList\");\n}\n\nfunction useRootNodeLoader(\n visibleNodes: VisibleTreeNodes,\n nodeLoader: ITreeNodeLoader\n): boolean {\n React.useEffect(() => {\n if (visibleNodes.getNumRootNodes() === undefined) {\n const subscription = nodeLoader\n .loadNode(visibleNodes.getModel().getRootNode(), 0)\n .subscribe();\n return () => subscription.unsubscribe();\n }\n\n return () => {};\n }, [visibleNodes, nodeLoader]);\n\n return visibleNodes.getNumRootNodes() === undefined;\n}\n\nfunction useEventDispatcher(\n nodeLoader: ITreeNodeLoader,\n treeEvents: TreeEvents,\n selectionMode: SelectionMode,\n visibleNodes: VisibleTreeNodes\n) {\n /* istanbul ignore next */\n const getVisibleNodes = React.useCallback(() => visibleNodes, [visibleNodes]);\n const eventDispatcher = React.useMemo(\n () => new TreeEventDispatcher(treeEvents, nodeLoader, selectionMode),\n [treeEvents, nodeLoader, selectionMode]\n );\n\n React.useEffect(() => {\n eventDispatcher.setVisibleNodes(getVisibleNodes);\n }, [eventDispatcher, getVisibleNodes]);\n\n return eventDispatcher;\n}\n\ninterface LoaderProps {\n loading: boolean;\n noData: boolean;\n spinnerRenderer?: () => React.ReactElement;\n noDataRenderer?: () => React.ReactElement;\n children: React.ReactElement;\n}\n\nfunction Loader(props: LoaderProps) {\n if (props.loading) {\n return props.spinnerRenderer ? (\n props.spinnerRenderer()\n ) : (\n <div className=\"components-controlledTree-loader\">\n <DelayedSpinner size=\"large\" />\n </div>\n );\n }\n if (props.noData) {\n return props.noDataRenderer ? (\n props.noDataRenderer()\n ) : (\n <FillCentered>\n <p className=\"components-controlledTree-errorMessage\">\n {UiComponents.translate(\"general.noData\")}\n </p>\n </FillCentered>\n );\n }\n\n return props.children;\n}\n\nfunction useNodeHeight(\n descriptionsEnabled: boolean\n): (node: TreeModelNode | TreeModelNodePlaceholder) => number {\n return React.useCallback(\n (node: TreeModelNode | TreeModelNodePlaceholder): number => {\n const contentHeight =\n isTreeModelNode(node) && descriptionsEnabled && node && node.description\n ? 43\n : 24;\n const borderSize = 1;\n // Not counting node's border size twice because we want neighboring borders to overlap\n return contentHeight + borderSize;\n },\n [descriptionsEnabled]\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .components-controlledTree-node-description {
7
7
  color: var(--iui-color-text-muted);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/components-react",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "iTwin.js UI complex components",
5
5
  "main": "lib/cjs/components-react.js",
6
6
  "module": "lib/esm/components-react.js",
@@ -24,7 +24,7 @@
24
24
  "peerDependencies": {
25
25
  "@itwin/appui-abstract": "^3.7.0 || ^4.0.0",
26
26
  "@itwin/core-bentley": "^3.7.0 || ^4.0.0",
27
- "@itwin/core-react": "^4.2.1",
27
+ "@itwin/core-react": "^4.3.0",
28
28
  "react": "^17.0.0 || ^18.0.0",
29
29
  "react-dom": "^17.0.0 || ^18.0.0"
30
30
  },
@@ -39,7 +39,7 @@
39
39
  "@itwin/core-common": "^3.7.0",
40
40
  "@itwin/core-geometry": "^3.7.0",
41
41
  "@itwin/core-i18n": "^3.7.0",
42
- "@itwin/core-react": "4.2.1",
42
+ "@itwin/core-react": "4.3.0",
43
43
  "@itwin/eslint-plugin": "^3.7.0",
44
44
  "@testing-library/dom": "^8.11.2",
45
45
  "@testing-library/react": "^12.0.0",
@@ -58,7 +58,7 @@
58
58
  "@types/react-dom": "^17.0.0",
59
59
  "@types/react-highlight-words": "^0.16.1",
60
60
  "@types/react-window": "^1.8.2",
61
- "@types/sinon": "^9.0.0",
61
+ "@types/sinon": "^10.0.15",
62
62
  "@types/sinon-chai": "^3.2.0",
63
63
  "chai": "^4.1.2",
64
64
  "chai-as-promised": "^7",
@@ -77,7 +77,7 @@
77
77
  "react": "^17.0.0",
78
78
  "react-dom": "^17.0.0",
79
79
  "rimraf": "^3.0.2",
80
- "sinon": "^9.0.2",
80
+ "sinon": "^15.2.0",
81
81
  "sinon-chai": "^3.2.0",
82
82
  "ts-node": "^10.8.2",
83
83
  "typemoq": "^2.1.0",