Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
64f96e2
polish up sample preview, change format selector to not be dropdown
hl662 Sep 3, 2025
6ea2ed9
update documentation, move inline styling out
hl662 Sep 3, 2025
bc21eff
pnpm change
hl662 Sep 3, 2025
37c69cb
add format selector test
hl662 Sep 3, 2025
f5d174d
Merge remote-tracking branch 'origin/master' into nam/ui-changes
hl662 Sep 4, 2025
d304aa8
address comment
hl662 Sep 4, 2025
d3ffaa0
address comments
hl662 Sep 4, 2025
b13a3eb
oops
hl662 Sep 4, 2025
6eb2b72
dont use relative path
hl662 Sep 4, 2025
639b2c8
make the list always have the size of its parent through inheritance
hl662 Sep 4, 2025
c148924
Merge remote-tracking branch 'origin/master' into nam/ui-changes
hl662 Sep 9, 2025
5e0b4f6
prototype tabs
hl662 Sep 9, 2025
53039ea
flesh out first draft of a format set panel
hl662 Sep 10, 2025
bb3e791
polish up sample preview, change format selector to not be dropdown
hl662 Sep 3, 2025
bdef8e5
pnpm change
hl662 Sep 3, 2025
f2fcc0a
oops
hl662 Sep 4, 2025
6c2d8c8
prototype tabs
hl662 Sep 9, 2025
f89b537
flesh out first draft of a format set panel
hl662 Sep 10, 2025
9672282
Merge branch 'nam/format-set-editing' of https://github.com/iTwin/vie…
hl662 Sep 17, 2025
7d2f273
sort imports, update css styling to be more consistent
hl662 Sep 18, 2025
4462afb
changes
hl662 Sep 19, 2025
2a1dab7
adjust
hl662 Sep 19, 2025
a43e726
remove as many inline styling for new components as possible
hl662 Sep 22, 2025
60f48fd
add tests
hl662 Sep 22, 2025
6ba25b9
update deps, add context menu for fmt
hl662 Sep 23, 2025
3f5d5e3
bump
hl662 Sep 24, 2025
7a365f6
Merge remote-tracking branch 'origin/master' into nam/format-set-editing
hl662 Oct 2, 2025
875412b
update to 5.2.0, consume description and unit system formatset
hl662 Oct 3, 2025
a36b283
update tests
hl662 Oct 3, 2025
ffbd6c1
cleaning up
hl662 Oct 6, 2025
47fd118
prettier:fix
hl662 Oct 6, 2025
14d74a6
clean up more
hl662 Oct 6, 2025
0fd1b22
add extract api, good copilot
hl662 Oct 7, 2025
a80d807
update documentation
hl662 Oct 7, 2025
eeb0802
run check extraction
hl662 Oct 7, 2025
27b01a9
Merge branch 'master' into nam/format-set-editing
hl662 Oct 7, 2025
2a9f25b
forgot release tags, update root readme
hl662 Oct 7, 2025
4d93a48
update change file
hl662 Oct 7, 2025
c2e16fb
prettier again
hl662 Oct 7, 2025
f7a3aa0
Merge branch 'master' into nam/format-set-editing
hl662 Oct 7, 2025
72607cd
address comments
hl662 Oct 8, 2025
e097102
address comments
hl662 Oct 8, 2025
3cf0d30
Merge branch 'master' into nam/format-set-editing
hl662 Oct 8, 2025
e0ba4c5
update package.json
hl662 Oct 8, 2025
c00f83c
update wording
hl662 Oct 8, 2025
ef30ad0
prettier?
hl662 Oct 8, 2025
9519e62
add learning snippets for quantity-formatting
hl662 Oct 9, 2025
5aa361e
inline the 'unit system' label
hl662 Oct 9, 2025
171af35
update styling
hl662 Oct 9, 2025
2233efe
add qty fmt to linkworkspace deps script
hl662 Oct 9, 2025
9fbe3bf
fixed width for input rows
hl662 Oct 10, 2025
ec48bca
update examples
hl662 Oct 10, 2025
1055a67
Merge remote-tracking branch 'origin/master' into nam/format-set-editing
hl662 Oct 10, 2025
d834337
expand input field a bit more
hl662 Oct 10, 2025
8f49f27
change percentage, run prettier
hl662 Oct 10, 2025
f31c6b9
Merge remote-tracking branch 'origin/master' into nam/format-set-editing
hl662 Oct 10, 2025
8c61416
update tests
hl662 Oct 10, 2025
4d5c2a2
Merge remote-tracking branch 'origin/master' into nam/format-set-editing
hl662 Oct 13, 2025
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
1 change: 1 addition & 0 deletions apps/learning-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dependencies": {
"@itwin/tree-widget-react": "workspace:*",
"@itwin/property-grid-react": "workspace:*",
"@itwin/quantity-formatting-react": "workspace:*",
"@itwin/itwinui-react": "^3.19.3",
"@itwin/appui-abstract": "^5.1.1",
"@itwin/appui-react": "^5.13.0",
Expand Down
29 changes: 25 additions & 4 deletions apps/learning-snippets/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions apps/learning-snippets/scripts/linkWorkspaceDeps.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const packages = [
name: "@itwin/property-grid-react",
dir: "property-grid",
},
{
name: "@itwin/quantity-formatting-react",
dir: "quantity-formatting",
},
];

