Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions apps/learning-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@
"link:deps": "node ./scripts/linkWorkspaceDeps.cjs"
},
"dependencies": {
"@itwin/appui-abstract": "^5.9.1",
"@itwin/appui-react": "^5.29.0",
"@itwin/build-tools": "^5.9.1",
"@itwin/components-react": "^5.29.0",
"@itwin/core-backend": "^5.9.1",
"@itwin/core-bentley": "^5.9.1",
"@itwin/core-common": "^5.9.1",
"@itwin/core-frontend": "^5.9.1",
"@itwin/core-geometry": "^5.9.1",
"@itwin/core-orbitgt": "^5.9.1",
"@itwin/core-quantity": "^5.9.1",
"@itwin/core-react": "^5.29.0",
"@itwin/ecschema-metadata": "^5.9.1",
"@itwin/ecschema-rpcinterface-common": "^5.9.1",
"@itwin/ecschema-rpcinterface-impl": "^5.9.1",
"@itwin/appui-abstract": "^5.11.2",
"@itwin/appui-react": "^5.33.0",
"@itwin/build-tools": "^5.11.2",
"@itwin/components-react": "^5.33.0",
"@itwin/core-backend": "^5.11.2",
"@itwin/core-bentley": "^5.11.2",
"@itwin/core-common": "^5.11.2",
"@itwin/core-frontend": "^5.11.2",
"@itwin/core-geometry": "^5.11.2",
"@itwin/core-orbitgt": "^5.11.2",
"@itwin/core-quantity": "^5.11.2",
"@itwin/core-react": "^5.33.0",
"@itwin/ecschema-metadata": "^5.11.2",
"@itwin/ecschema-rpcinterface-common": "^5.11.2",
"@itwin/ecschema-rpcinterface-impl": "^5.11.2",
"@itwin/eslint-plugin": "^6.1.0",
"@itwin/imodel-components-react": "^5.29.0",
"@itwin/imodel-components-react": "^5.33.0",
"@itwin/itwinui-react": "^3.20.2",
"@itwin/presentation-backend": "^5.9.1",
"@itwin/presentation-common": "^5.9.1",
"@itwin/presentation-components": "^5.13.7",
"@itwin/presentation-frontend": "^5.9.1",
"@itwin/presentation-backend": "^5.11.2",
"@itwin/presentation-common": "^5.11.2",
"@itwin/presentation-components": "^6.0.0",
"@itwin/presentation-frontend": "^5.11.2",
"@itwin/presentation-hierarchies": "^1.7.14",
"@itwin/presentation-shared": "^1.2.13",
"@itwin/property-grid-react": "workspace:*",
Expand Down
3,110 changes: 1,308 additions & 1,802 deletions apps/learning-snippets/pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
*--------------------------------------------------------------------------------------------*/
/* eslint-disable unused-imports/no-unused-vars */
/* eslint-disable import/no-duplicates */
/* eslint-disable @typescript-eslint/no-deprecated */

import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { UiFramework } from "@itwin/appui-react";
import { Presentation } from "@itwin/presentation-frontend";
// __PUBLISH_EXTRACT_START__ PropertyGrid.ExampleContextMenuItemImports
import { PropertyGridContextMenuItem } from "@itwin/property-grid-react";
import type { ContextMenuItemProps } from "@itwin/property-grid-react";
Expand All @@ -23,6 +21,9 @@ import { buildIModel } from "../../utils/IModelUtils.js";
import { initializeLearningSnippetsTests, terminateLearningSnippetsTests } from "../../utils/InitializationUtils.js";
import { PropertyGridTestUtils } from "../../utils/PropertyGridTestUtils.js";
import { withEditTxn } from "@itwin/core-backend";
import { createStorage } from "@itwin/unified-selection";

const selectionStorage = createStorage();

describe("Property grid", () => {
describe("Learning snippets", () => {
Expand Down Expand Up @@ -68,11 +69,15 @@ describe("Property grid", () => {

// __PUBLISH_EXTRACT_START__ PropertyGrid.PropertyGridWithContextMenuItem
function MyPropertyGrid() {
return <PropertyGridComponent contextMenuItems={[(props) => <ExampleContextMenuItem {...props} />]} />;
return <PropertyGridComponent selectionStorage={selectionStorage} contextMenuItems={[(props) => <ExampleContextMenuItem {...props} />]} />;
}
// __PUBLISH_EXTRACT_END__

Presentation.selection.addToSelection("", imodelConnection, [keys.category]);
selectionStorage.addToSelection({
source: "test",
imodelKey: imodelConnection.key,
selectables: [keys.category],
});

using _ = { [Symbol.dispose]: cleanup };
const { baseElement, getAllByText } = render(<MyPropertyGrid />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { buildIModel } from "../../utils/IModelUtils.js";
import { initializeLearningSnippetsTests, terminateLearningSnippetsTests } from "../../utils/InitializationUtils.js";
import { PropertyGridTestUtils } from "../../utils/PropertyGridTestUtils.js";
import { withEditTxn } from "@itwin/core-backend";
import { createStorage } from "@itwin/unified-selection";

const selectionStorage = createStorage();

describe("Property grid", () => {
describe("Learning snippets", () => {
Expand Down Expand Up @@ -63,7 +66,7 @@ describe("Property grid", () => {

// __PUBLISH_EXTRACT_START__ PropertyGrid.PropertyGridWithSettingsMenuItem
function MyPropertyGrid() {
return <PropertyGridComponent settingsMenuItems={[() => <ExampleSettingsMenuItem />]} />;
return <PropertyGridComponent selectionStorage={selectionStorage} settingsMenuItems={[() => <ExampleSettingsMenuItem />]} />;
}
// __PUBLISH_EXTRACT_END__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable import/no-duplicates */
/* eslint-disable @typescript-eslint/no-deprecated */

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { UiFramework } from "@itwin/appui-react";
import { Presentation } from "@itwin/presentation-frontend";
// __PUBLISH_EXTRACT_START__ PropertyGrid.ComponentWithTelemetryImports
import { PropertyGridComponent } from "@itwin/property-grid-react";
// __PUBLISH_EXTRACT_END__
Expand All @@ -21,6 +19,9 @@ import { buildIModel } from "../../utils/IModelUtils.js";
import { initializeLearningSnippetsTests, terminateLearningSnippetsTests } from "../../utils/InitializationUtils.js";
import { PropertyGridTestUtils } from "../../utils/PropertyGridTestUtils.js";
import { withEditTxn } from "@itwin/core-backend";
import { createStorage } from "@itwin/unified-selection";

const selectionStorage = createStorage();

describe("Property grid", () => {
describe("Learning snippets", () => {
Expand Down Expand Up @@ -52,6 +53,7 @@ describe("Property grid", () => {
function MyPropertyGrid() {
return (
<PropertyGridComponent
selectionStorage={selectionStorage}
onPerformanceMeasured={(feature, elapsedTime) => {
// user-defined function to handle performance logging.
logPerformance(feature, elapsedTime);
Expand All @@ -68,7 +70,11 @@ describe("Property grid", () => {
using _ = { [Symbol.dispose]: cleanup };
render(<MyPropertyGrid />);
act(() => {
Presentation.selection.addToSelection("", imodelConnection, [keys.category]);
selectionStorage.addToSelection({
source: "test",
imodelKey: imodelConnection.key,
selectables: [keys.category],
});
});
await waitFor(() => {
expect(logUsage).toHaveBeenCalledTimes(3);
Expand Down Expand Up @@ -104,13 +110,17 @@ describe("Property grid", () => {
logUsage(feature);
}}
>
<PropertyGrid imodel={imodelConnection} />
<PropertyGrid selectionStorage={selectionStorage} imodel={imodelConnection} />
</TelemetryContextProvider>
);
}
// __PUBLISH_EXTRACT_END__

Presentation.selection.addToSelection("", imodelConnection, [keys.category]);
selectionStorage.addToSelection({
source: "test",
imodelKey: imodelConnection.key,
selectables: [keys.category],
});

using _ = { [Symbol.dispose]: cleanup };
const user = userEvent.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import type { IModelConnection } from "@itwin/core-frontend";
// __PUBLISH_EXTRACT_END__
import { PropertyGridTestUtils } from "../../utils/PropertyGridTestUtils.js";

const selectionStorage = createStorage();
const getGlobalSelectionStorage = () => selectionStorage;

describe("Property grid", () => {
describe("Learning snippets", () => {
describe("Usage", () => {
Expand All @@ -40,7 +43,7 @@ describe("Property grid", () => {

it("registers property grid", async () => {
// __PUBLISH_EXTRACT_START__ PropertyGrid.RegisterPropertyGridWidget
UiItemsManager.register({ id: "property-grid-provider", getWidgets: () => [createPropertyGrid({})] });
UiItemsManager.register({ id: "property-grid-provider", getWidgets: () => [createPropertyGrid({ selectionStorage: getGlobalSelectionStorage() })] });
// __PUBLISH_EXTRACT_END__

expect(UiItemsManager.getWidgets("", StageUsage.General, StagePanelLocation.Right, StagePanelSection.End)).not.toHaveLength(0);
Expand All @@ -49,9 +52,6 @@ describe("Property grid", () => {
it("registers customizable property grid", async () => {
const MY_CUSTOM_RULESET = undefined;

const selectionStorage = createStorage();
const getGlobalSelectionStorage = () => selectionStorage;

// __PUBLISH_EXTRACT_START__ PropertyGrid.RegisterCustomPropertyGridWidget
UiItemsManager.register({
id: "property-grid-provider",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ function CustomModelsTreeComponentWithFilterAndTargetItems({
WHERE Label LIKE '%${activeFilter.replaceAll(/[%_\\]/g, "\\$&")}%' ESCAPE '\\'
`,
undefined,
{ rowFormat: QueryRowFormat.UseJsPropertyNames },
{ rowFormat: QueryRowFormat.UseECSqlPropertyIndexes },
)) {
targetItems.push({ id: row.Id, className: row.ClassName });
targetItems.push({ id: row[1], className: row[0] });
}
// `createInstanceKeyPaths` doesn't automatically set the `autoExpand` flag - set it here
const paths = await createInstanceKeyPaths({ targetItems });
Expand Down
36 changes: 18 additions & 18 deletions apps/test-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
"type": "module",
"private": true,
"dependencies": {
"@itwin/appui-abstract": "^5.11.1",
"@itwin/appui-abstract": "^5.11.2",
"@itwin/appui-react": "^5.33.0",
"@itwin/browser-authorization": "^2.0.2",
"@itwin/components-react": "^5.33.0",
"@itwin/core-bentley": "^5.11.1",
"@itwin/core-common": "^5.11.1",
"@itwin/core-frontend": "^5.11.1",
"@itwin/core-geometry": "^5.11.1",
"@itwin/core-i18n": "^5.11.1",
"@itwin/core-markup": "^5.11.1",
"@itwin/core-orbitgt": "^5.11.1",
"@itwin/core-quantity": "^5.11.1",
"@itwin/core-bentley": "^5.11.2",
"@itwin/core-common": "^5.11.2",
"@itwin/core-frontend": "^5.11.2",
"@itwin/core-geometry": "^5.11.2",
"@itwin/core-i18n": "^5.11.2",
"@itwin/core-markup": "^5.11.2",
"@itwin/core-orbitgt": "^5.11.2",
"@itwin/core-quantity": "^5.11.2",
"@itwin/core-react": "^5.33.0",
"@itwin/ec3-widget-react": "workspace:*",
"@itwin/ecschema-metadata": "^5.11.1",
"@itwin/ecschema-rpcinterface-common": "^5.11.1",
"@itwin/frontend-devtools": "^5.11.1",
"@itwin/ecschema-metadata": "^5.11.2",
"@itwin/ecschema-rpcinterface-common": "^5.11.2",
"@itwin/frontend-devtools": "^5.11.2",
"@itwin/geo-tools-react": "workspace:*",
"@itwin/grouping-mapping-widget": "workspace:*",
"@itwin/imodel-components-react": "^5.33.0",
Expand All @@ -30,13 +30,13 @@
"@itwin/itwinui-illustrations-react": "^2.1.0",
"@itwin/itwinui-react": "3.21.2",
"@itwin/map-layers": "workspace:*",
"@itwin/map-layers-auth": "^5.11.1",
"@itwin/map-layers-formats": "^5.11.1",
"@itwin/map-layers-auth": "^5.11.2",
"@itwin/map-layers-formats": "^5.11.2",
"@itwin/measure-tools-react": "workspace:*",
"@itwin/one-click-lca-react": "workspace:*",
"@itwin/presentation-common": "^5.11.1",
"@itwin/presentation-components": "^5.16.3",
"@itwin/presentation-frontend": "^5.11.1",
"@itwin/presentation-common": "^5.11.2",
"@itwin/presentation-components": "^6.0.0",
"@itwin/presentation-frontend": "^5.11.2",
"@itwin/presentation-hierarchies": "^1.7.14",
"@itwin/presentation-hierarchies-react": "^1.10.3",
"@itwin/presentation-shared": "^1.2.13",
Expand All @@ -46,7 +46,7 @@
"@itwin/tree-widget-react": "workspace:*",
"@itwin/unified-selection": "^1.7.3",
"@itwin/web-viewer-react": "^5.0.1",
"@itwin/webgl-compatibility": "^5.11.1",
"@itwin/webgl-compatibility": "^5.11.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^6.1.1",
Expand Down
Loading
Loading