From b2652392ac24ed1e8d628c041d8e2d18cbbf2ced Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:22:53 +0200 Subject: [PATCH 01/12] Initial --- .../properties/renderers/PropertyRenderer.tsx | 4 + .../component/PropertyGridCommons.ts | 2 + ...PropertyGridEventsRelatedPropsSupplier.tsx | 1 - .../component/VirtualizedPropertyGrid.tsx | 6 ++ .../flat-properties/FlatPropertyRenderer.tsx | 79 ++++++++----------- .../internal/FlatPropertyRenderer.test.tsx | 24 ++++++ 6 files changed, 70 insertions(+), 46 deletions(-) diff --git a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx index 7a378e46831..22826863f4f 100644 --- a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx +++ b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx @@ -56,6 +56,8 @@ export interface SharedRendererProps { actionButtonRenderers?: ActionButtonRenderer[]; /** Is resize handle hovered */ isResizeHandleHovered?: boolean; + /** Enables/disables property editing */ + isPropertyEditingEnabled?: boolean; /** Callback to hover event change */ onResizeHandleHoverChanged?: (isHovered: boolean) => void; /** Is resize handle being dragged */ @@ -64,6 +66,8 @@ export interface SharedRendererProps { onResizeHandleDragChanged?: (isDragStarted: boolean) => void; /** Information for styling property grid columns */ columnInfo?: PropertyGridColumnInfo; + /** Callback to determine which editors should be always visible */ + showOnlyEditor?: (editorName?: string) => boolean; } /** Properties of [[PropertyRenderer]] React component diff --git a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts index 475c6528d61..408555740e1 100644 --- a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts +++ b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts @@ -92,6 +92,8 @@ export interface CommonPropertyGridProps extends CommonProps { * to render an action button for the property or not. */ actionButtonRenderers?: ActionButtonRenderer[]; + /** Callback to determine which editors should be always visible */ + showOnlyEditor?: (editorName?: string) => boolean; } /** diff --git a/ui/components-react/src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx b/ui/components-react/src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx index 3060d9e67bd..12b55b105f8 100644 --- a/ui/components-react/src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx +++ b/ui/components-react/src/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.tsx @@ -43,7 +43,6 @@ export type PropertyGridEventsRelatedPropsSupplierProps = Pick< CommonPropertyGridProps, | "onPropertyContextMenu" | "isPropertySelectionOnRightClickEnabled" - | "isPropertySelectionOnRightClickEnabled" | "onPropertySelectionChanged" | "isPropertyEditingEnabled" | "onPropertyUpdated" diff --git a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx index 9b59710b766..b00a36b933c 100644 --- a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx +++ b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx @@ -109,7 +109,9 @@ export interface VirtualizedPropertyGridContext { isPropertyHoverEnabled: boolean; isPropertySelectionEnabled: boolean; selectedPropertyKey?: string; + isPropertyEditingEnabled?: boolean; + showOnlyEditor?: (editorName?: string) => boolean; onPropertyClicked?: (property: PropertyRecord, key?: string) => void; onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void; onPropertyContextMenu?: ( @@ -372,7 +374,9 @@ export class VirtualizedPropertyGrid extends React.Component< isPropertySelectionEnabled: selectionContext.isPropertySelectionEnabled, selectedPropertyKey: selectionContext.selectedPropertyKey, + isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, + showOnlyEditor: this.props.showOnlyEditor, onPropertyClicked: selectionContext.onPropertyClicked, onPropertyRightClicked: selectionContext.onPropertyRightClicked, onPropertyContextMenu: selectionContext.onPropertyContextMenu, @@ -602,6 +606,8 @@ const FlatGridItemNode = React.memo( onContextMenu={gridContext.onPropertyContextMenu} category={parentCategoryItem.derivedCategory} isEditing={selectionKey === gridContext.editingPropertyKey} + isPropertyEditingEnabled={gridContext.isPropertyEditingEnabled} + showOnlyEditor={gridContext.showOnlyEditor} onEditCommit={gridContext.onEditCommit} onEditCancel={gridContext.onEditCancel} isExpanded={node.isExpanded} diff --git a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx index 98f913eb67f..4aa50870518 100644 --- a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx +++ b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx @@ -32,6 +32,8 @@ export interface FlatPropertyRendererProps extends SharedRendererProps { indentation?: number; /** Indicates property is being edited */ isEditing?: boolean; + /** Callback to determine which editors should be always visible */ + showOnlyEditor?: (editorName?: string) => boolean; /** Called when property edit is committed. */ onEditCommit?: ( args: PropertyUpdatedArgs, @@ -60,35 +62,10 @@ export interface FlatPropertyRendererProps extends SharedRendererProps { export const FlatPropertyRenderer: React.FC = ( props ) => { - const { - category, - propertyValueRendererManager, - isEditing, - onEditCommit, - onEditCancel, - onHeightChanged, - highlight, - ...passthroughProps - } = props; - - const valueElementRenderer = () => ( - - ); + const { propertyValueRendererManager, highlight, ...passthroughProps } = + props; + + const valueElementRenderer = () => ; const primitiveRendererProps: PrimitiveRendererProps = { ...passthroughProps, @@ -147,6 +124,8 @@ export const FlatPropertyRenderer: React.FC = ( interface DisplayValueProps { isEditing?: boolean; + isPropertyEditingEnabled?: boolean; + showOnlyEditor?: (editorName?: string) => boolean; propertyRecord: PropertyRecord; orientation: Orientation; @@ -178,35 +157,45 @@ const DisplayValue: React.FC = (props) => { props.isEditing, props.onHeightChanged ); - - if (props.isEditing) { + const editorName = + props.propertyRecord.property.editor !== undefined + ? props.propertyRecord.property.editor.name + : undefined; + + if ( + props.showOnlyEditor && props.isPropertyEditingEnabled + ? props.showOnlyEditor(editorName) + : false || props.isEditing + ) { const _onEditCommit = (args: PropertyUpdatedArgs) => { if (props.category) props.onEditCommit?.(args, props.category); }; + const setFocus = props.showOnlyEditor + ? props.isEditing + ? true + : false + : true; + return ( {})} - setFocus={true} + setFocus={setFocus} /> ); } - return ( - <> - {CommonPropertyRenderer.createNewDisplayValue( - props.orientation, - props.propertyRecord, - props.indentation, - props.propertyValueRendererManager, - props.isExpanded, - props.onExpansionToggled, - props.onHeightChanged, - props.highlight - )} - + return CommonPropertyRenderer.createNewDisplayValue( + props.orientation, + props.propertyRecord, + props.indentation, + props.propertyValueRendererManager, + props.isExpanded, + props.onExpansionToggled, + props.onHeightChanged, + props.highlight ); }; diff --git a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx index 3e06c54a662..23b94d50128 100644 --- a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx +++ b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx @@ -362,6 +362,30 @@ describe("FlatPropertyRenderer", () => { ); }); + it("renders an editor at all times", () => { + const textPropertyRecord = TestUtils.createPrimitiveStringProperty( + "Label", + "Model", + "DisplayValue", + { name: "textEditor" } + ); + render( + editorName === "textEditor"} + isExpanded={false} + onExpansionToggled={() => {}} + /> + ); + + expect(screen.getByRole("textbox")).satisfy( + selectorMatches(".components-text-editor") + ); + }); + it("calls onEditCommit on Enter key when editing", async () => { const spy = vi.fn(); const propertyRenderer = render( From 62eb5e2fb44be924de6819ab8fa089e9ac0d323f Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:55:44 +0200 Subject: [PATCH 02/12] extract-api --- common/api/components-react.api.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/api/components-react.api.md b/common/api/components-react.api.md index 823d338ad43..e4207e43b7c 100644 --- a/common/api/components-react.api.md +++ b/common/api/components-react.api.md @@ -260,6 +260,7 @@ export interface CommonPropertyGridProps extends CommonProps { onPropertyUpdated?: (args: PropertyUpdatedArgs, category: PropertyCategory) => Promise; orientation?: Orientation; propertyValueRendererManager?: PropertyValueRendererManager; + showOnlyEditor?: (editorName?: string) => boolean; } // @public @@ -2328,6 +2329,7 @@ export interface SharedRendererProps { columnInfo?: PropertyGridColumnInfo; columnRatio?: number; isHoverable?: boolean; + isPropertyEditingEnabled?: boolean; isResizeHandleBeingDragged?: boolean; isResizeHandleHovered?: boolean; isSelectable?: boolean; @@ -2342,6 +2344,7 @@ export interface SharedRendererProps { onRightClick?: (property: PropertyRecord, key?: string) => void; orientation: Orientation; propertyRecord: PropertyRecord; + showOnlyEditor?: (editorName?: string) => boolean; uniqueKey?: string; width?: number; } @@ -3275,6 +3278,8 @@ export interface VirtualizedPropertyGridContext { // (undocumented) highlight?: PropertyGridContentHighlightProps; // (undocumented) + isPropertyEditingEnabled?: boolean; + // (undocumented) isPropertyHoverEnabled: boolean; // (undocumented) isPropertySelectionEnabled: boolean; @@ -3308,6 +3313,8 @@ export interface VirtualizedPropertyGridContext { propertyValueRendererManager?: PropertyValueRendererManager; // (undocumented) selectedPropertyKey?: string; + // (undocumented) + showOnlyEditor?: (editorName?: string) => boolean; } // @public From de52c1d181e4a722fdeeb3aec6dc27b57c516fca Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:10:06 +0200 Subject: [PATCH 03/12] fix --- .../properties/renderers/PropertyRenderer.tsx | 2 +- .../propertygrid/component/PropertyGridCommons.ts | 2 +- .../propertygrid/component/VirtualizedPropertyGrid.tsx | 2 +- .../internal/flat-properties/FlatPropertyRenderer.tsx | 10 +++------- .../component/internal/FlatPropertyRenderer.test.tsx | 4 +++- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx index 22826863f4f..21331cbfd40 100644 --- a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx +++ b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx @@ -67,7 +67,7 @@ export interface SharedRendererProps { /** Information for styling property grid columns */ columnInfo?: PropertyGridColumnInfo; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; } /** Properties of [[PropertyRenderer]] React component diff --git a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts index 408555740e1..7657883b173 100644 --- a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts +++ b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts @@ -93,7 +93,7 @@ export interface CommonPropertyGridProps extends CommonProps { */ actionButtonRenderers?: ActionButtonRenderer[]; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; } /** diff --git a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx index b00a36b933c..e7dbef8f3ac 100644 --- a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx +++ b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx @@ -111,7 +111,7 @@ export interface VirtualizedPropertyGridContext { selectedPropertyKey?: string; isPropertyEditingEnabled?: boolean; - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; onPropertyClicked?: (property: PropertyRecord, key?: string) => void; onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void; onPropertyContextMenu?: ( diff --git a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx index 4aa50870518..0a963ecaa72 100644 --- a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx +++ b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx @@ -33,7 +33,7 @@ export interface FlatPropertyRendererProps extends SharedRendererProps { /** Indicates property is being edited */ isEditing?: boolean; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; /** Called when property edit is committed. */ onEditCommit?: ( args: PropertyUpdatedArgs, @@ -125,7 +125,7 @@ export const FlatPropertyRenderer: React.FC = ( interface DisplayValueProps { isEditing?: boolean; isPropertyEditingEnabled?: boolean; - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; propertyRecord: PropertyRecord; orientation: Orientation; @@ -157,14 +157,10 @@ const DisplayValue: React.FC = (props) => { props.isEditing, props.onHeightChanged ); - const editorName = - props.propertyRecord.property.editor !== undefined - ? props.propertyRecord.property.editor.name - : undefined; if ( props.showOnlyEditor && props.isPropertyEditingEnabled - ? props.showOnlyEditor(editorName) + ? props.showOnlyEditor(props.propertyRecord) : false || props.isEditing ) { const _onEditCommit = (args: PropertyUpdatedArgs) => { diff --git a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx index 23b94d50128..77f234c1289 100644 --- a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx +++ b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx @@ -375,7 +375,9 @@ describe("FlatPropertyRenderer", () => { propertyRecord={textPropertyRecord} isEditing={false} isPropertyEditingEnabled={true} - showOnlyEditor={(editorName) => editorName === "textEditor"} + showOnlyEditor={(property) => + property.property.editor?.name === "textEditor" + } isExpanded={false} onExpansionToggled={() => {}} /> From 6cab8d332e6842d4431ebbffce3e2f827420f80b Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:12:01 +0200 Subject: [PATCH 04/12] extract-api --- common/api/components-react.api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/api/components-react.api.md b/common/api/components-react.api.md index e4207e43b7c..55f49fbcc44 100644 --- a/common/api/components-react.api.md +++ b/common/api/components-react.api.md @@ -260,7 +260,7 @@ export interface CommonPropertyGridProps extends CommonProps { onPropertyUpdated?: (args: PropertyUpdatedArgs, category: PropertyCategory) => Promise; orientation?: Orientation; propertyValueRendererManager?: PropertyValueRendererManager; - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property?: PropertyRecord) => boolean; } // @public @@ -2344,7 +2344,7 @@ export interface SharedRendererProps { onRightClick?: (property: PropertyRecord, key?: string) => void; orientation: Orientation; propertyRecord: PropertyRecord; - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property?: PropertyRecord) => boolean; uniqueKey?: string; width?: number; } @@ -3314,7 +3314,7 @@ export interface VirtualizedPropertyGridContext { // (undocumented) selectedPropertyKey?: string; // (undocumented) - showOnlyEditor?: (editorName?: string) => boolean; + showOnlyEditor?: (property?: PropertyRecord) => boolean; } // @public From 5cb159f0d2fb34744e9b68740c8618825e43ea05 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:33:21 +0200 Subject: [PATCH 05/12] extract-api --- common/api/components-react.api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/api/components-react.api.md b/common/api/components-react.api.md index 55f49fbcc44..e3c5ab20913 100644 --- a/common/api/components-react.api.md +++ b/common/api/components-react.api.md @@ -260,7 +260,7 @@ export interface CommonPropertyGridProps extends CommonProps { onPropertyUpdated?: (args: PropertyUpdatedArgs, category: PropertyCategory) => Promise; orientation?: Orientation; propertyValueRendererManager?: PropertyValueRendererManager; - showOnlyEditor?: (property?: PropertyRecord) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; } // @public @@ -2344,7 +2344,7 @@ export interface SharedRendererProps { onRightClick?: (property: PropertyRecord, key?: string) => void; orientation: Orientation; propertyRecord: PropertyRecord; - showOnlyEditor?: (property?: PropertyRecord) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; uniqueKey?: string; width?: number; } @@ -3314,7 +3314,7 @@ export interface VirtualizedPropertyGridContext { // (undocumented) selectedPropertyKey?: string; // (undocumented) - showOnlyEditor?: (property?: PropertyRecord) => boolean; + showOnlyEditor?: (property: PropertyRecord) => boolean; } // @public From 176d71b05520f28713dfadb80d5e7675cdf758da Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:47:41 +0200 Subject: [PATCH 06/12] add test --- .../flat-properties/FlatPropertyRenderer.tsx | 5 ++-- .../internal/FlatPropertyRenderer.test.tsx | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx index 0a963ecaa72..e8d76d9bbbc 100644 --- a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx +++ b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx @@ -159,9 +159,10 @@ const DisplayValue: React.FC = (props) => { ); if ( - props.showOnlyEditor && props.isPropertyEditingEnabled + props.isEditing || + (props.showOnlyEditor && props.isPropertyEditingEnabled ? props.showOnlyEditor(props.propertyRecord) - : false || props.isEditing + : false) ) { const _onEditCommit = (args: PropertyUpdatedArgs) => { if (props.category) props.onEditCommit?.(args, props.category); diff --git a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx index 77f234c1289..446f8237c8c 100644 --- a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx +++ b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import type { PropertyRecord } from "@itwin/appui-abstract"; import { Orientation } from "@itwin/core-react"; -import { fireEvent, render, screen } from "@testing-library/react"; +import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import { PropertyValueRendererManager } from "../../../../components-react/properties/ValueRendererManager.js"; import { FlatPropertyRenderer } from "../../../../components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js"; import TestUtils, { selectorMatches, userEvent } from "../../../TestUtils.js"; @@ -388,6 +388,29 @@ describe("FlatPropertyRenderer", () => { ); }); + it("renders an editor with focus when showOnlyEditor is defined and isEditing is true", async () => { + const textPropertyRecord = TestUtils.createPrimitiveStringProperty( + "Label", + "Model", + "DisplayValue", + { name: "textEditor" } + ); + render( + false} + isExpanded={false} + onExpansionToggled={() => {}} + /> + ); + + const input = await waitFor(() => screen.getByRole("textbox")); + await waitFor(() => expect(input).to.be.eq(document.activeElement)); + }); + it("calls onEditCommit on Enter key when editing", async () => { const spy = vi.fn(); const propertyRenderer = render( From d7e8ec5f1f0655e09fe47385d2e1826940ddd464 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:16:28 +0200 Subject: [PATCH 07/12] change --- ...-callback-to-show-only-editor_2024-10-31-10-15.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/changes/@itwin/components-react/mast-property-grid-callback-to-show-only-editor_2024-10-31-10-15.json diff --git a/common/changes/@itwin/components-react/mast-property-grid-callback-to-show-only-editor_2024-10-31-10-15.json b/common/changes/@itwin/components-react/mast-property-grid-callback-to-show-only-editor_2024-10-31-10-15.json new file mode 100644 index 00000000000..5fcf3fd6581 --- /dev/null +++ b/common/changes/@itwin/components-react/mast-property-grid-callback-to-show-only-editor_2024-10-31-10-15.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/components-react", + "comment": "Added a callback to `VirtualizedPropertyGrid` which determines which editors should always be visible", + "type": "none" + } + ], + "packageName": "@itwin/components-react" +} \ No newline at end of file From 372b440e01f13c59c743a7a43b3c865b01cee427 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:20:24 +0200 Subject: [PATCH 08/12] adjustments --- .../flat-properties/FlatPropertyRenderer.tsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx index e8d76d9bbbc..7579f52f10c 100644 --- a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx +++ b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx @@ -158,28 +158,21 @@ const DisplayValue: React.FC = (props) => { props.onHeightChanged ); - if ( - props.isEditing || - (props.showOnlyEditor && props.isPropertyEditingEnabled - ? props.showOnlyEditor(props.propertyRecord) - : false) - ) { + const showsOnlyEditor = props.showOnlyEditor + ? props.showOnlyEditor(props.propertyRecord) + : false; + + if (props.isEditing || (showsOnlyEditor && props.isPropertyEditingEnabled)) { const _onEditCommit = (args: PropertyUpdatedArgs) => { if (props.category) props.onEditCommit?.(args, props.category); }; - const setFocus = props.showOnlyEditor - ? props.isEditing - ? true - : false - : true; - return ( {})} - setFocus={setFocus} + setFocus={props.isEditing} /> ); } From 9e5482942205cad649ec0f910907cba38ae0f284 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:28:27 +0200 Subject: [PATCH 09/12] fixes --- .../src/components/PropertyGrid.stories.tsx | 76 ++++++++++++++++++- .../editors/EditorContainer.tsx | 11 ++- .../properties/renderers/PropertyRenderer.tsx | 21 ++++- .../component/PropertyGridCommons.ts | 2 +- .../component/VirtualizedPropertyGrid.tsx | 6 +- .../flat-properties/FlatPropertyRenderer.tsx | 17 +++-- .../renderers/PropertyRenderer.test.tsx | 48 +++++++++++- .../internal/FlatPropertyRenderer.test.tsx | 30 +++++++- 8 files changed, 190 insertions(+), 21 deletions(-) diff --git a/docs/storybook/src/components/PropertyGrid.stories.tsx b/docs/storybook/src/components/PropertyGrid.stories.tsx index 878c3edf92a..6c7d536ec42 100644 --- a/docs/storybook/src/components/PropertyGrid.stories.tsx +++ b/docs/storybook/src/components/PropertyGrid.stories.tsx @@ -15,7 +15,7 @@ import { PropertyDataChangeEvent, PropertyValueRendererManager, VirtualizedPropertyGridWithDataProvider, -} from "@itwin/components-react-internal/src/components-react"; +} from "@itwin/components-react"; import { MultilineTextPropertyValueRenderer } from "@itwin/components-react-internal/src/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer"; import { AppUiDecorator } from "../Decorators"; @@ -364,6 +364,78 @@ export const Links: Story = { }, }; +export const AlwaysVisibleEditor: Story = { + args: { + dataProvider: { + getData: async () => ({ + label: PropertyRecord.fromString("Record 1"), + categories: [ + { name: "Group_1", label: "Group 1", expand: true }, + { name: "Group_2", label: "Group 2", expand: true }, + ], + records: { + Group_1: [ + new PropertyRecord( + { + valueFormat: PropertyValueFormat.Primitive, + value: true, + }, + { + name: "toggleProperty", + displayLabel: "Always visible toggle editor", + typename: "boolean", + editor: { name: "toggle" }, + } + ), + new PropertyRecord( + { + valueFormat: PropertyValueFormat.Primitive, + value: false, + }, + { + name: "toggleProperty2", + displayLabel: "Always visible toggle editor", + typename: "boolean", + editor: { name: "toggle" }, + } + ), + ], + Group_2: [ + new PropertyRecord( + { + valueFormat: PropertyValueFormat.Primitive, + value: true, + }, + { + name: "toggleProperty3", + displayLabel: "Not always visible boolean editor", + typename: "boolean", + } + ), + new PropertyRecord( + { + valueFormat: PropertyValueFormat.Primitive, + value: "Text", + }, + { + name: "stringProperty", + displayLabel: "Not always visible string editor", + typename: "string", + } + ), + ], + Group_3: [], + }, + }), + onDataChanged: new PropertyDataChangeEvent(), + }, + onPropertyContextMenu: undefined, + isPropertyEditingEnabled: true, + alwaysShowEditor: (propertyRecord: PropertyRecord) => + propertyRecord.property.editor?.name === "toggle", + }, +}; + rendererManager.registerRenderer("customRendererStructPropertyRenderer", { canRender: () => true, render: (record) => { @@ -401,7 +473,7 @@ rendererManager.registerRenderer("customRendererArrayPropertyRenderer", { rendererManager.registerRenderer("defaultRendererPropertyRenderer", { canRender: () => false, render: () => { -
Should not render
; + return
Should not render
; }, }); diff --git a/ui/components-react/src/components-react/editors/EditorContainer.tsx b/ui/components-react/src/components-react/editors/EditorContainer.tsx index 353a7744ba7..28c96de0028 100644 --- a/ui/components-react/src/components-react/editors/EditorContainer.tsx +++ b/ui/components-react/src/components-react/editors/EditorContainer.tsx @@ -71,6 +71,8 @@ export interface EditorContainerProps extends CommonProps { onCancel: () => void; /** Indicates whether the Property Editor should set focus */ setFocus?: boolean; + /** Handler for click */ + onClick?: () => void; /** @internal */ ignoreEditorBlur?: boolean; @@ -107,13 +109,18 @@ export function EditorContainer(props: EditorContainerProps) { setFocus, onCommit, onCancel, + onClick, ...rest } = props; const editorRef = React.useRef(); const propertyEditorRef = React.useRef(); - const handleClick = (e: React.MouseEvent) => e.stopPropagation(); + const handleClick = (e: React.MouseEvent) => { + onClick?.(); + e.stopPropagation(); + }; + const handleContextMenu = (e: React.MouseEvent) => e.stopPropagation(); const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation(); const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args); @@ -269,7 +276,7 @@ export function EditorContainer(props: EditorContainerProps) { onBlur={handleContainerBlur} onKeyDown={handleKeyDown} onClick={handleClick} - onContextMenu={handleClick} + onContextMenu={handleContextMenu} title={title} data-testid="editor-container" role="presentation" diff --git a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx index 21331cbfd40..f1ac13e03f9 100644 --- a/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx +++ b/ui/components-react/src/components-react/properties/renderers/PropertyRenderer.tsx @@ -67,7 +67,7 @@ export interface SharedRendererProps { /** Information for styling property grid columns */ columnInfo?: PropertyGridColumnInfo; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (property: PropertyRecord) => boolean; + alwaysShowEditor?: (property: PropertyRecord) => boolean; } /** Properties of [[PropertyRenderer]] React component @@ -105,6 +105,10 @@ export const PropertyRenderer = (props: PropertyRendererProps) => { propertyValueRendererManager, onEditCommit, onEditCancel, + alwaysShowEditor, + isPropertyEditingEnabled, + onClick, + uniqueKey, ...restProps } = props; @@ -119,14 +123,19 @@ export const PropertyRenderer = (props: PropertyRendererProps) => { if (onEditCancel) onEditCancel(); }, [onEditCancel]); + const alwaysShowsEditor = props.alwaysShowEditor + ? props.alwaysShowEditor(props.propertyRecord) + : false; + React.useEffect(() => { - if (isEditing) { + if (isEditing || (alwaysShowsEditor && isPropertyEditingEnabled)) { setDisplayValue( onClick?.(propertyRecord, uniqueKey)} /> ); return; @@ -148,10 +157,16 @@ export const PropertyRenderer = (props: PropertyRendererProps) => { onCommit, onCancel, isEditing, + alwaysShowsEditor, + isPropertyEditingEnabled, + onClick, + uniqueKey, ]); const primitiveRendererProps: PrimitiveRendererProps = { ...restProps, + onClick, + uniqueKey, propertyRecord, orientation, indentation, diff --git a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts index 7656bedbe57..eec23dced43 100644 --- a/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts +++ b/ui/components-react/src/components-react/propertygrid/component/PropertyGridCommons.ts @@ -93,7 +93,7 @@ export interface CommonPropertyGridProps extends CommonProps { */ actionButtonRenderers?: ActionButtonRenderer[]; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (property: PropertyRecord) => boolean; + alwaysShowEditor?: (property: PropertyRecord) => boolean; } /** diff --git a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx index e7dbef8f3ac..fb8afb6b839 100644 --- a/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx +++ b/ui/components-react/src/components-react/propertygrid/component/VirtualizedPropertyGrid.tsx @@ -111,7 +111,7 @@ export interface VirtualizedPropertyGridContext { selectedPropertyKey?: string; isPropertyEditingEnabled?: boolean; - showOnlyEditor?: (property: PropertyRecord) => boolean; + alwaysShowEditor?: (property: PropertyRecord) => boolean; onPropertyClicked?: (property: PropertyRecord, key?: string) => void; onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void; onPropertyContextMenu?: ( @@ -376,7 +376,7 @@ export class VirtualizedPropertyGrid extends React.Component< selectedPropertyKey: selectionContext.selectedPropertyKey, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, - showOnlyEditor: this.props.showOnlyEditor, + alwaysShowEditor: this.props.alwaysShowEditor, onPropertyClicked: selectionContext.onPropertyClicked, onPropertyRightClicked: selectionContext.onPropertyRightClicked, onPropertyContextMenu: selectionContext.onPropertyContextMenu, @@ -607,7 +607,7 @@ const FlatGridItemNode = React.memo( category={parentCategoryItem.derivedCategory} isEditing={selectionKey === gridContext.editingPropertyKey} isPropertyEditingEnabled={gridContext.isPropertyEditingEnabled} - showOnlyEditor={gridContext.showOnlyEditor} + alwaysShowEditor={gridContext.alwaysShowEditor} onEditCommit={gridContext.onEditCommit} onEditCancel={gridContext.onEditCancel} isExpanded={node.isExpanded} diff --git a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx index 7579f52f10c..35ab2acfd73 100644 --- a/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx +++ b/ui/components-react/src/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.tsx @@ -33,7 +33,7 @@ export interface FlatPropertyRendererProps extends SharedRendererProps { /** Indicates property is being edited */ isEditing?: boolean; /** Callback to determine which editors should be always visible */ - showOnlyEditor?: (property: PropertyRecord) => boolean; + alwaysShowEditor?: (property: PropertyRecord) => boolean; /** Called when property edit is committed. */ onEditCommit?: ( args: PropertyUpdatedArgs, @@ -125,7 +125,7 @@ export const FlatPropertyRenderer: React.FC = ( interface DisplayValueProps { isEditing?: boolean; isPropertyEditingEnabled?: boolean; - showOnlyEditor?: (property: PropertyRecord) => boolean; + alwaysShowEditor?: (property: PropertyRecord) => boolean; propertyRecord: PropertyRecord; orientation: Orientation; @@ -137,7 +137,8 @@ interface DisplayValueProps { isExpanded?: boolean; onExpansionToggled?: () => void; onHeightChanged?: (newHeight: number) => void; - + onClick?: (property: PropertyRecord, key?: string) => void; + uniqueKey?: string; category?: PropertyCategory; onEditCancel?: () => void; onEditCommit?: ( @@ -158,11 +159,14 @@ const DisplayValue: React.FC = (props) => { props.onHeightChanged ); - const showsOnlyEditor = props.showOnlyEditor - ? props.showOnlyEditor(props.propertyRecord) + const alwaysShowsEditor = props.alwaysShowEditor + ? props.alwaysShowEditor(props.propertyRecord) : false; - if (props.isEditing || (showsOnlyEditor && props.isPropertyEditingEnabled)) { + if ( + props.isEditing || + (alwaysShowsEditor && props.isPropertyEditingEnabled) + ) { const _onEditCommit = (args: PropertyUpdatedArgs) => { if (props.category) props.onEditCommit?.(args, props.category); }; @@ -173,6 +177,7 @@ const DisplayValue: React.FC = (props) => { onCommit={_onEditCommit} onCancel={props.onEditCancel ?? (() => {})} setFocus={props.isEditing} + onClick={() => props.onClick?.(props.propertyRecord, props.uniqueKey)} /> ); } diff --git a/ui/components-react/src/test/properties/renderers/PropertyRenderer.test.tsx b/ui/components-react/src/test/properties/renderers/PropertyRenderer.test.tsx index 24b0a2810b2..0ed0d9a3fba 100644 --- a/ui/components-react/src/test/properties/renderers/PropertyRenderer.test.tsx +++ b/ui/components-react/src/test/properties/renderers/PropertyRenderer.test.tsx @@ -11,7 +11,7 @@ import TestUtils, { styleMatch, userEvent, } from "../../TestUtils.js"; -import { fireEvent, render, screen } from "@testing-library/react"; +import { fireEvent, render, screen, waitFor } from "@testing-library/react"; import type { PropertyRecord } from "@itwin/appui-abstract"; describe("PropertyRenderer", () => { @@ -282,6 +282,52 @@ describe("PropertyRenderer", () => { ); }); + it("renders an editor at all times", () => { + const textPropertyRecord = TestUtils.createPrimitiveStringProperty( + "Label", + "Model", + "DisplayValue", + { name: "textEditor" } + ); + render( + + property.property.editor?.name === "textEditor" + } + /> + ); + + expect(screen.getByRole("textbox")).satisfy( + selectorMatches(".components-text-editor") + ); + }); + + it("calls on click when clicking on an editor", async () => { + const spy = vi.fn(); + const textPropertyRecord = TestUtils.createPrimitiveStringProperty( + "Label", + "Model", + "DisplayValue", + { name: "textEditor" } + ); + render( + + ); + + const editor = await waitFor(() => screen.getByRole("textbox")); + fireEvent.click(editor); + expect(spy).toHaveBeenCalledOnce(); + }); + it("calls onEditCommit on Enter key when editing", async () => { const spy = vi.fn(); const propertyRenderer = render( diff --git a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx index 446f8237c8c..84124cc39ba 100644 --- a/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx +++ b/ui/components-react/src/test/propertygrid/component/internal/FlatPropertyRenderer.test.tsx @@ -375,7 +375,7 @@ describe("FlatPropertyRenderer", () => { propertyRecord={textPropertyRecord} isEditing={false} isPropertyEditingEnabled={true} - showOnlyEditor={(property) => + alwaysShowEditor={(property) => property.property.editor?.name === "textEditor" } isExpanded={false} @@ -388,7 +388,31 @@ describe("FlatPropertyRenderer", () => { ); }); - it("renders an editor with focus when showOnlyEditor is defined and isEditing is true", async () => { + it("calls on click when clicking on an editor", async () => { + const spy = vi.fn(); + const textPropertyRecord = TestUtils.createPrimitiveStringProperty( + "Label", + "Model", + "DisplayValue", + { name: "textEditor" } + ); + render( + {}} + /> + ); + + const editor = await waitFor(() => screen.getByRole("textbox")); + fireEvent.click(editor); + expect(spy).toHaveBeenCalledOnce(); + }); + + it("renders an editor with focus when alwaysShowEditor is defined and isEditing is true", async () => { const textPropertyRecord = TestUtils.createPrimitiveStringProperty( "Label", "Model", @@ -401,7 +425,7 @@ describe("FlatPropertyRenderer", () => { propertyRecord={textPropertyRecord} isEditing={true} isPropertyEditingEnabled={true} - showOnlyEditor={() => false} + alwaysShowEditor={() => false} isExpanded={false} onExpansionToggled={() => {}} /> From 4c623edfb9d20e25fac65d1840ebf405f63b5e91 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:33:17 +0200 Subject: [PATCH 10/12] extract-api --- common/api/components-react.api.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/common/api/components-react.api.md b/common/api/components-react.api.md index 44fba6b250d..1fbdccddd19 100644 --- a/common/api/components-react.api.md +++ b/common/api/components-react.api.md @@ -96,7 +96,7 @@ export function adjustDateToTimezone(inDateTime: Date, utcOffset: number): Date; // @public export class ArrayPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; + render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; } // @public @@ -246,6 +246,7 @@ export interface CheckboxStateChange { export interface CommonPropertyGridProps extends CommonProps { actionButtonRenderers?: ActionButtonRenderer[]; actionButtonWidth?: number; + alwaysShowEditor?: (property: PropertyRecord) => boolean; horizontalOrientationMinWidth?: number; isOrientationFixed?: boolean; isPropertyEditingEnabled?: boolean; @@ -260,7 +261,6 @@ export interface CommonPropertyGridProps extends CommonProps { onPropertyUpdated?: (args: PropertyUpdatedArgs, category: PropertyCategory) => Promise; orientation?: Orientation; propertyValueRendererManager?: PropertyValueRendererManager; - showOnlyEditor?: (property: PropertyRecord) => boolean; } // @public @@ -548,6 +548,7 @@ export interface EditorContainerProps extends CommonProps { // @internal (undocumented) ignoreEditorBlur?: boolean; onCancel: () => void; + onClick?: () => void; onCommit: (args: PropertyUpdatedArgs) => void; propertyRecord: PropertyRecord; setFocus?: boolean; @@ -1246,7 +1247,7 @@ export const matchLinks: (text: string) => Array<{ // @public export class MergedPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; + render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; } // @public @@ -2326,6 +2327,7 @@ export enum SelectionModeFlags { // @public export interface SharedRendererProps { actionButtonRenderers?: ActionButtonRenderer[]; + alwaysShowEditor?: (property: PropertyRecord) => boolean; columnInfo?: PropertyGridColumnInfo; columnRatio?: number; isHoverable?: boolean; @@ -2344,7 +2346,6 @@ export interface SharedRendererProps { onRightClick?: (property: PropertyRecord, key?: string) => void; orientation: Orientation; propertyRecord: PropertyRecord; - showOnlyEditor?: (property: PropertyRecord) => boolean; uniqueKey?: string; width?: number; } @@ -2491,7 +2492,7 @@ export class StringTypeConverter extends TypeConverter implements StringOperator // @public export class StructPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; + render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; } // @public @@ -3264,6 +3265,8 @@ export interface VirtualizedPropertyGridContext { // (undocumented) actionButtonRenderers?: ActionButtonRenderer[]; // (undocumented) + alwaysShowEditor?: (property: PropertyRecord) => boolean; + // (undocumented) columnInfo: PropertyGridColumnInfo; // (undocumented) columnRatio: number; @@ -3313,8 +3316,6 @@ export interface VirtualizedPropertyGridContext { propertyValueRendererManager?: PropertyValueRendererManager; // (undocumented) selectedPropertyKey?: string; - // (undocumented) - showOnlyEditor?: (property: PropertyRecord) => boolean; } // @public @@ -3355,7 +3356,7 @@ export interface VisibleTreeNodes extends Iterable string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; +export const withContextStyle: (node: React_3.ReactNode, context?: PropertyValueRendererContext) => string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; // @public export const withLinks: (stringValue: string, links?: LinkElementsInfo, highlight?: (text: string) => React_3.ReactNode) => React_3.ReactNode; From e6a95dcf68d69eb6dd35629ad5eced074347da04 Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:25:27 +0200 Subject: [PATCH 11/12] extract-api --- common/api/components-react.api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/api/components-react.api.md b/common/api/components-react.api.md index 1fbdccddd19..241122457fe 100644 --- a/common/api/components-react.api.md +++ b/common/api/components-react.api.md @@ -96,7 +96,7 @@ export function adjustDateToTimezone(inDateTime: Date, utcOffset: number): Date; // @public export class ArrayPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; + render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; } // @public @@ -1247,7 +1247,7 @@ export const matchLinks: (text: string) => Array<{ // @public export class MergedPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; + render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; } // @public @@ -2492,7 +2492,7 @@ export class StringTypeConverter extends TypeConverter implements StringOperator // @public export class StructPropertyValueRenderer implements IPropertyValueRenderer { canRender(record: PropertyRecord): boolean; - render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; + render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; } // @public @@ -3356,7 +3356,7 @@ export interface VisibleTreeNodes extends Iterable string | number | boolean | React_3.JSX.Element | Iterable | null | undefined; +export const withContextStyle: (node: React_3.ReactNode, context?: PropertyValueRendererContext) => string | number | boolean | Iterable | React_3.JSX.Element | null | undefined; // @public export const withLinks: (stringValue: string, links?: LinkElementsInfo, highlight?: (text: string) => React_3.ReactNode) => React_3.ReactNode; From e81b5eadebbc7235a9ed0c144789914acf34749b Mon Sep 17 00:00:00 2001 From: Martynas Strazdas <43886789+MartynasStrazdas@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:40:47 +0200 Subject: [PATCH 12/12] NextVersion md --- docs/changehistory/NextVersion.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/changehistory/NextVersion.md b/docs/changehistory/NextVersion.md index 5ec6e734bda..7783ba5ecda 100644 --- a/docs/changehistory/NextVersion.md +++ b/docs/changehistory/NextVersion.md @@ -1 +1,10 @@ # NextVersion + +- [@itwin/components-react](#itwincomponents-react) + - [Additions](#additions) + +## @itwin/components-react + +### Additions + +- Added a callback to `VirtualizedPropertyGrid` which determines which editors should always be visible. [#1090](https://github.com/iTwin/appui/pull/1090)