linkPackages();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { expect } from "chai";
import { render, screen } from "@testing-library/react";
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSelectorExampleImports
import { FormatSelector } from "@itwin/quantity-formatting-react";
import type { FormatDefinition } from "@itwin/core-quantity";
import type { FormatSet } from "@itwin/ecschema-metadata";
// __PUBLISH_EXTRACT_END__
import { QuantityFormattingTestUtils } from "../../utils/QuantityFormattingTestUtils.js";

describe("Quantity formatting", () => {
describe("Learning snippets", () => {
describe("FormatSelector", () => {
before(async function () {
await QuantityFormattingTestUtils.initialize();
});

after(async function () {
await QuantityFormattingTestUtils.terminate();
});

it("renders FormatSelector", async function () {
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSelectorExample
const formatSet: FormatSet = {
name: "TestSet",
label: "Test Format Set",
unitSystem: "metric",
formats: {
"test-format": {
name: "test-format",
label: "Test Format",
type: "Decimal",
precision: 2,
composite: { units: [{ name: "Units.M", label: "m" }] },
},
},
} as FormatSet;

const handleFormatSelection = (_formatDef: FormatDefinition, _key: string) => {
// Handle format selection
};

render(<FormatSelector activeFormatSet={formatSet} activeFormatDefinitionKey={undefined} onListItemChange={handleFormatSelection} />);
// __PUBLISH_EXTRACT_END__

expect(screen.getByPlaceholderText("labels.searchFormats")).to.exist;
});
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { expect } from "chai";
import { render, screen } from "@testing-library/react";
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSetPanelExampleImports
import { FormatSetPanel } from "@itwin/quantity-formatting-react";
import type { FormatSet } from "@itwin/ecschema-metadata";
// __PUBLISH_EXTRACT_END__
import { QuantityFormattingTestUtils } from "../../utils/QuantityFormattingTestUtils.js";

describe("Quantity formatting", () => {
describe("Learning snippets", () => {
describe("FormatSetPanel", () => {
before(async function () {
await QuantityFormattingTestUtils.initialize();
});

after(async function () {
await QuantityFormattingTestUtils.terminate();
});

it("renders FormatSetPanel in editable mode", async function () {
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSetPanelEditableExample
const formatSet: FormatSet = {
name: "CustomSet",
label: "Custom Format Set",
unitSystem: "metric",
description: "A custom format set",
formats: {},
} as FormatSet;

const handleFormatSetChange = (_updatedFormatSet: FormatSet) => {
// Handle format set change
};

render(<FormatSetPanel formatSet={formatSet} editable={true} onFormatSetChange={handleFormatSetChange} />);
// __PUBLISH_EXTRACT_END__

expect(screen.getByText("labels.formatSetDetails")).to.exist;
});

it("renders FormatSetPanel in read-only mode", async function () {
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSetPanelReadOnlyExample
const formatSet: FormatSet = {
name: "ReadOnlySet",
label: "Read-Only Format Set",
unitSystem: "imperial",
description: "A read-only format set",
formats: {},
} as FormatSet;

render(<FormatSetPanel formatSet={formatSet} editable={false} />);
// __PUBLISH_EXTRACT_END__

expect(screen.getByText("labels.formatSetDetails")).to.exist;
const labelInput = screen.getByLabelText("labels.description");
expect((labelInput as HTMLInputElement).disabled).to.be.true;
});
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { expect } from "chai";
import { render, screen } from "@testing-library/react";
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSetSelectorExampleImports
import { FormatSetSelector } from "@itwin/quantity-formatting-react";
import type { FormatSet } from "@itwin/ecschema-metadata";
// __PUBLISH_EXTRACT_END__
import { QuantityFormattingTestUtils } from "../../utils/QuantityFormattingTestUtils.js";

describe("Quantity formatting", () => {
describe("Learning snippets", () => {
describe("FormatSetSelector", () => {
before(async function () {
await QuantityFormattingTestUtils.initialize();
});

after(async function () {
await QuantityFormattingTestUtils.terminate();
});

it("renders FormatSetSelector", async function () {
// __PUBLISH_EXTRACT_START__ QuantityFormat.FormatSetSelectorExample
const formatSets: FormatSet[] = [
{
name: "MetricSet",
label: "Metric Formats",
unitSystem: "metric",
description: "Standard metric unit formats",
formats: {},
} as FormatSet,
{
name: "ImperialSet",
label: "Imperial Formats",
unitSystem: "imperial",
description: "Imperial unit formats",
formats: {},
} as FormatSet,
];

const handleFormatSetChange = (_formatSet: FormatSet, _key: string) => {
// Handle format set change
};

render(<FormatSetSelector formatSets={formatSets} selectedFormatSetKey={undefined} onFormatSetChange={handleFormatSetChange} />);
// __PUBLISH_EXTRACT_END__

expect(screen.getByPlaceholderText("labels.searchFormatSets")).to.exist;
});
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { expect } from "chai";
import { render, screen } from "@testing-library/react";
// __PUBLISH_EXTRACT_START__ QuantityFormat.QuantityFormatPanelExampleImports
import { QuantityFormatPanel } from "@itwin/quantity-formatting-react";
import { IModelApp } from "@itwin/core-frontend";
import type { FormatDefinition } from "@itwin/core-quantity";
// __PUBLISH_EXTRACT_END__
import { QuantityFormattingTestUtils } from "../../utils/QuantityFormattingTestUtils.js";

describe("Quantity formatting", () => {
describe("Learning snippets", () => {
describe("QuantityFormatPanel", () => {
before(async function () {
await QuantityFormattingTestUtils.initialize();
});

after(async function () {
await QuantityFormattingTestUtils.terminate();
});

it("renders QuantityFormatPanel", async function () {
// __PUBLISH_EXTRACT_START__ QuantityFormat.QuantityFormatPanelExample
const formatDefinition: FormatDefinition = {
precision: 4,
type: "Decimal",
composite: {
units: [{ name: "Units.M", label: "m" }],
},
};

const handleFormatChange = (_newFormat: FormatDefinition) => {
// Handle format change
};

render(
<QuantityFormatPanel
formatDefinition={formatDefinition}
unitsProvider={IModelApp.quantityFormatter.unitsProvider}
onFormatChange={handleFormatChange}
initialMagnitude={123.456}
/>,
);
// __PUBLISH_EXTRACT_END__

expect(screen.getByText("labels.type")).to.exist;
});
});
});
});
32 changes: 32 additions & 0 deletions apps/learning-snippets/src/utils/QuantityFormattingTestUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable import/no-duplicates */
import { IModelApp, NoRenderApp } from "@itwin/core-frontend";
// __PUBLISH_EXTRACT_START__ QuantityFormat.QuantityFormattingInitializeImports
import { QuantityFormatting } from "@itwin/quantity-formatting-react";

// __PUBLISH_EXTRACT_END__

export class QuantityFormattingTestUtils {
private static _initialized = false;

public static async initialize() {
if (QuantityFormattingTestUtils._initialized) {
return;
}

await NoRenderApp.startup();
// __PUBLISH_EXTRACT_START__ QuantityFormat.QuantityFormattingInitialize
await QuantityFormatting.startup({ localization: IModelApp.localization });
// __PUBLISH_EXTRACT_END__
QuantityFormattingTestUtils._initialized = true;
}

public static async terminate() {
QuantityFormatting.terminate();
await IModelApp.shutdown();
QuantityFormattingTestUtils._initialized = false;
}
}
4 changes: 2 additions & 2 deletions apps/test-viewer/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading