From 24c65533438ee2cb8f14fc97a55ca45c7a0bfd29 Mon Sep 17 00:00:00 2001 From: Grigas <35135765+grigasp@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:56:41 +0200 Subject: [PATCH] Add `exports` and `type` attributes to `package.json` (#754) * components * testing * change * Fix internal imports from `presentation-components` * Fix internal imports from `presentation-testing` * Remove `*:watch` scripts. Can use `build -- -w` instead. * attempt to start docs build --- .changeset/polite-mails-count.md | 10 + .changeset/selfish-parents-appear.md | 10 + apps/full-stack-tests/package.json | 1 - apps/full-stack-tests/src/IModelUtils.ts | 7 +- .../{Hilite.test.ts => Hilite.test.tsx} | 213 ++++++++++-------- .../hierarchies/HierarchyFiltering.test.ts | 2 +- .../src/hierarchies/Update.test.ts | 2 +- apps/performance-tests/package.json | 1 - packages/components/.mocharc.json | 2 +- packages/components/.nycrc | 4 +- .../api/presentation-components.api.md | 15 +- packages/components/package.json | 14 +- .../components/src/presentation-components.ts | 70 +++--- .../common/ContentBuilder.ts | 4 +- .../common/ContentDataProvider.ts | 9 +- .../common/PropertyRecordsBuilder.ts | 2 +- .../presentation-components/common/Utils.ts | 8 +- .../favorite-properties/DataProvider.ts | 4 +- .../favorite-properties/Utils.ts | 2 +- .../hooks/UseRulesetRegistration.ts | 2 +- .../InstanceFilterBuilder.tsx | 8 +- .../InstanceFilterConverter.ts | 4 +- .../PresentationFilterBuilder.tsx | 14 +- .../PresentationInstanceFilter.ts | 4 +- .../PresentationInstanceFilterDialog.tsx | 10 +- .../PresentationInstanceFilterProperty.tsx | 2 +- .../instance-filter-builder/Utils.ts | 8 +- .../labels/LabelsProvider.ts | 2 +- .../properties/InstanceKeyValueRenderer.tsx | 4 +- .../editors/NavigationPropertyEditor.tsx | 6 +- .../NavigationPropertyEditorContext.tsx | 2 +- .../editors/NumericPropertyEditor.tsx | 4 +- .../editors/QuantityPropertyEditor.tsx | 4 +- .../properties/editors/index.ts | 8 +- .../NavigationPropertyTargetSelector.tsx | 8 +- .../inputs/NumericPropertyInput.tsx | 4 +- .../inputs/QuantityPropertyEditorInput.tsx | 8 +- .../inputs/UniquePropertyValuesSelector.tsx | 8 +- .../UseNavigationPropertyTargetsLoader.ts | 2 +- .../inputs/UseQuantityValueInput.tsx | 2 +- .../inputs/UseUniquePropertyValuesLoader.ts | 4 +- .../propertygrid/DataProvider.ts | 11 +- .../FavoritePropertiesDataFilterer.ts | 2 +- .../propertygrid/UseUnifiedSelection.tsx | 2 +- .../table/UseColumns.ts | 4 +- .../table/UsePresentationTable.ts | 8 +- .../presentation-components/table/UseRows.ts | 8 +- .../table/UseTableOptions.ts | 2 +- .../tree/DataProvider.ts | 18 +- .../tree/FilteredDataProvider.ts | 10 +- .../tree/IPresentationTreeDataProvider.ts | 2 +- .../tree/PresentationTreeNodeItem.ts | 2 +- .../tree/ReportingTreeNodeLoader.ts | 2 +- .../src/presentation-components/tree/Utils.ts | 6 +- .../tree/controlled/PresentationTree.tsx | 4 +- .../PresentationTreeNodeRenderer.tsx | 4 +- .../controlled/PresentationTreeRenderer.tsx | 14 +- .../tree/controlled/TreeHooks.ts | 8 +- .../tree/controlled/TreeReloader.ts | 4 +- .../controlled/UseControlledTreeFiltering.ts | 4 +- .../controlled/UseHierarchyLevelFiltering.ts | 4 +- .../controlled/UsePresentationTreeState.ts | 10 +- .../tree/controlled/UseTreeReload.ts | 6 +- .../tree/controlled/UseUnifiedSelection.ts | 6 +- .../UnifiedSelectionContext.tsx | 2 +- .../viewport/WithUnifiedSelection.tsx | 4 +- packages/components/src/test/TestUtils.tsx | 2 +- .../components/src/test/_helpers/Common.ts | 4 +- .../components/src/test/_helpers/Content.ts | 2 +- .../components/src/test/_helpers/Hierarchy.ts | 4 +- .../src/test/_helpers/UiComponents.ts | 4 +- .../src/test/common/ContentBuilder.test.ts | 12 +- .../test/common/ContentDataProvider.test.ts | 6 +- .../src/test/common/Diagnostics.test.ts | 4 +- .../common/RulesetRegistrationHelper.test.ts | 6 +- .../src/test/common/StyleHelper.test.ts | 4 +- .../components/src/test/common/Utils.test.ts | 15 +- .../favorite-properties/DataProvider.test.ts | 6 +- .../test/hooks/UseRulesetRegistration.test.ts | 4 +- .../InstanceFilterConverter.test.ts | 12 +- .../IntanceFilterBuilder.test.tsx | 12 +- .../PresentationFilterBuilder.test.tsx | 10 +- .../PresentationInstanceFilter.test.ts | 10 +- .../PresentationInstanceFilterDialog.test.tsx | 16 +- ...resentationInstanceFilterProperty.test.tsx | 6 +- .../instance-filter-builder/Utils.test.ts | 8 +- .../src/test/labels/LabelsProvider.test.ts | 4 +- .../InstanceKeyValueRenderer.test.tsx | 6 +- .../editors/NavigationPropertyEditor.test.tsx | 14 +- .../editors/NumericPropertyEditor.test.tsx | 6 +- .../editors/QuantityPropertyEditor.test.tsx | 8 +- .../NavigationPropertyTargetSelector.test.tsx | 10 +- .../inputs/NumericPropertyInput.test.tsx | 8 +- .../QuantityPropertyEditorInput.test.tsx | 12 +- .../UniquePropertyValuesSelector.test.tsx | 14 +- ...UseNavigationPropertyTargetsLoader.test.ts | 8 +- .../inputs/UseQuantityValueInput.test.tsx | 4 +- .../src/test/properties/inputs/Utils.test.ts | 2 +- .../test/propertygrid/DataProvider.test.ts | 10 +- .../FavoritePropertiesDataFilterer.test.ts | 10 +- .../propertygrid/UseUnifiedSelection.test.tsx | 11 +- .../VirtualizedPropertyGrid.test.tsx | 8 +- packages/components/src/test/setup.ts | 5 - .../src/test/table/CellRenderer.test.tsx | 4 +- .../src/test/table/UseColumns.test.tsx | 8 +- .../test/table/UsePresentationTable.test.tsx | 10 +- .../src/test/table/UseRows.test.tsx | 8 +- .../src/test/table/UseTableOptions.test.ts | 8 +- .../src/test/tree/DataProvider.test.ts | 18 +- .../test/tree/FilteredDataProvider.test.ts | 14 +- .../tree/PresentationTreeNodeItem.test.ts | 4 +- .../test/tree/ReportingTreeNodeLoader.test.ts | 4 +- .../components/src/test/tree/Utils.test.ts | 6 +- .../src/test/tree/controlled/Helpers.ts | 8 +- .../PresentationTreeNodeRenderer.test.tsx | 14 +- .../PresentationTreeRenderer.test.tsx | 20 +- .../test/tree/controlled/TreeHooks.test.ts | 8 +- .../test/tree/controlled/TreeReloader.test.ts | 4 +- .../UseControlledTreeFiltering.test.ts | 10 +- .../UseHierarchyLevelFiltering.test.ts | 14 +- .../UsePresentationTreeState.test.ts | 10 +- .../controlled/UseUnifiedSelection.test.ts | 12 +- .../UnifiedSelectionContext.test.tsx | 4 +- .../viewport/WithUnifiedSelection.test.tsx | 8 +- packages/components/tsconfig.esm.json | 4 +- packages/components/tsconfig.json | 1 - packages/hierarchies-react/package.json | 1 - packages/testing/.mocharc.json | 2 +- packages/testing/.nycrc | 4 +- .../testing/api/presentation-testing.api.md | 16 ++ .../api/presentation-testing.exports.csv | 5 + packages/testing/package.json | 13 +- packages/testing/src/presentation-testing.ts | 15 +- .../{InternalUtils.ts => FilenameUtils.ts} | 43 +++- .../src/presentation-testing/Helpers.ts | 2 +- .../presentation-testing/IModelBuilderImpl.ts | 2 +- .../presentation-testing/IModelUtilities.ts | 6 +- .../testing/src/test/ContentBuilder.test.ts | 4 +- ...nalUtils.test.ts => FilenameUtils.test.ts} | 2 +- packages/testing/src/test/Helpers.test.ts | 2 +- .../testing/src/test/HierarchyBuilder.test.ts | 4 +- .../src/test/IModelBuilderImpl.test.ts | 4 +- .../testing/src/test/IModelUtilities.test.ts | 12 +- packages/testing/tsconfig.esm.json | 4 +- packages/unified-selection/package.json | 1 - 145 files changed, 684 insertions(+), 591 deletions(-) create mode 100644 .changeset/polite-mails-count.md create mode 100644 .changeset/selfish-parents-appear.md rename apps/full-stack-tests/src/components/unified-selection/{Hilite.test.ts => Hilite.test.tsx} (54%) rename packages/testing/src/presentation-testing/{InternalUtils.ts => FilenameUtils.ts} (71%) rename packages/testing/src/test/{InternalUtils.test.ts => FilenameUtils.test.ts} (98%) diff --git a/.changeset/polite-mails-count.md b/.changeset/polite-mails-count.md new file mode 100644 index 000000000..daaec2316 --- /dev/null +++ b/.changeset/polite-mails-count.md @@ -0,0 +1,10 @@ +--- +"@itwin/presentation-components": minor +"@itwin/presentation-testing": minor +--- + +Define `type` and `exports` attributes in `package.json`. + +The change moves this package a step closer towards dropping CommonJS support - it's now transpiled from ESM to CommonJS instead of the opposite. + +In addition, the `exports` attribute has been added to `package.json` to prohibit access to APIs that are not intended to be used by external consumers. diff --git a/.changeset/selfish-parents-appear.md b/.changeset/selfish-parents-appear.md new file mode 100644 index 000000000..8d5d44572 --- /dev/null +++ b/.changeset/selfish-parents-appear.md @@ -0,0 +1,10 @@ +--- +"@itwin/presentation-testing": minor +--- + +Export file name utility functions. + +- `getTestOutputDir` and `setTestOutputDir` - get/set functions for the global test output directory used by this package. +- `setupOutputFileLocation` - given a file name, returns a full path to the file in the test output directory. +- `createFileNameFromString` - creates a valid, sanitized file name from any string. +- `limitFilePathLength` - makes sure the given file path is shorter than 260 characters. diff --git a/apps/full-stack-tests/package.json b/apps/full-stack-tests/package.json index 33dcb1c69..7d3671e69 100644 --- a/apps/full-stack-tests/package.json +++ b/apps/full-stack-tests/package.json @@ -5,7 +5,6 @@ "private": true, "scripts": { "build": "node ./scripts/setup-tests.cjs && tsc", - "build:watch": "npm run build -- -w", "clean": "rimraf lib build", "cover": "npm run -s test", "lint": "eslint ./src/**/*.{ts,tsx}", diff --git a/apps/full-stack-tests/src/IModelUtils.ts b/apps/full-stack-tests/src/IModelUtils.ts index e0426e7ab..0c28130df 100644 --- a/apps/full-stack-tests/src/IModelUtils.ts +++ b/apps/full-stack-tests/src/IModelUtils.ts @@ -11,12 +11,7 @@ import { ECDb, ECSqlStatement } from "@itwin/core-backend"; import { BentleyError, DbResult, Guid, Id64, Id64String, OrderedId64Iterable } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { ECSqlBinding, parseFullClassName, PrimitiveValue } from "@itwin/presentation-shared"; -import { buildTestIModel, TestIModelBuilder } from "@itwin/presentation-testing"; -import { - createFileNameFromString, - limitFilePathLength, - setupOutputFileLocation, -} from "@itwin/presentation-testing/lib/cjs/presentation-testing/InternalUtils.js"; +import { buildTestIModel, createFileNameFromString, limitFilePathLength, setupOutputFileLocation, TestIModelBuilder } from "@itwin/presentation-testing"; function isBinding(value: ECSqlBinding | PrimitiveValue): value is ECSqlBinding { return typeof value === "object" && (value as ECSqlBinding).type !== undefined && (value as ECSqlBinding).value !== undefined; diff --git a/apps/full-stack-tests/src/components/unified-selection/Hilite.test.ts b/apps/full-stack-tests/src/components/unified-selection/Hilite.test.tsx similarity index 54% rename from apps/full-stack-tests/src/components/unified-selection/Hilite.test.ts rename to apps/full-stack-tests/src/components/unified-selection/Hilite.test.tsx index 42e11512d..6c9472be3 100644 --- a/apps/full-stack-tests/src/components/unified-selection/Hilite.test.ts +++ b/apps/full-stack-tests/src/components/unified-selection/Hilite.test.tsx @@ -12,12 +12,12 @@ import { insertSubCategory, insertSubject, } from "presentation-test-utilities"; -import { Id64, using } from "@itwin/core-bentley"; +import { Id64 } from "@itwin/core-bentley"; import { InstanceKey, KeySet } from "@itwin/presentation-common"; -import { ViewportSelectionHandler } from "@itwin/presentation-components/lib/cjs/presentation-components/viewport/ViewportSelectionHandler.js"; +import { viewWithUnifiedSelection } from "@itwin/presentation-components"; import { Presentation, TRANSIENT_ELEMENT_CLASSNAME } from "@itwin/presentation-frontend"; import { buildTestIModel as buildTestIModel } from "@itwin/presentation-testing"; -import { waitFor } from "@testing-library/react"; +import { render, waitFor } from "@testing-library/react"; import { initialize, terminate } from "../../IntegrationTests.js"; describe("Unified Selection", () => { @@ -29,6 +29,10 @@ describe("Unified Selection", () => { await terminate(); }); + const UnifiedSelectionComponent = viewWithUnifiedSelection(function () { + return null; + }); + describe("Hiliting selection", () => { describe("Subject", () => { it("hilites models directly under subject", async function () { @@ -42,16 +46,17 @@ describe("Unified Selection", () => { insertPhysicalModelWithPartition({ builder, codeValue: "model 2", partitionParentId: subjectKey.id }), ]; }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([subjectKey!])); - await waitFor(() => { - expect(imodel.hilited.models.toId64Array()) - .to.have.lengthOf(modelKeys.length) - .and.to.include.members(modelKeys.map((k) => k.id)); - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.isEmpty).to.be.true; - expect(imodel.selectionSet.size).to.eq(0); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([subjectKey!])); + await waitFor(() => { + expect(imodel.hilited.models.toId64Array()) + .to.have.lengthOf(modelKeys.length) + .and.to.include.members(modelKeys.map((k) => k.id)); + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.isEmpty).to.be.true; + expect(imodel.selectionSet.size).to.eq(0); }); }); @@ -69,16 +74,17 @@ describe("Unified Selection", () => { insertPhysicalModelWithPartition({ builder, codeValue: "model 2", partitionParentId: subject4.id }), ]; }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([subjectKey!])); - await waitFor(() => { - expect(imodel.hilited.models.toId64Array()) - .to.have.lengthOf(modelKeys.length) - .and.to.include.members(modelKeys.map((k) => k.id)); - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.isEmpty).to.be.true; - expect(imodel.selectionSet.size).to.eq(0); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([subjectKey!])); + await waitFor(() => { + expect(imodel.hilited.models.toId64Array()) + .to.have.lengthOf(modelKeys.length) + .and.to.include.members(modelKeys.map((k) => k.id)); + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.isEmpty).to.be.true; + expect(imodel.selectionSet.size).to.eq(0); }); }); }); @@ -90,14 +96,15 @@ describe("Unified Selection", () => { const imodel = await buildTestIModel(this, async (builder) => { modelKey = insertPhysicalModelWithPartition({ builder, codeValue: "test model" }); }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([modelKey!])); - await waitFor(() => { - expect(imodel.hilited.models.toId64Array()).to.have.lengthOf(1).and.to.include(modelKey.id); - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.isEmpty).to.be.true; - expect(imodel.selectionSet.size).to.eq(0); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([modelKey!])); + await waitFor(() => { + expect(imodel.hilited.models.toId64Array()).to.have.lengthOf(1).and.to.include(modelKey.id); + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.isEmpty).to.be.true; + expect(imodel.selectionSet.size).to.eq(0); }); }); }); @@ -115,16 +122,17 @@ describe("Unified Selection", () => { insertSubCategory({ builder, codeValue: "sub 2", parentCategoryId: categoryKey.id }), ]; }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([categoryKey!])); - await waitFor(() => { - expect(imodel.hilited.models.isEmpty).to.be.true; - expect(imodel.hilited.subcategories.toId64Array()) - .to.have.lengthOf(subCategoryKeys.length) - .and.to.include.members(subCategoryKeys.map((k) => k.id)); - expect(imodel.hilited.elements.isEmpty).to.be.true; - expect(imodel.selectionSet.size).to.eq(0); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([categoryKey!])); + await waitFor(() => { + expect(imodel.hilited.models.isEmpty).to.be.true; + expect(imodel.hilited.subcategories.toId64Array()) + .to.have.lengthOf(subCategoryKeys.length) + .and.to.include.members(subCategoryKeys.map((k) => k.id)); + expect(imodel.hilited.elements.isEmpty).to.be.true; + expect(imodel.selectionSet.size).to.eq(0); }); }); @@ -135,14 +143,15 @@ describe("Unified Selection", () => { categoryKey = insertSpatialCategory({ builder, codeValue: "test category" }); }); const subCategoryKey = getDefaultSubcategoryKey(categoryKey!.id); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([subCategoryKey])); - await waitFor(() => { - expect(imodel.hilited.models.isEmpty).to.be.true; - expect(imodel.hilited.subcategories.toId64Array()).to.have.lengthOf(1).and.to.include(subCategoryKey.id); - expect(imodel.hilited.elements.isEmpty).to.be.true; - expect(imodel.selectionSet.size).to.eq(0); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([subCategoryKey])); + await waitFor(() => { + expect(imodel.hilited.models.isEmpty).to.be.true; + expect(imodel.hilited.subcategories.toId64Array()).to.have.lengthOf(1).and.to.include(subCategoryKey.id); + expect(imodel.hilited.elements.isEmpty).to.be.true; + expect(imodel.selectionSet.size).to.eq(0); }); }); }); @@ -174,18 +183,19 @@ describe("Unified Selection", () => { const element5 = insertPhysicalElement({ builder, userLabel: "element 5", modelId: modelKey.id, categoryId: categoryKey.id, parentId: element3.id }); expectedHighlightedElementKeys = [assemblyKey, element2, element3, element4, element5]; }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([assemblyKey!])); - await waitFor(() => { - expect(imodel.hilited.models.isEmpty).to.be.true; - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.toId64Array()) - .to.have.lengthOf(expectedHighlightedElementKeys.length) - .and.to.include.members(expectedHighlightedElementKeys.map((k) => k.id)); - expect([...imodel.selectionSet.elements]) - .to.have.lengthOf(expectedHighlightedElementKeys.length) - .and.to.include.members(expectedHighlightedElementKeys.map((k) => k.id)); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([assemblyKey!])); + await waitFor(() => { + expect(imodel.hilited.models.isEmpty).to.be.true; + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.toId64Array()) + .to.have.lengthOf(expectedHighlightedElementKeys.length) + .and.to.include.members(expectedHighlightedElementKeys.map((k) => k.id)); + expect([...imodel.selectionSet.elements]) + .to.have.lengthOf(expectedHighlightedElementKeys.length) + .and.to.include.members(expectedHighlightedElementKeys.map((k) => k.id)); }); }); @@ -197,16 +207,17 @@ describe("Unified Selection", () => { const categoryKey = insertSpatialCategory({ builder, codeValue: "test category" }); elementKey = insertPhysicalElement({ builder, userLabel: "element", modelId: modelKey.id, categoryId: categoryKey.id }); }); - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([elementKey!])); - await waitFor(() => { - expect(imodel.hilited.models.isEmpty).to.be.true; - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(elementKey.id); - expect([...imodel.selectionSet.elements]) - .to.have.lengthOf(1) - .and.to.include(elementKey.id); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([elementKey!])); + await waitFor(() => { + expect(imodel.hilited.models.isEmpty).to.be.true; + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(elementKey.id); + expect([...imodel.selectionSet.elements]) + .to.have.lengthOf(1) + .and.to.include(elementKey.id); }); }); @@ -214,16 +225,17 @@ describe("Unified Selection", () => { // eslint-disable-next-line deprecation/deprecation const imodel = await buildTestIModel(this, async (_) => {}); const transientElementKey = { className: TRANSIENT_ELEMENT_CLASSNAME, id: Id64.fromLocalAndBriefcaseIds(123, 0xffffff) }; - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - Presentation.selection.replaceSelection("", imodel, new KeySet([transientElementKey])); - await waitFor(() => { - expect(imodel.hilited.models.isEmpty).to.be.true; - expect(imodel.hilited.subcategories.isEmpty).to.be.true; - expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); - expect([...imodel.selectionSet.elements]) - .to.have.lengthOf(1) - .and.to.include(transientElementKey.id); - }); + + render(); + + Presentation.selection.replaceSelection("", imodel, new KeySet([transientElementKey])); + await waitFor(() => { + expect(imodel.hilited.models.isEmpty).to.be.true; + expect(imodel.hilited.subcategories.isEmpty).to.be.true; + expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); + expect([...imodel.selectionSet.elements]) + .to.have.lengthOf(1) + .and.to.include(transientElementKey.id); }); }); @@ -231,27 +243,28 @@ describe("Unified Selection", () => { // eslint-disable-next-line deprecation/deprecation const imodel = await buildTestIModel(this, async (_) => {}); const transientElementKey = { className: TRANSIENT_ELEMENT_CLASSNAME, id: Id64.fromLocalAndBriefcaseIds(123, 0xffffff) }; - await using(new ViewportSelectionHandler({ imodel }), async (_) => { - // set up the selection to contain a transient element - Presentation.selection.replaceSelection("", imodel, new KeySet([transientElementKey])); - await waitFor(() => { - expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); - expect([...imodel.selectionSet.elements]) - .to.have.lengthOf(1) - .and.to.include(transientElementKey.id); - }); - // remove and add back the transient element - imodel.selectionSet.remove(transientElementKey.id); - imodel.selectionSet.replace(transientElementKey.id); + render(); - // expect the transient element to be both hilited and selected - await waitFor(() => { - expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); - expect([...imodel.selectionSet.elements]) - .to.have.lengthOf(1) - .and.to.include(transientElementKey.id); - }); + // set up the selection to contain a transient element + Presentation.selection.replaceSelection("", imodel, new KeySet([transientElementKey])); + await waitFor(() => { + expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); + expect([...imodel.selectionSet.elements]) + .to.have.lengthOf(1) + .and.to.include(transientElementKey.id); + }); + + // remove and add back the transient element + imodel.selectionSet.remove(transientElementKey.id); + imodel.selectionSet.replace(transientElementKey.id); + + // expect the transient element to be both hilited and selected + await waitFor(() => { + expect(imodel.hilited.elements.toId64Array()).to.have.lengthOf(1).and.to.include(transientElementKey.id); + expect([...imodel.selectionSet.elements]) + .to.have.lengthOf(1) + .and.to.include(transientElementKey.id); }); }); }); diff --git a/apps/full-stack-tests/src/hierarchies/HierarchyFiltering.test.ts b/apps/full-stack-tests/src/hierarchies/HierarchyFiltering.test.ts index dcdc603f8..7324a45dc 100644 --- a/apps/full-stack-tests/src/hierarchies/HierarchyFiltering.test.ts +++ b/apps/full-stack-tests/src/hierarchies/HierarchyFiltering.test.ts @@ -30,7 +30,7 @@ import { mergeProviders, } from "@itwin/presentation-hierarchies"; import { createBisInstanceLabelSelectClauseFactory, ECSqlBinding, InstanceKey } from "@itwin/presentation-shared"; -import { createFileNameFromString } from "@itwin/presentation-testing/lib/cjs/presentation-testing/InternalUtils.js"; +import { createFileNameFromString } from "@itwin/presentation-testing"; import { buildIModel, importSchema, withECDb } from "../IModelUtils.js"; import { initialize, terminate } from "../IntegrationTests.js"; import { NodeValidators, validateHierarchy } from "./HierarchyValidation.js"; diff --git a/apps/full-stack-tests/src/hierarchies/Update.test.ts b/apps/full-stack-tests/src/hierarchies/Update.test.ts index 0922179e0..b784820c0 100644 --- a/apps/full-stack-tests/src/hierarchies/Update.test.ts +++ b/apps/full-stack-tests/src/hierarchies/Update.test.ts @@ -40,7 +40,7 @@ import { ECSchemaRpcImpl } from "@itwin/ecschema-rpcinterface-impl"; import { registerTxnListeners } from "@itwin/presentation-core-interop"; import { createNodesQueryClauseFactory, HierarchyDefinition } from "@itwin/presentation-hierarchies"; import { createBisInstanceLabelSelectClauseFactory, ECSql } from "@itwin/presentation-shared"; -import { createFileNameFromString, setupOutputFileLocation } from "@itwin/presentation-testing/lib/cjs/presentation-testing/InternalUtils.js"; +import { createFileNameFromString, setupOutputFileLocation } from "@itwin/presentation-testing"; import { NodeValidators, validateHierarchyLevel } from "./HierarchyValidation.js"; import { createClassECSqlSelector, createIModelAccess, createProvider } from "./Utils.js"; diff --git a/apps/performance-tests/package.json b/apps/performance-tests/package.json index 54e6e0c82..18223de9a 100644 --- a/apps/performance-tests/package.json +++ b/apps/performance-tests/package.json @@ -6,7 +6,6 @@ "benchmark:hierarchies": "npm run test:hierarchies -- -O BENCHMARK_OUTPUT_PATH=./hierarchies-benchmark.json", "benchmark:unified-selection": "npm run test:unified-selection -- -O BENCHMARK_OUTPUT_PATH=./unified-selection-benchmark.json", "build": "tsc", - "build:watch": "tsc -w", "clean": "rimraf lib temp", "docs": "betools extract --fileExt=ts --extractFrom=./src --recursive --out=./build/docs/extract", "lint": "eslint \"./src/**/*.ts\"", diff --git a/packages/components/.mocharc.json b/packages/components/.mocharc.json index ecf6ab4bf..83d3fea22 100644 --- a/packages/components/.mocharc.json +++ b/packages/components/.mocharc.json @@ -1,5 +1,5 @@ { - "require": ["ignore-styles", "./lib/cjs/test/setup"], + "require": ["ignore-styles", "./lib/cjs/test/setup.js"], "checkLeaks": true, "global": ["IS_REACT_ACT_ENVIRONMENT", "__iui"], "timeout": 60000, diff --git a/packages/components/.nycrc b/packages/components/.nycrc index e5c7ead2f..9e2511fd0 100644 --- a/packages/components/.nycrc +++ b/packages/components/.nycrc @@ -4,9 +4,7 @@ "functions": 100, "branches": 100, "lines": 100, - "include": ["src/**/*", "lib/cjs/**/*"], - "exclude": ["src/presentation-components.ts", "src/test/**", "lib/cjs/test/**"], - "extension": [".ts", ".tsx"], + "include": ["src/presentation-components/**/*", "lib/cjs/presentation-components/**/*"], "temp-dir": "./lib/test/coverage/.nyc_output", "report-dir": "./lib/test/coverage", "reporter": ["text-summary", "lcov", "cobertura"] diff --git a/packages/components/api/presentation-components.api.md b/packages/components/api/presentation-components.api.md index 59d6397b7..1f3f901fc 100644 --- a/packages/components/api/presentation-components.api.md +++ b/packages/components/api/presentation-components.api.md @@ -35,6 +35,7 @@ import { IPropertyValueRenderer } from '@itwin/components-react'; import { ITreeDataProvider } from '@itwin/components-react'; import { ITreeNodeLoader } from '@itwin/components-react'; import { JSX as JSX_2 } from 'react/jsx-runtime'; +import { JSX as JSX_3 } from 'react/jsx-runtime.js'; import { Keys } from '@itwin/presentation-common'; import { KeySet } from '@itwin/presentation-common'; import { Memoized } from 'micro-memoize'; @@ -286,7 +287,7 @@ export class InstanceKeyValueRenderer implements IPropertyValueRenderer { // (undocumented) canRender(record: PropertyRecord): boolean; // (undocumented) - render(record: PropertyRecord, context?: PropertyValueRendererContext): JSX_2.Element; + render(record: PropertyRecord, context?: PropertyValueRendererContext): JSX_3.Element; } // @public @@ -335,7 +336,7 @@ export interface IUnifiedSelectionComponent { export const NavigationPropertyEditor: new () => PropertyEditorBase; // @public -export function NavigationPropertyEditorContextProvider({ children, ...props }: PropsWithChildren): JSX_2.Element; +export function NavigationPropertyEditorContextProvider({ children, ...props }: PropsWithChildren): JSX_3.Element; // @public export interface NavigationPropertyEditorContextProviderProps { @@ -364,7 +365,7 @@ export enum PresentationComponentsLoggerCategory { } // @public -export function PresentationFilterBuilderValueRenderer({ imodel, descriptor, descriptorInputKeys, selectedClasses, ...props }: PresentationFilterBuilderValueRendererProps): JSX_2.Element; +export function PresentationFilterBuilderValueRenderer({ imodel, descriptor, descriptorInputKeys, selectedClasses, ...props }: PresentationFilterBuilderValueRendererProps): JSX_3.Element; // @public export interface PresentationFilterBuilderValueRendererProps extends PropertyFilterBuilderRuleValueRendererProps { @@ -396,7 +397,7 @@ export namespace PresentationInstanceFilter { } // @public -export function PresentationInstanceFilterBuilder(props: PresentationInstanceFilterBuilderProps): JSX_2.Element; +export function PresentationInstanceFilterBuilder(props: PresentationInstanceFilterBuilderProps): JSX_3.Element; // @public export interface PresentationInstanceFilterBuilderProps { @@ -512,7 +513,7 @@ export interface PresentationPropertyDataProviderProps extends DiagnosticsProps } // @public -export function PresentationTree({ state, ...props }: PresentationTreeProps): JSX_2.Element; +export function PresentationTree({ state, ...props }: PresentationTreeProps): JSX_3.Element; // @public export class PresentationTreeDataProvider implements IPresentationTreeDataProvider, IDisposable { @@ -628,7 +629,7 @@ export type PresentationTreeProps = Omit }; // @public -export function PresentationTreeRenderer(props: PresentationTreeRendererProps): JSX_2.Element; +export function PresentationTreeRenderer(props: PresentationTreeRendererProps): JSX_3.Element; // @public export interface PresentationTreeRendererProps extends Omit { @@ -808,7 +809,7 @@ export interface UseHierarchyLevelFilteringProps { // @public export function useInstanceFilterPropertyInfos({ descriptor }: UseInstanceFilterPropertyInfosProps): { propertyInfos: PresentationInstanceFilterPropertyInfo[]; - propertyRenderer: (name: string) => JSX_2.Element; + propertyRenderer: (name: string) => JSX_3.Element; }; // @public diff --git a/packages/components/package.json b/packages/components/package.json index 728cb0352..f9f443516 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -22,23 +22,29 @@ "name": "Bentley Systems, Inc.", "url": "http://www.bentley.com" }, + "type": "module", "main": "lib/cjs/presentation-components.js", + "types": "lib/cjs/presentation-components", "module": "lib/esm/presentation-components.js", - "types": "lib/cjs/presentation-components.d.ts", + "exports": { + ".": { + "import": "./lib/esm/presentation-components.js", + "require": "./lib/cjs/presentation-components.js" + }, + "./package.json": "./package.json" + }, "scripts": { "build": "npm run -s copy:locale && npm run -s build:cjs && npm run -s build:esm", - "build:cjs": "npm run -s copy:cjs && tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/package-cjs.mjs ./lib/cjs && npm run -s copy:cjs && tsc -p tsconfig.cjs.json", "build:esm": "npm run -s copy:esm && tsc -p tsconfig.esm.json", "copy:locale": "cpx \"./public/**/*\" ./lib/public", "copy:cjs": "cpx \"./src/**/*.{scss,json}\" ./lib/cjs", "copy:esm": "cpx \"./src/**/*.{scss,json}\" ./lib/esm", - "build:watch": "npm run -s build:cjs -- -w", "clean": "rimraf lib build", "cover": "nyc npm -s test", "lint": "eslint ./src/**/*.{ts,tsx}", "test": "mocha --enable-source-maps --parallel --config ./.mocharc.json", "test:dev": "mocha --enable-source-maps --config ./.mocharc.json", - "test:watch": "npm run -s test:dev -- --reporter min --watch-extensions ts,tsx --watch", "docs": "npm run -s docs:extract && npm run -s docs:reference && npm run -s docs:changelog", "docs:changelog": "cpx ./CHANGELOG.md ./build/docs/reference/presentation-components", "docs:reference": "cross-env NODE_PROJECT_ROOT_DIRECTORY=../../ betools docs --includes=./build/docs/extract --json=./build/docs/reference/presentation-components/file.json --tsIndexFile=presentation-components.ts --onlyJson", diff --git a/packages/components/src/presentation-components.ts b/packages/components/src/presentation-components.ts index d575e3d21..7204df6b6 100644 --- a/packages/components/src/presentation-components.ts +++ b/packages/components/src/presentation-components.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ /* eslint-disable deprecation/deprecation */ import { Presentation } from "@itwin/presentation-frontend"; -import { initializeLocalization, initializePropertyValueRenderers } from "./presentation-components/common/Utils"; +import { initializeLocalization, initializePropertyValueRenderers } from "./presentation-components/common/Utils.js"; /** * @module Core @@ -12,14 +12,14 @@ import { initializeLocalization, initializePropertyValueRenderers } from "./pres * @docs-group-description Core * Common types used all across ($presentation-components) package. */ -export * from "./presentation-components/common/ContentDataProvider"; -export * from "./presentation-components/common/Diagnostics"; -export * from "./presentation-components/common/IPresentationDataProvider"; -export * from "./presentation-components/common/IUnifiedSelectionComponent"; -export * from "./presentation-components/common/PropertyRecordsBuilder"; -export * from "./presentation-components/common/SchemaMetadataContext"; -export { PortalTargetContextProvider, type PortalTargetContextProviderProps } from "./presentation-components/common/PortalTargetContext"; -export * from "./presentation-components/hooks/UseRulesetRegistration"; +export * from "./presentation-components/common/ContentDataProvider.js"; +export * from "./presentation-components/common/Diagnostics.js"; +export * from "./presentation-components/common/IPresentationDataProvider.js"; +export * from "./presentation-components/common/IUnifiedSelectionComponent.js"; +export * from "./presentation-components/common/PropertyRecordsBuilder.js"; +export * from "./presentation-components/common/SchemaMetadataContext.js"; +export { PortalTargetContextProvider, type PortalTargetContextProviderProps } from "./presentation-components/common/PortalTargetContext.js"; +export * from "./presentation-components/hooks/UseRulesetRegistration.js"; /** * @module Logging @@ -27,7 +27,7 @@ export * from "./presentation-components/hooks/UseRulesetRegistration"; * @docs-group-description Logging * Types related to logging in ($presentation-components) package. */ -export * from "./presentation-components/ComponentsLoggerCategory"; +export * from "./presentation-components/ComponentsLoggerCategory.js"; /** * @module Properties @@ -35,8 +35,8 @@ export * from "./presentation-components/ComponentsLoggerCategory"; * @docs-group-description Properties * Presentation-specific [Properties]($components-react:Properties). */ -export * from "./presentation-components/properties/InstanceKeyValueRenderer"; -export * from "./presentation-components/properties/editors"; +export * from "./presentation-components/properties/InstanceKeyValueRenderer.js"; +export * from "./presentation-components/properties/editors/index.js"; /** * @module PropertyGrid @@ -44,13 +44,13 @@ export * from "./presentation-components/properties/editors"; * @docs-group-description PropertyGrid * Presentation features for [VirtualizedPropertyGrid]($components-react) component. */ -export * from "./presentation-components/propertygrid/DataProvider"; -export * from "./presentation-components/propertygrid/FavoritePropertiesDataFilterer"; +export * from "./presentation-components/propertygrid/DataProvider.js"; +export * from "./presentation-components/propertygrid/FavoritePropertiesDataFilterer.js"; export { PropertyDataProviderWithUnifiedSelectionProps, UsePropertyDataProviderWithUnifiedSelectionResult, usePropertyDataProviderWithUnifiedSelection, -} from "./presentation-components/propertygrid/UseUnifiedSelection"; +} from "./presentation-components/propertygrid/UseUnifiedSelection.js"; /** * @module FavoriteProperties @@ -58,7 +58,7 @@ export { * @docs-group-description FavoriteProperties * Presentation features for [Favorite properties]($components-react:Favorite). */ -export * from "./presentation-components/favorite-properties/DataProvider"; +export * from "./presentation-components/favorite-properties/DataProvider.js"; /** * @module Tree @@ -66,16 +66,16 @@ export * from "./presentation-components/favorite-properties/DataProvider"; * @docs-group-description Tree * Presentation features for [Tree]($components-react:Tree) component. */ -export * from "./presentation-components/tree/DataProvider"; -export * from "./presentation-components/tree/IPresentationTreeDataProvider"; -export * from "./presentation-components/tree/PresentationTreeNodeItem"; -export * from "./presentation-components/tree/controlled/PresentationTree"; -export * from "./presentation-components/tree/controlled/PresentationTreeNodeRenderer"; -export * from "./presentation-components/tree/controlled/PresentationTreeRenderer"; -export * from "./presentation-components/tree/controlled/TreeHooks"; -export * from "./presentation-components/tree/controlled/UseHierarchyLevelFiltering"; -export * from "./presentation-components/tree/controlled/UsePresentationTreeState"; -export * from "./presentation-components/tree/controlled/UseUnifiedSelection"; +export * from "./presentation-components/tree/DataProvider.js"; +export * from "./presentation-components/tree/IPresentationTreeDataProvider.js"; +export * from "./presentation-components/tree/PresentationTreeNodeItem.js"; +export * from "./presentation-components/tree/controlled/PresentationTree.js"; +export * from "./presentation-components/tree/controlled/PresentationTreeNodeRenderer.js"; +export * from "./presentation-components/tree/controlled/PresentationTreeRenderer.js"; +export * from "./presentation-components/tree/controlled/TreeHooks.js"; +export * from "./presentation-components/tree/controlled/UseHierarchyLevelFiltering.js"; +export * from "./presentation-components/tree/controlled/UsePresentationTreeState.js"; +export * from "./presentation-components/tree/controlled/UseUnifiedSelection.js"; /** * @module Table @@ -83,9 +83,9 @@ export * from "./presentation-components/tree/controlled/UseUnifiedSelection"; * @docs-group-description Table * Presentation features for Table component. */ -export * from "./presentation-components/table/UsePresentationTable"; -export * from "./presentation-components/table/Types"; -export * from "./presentation-components/table/CellRenderer"; +export * from "./presentation-components/table/UsePresentationTable.js"; +export * from "./presentation-components/table/Types.js"; +export * from "./presentation-components/table/CellRenderer.js"; /** * @module Viewport @@ -94,7 +94,7 @@ export * from "./presentation-components/table/CellRenderer"; * Presentation features for [ViewportComponent]($imodel-components-react). */ // eslint-disable-next-line deprecation/deprecation -export { viewWithUnifiedSelection, ViewWithUnifiedSelectionProps } from "./presentation-components/viewport/WithUnifiedSelection"; +export { viewWithUnifiedSelection, ViewWithUnifiedSelectionProps } from "./presentation-components/viewport/WithUnifiedSelection.js"; /** * @module DisplayLabels @@ -102,7 +102,7 @@ export { viewWithUnifiedSelection, ViewWithUnifiedSelectionProps } from "./prese * @docs-group-description DisplayLabels * Types related to display labels. */ -export * from "./presentation-components/labels/LabelsProvider"; +export * from "./presentation-components/labels/LabelsProvider.js"; /** * @module UnifiedSelection @@ -110,7 +110,7 @@ export * from "./presentation-components/labels/LabelsProvider"; * @docs-group-description UnifiedSelection * Utilities for working with [Unified Selection]($docs/presentation/unified-selection/index.md) within [React](https://reactjs.org/) components. */ -export * from "./presentation-components/unified-selection/UnifiedSelectionContext"; +export * from "./presentation-components/unified-selection/UnifiedSelectionContext.js"; /** * @module InstancesFilter @@ -118,9 +118,9 @@ export * from "./presentation-components/unified-selection/UnifiedSelectionConte * @docs-group-description InstancesFilter * Utilities for creating filters for filtering presentation data. */ -export * from "./presentation-components/instance-filter-builder/PresentationInstanceFilter"; -export * from "./presentation-components/instance-filter-builder/PresentationInstanceFilterDialog"; -export * from "./presentation-components/instance-filter-builder/PresentationFilterBuilder"; +export * from "./presentation-components/instance-filter-builder/PresentationInstanceFilter.js"; +export * from "./presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.js"; +export * from "./presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; /** * @module Internal diff --git a/packages/components/src/presentation-components/common/ContentBuilder.ts b/packages/components/src/presentation-components/common/ContentBuilder.ts index 0d9c65e74..49656fde5 100644 --- a/packages/components/src/presentation-components/common/ContentBuilder.ts +++ b/packages/components/src/presentation-components/common/ContentBuilder.ts @@ -37,8 +37,8 @@ import { StartStructProps, TypeDescription, } from "@itwin/presentation-common"; -import { NumericEditorName } from "../properties/editors/NumericPropertyEditor"; -import { QuantityEditorName } from "../properties/editors/QuantityPropertyEditor"; +import { NumericEditorName } from "../properties/editors/NumericPropertyEditor.js"; +import { QuantityEditorName } from "../properties/editors/QuantityPropertyEditor.js"; /** @internal */ export interface FieldInfo { diff --git a/packages/components/src/presentation-components/common/ContentDataProvider.ts b/packages/components/src/presentation-components/common/ContentDataProvider.ts index ad7439f09..f73a209df 100644 --- a/packages/components/src/presentation-components/common/ContentDataProvider.ts +++ b/packages/components/src/presentation-components/common/ContentDataProvider.ts @@ -6,7 +6,6 @@ * @module Core */ -import memoize from "micro-memoize"; import { PropertyDescription, PropertyRecord } from "@itwin/appui-abstract"; import { Logger } from "@itwin/core-bentley"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; @@ -26,10 +25,10 @@ import { SelectionInfo, } from "@itwin/presentation-common"; import { IModelContentChangeEventArgs, Presentation } from "@itwin/presentation-frontend"; -import { PresentationComponentsLoggerCategory } from "../ComponentsLoggerCategory"; -import { createDiagnosticsOptions, DiagnosticsProps } from "./Diagnostics"; -import { IPresentationDataProvider } from "./IPresentationDataProvider"; -import { findField, getRulesetId, RulesetOrId } from "./Utils"; +import { PresentationComponentsLoggerCategory } from "../ComponentsLoggerCategory.js"; +import { createDiagnosticsOptions, DiagnosticsProps } from "./Diagnostics.js"; +import { IPresentationDataProvider } from "./IPresentationDataProvider.js"; +import { findField, getRulesetId, memoize, RulesetOrId } from "./Utils.js"; /** * Properties for invalidating content cache. diff --git a/packages/components/src/presentation-components/common/PropertyRecordsBuilder.ts b/packages/components/src/presentation-components/common/PropertyRecordsBuilder.ts index 1ae48cb0e..0a9ecfa2c 100644 --- a/packages/components/src/presentation-components/common/PropertyRecordsBuilder.ts +++ b/packages/components/src/presentation-components/common/PropertyRecordsBuilder.ts @@ -20,7 +20,7 @@ import { StartItemProps, StartStructProps, } from "@itwin/presentation-common"; -import { FieldHierarchyRecord, InternalPropertyRecordsBuilder } from "./ContentBuilder"; +import { FieldHierarchyRecord, InternalPropertyRecordsBuilder } from "./ContentBuilder.js"; /** * A `Content` visitor that traverses all content, creates a `PropertyRecord` for each property diff --git a/packages/components/src/presentation-components/common/Utils.ts b/packages/components/src/presentation-components/common/Utils.ts index 792f0f42c..fb31e6bc1 100644 --- a/packages/components/src/presentation-components/common/Utils.ts +++ b/packages/components/src/presentation-components/common/Utils.ts @@ -6,6 +6,7 @@ * @module Core */ +import * as mm from "micro-memoize"; import { LegacyRef, MutableRefObject, RefCallback, useCallback, useEffect, useState } from "react"; import { Primitives, PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { IPropertyValueRenderer, PropertyValueRendererManager } from "@itwin/components-react"; @@ -13,7 +14,7 @@ import { Guid, GuidString, IDisposable } from "@itwin/core-bentley"; import { TranslationOptions } from "@itwin/core-common"; import { Descriptor, Field, LabelCompositeValue, LabelDefinition, parseCombinedFieldNames, Ruleset, Value } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { InstanceKeyValueRenderer } from "../properties/InstanceKeyValueRenderer"; +import { InstanceKeyValueRenderer } from "../properties/InstanceKeyValueRenderer.js"; const localizationNamespaceName = "PresentationComponents"; @@ -262,3 +263,8 @@ export function deserializeUniqueValues(serializedDisplayValues: string, seriali } return uniqueValues; } + +export function memoize(fn: Fn | mm.Memoized, options?: mm.Options): mm.Memoized { + const microMemoize = mm.default as unknown as (fn: Fn | mm.Memoized, options?: mm.Options) => mm.Memoized; + return microMemoize(fn, options); +} diff --git a/packages/components/src/presentation-components/favorite-properties/DataProvider.ts b/packages/components/src/presentation-components/favorite-properties/DataProvider.ts index d4ad73986..29d4b2821 100644 --- a/packages/components/src/presentation-components/favorite-properties/DataProvider.ts +++ b/packages/components/src/presentation-components/favorite-properties/DataProvider.ts @@ -11,8 +11,8 @@ import { Id64Arg, using } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { KeySet, Ruleset } from "@itwin/presentation-common"; import { createSelectionScopeProps, Presentation } from "@itwin/presentation-frontend"; -import { PresentationPropertyDataProvider } from "../propertygrid/DataProvider"; -import { getFavoritesCategory } from "./Utils"; +import { PresentationPropertyDataProvider } from "../propertygrid/DataProvider.js"; +import { getFavoritesCategory } from "./Utils.js"; /** * An data provider interface for returning favorite properties for the given elements diff --git a/packages/components/src/presentation-components/favorite-properties/Utils.ts b/packages/components/src/presentation-components/favorite-properties/Utils.ts index 444bc2a05..8690d7eaf 100644 --- a/packages/components/src/presentation-components/favorite-properties/Utils.ts +++ b/packages/components/src/presentation-components/favorite-properties/Utils.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { CategoryDescription } from "@itwin/presentation-common"; -import { translate } from "../common/Utils"; +import { translate } from "../common/Utils.js"; /** @internal */ export const FAVORITES_CATEGORY_NAME = "Favorite"; diff --git a/packages/components/src/presentation-components/hooks/UseRulesetRegistration.ts b/packages/components/src/presentation-components/hooks/UseRulesetRegistration.ts index cedf99405..9ce7c3f2e 100644 --- a/packages/components/src/presentation-components/hooks/UseRulesetRegistration.ts +++ b/packages/components/src/presentation-components/hooks/UseRulesetRegistration.ts @@ -9,7 +9,7 @@ import { useCallback } from "react"; import { useDisposable } from "@itwin/core-react"; import { Ruleset } from "@itwin/presentation-common"; -import { RulesetRegistrationHelper } from "../common/RulesetRegistrationHelper"; +import { RulesetRegistrationHelper } from "../common/RulesetRegistrationHelper.js"; /** * Custom hook which registers supplied Ruleset on mount and removes on unmount. diff --git a/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterBuilder.tsx b/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterBuilder.tsx index ff895cda1..b9a6bda50 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterBuilder.tsx +++ b/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterBuilder.tsx @@ -16,10 +16,10 @@ import { PropertyFilterBuilderRenderer, PropertyFilterBuilderRendererProps, Prop import { IModelConnection } from "@itwin/core-frontend"; import { Alert, ComboBox, SelectOption } from "@itwin/itwinui-react"; import { ClassInfo, Descriptor, Keys } from "@itwin/presentation-common"; -import { translate } from "../common/Utils"; -import { getIModelMetadataProvider } from "./ECMetadataProvider"; -import { PresentationFilterBuilderValueRenderer, PresentationInstanceFilterPropertyInfo, useInstanceFilterPropertyInfos } from "./PresentationFilterBuilder"; -import { isFilterNonEmpty } from "./Utils"; +import { translate } from "../common/Utils.js"; +import { getIModelMetadataProvider } from "./ECMetadataProvider.js"; +import { PresentationFilterBuilderValueRenderer, PresentationInstanceFilterPropertyInfo, useInstanceFilterPropertyInfos } from "./PresentationFilterBuilder.js"; +import { isFilterNonEmpty } from "./Utils.js"; /** * Props for [[InstanceFilterBuilder]] component. diff --git a/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterConverter.ts b/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterConverter.ts index d8acb705f..4c8bf0b49 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterConverter.ts +++ b/packages/components/src/presentation-components/instance-filter-builder/InstanceFilterConverter.ts @@ -19,8 +19,8 @@ import { } from "@itwin/core-common"; import { IModelConnection } from "@itwin/core-frontend"; import { ClassInfo } from "@itwin/presentation-common"; -import { getIModelMetadataProvider } from "./ECMetadataProvider"; -import { PresentationInstanceFilter } from "./PresentationInstanceFilter"; +import { getIModelMetadataProvider } from "./ECMetadataProvider.js"; +import { PresentationInstanceFilter } from "./PresentationInstanceFilter.js"; /** @internal */ export async function findBaseExpressionClassName(imodel: IModelConnection, propertyClassNames: string[]) { diff --git a/packages/components/src/presentation-components/instance-filter-builder/PresentationFilterBuilder.tsx b/packages/components/src/presentation-components/instance-filter-builder/PresentationFilterBuilder.tsx index fa2a5f743..ebe0e9b43 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/PresentationFilterBuilder.tsx +++ b/packages/components/src/presentation-components/instance-filter-builder/PresentationFilterBuilder.tsx @@ -12,13 +12,13 @@ import { PropertyFilterBuilderRuleValue, PropertyFilterBuilderRuleValueRendererP import { assert } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { ClassId, ClassInfo, Descriptor, InstanceFilterDefinition, Keys, PropertiesField } from "@itwin/presentation-common"; -import { NavigationPropertyEditorContextProvider } from "../properties/editors/NavigationPropertyEditorContext"; -import { UniquePropertyValuesSelector } from "../properties/inputs/UniquePropertyValuesSelector"; -import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "./InstanceFilterBuilder"; -import { createFilterClassExpression, createInstanceFilterDefinitionBase } from "./InstanceFilterConverter"; -import { PresentationInstanceFilter, PresentationInstanceFilterConditionGroup } from "./PresentationInstanceFilter"; -import { PresentationInstanceFilterProperty } from "./PresentationInstanceFilterProperty"; -import { createInstanceFilterPropertyInfos, useFilterBuilderNavigationPropertyEditorContextProviderProps } from "./Utils"; +import { NavigationPropertyEditorContextProvider } from "../properties/editors/NavigationPropertyEditorContext.js"; +import { UniquePropertyValuesSelector } from "../properties/inputs/UniquePropertyValuesSelector.js"; +import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "./InstanceFilterBuilder.js"; +import { createFilterClassExpression, createInstanceFilterDefinitionBase } from "./InstanceFilterConverter.js"; +import { PresentationInstanceFilter, PresentationInstanceFilterConditionGroup } from "./PresentationInstanceFilter.js"; +import { PresentationInstanceFilterProperty } from "./PresentationInstanceFilterProperty.js"; +import { createInstanceFilterPropertyInfos, useFilterBuilderNavigationPropertyEditorContextProviderProps } from "./Utils.js"; /** * Function that checks if supplied [[PresentationInstanceFilter]] is [[PresentationInstanceFilterConditionGroup]]. diff --git a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilter.ts b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilter.ts index ad0e2d0fc..ddcad297a 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilter.ts +++ b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilter.ts @@ -35,8 +35,8 @@ import { RelationshipPath, Value, } from "@itwin/presentation-common"; -import { deserializeUniqueValues, findField, serializeUniqueValues, UniqueValue } from "../common/Utils"; -import { createPropertyInfoFromPropertiesField, getInstanceFilterFieldName } from "./Utils"; +import { deserializeUniqueValues, findField, serializeUniqueValues, UniqueValue } from "../common/Utils.js"; +import { createPropertyInfoFromPropertiesField, getInstanceFilterFieldName } from "./Utils.js"; /** * Type that describes instance filter based on [Descriptor]($presentation-common) fields. It can be diff --git a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.tsx b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.tsx index af900d22c..de4f630b3 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.tsx +++ b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.tsx @@ -14,11 +14,11 @@ import { IModelConnection } from "@itwin/core-frontend"; import { SvgError } from "@itwin/itwinui-illustrations-react"; import { Button, Dialog, NonIdealState, ProgressRadial } from "@itwin/itwinui-react"; import { Descriptor, Keys } from "@itwin/presentation-common"; -import { translate, useDelay } from "../common/Utils"; -import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "./InstanceFilterBuilder"; -import { PresentationInstanceFilterInfo } from "./PresentationFilterBuilder"; -import { PresentationInstanceFilter } from "./PresentationInstanceFilter"; -import { filterRuleValidator, isFilterNonEmpty } from "./Utils"; +import { translate, useDelay } from "../common/Utils.js"; +import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "./InstanceFilterBuilder.js"; +import { PresentationInstanceFilterInfo } from "./PresentationFilterBuilder.js"; +import { PresentationInstanceFilter } from "./PresentationInstanceFilter.js"; +import { filterRuleValidator, isFilterNonEmpty } from "./Utils.js"; /** * Data structure that describes source to gather properties from. diff --git a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterProperty.tsx b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterProperty.tsx index a26511f38..b9b0f8f8b 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterProperty.tsx +++ b/packages/components/src/presentation-components/instance-filter-builder/PresentationInstanceFilterProperty.tsx @@ -9,7 +9,7 @@ import "./PresentationInstanceFilterProperty.scss"; import { PropertyDescription } from "@itwin/appui-abstract"; import { Badge, Text, Tooltip } from "@itwin/itwinui-react"; -import { translate } from "../common/Utils"; +import { translate } from "../common/Utils.js"; /** * Props for [[PresentationInstanceFilterProperty]] component. diff --git a/packages/components/src/presentation-components/instance-filter-builder/Utils.ts b/packages/components/src/presentation-components/instance-filter-builder/Utils.ts index 6cbb97d68..910a738f2 100644 --- a/packages/components/src/presentation-components/instance-filter-builder/Utils.ts +++ b/packages/components/src/presentation-components/instance-filter-builder/Utils.ts @@ -18,10 +18,10 @@ import { } from "@itwin/components-react"; import { IModelConnection } from "@itwin/core-frontend"; import { CategoryDescription, ClassInfo, combineFieldNames, Descriptor, Field, NestedContentField, PropertiesField } from "@itwin/presentation-common"; -import { createPropertyDescriptionFromFieldInfo } from "../common/ContentBuilder"; -import { translate } from "../common/Utils"; -import { NavigationPropertyEditorContextProviderProps } from "../properties/editors/NavigationPropertyEditorContext"; -import { PresentationInstanceFilterPropertyInfo } from "./PresentationFilterBuilder"; +import { createPropertyDescriptionFromFieldInfo } from "../common/ContentBuilder.js"; +import { translate } from "../common/Utils.js"; +import { NavigationPropertyEditorContextProviderProps } from "../properties/editors/NavigationPropertyEditorContext.js"; +import { PresentationInstanceFilterPropertyInfo } from "./PresentationFilterBuilder.js"; /** @internal */ export function createInstanceFilterPropertyInfos(descriptor: Descriptor): PresentationInstanceFilterPropertyInfo[] { diff --git a/packages/components/src/presentation-components/labels/LabelsProvider.ts b/packages/components/src/presentation-components/labels/LabelsProvider.ts index e10f05645..e624b9a8b 100644 --- a/packages/components/src/presentation-components/labels/LabelsProvider.ts +++ b/packages/components/src/presentation-components/labels/LabelsProvider.ts @@ -6,11 +6,11 @@ * @module DisplayLabels */ -import memoize from "micro-memoize"; import { bufferCount, from, map, mergeAll, mergeMap, reduce } from "rxjs"; import { IModelConnection } from "@itwin/core-frontend"; import { DEFAULT_KEYS_BATCH_SIZE, InstanceKey } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; +import { memoize } from "../common/Utils.js"; /** * Interface for presentation rules-driven labels provider. diff --git a/packages/components/src/presentation-components/properties/InstanceKeyValueRenderer.tsx b/packages/components/src/presentation-components/properties/InstanceKeyValueRenderer.tsx index 1408b3623..78919473f 100644 --- a/packages/components/src/presentation-components/properties/InstanceKeyValueRenderer.tsx +++ b/packages/components/src/presentation-components/properties/InstanceKeyValueRenderer.tsx @@ -10,8 +10,8 @@ import { Primitives, PrimitiveValue, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { IPropertyValueRenderer, PropertyValueRendererContext, TypeConverterManager, useAsyncValue } from "@itwin/components-react"; import { Anchor } from "@itwin/itwinui-react"; -import { translate } from "../common/Utils"; -import { useUnifiedSelectionContext } from "../unified-selection/UnifiedSelectionContext"; +import { translate } from "../common/Utils.js"; +import { useUnifiedSelectionContext } from "../unified-selection/UnifiedSelectionContext.js"; /** * Property value renderer for instance keys. If application provides a [[UnifiedSelectionContext]] and this value is diff --git a/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditor.tsx b/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditor.tsx index 9bdaeefeb..fb5cd1d63 100644 --- a/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditor.tsx +++ b/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditor.tsx @@ -5,9 +5,9 @@ import { createRef, forwardRef, PureComponent } from "react"; import { PropertyEditorBase, PropertyEditorProps, TypeEditor } from "@itwin/components-react"; -import { NavigationPropertyTargetSelector, ReadonlyNavigationPropertyTarget } from "../inputs/NavigationPropertyTargetSelector"; -import { PropertyEditorAttributes } from "./Common"; -import { useNavigationPropertyEditorContext } from "./NavigationPropertyEditorContext"; +import { NavigationPropertyTargetSelector, ReadonlyNavigationPropertyTarget } from "../inputs/NavigationPropertyTargetSelector.js"; +import { PropertyEditorAttributes } from "./Common.js"; +import { useNavigationPropertyEditorContext } from "./NavigationPropertyEditorContext.js"; /** * Editor for navigation properties. diff --git a/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditorContext.tsx b/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditorContext.tsx index 1c2b03d09..2c1fa18b5 100644 --- a/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditorContext.tsx +++ b/packages/components/src/presentation-components/properties/editors/NavigationPropertyEditorContext.tsx @@ -11,7 +11,7 @@ import { createContext, PropsWithChildren, useContext, useMemo } from "react"; import { PropertyDescription } from "@itwin/appui-abstract"; import { IModelConnection } from "@itwin/core-frontend"; import { NavigationPropertyInfo } from "@itwin/presentation-common"; -import { IContentDataProvider } from "../../common/ContentDataProvider"; +import { IContentDataProvider } from "../../common/ContentDataProvider.js"; /** * A context providing necessary information for [[NavigationPropertyEditor]]. diff --git a/packages/components/src/presentation-components/properties/editors/NumericPropertyEditor.tsx b/packages/components/src/presentation-components/properties/editors/NumericPropertyEditor.tsx index 0e4db56d1..960c31271 100644 --- a/packages/components/src/presentation-components/properties/editors/NumericPropertyEditor.tsx +++ b/packages/components/src/presentation-components/properties/editors/NumericPropertyEditor.tsx @@ -5,8 +5,8 @@ import { createRef, PureComponent } from "react"; import { PropertyEditorBase, PropertyEditorProps, TypeEditor } from "@itwin/components-react"; -import { NumericPropertyInput } from "../inputs/NumericPropertyInput"; -import { PropertyEditorAttributes } from "./Common"; +import { NumericPropertyInput } from "../inputs/NumericPropertyInput.js"; +import { PropertyEditorAttributes } from "./Common.js"; /** * Name for `NumericPropertyEditor`. diff --git a/packages/components/src/presentation-components/properties/editors/QuantityPropertyEditor.tsx b/packages/components/src/presentation-components/properties/editors/QuantityPropertyEditor.tsx index 42e3af4ed..9dd117253 100644 --- a/packages/components/src/presentation-components/properties/editors/QuantityPropertyEditor.tsx +++ b/packages/components/src/presentation-components/properties/editors/QuantityPropertyEditor.tsx @@ -5,8 +5,8 @@ import { createRef, PureComponent } from "react"; import { PropertyEditorBase, PropertyEditorProps, TypeEditor } from "@itwin/components-react"; -import { QuantityPropertyEditorInput } from "../inputs/QuantityPropertyEditorInput"; -import { PropertyEditorAttributes } from "./Common"; +import { QuantityPropertyEditorInput } from "../inputs/QuantityPropertyEditorInput.js"; +import { PropertyEditorAttributes } from "./Common.js"; /** * Name for `QuantityPropertyEditor`. diff --git a/packages/components/src/presentation-components/properties/editors/index.ts b/packages/components/src/presentation-components/properties/editors/index.ts index d529c3150..e05f74427 100644 --- a/packages/components/src/presentation-components/properties/editors/index.ts +++ b/packages/components/src/presentation-components/properties/editors/index.ts @@ -13,15 +13,15 @@ import { PropertyEditorBase, PropertyEditorManager, PropertyEditorProps, TypeEdi import { NavigationPropertyEditor as NavigationPropertyEditorInternal, NavigationPropertyTargetEditor as NavigationPropertyTargetEditorInternal, -} from "./NavigationPropertyEditor"; -import { NumericEditorName, NumericPropertyEditorBase } from "./NumericPropertyEditor"; -import { QuantityEditorName, QuantityPropertyEditorBase } from "./QuantityPropertyEditor"; +} from "./NavigationPropertyEditor.js"; +import { NumericEditorName, NumericPropertyEditorBase } from "./NumericPropertyEditor.js"; +import { QuantityEditorName, QuantityPropertyEditorBase } from "./QuantityPropertyEditor.js"; export { NavigationPropertyEditorContextProvider, NavigationPropertyEditorContextProviderProps, useNavigationPropertyEditorContextProviderProps, -} from "./NavigationPropertyEditorContext"; +} from "./NavigationPropertyEditorContext.js"; /** * Editor for navigation properties. diff --git a/packages/components/src/presentation-components/properties/inputs/NavigationPropertyTargetSelector.tsx b/packages/components/src/presentation-components/properties/inputs/NavigationPropertyTargetSelector.tsx index 96a6fee63..9ea121136 100644 --- a/packages/components/src/presentation-components/properties/inputs/NavigationPropertyTargetSelector.tsx +++ b/packages/components/src/presentation-components/properties/inputs/NavigationPropertyTargetSelector.tsx @@ -10,10 +10,10 @@ import { PropertyEditorProps, PropertyValueRendererManager } from "@itwin/compon import { IModelConnection } from "@itwin/core-frontend"; import { ComboBox, SelectOption } from "@itwin/itwinui-react"; import { InstanceKey, LabelDefinition, NavigationPropertyInfo } from "@itwin/presentation-common"; -import { translate } from "../../common/Utils"; -import { PropertyEditorAttributes } from "../editors/Common"; -import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader"; -import { NavigationPropertyTarget, useNavigationPropertyTargetsLoader, useNavigationPropertyTargetsRuleset } from "./UseNavigationPropertyTargetsLoader"; +import { translate } from "../../common/Utils.js"; +import { PropertyEditorAttributes } from "../editors/Common.js"; +import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader.js"; +import { NavigationPropertyTarget, useNavigationPropertyTargetsLoader, useNavigationPropertyTargetsRuleset } from "./UseNavigationPropertyTargetsLoader.js"; /** @internal */ export interface NavigationPropertyTargetSelectorProps extends PropertyEditorProps { diff --git a/packages/components/src/presentation-components/properties/inputs/NumericPropertyInput.tsx b/packages/components/src/presentation-components/properties/inputs/NumericPropertyInput.tsx index abab78478..732f224f4 100644 --- a/packages/components/src/presentation-components/properties/inputs/NumericPropertyInput.tsx +++ b/packages/components/src/presentation-components/properties/inputs/NumericPropertyInput.tsx @@ -7,8 +7,8 @@ import { forwardRef, useImperativeHandle, useRef, useState } from "react"; import { PrimitiveValue, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { PropertyEditorProps } from "@itwin/components-react"; import { Input } from "@itwin/itwinui-react"; -import { PropertyEditorAttributes } from "../editors/Common"; -import { getDecimalRoundingError } from "./Utils"; +import { PropertyEditorAttributes } from "../editors/Common.js"; +import { getDecimalRoundingError } from "./Utils.js"; /** @internal */ export interface NumericPropertyInputProps extends PropertyEditorProps { diff --git a/packages/components/src/presentation-components/properties/inputs/QuantityPropertyEditorInput.tsx b/packages/components/src/presentation-components/properties/inputs/QuantityPropertyEditorInput.tsx index 01fcbdc11..15f418638 100644 --- a/packages/components/src/presentation-components/properties/inputs/QuantityPropertyEditorInput.tsx +++ b/packages/components/src/presentation-components/properties/inputs/QuantityPropertyEditorInput.tsx @@ -7,10 +7,10 @@ import { forwardRef, useImperativeHandle, useRef } from "react"; import { PrimitiveValue, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { PropertyEditorProps } from "@itwin/components-react"; import { Input } from "@itwin/itwinui-react"; -import { useSchemaMetadataContext } from "../../common/SchemaMetadataContext"; -import { PropertyEditorAttributes } from "../editors/Common"; -import { NumericPropertyInput } from "./NumericPropertyInput"; -import { useQuantityValueInput, UseQuantityValueInputProps } from "./UseQuantityValueInput"; +import { useSchemaMetadataContext } from "../../common/SchemaMetadataContext.js"; +import { PropertyEditorAttributes } from "../editors/Common.js"; +import { NumericPropertyInput } from "./NumericPropertyInput.js"; +import { useQuantityValueInput, UseQuantityValueInputProps } from "./UseQuantityValueInput.js"; /** @internal */ export interface QuantityPropertyEditorImplProps extends PropertyEditorProps { diff --git a/packages/components/src/presentation-components/properties/inputs/UniquePropertyValuesSelector.tsx b/packages/components/src/presentation-components/properties/inputs/UniquePropertyValuesSelector.tsx index fbb95f182..67e9d60af 100644 --- a/packages/components/src/presentation-components/properties/inputs/UniquePropertyValuesSelector.tsx +++ b/packages/components/src/presentation-components/properties/inputs/UniquePropertyValuesSelector.tsx @@ -8,10 +8,10 @@ import { PropertyDescription, PropertyValue, PropertyValueFormat } from "@itwin/ import { IModelConnection } from "@itwin/core-frontend"; import { ComboBox, SelectOption } from "@itwin/itwinui-react"; import { ClassInfo, Descriptor, Field, Keys, KeySet, MultiSchemaClassesSpecification, Ruleset } from "@itwin/presentation-common"; -import { deserializeUniqueValues, findField, serializeUniqueValues, translate, UniqueValue } from "../../common/Utils"; -import { getInstanceFilterFieldName } from "../../instance-filter-builder/Utils"; -import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader"; -import { useUniquePropertyValuesLoader } from "./UseUniquePropertyValuesLoader"; +import { deserializeUniqueValues, findField, serializeUniqueValues, translate, UniqueValue } from "../../common/Utils.js"; +import { getInstanceFilterFieldName } from "../../instance-filter-builder/Utils.js"; +import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader.js"; +import { useUniquePropertyValuesLoader } from "./UseUniquePropertyValuesLoader.js"; /** @internal */ export interface UniquePropertyValuesSelectorProps { diff --git a/packages/components/src/presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader.ts b/packages/components/src/presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader.ts index 3c2ba701c..cfb7190d7 100644 --- a/packages/components/src/presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader.ts +++ b/packages/components/src/presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader.ts @@ -23,7 +23,7 @@ import { RuleTypes, } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader"; +import { FILTER_WARNING_OPTION, VALUE_BATCH_SIZE } from "./ItemsLoader.js"; /** @internal */ export interface NavigationPropertyTarget { diff --git a/packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx b/packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx index 247df97cc..af5477fc2 100644 --- a/packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx +++ b/packages/components/src/presentation-components/properties/inputs/UseQuantityValueInput.tsx @@ -9,7 +9,7 @@ import { IModelApp } from "@itwin/core-frontend"; import { FormatterSpec, ParserSpec } from "@itwin/core-quantity"; import { SchemaContext } from "@itwin/ecschema-metadata"; import { KoqPropertyValueFormatter } from "@itwin/presentation-common"; -import { getPersistenceUnitRoundingError } from "./Utils"; +import { getPersistenceUnitRoundingError } from "./Utils.js"; /** * Value of kind of quantity property. diff --git a/packages/components/src/presentation-components/properties/inputs/UseUniquePropertyValuesLoader.ts b/packages/components/src/presentation-components/properties/inputs/UseUniquePropertyValuesLoader.ts index 4e5e142fa..479830c41 100644 --- a/packages/components/src/presentation-components/properties/inputs/UseUniquePropertyValuesLoader.ts +++ b/packages/components/src/presentation-components/properties/inputs/UseUniquePropertyValuesLoader.ts @@ -9,8 +9,8 @@ import { IModelConnection } from "@itwin/core-frontend"; import { SelectOption } from "@itwin/itwinui-react"; import { DisplayValue, DisplayValueGroup, Field, FieldDescriptor, Keys, KeySet, Ruleset } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { translate, UniqueValue } from "../../common/Utils"; -import { FILTER_WARNING_OPTION, ItemsLoader, VALUE_BATCH_SIZE } from "./ItemsLoader"; +import { translate, UniqueValue } from "../../common/Utils.js"; +import { FILTER_WARNING_OPTION, ItemsLoader, VALUE_BATCH_SIZE } from "./ItemsLoader.js"; interface UseUniquePropertyValuesLoaderProps { imodel: IModelConnection; diff --git a/packages/components/src/presentation-components/propertygrid/DataProvider.ts b/packages/components/src/presentation-components/propertygrid/DataProvider.ts index 8db448d85..387df925d 100644 --- a/packages/components/src/presentation-components/propertygrid/DataProvider.ts +++ b/packages/components/src/presentation-components/propertygrid/DataProvider.ts @@ -7,7 +7,6 @@ */ import { inPlaceSort } from "fast-sort"; -import memoize from "micro-memoize"; import { PropertyRecord, PropertyValueFormat as UiPropertyValueFormat } from "@itwin/appui-abstract"; import { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from "@itwin/components-react"; import { assert } from "@itwin/core-bentley"; @@ -37,11 +36,11 @@ import { ValuesMap, } from "@itwin/presentation-common"; import { FavoritePropertiesScope, Presentation } from "@itwin/presentation-frontend"; -import { FieldHierarchyRecord, InternalPropertyRecordsBuilder, IPropertiesAppender } from "../common/ContentBuilder"; -import { CacheInvalidationProps, ContentDataProvider, IContentDataProvider } from "../common/ContentDataProvider"; -import { DiagnosticsProps } from "../common/Diagnostics"; -import { createLabelRecord, findField } from "../common/Utils"; -import { FAVORITES_CATEGORY_NAME, getFavoritesCategory } from "../favorite-properties/Utils"; +import { FieldHierarchyRecord, InternalPropertyRecordsBuilder, IPropertiesAppender } from "../common/ContentBuilder.js"; +import { CacheInvalidationProps, ContentDataProvider, IContentDataProvider } from "../common/ContentDataProvider.js"; +import { DiagnosticsProps } from "../common/Diagnostics.js"; +import { createLabelRecord, findField, memoize } from "../common/Utils.js"; +import { FAVORITES_CATEGORY_NAME, getFavoritesCategory } from "../favorite-properties/Utils.js"; const labelsComparer = new Intl.Collator(undefined, { sensitivity: "base" }).compare; diff --git a/packages/components/src/presentation-components/propertygrid/FavoritePropertiesDataFilterer.ts b/packages/components/src/presentation-components/propertygrid/FavoritePropertiesDataFilterer.ts index bce7c1caa..070e4f304 100644 --- a/packages/components/src/presentation-components/propertygrid/FavoritePropertiesDataFilterer.ts +++ b/packages/components/src/presentation-components/propertygrid/FavoritePropertiesDataFilterer.ts @@ -11,7 +11,7 @@ import { PropertyDataFiltererBase, PropertyDataFilterResult } from "@itwin/compo import { IModelConnection } from "@itwin/core-frontend"; import { Field } from "@itwin/presentation-common"; import { FavoritePropertiesScope, Presentation } from "@itwin/presentation-frontend"; -import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; +import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; /** * Props for [[FavoritePropertiesDataFilterer]]. diff --git a/packages/components/src/presentation-components/propertygrid/UseUnifiedSelection.tsx b/packages/components/src/presentation-components/propertygrid/UseUnifiedSelection.tsx index c111e99dc..c49118ed3 100644 --- a/packages/components/src/presentation-components/propertygrid/UseUnifiedSelection.tsx +++ b/packages/components/src/presentation-components/propertygrid/UseUnifiedSelection.tsx @@ -9,7 +9,7 @@ import { createContext, PropsWithChildren, useContext, useEffect, useState } from "react"; import { KeySet } from "@itwin/presentation-common"; import { Presentation, SelectionChangeEventArgs, SelectionHandler } from "@itwin/presentation-frontend"; -import { IPresentationPropertyDataProvider } from "./DataProvider"; +import { IPresentationPropertyDataProvider } from "./DataProvider.js"; const DEFAULT_REQUESTED_CONTENT_INSTANCES_LIMIT = 100; diff --git a/packages/components/src/presentation-components/table/UseColumns.ts b/packages/components/src/presentation-components/table/UseColumns.ts index cb7f767f0..483189ac4 100644 --- a/packages/components/src/presentation-components/table/UseColumns.ts +++ b/packages/components/src/presentation-components/table/UseColumns.ts @@ -10,8 +10,8 @@ import { useEffect, useState } from "react"; import { IModelConnection } from "@itwin/core-frontend"; import { DefaultContentDisplayTypes, Descriptor, Field, KeySet, Ruleset } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { useErrorState } from "../common/Utils"; -import { TableColumnDefinition } from "./Types"; +import { useErrorState } from "../common/Utils.js"; +import { TableColumnDefinition } from "./Types.js"; /** @internal */ export interface UseColumnsProps { diff --git a/packages/components/src/presentation-components/table/UsePresentationTable.ts b/packages/components/src/presentation-components/table/UsePresentationTable.ts index f065781a4..0a9a67373 100644 --- a/packages/components/src/presentation-components/table/UsePresentationTable.ts +++ b/packages/components/src/presentation-components/table/UsePresentationTable.ts @@ -10,10 +10,10 @@ import { useEffect, useMemo, useState } from "react"; import { IModelConnection } from "@itwin/core-frontend"; import { Key, KeySet, Ruleset } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { TableColumnDefinition, TableRowDefinition } from "./Types"; -import { useColumns } from "./UseColumns"; -import { useRows } from "./UseRows"; -import { useTableOptions } from "./UseTableOptions"; +import { TableColumnDefinition, TableRowDefinition } from "./Types.js"; +import { useColumns } from "./UseColumns.js"; +import { useRows } from "./UseRows.js"; +import { useTableOptions } from "./UseTableOptions.js"; /** * Props for [[usePresentationTable]] hook. diff --git a/packages/components/src/presentation-components/table/UseRows.ts b/packages/components/src/presentation-components/table/UseRows.ts index a4c8c4df1..b4d487b7d 100644 --- a/packages/components/src/presentation-components/table/UseRows.ts +++ b/packages/components/src/presentation-components/table/UseRows.ts @@ -12,10 +12,10 @@ import { assert } from "@itwin/core-bentley"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Content, DefaultContentDisplayTypes, KeySet, PageOptions, Ruleset, StartItemProps, traverseContent } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { FieldHierarchyRecord, InternalPropertyRecordsBuilder } from "../common/ContentBuilder"; -import { useErrorState } from "../common/Utils"; -import { TableRowDefinition } from "./Types"; -import { TableOptions } from "./UseTableOptions"; +import { FieldHierarchyRecord, InternalPropertyRecordsBuilder } from "../common/ContentBuilder.js"; +import { useErrorState } from "../common/Utils.js"; +import { TableRowDefinition } from "./Types.js"; +import { TableOptions } from "./UseTableOptions.js"; /** @internal */ export interface UseRowsProps { diff --git a/packages/components/src/presentation-components/table/UseTableOptions.ts b/packages/components/src/presentation-components/table/UseTableOptions.ts index 67e66d294..f03c8c997 100644 --- a/packages/components/src/presentation-components/table/UseTableOptions.ts +++ b/packages/components/src/presentation-components/table/UseTableOptions.ts @@ -8,7 +8,7 @@ import { useCallback, useEffect, useState } from "react"; import { FieldDescriptor, SortDirection } from "@itwin/presentation-common"; -import { TableColumnDefinition } from "./Types"; +import { TableColumnDefinition } from "./Types.js"; /** @internal */ export interface UseTableOptionsProps { diff --git a/packages/components/src/presentation-components/tree/DataProvider.ts b/packages/components/src/presentation-components/tree/DataProvider.ts index 0623cb61c..6761d90c7 100644 --- a/packages/components/src/presentation-components/tree/DataProvider.ts +++ b/packages/components/src/presentation-components/tree/DataProvider.ts @@ -5,7 +5,7 @@ /** @packageDocumentation * @module Tree */ -import memoize from "micro-memoize"; + import { DelayLoadedTreeNodeItem, PageOptions, PropertyFilterRuleGroupOperator, TreeNodeItem } from "@itwin/components-react"; import { IDisposable, Logger } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; @@ -26,14 +26,14 @@ import { Ruleset, } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { createDiagnosticsOptions, DiagnosticsProps } from "../common/Diagnostics"; -import { getRulesetId, translate } from "../common/Utils"; -import { PresentationComponentsLoggerCategory } from "../ComponentsLoggerCategory"; -import { createInstanceFilterDefinition, PresentationInstanceFilterInfo } from "../instance-filter-builder/PresentationFilterBuilder"; -import { PresentationInstanceFilter } from "../instance-filter-builder/PresentationInstanceFilter"; -import { IPresentationTreeDataProvider } from "./IPresentationTreeDataProvider"; -import { InfoTreeNodeItemType, isPresentationTreeNodeItem, PresentationTreeNodeItem } from "./PresentationTreeNodeItem"; -import { createInfoNode, createTreeNodeItem, pageOptionsUiToPresentation } from "./Utils"; +import { createDiagnosticsOptions, DiagnosticsProps } from "../common/Diagnostics.js"; +import { getRulesetId, memoize, translate } from "../common/Utils.js"; +import { PresentationComponentsLoggerCategory } from "../ComponentsLoggerCategory.js"; +import { createInstanceFilterDefinition, PresentationInstanceFilterInfo } from "../instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationInstanceFilter } from "../instance-filter-builder/PresentationInstanceFilter.js"; +import { IPresentationTreeDataProvider } from "./IPresentationTreeDataProvider.js"; +import { InfoTreeNodeItemType, isPresentationTreeNodeItem, PresentationTreeNodeItem } from "./PresentationTreeNodeItem.js"; +import { createInfoNode, createTreeNodeItem, pageOptionsUiToPresentation } from "./Utils.js"; /** * Properties for creating a `PresentationTreeDataProvider` instance. diff --git a/packages/components/src/presentation-components/tree/FilteredDataProvider.ts b/packages/components/src/presentation-components/tree/FilteredDataProvider.ts index 6da73a7b7..58276aa55 100644 --- a/packages/components/src/presentation-components/tree/FilteredDataProvider.ts +++ b/packages/components/src/presentation-components/tree/FilteredDataProvider.ts @@ -3,7 +3,6 @@ * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ -import memoize from "micro-memoize"; import { ActiveMatchInfo, DelayLoadedTreeNodeItem, @@ -14,10 +13,11 @@ import { } from "@itwin/components-react"; import { IModelConnection } from "@itwin/core-frontend"; import { InstanceFilterDefinition, Node, NodeKey, NodePathElement } from "@itwin/presentation-common"; -import { PresentationTreeDataProvider } from "./DataProvider"; -import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "./IPresentationTreeDataProvider"; -import { PresentationTreeNodeItem } from "./PresentationTreeNodeItem"; -import { createTreeNodeItem } from "./Utils"; +import { memoize } from "../common/Utils.js"; +import { PresentationTreeDataProvider } from "./DataProvider.js"; +import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "./IPresentationTreeDataProvider.js"; +import { PresentationTreeNodeItem } from "./PresentationTreeNodeItem.js"; +import { createTreeNodeItem } from "./Utils.js"; /** @internal */ export interface FilteredPresentationTreeDataProviderProps { diff --git a/packages/components/src/presentation-components/tree/IPresentationTreeDataProvider.ts b/packages/components/src/presentation-components/tree/IPresentationTreeDataProvider.ts index 740462dd0..81ea53afb 100644 --- a/packages/components/src/presentation-components/tree/IPresentationTreeDataProvider.ts +++ b/packages/components/src/presentation-components/tree/IPresentationTreeDataProvider.ts @@ -9,7 +9,7 @@ import { ActiveMatchInfo, ITreeDataProvider, TreeNodeItem } from "@itwin/components-react"; import { IModelConnection } from "@itwin/core-frontend"; import { HierarchyRequestOptions, InstanceFilterDefinition, NodeKey, NodePathElement } from "@itwin/presentation-common"; -import { IPresentationDataProvider } from "../common/IPresentationDataProvider"; +import { IPresentationDataProvider } from "../common/IPresentationDataProvider.js"; /** * Presentation tree data provider. diff --git a/packages/components/src/presentation-components/tree/PresentationTreeNodeItem.ts b/packages/components/src/presentation-components/tree/PresentationTreeNodeItem.ts index 6254a184e..5db2c9292 100644 --- a/packages/components/src/presentation-components/tree/PresentationTreeNodeItem.ts +++ b/packages/components/src/presentation-components/tree/PresentationTreeNodeItem.ts @@ -8,7 +8,7 @@ import { DelayLoadedTreeNodeItem, ImmediatelyLoadedTreeNodeItem, TreeNodeItem } from "@itwin/components-react"; import { Descriptor, NodeKey } from "@itwin/presentation-common"; -import { PresentationInstanceFilterInfo } from "../instance-filter-builder/PresentationFilterBuilder"; +import { PresentationInstanceFilterInfo } from "../instance-filter-builder/PresentationFilterBuilder.js"; /** * Describes descriptor used for hierarchy level filtering. It can be lazy loaded. diff --git a/packages/components/src/presentation-components/tree/ReportingTreeNodeLoader.ts b/packages/components/src/presentation-components/tree/ReportingTreeNodeLoader.ts index 199efe5c5..8d2e952af 100644 --- a/packages/components/src/presentation-components/tree/ReportingTreeNodeLoader.ts +++ b/packages/components/src/presentation-components/tree/ReportingTreeNodeLoader.ts @@ -9,7 +9,7 @@ import { share, Subject, tap } from "rxjs"; import { Observable, PagedTreeNodeLoader, TreeDataProvider, TreeModelNode, TreeModelRootNode, TreeNodeLoadResult } from "@itwin/components-react"; -import { toRxjsObservable } from "./Utils"; +import { toRxjsObservable } from "./Utils.js"; /** * Wrapper for `PagedTreeNodeLoader` that reports load times of nodes. diff --git a/packages/components/src/presentation-components/tree/Utils.ts b/packages/components/src/presentation-components/tree/Utils.ts index 3781df997..7b258d1b3 100644 --- a/packages/components/src/presentation-components/tree/Utils.ts +++ b/packages/components/src/presentation-components/tree/Utils.ts @@ -11,9 +11,9 @@ import { PropertyRecord } from "@itwin/appui-abstract"; import { DelayLoadedTreeNodeItem, ItemColorOverrides, ItemStyle, Observable, TreeNodeItem, PageOptions as UiPageOptions } from "@itwin/components-react"; import { CheckBoxState } from "@itwin/core-react"; import { LabelDefinition, Node, NodeKey, PartialNode, PageOptions as PresentationPageOptions } from "@itwin/presentation-common"; -import { StyleHelper } from "../common/StyleHelper"; -import { createLabelRecord } from "../common/Utils"; -import { InfoTreeNodeItemType, PresentationInfoTreeNodeItem, PresentationTreeNodeItem } from "./PresentationTreeNodeItem"; +import { StyleHelper } from "../common/StyleHelper.js"; +import { createLabelRecord } from "../common/Utils.js"; +import { InfoTreeNodeItemType, PresentationInfoTreeNodeItem, PresentationTreeNodeItem } from "./PresentationTreeNodeItem.js"; /** @internal */ export interface CreateTreeNodeItemProps { diff --git a/packages/components/src/presentation-components/tree/controlled/PresentationTree.tsx b/packages/components/src/presentation-components/tree/controlled/PresentationTree.tsx index fe1b6ebab..e0bf1dfca 100644 --- a/packages/components/src/presentation-components/tree/controlled/PresentationTree.tsx +++ b/packages/components/src/presentation-components/tree/controlled/PresentationTree.tsx @@ -15,8 +15,8 @@ import { TreeRendererProps, useTreeModel, } from "@itwin/components-react"; -import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; -import { UsePresentationTreeStateResult } from "./UsePresentationTreeState"; +import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; +import { UsePresentationTreeStateResult } from "./UsePresentationTreeState.js"; /** * Props for [[PresentationTree]] component. diff --git a/packages/components/src/presentation-components/tree/controlled/PresentationTreeNodeRenderer.tsx b/packages/components/src/presentation-components/tree/controlled/PresentationTreeNodeRenderer.tsx index 5c1f1d3b9..ef18bb6b8 100644 --- a/packages/components/src/presentation-components/tree/controlled/PresentationTreeNodeRenderer.tsx +++ b/packages/components/src/presentation-components/tree/controlled/PresentationTreeNodeRenderer.tsx @@ -12,8 +12,8 @@ import { TreeNodeRenderer, TreeNodeRendererProps } from "@itwin/components-react import { TreeNode } from "@itwin/core-react"; import { SvgCloseSmall, SvgFilter, SvgFilterHollow } from "@itwin/itwinui-icons-react"; import { Anchor, ButtonGroup, IconButton, Text } from "@itwin/itwinui-react"; -import { translate } from "../../common/Utils"; -import { InfoTreeNodeItemType, isPresentationInfoTreeNodeItem, isPresentationTreeNodeItem } from "../PresentationTreeNodeItem"; +import { translate } from "../../common/Utils.js"; +import { InfoTreeNodeItemType, isPresentationInfoTreeNodeItem, isPresentationTreeNodeItem } from "../PresentationTreeNodeItem.js"; /** * Props for [[PresentationTreeNodeRenderer]] component. diff --git a/packages/components/src/presentation-components/tree/controlled/PresentationTreeRenderer.tsx b/packages/components/src/presentation-components/tree/controlled/PresentationTreeRenderer.tsx index 25214ed34..848c44777 100644 --- a/packages/components/src/presentation-components/tree/controlled/PresentationTreeRenderer.tsx +++ b/packages/components/src/presentation-components/tree/controlled/PresentationTreeRenderer.tsx @@ -16,18 +16,18 @@ import { } from "@itwin/components-react"; import { NodeKey, PresentationError, PresentationStatus } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { translate } from "../../common/Utils"; -import { createInstanceFilterDefinition, PresentationInstanceFilterInfo } from "../../instance-filter-builder/PresentationFilterBuilder"; -import { PresentationInstanceFilterDialog } from "../../instance-filter-builder/PresentationInstanceFilterDialog"; -import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; +import { translate } from "../../common/Utils.js"; +import { createInstanceFilterDefinition, PresentationInstanceFilterInfo } from "../../instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationInstanceFilterDialog } from "../../instance-filter-builder/PresentationInstanceFilterDialog.js"; +import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; import { FilterablePresentationTreeNodeItem, isFilterablePresentationTreeNodeItem, isPresentationTreeNodeItem, PresentationTreeNodeItem, -} from "../PresentationTreeNodeItem"; -import { PresentationTreeNodeRenderer } from "./PresentationTreeNodeRenderer"; -import { useHierarchyLevelFiltering } from "./UseHierarchyLevelFiltering"; +} from "../PresentationTreeNodeItem.js"; +import { PresentationTreeNodeRenderer } from "./PresentationTreeNodeRenderer.js"; +import { useHierarchyLevelFiltering } from "./UseHierarchyLevelFiltering.js"; /** * Props for [[PresentationTreeRenderer]] component. diff --git a/packages/components/src/presentation-components/tree/controlled/TreeHooks.ts b/packages/components/src/presentation-components/tree/controlled/TreeHooks.ts index 58ba8f5b3..207d7fcec 100644 --- a/packages/components/src/presentation-components/tree/controlled/TreeHooks.ts +++ b/packages/components/src/presentation-components/tree/controlled/TreeHooks.ts @@ -19,10 +19,10 @@ import { } from "@itwin/components-react"; import { IModelApp } from "@itwin/core-frontend"; import { IModelHierarchyChangeEventArgs, Presentation } from "@itwin/presentation-frontend"; -import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider"; -import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; -import { reloadTree } from "./TreeReloader"; -import { useFilteredNodeLoader, useNodeHighlightingProps } from "./UseControlledTreeFiltering"; +import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider.js"; +import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; +import { reloadTree } from "./TreeReloader.js"; +import { useFilteredNodeLoader, useNodeHighlightingProps } from "./UseControlledTreeFiltering.js"; /** * Properties for [[usePresentationTreeNodeLoader]] hook. diff --git a/packages/components/src/presentation-components/tree/controlled/TreeReloader.ts b/packages/components/src/presentation-components/tree/controlled/TreeReloader.ts index 7dc7c4ed3..4fee8ec84 100644 --- a/packages/components/src/presentation-components/tree/controlled/TreeReloader.ts +++ b/packages/components/src/presentation-components/tree/controlled/TreeReloader.ts @@ -36,8 +36,8 @@ import { VisibleTreeNodes, } from "@itwin/components-react"; import { assert, isIDisposable } from "@itwin/core-bentley"; -import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; -import { toRxjsObservable } from "../Utils"; +import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; +import { toRxjsObservable } from "../Utils.js"; /** * Creates a new tree model from scratch while attempting to match provided tree model's expanded structure. diff --git a/packages/components/src/presentation-components/tree/controlled/UseControlledTreeFiltering.ts b/packages/components/src/presentation-components/tree/controlled/UseControlledTreeFiltering.ts index e457852ad..e44ec11b4 100644 --- a/packages/components/src/presentation-components/tree/controlled/UseControlledTreeFiltering.ts +++ b/packages/components/src/presentation-components/tree/controlled/UseControlledTreeFiltering.ts @@ -18,8 +18,8 @@ import { useDebouncedAsyncValue, } from "@itwin/components-react"; import { assert } from "@itwin/core-bentley"; -import { FilteredPresentationTreeDataProvider } from "../FilteredDataProvider"; -import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; +import { FilteredPresentationTreeDataProvider } from "../FilteredDataProvider.js"; +import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; const FILTERED_DATA_PAGE_SIZE = 20; diff --git a/packages/components/src/presentation-components/tree/controlled/UseHierarchyLevelFiltering.ts b/packages/components/src/presentation-components/tree/controlled/UseHierarchyLevelFiltering.ts index e106f1761..9e7cfad9a 100644 --- a/packages/components/src/presentation-components/tree/controlled/UseHierarchyLevelFiltering.ts +++ b/packages/components/src/presentation-components/tree/controlled/UseHierarchyLevelFiltering.ts @@ -8,8 +8,8 @@ import { useRef } from "react"; import { isTreeModelNode, ITreeNodeLoader, Subscription, TreeModelSource } from "@itwin/components-react"; -import { PresentationInstanceFilterInfo } from "../../instance-filter-builder/PresentationFilterBuilder"; -import { isPresentationTreeNodeItem } from "../PresentationTreeNodeItem"; +import { PresentationInstanceFilterInfo } from "../../instance-filter-builder/PresentationFilterBuilder.js"; +import { isPresentationTreeNodeItem } from "../PresentationTreeNodeItem.js"; /** * Props for [[useHierarchyLevelFiltering]] hook. diff --git a/packages/components/src/presentation-components/tree/controlled/UsePresentationTreeState.ts b/packages/components/src/presentation-components/tree/controlled/UsePresentationTreeState.ts index 6192607ca..e0e689783 100644 --- a/packages/components/src/presentation-components/tree/controlled/UsePresentationTreeState.ts +++ b/packages/components/src/presentation-components/tree/controlled/UsePresentationTreeState.ts @@ -17,11 +17,11 @@ import { TreeModel, TreeModelSource, } from "@itwin/components-react"; -import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider"; -import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; -import { ReportingTreeNodeLoader } from "../ReportingTreeNodeLoader"; -import { useFilteredNodeLoader, useNodeHighlightingProps } from "./UseControlledTreeFiltering"; -import { ReloadedTree, useTreeReload } from "./UseTreeReload"; +import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider.js"; +import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; +import { ReportingTreeNodeLoader } from "../ReportingTreeNodeLoader.js"; +import { useFilteredNodeLoader, useNodeHighlightingProps } from "./UseControlledTreeFiltering.js"; +import { ReloadedTree, useTreeReload } from "./UseTreeReload.js"; /** * Properties for [[usePresentationTreeState]] hook. diff --git a/packages/components/src/presentation-components/tree/controlled/UseTreeReload.ts b/packages/components/src/presentation-components/tree/controlled/UseTreeReload.ts index d39acea6c..5e1196cb8 100644 --- a/packages/components/src/presentation-components/tree/controlled/UseTreeReload.ts +++ b/packages/components/src/presentation-components/tree/controlled/UseTreeReload.ts @@ -11,9 +11,9 @@ import { RenderedItemsRange, Subscription, TreeModelSource } from "@itwin/compon import { IModelApp } from "@itwin/core-frontend"; import { Ruleset } from "@itwin/presentation-common"; import { IModelHierarchyChangeEventArgs, Presentation } from "@itwin/presentation-frontend"; -import { getRulesetId } from "../../common/Utils"; -import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider"; -import { reloadTree } from "./TreeReloader"; +import { getRulesetId } from "../../common/Utils.js"; +import { PresentationTreeDataProvider, PresentationTreeDataProviderProps } from "../DataProvider.js"; +import { reloadTree } from "./TreeReloader.js"; /** @internal */ export interface ReloadedTree { diff --git a/packages/components/src/presentation-components/tree/controlled/UseUnifiedSelection.ts b/packages/components/src/presentation-components/tree/controlled/UseUnifiedSelection.ts index 5cad08225..e9a616a80 100644 --- a/packages/components/src/presentation-components/tree/controlled/UseUnifiedSelection.ts +++ b/packages/components/src/presentation-components/tree/controlled/UseUnifiedSelection.ts @@ -23,9 +23,9 @@ import { Guid, IDisposable } from "@itwin/core-bentley"; import { useDisposable } from "@itwin/core-react"; import { Keys, KeySet, NodeKey } from "@itwin/presentation-common"; import { Presentation, SelectionChangeEventArgs, SelectionChangeType, SelectionHelper } from "@itwin/presentation-frontend"; -import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider"; -import { isPresentationTreeNodeItem } from "../PresentationTreeNodeItem"; -import { toRxjsObservable } from "../Utils"; +import { IPresentationTreeDataProvider } from "../IPresentationTreeDataProvider.js"; +import { isPresentationTreeNodeItem } from "../PresentationTreeNodeItem.js"; +import { toRxjsObservable } from "../Utils.js"; /** * Data structure that describes parameters for UnifiedSelectionTreeEventHandler diff --git a/packages/components/src/presentation-components/unified-selection/UnifiedSelectionContext.tsx b/packages/components/src/presentation-components/unified-selection/UnifiedSelectionContext.tsx index 41b2c66f5..5d94b1c98 100644 --- a/packages/components/src/presentation-components/unified-selection/UnifiedSelectionContext.tsx +++ b/packages/components/src/presentation-components/unified-selection/UnifiedSelectionContext.tsx @@ -7,12 +7,12 @@ * @module UnifiedSelection */ -import memoize from "micro-memoize"; import { createContext, useContext, useEffect, useRef, useState } from "react"; import { assert } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { Keys, KeySet } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; +import { memoize } from "../common/Utils.js"; /** * Interface for accessing and modifying Unified Selection within React components. diff --git a/packages/components/src/presentation-components/viewport/WithUnifiedSelection.tsx b/packages/components/src/presentation-components/viewport/WithUnifiedSelection.tsx index e51ed4fb5..99dd7bcdf 100644 --- a/packages/components/src/presentation-components/viewport/WithUnifiedSelection.tsx +++ b/packages/components/src/presentation-components/viewport/WithUnifiedSelection.tsx @@ -8,8 +8,8 @@ import { createContext, memo, PropsWithChildren, useContext, useEffect, useState } from "react"; import { ViewportProps } from "@itwin/imodel-components-react"; -import { getDisplayName } from "../common/Utils"; -import { ViewportSelectionHandler } from "./ViewportSelectionHandler"; +import { getDisplayName } from "../common/Utils.js"; +import { ViewportSelectionHandler } from "./ViewportSelectionHandler.js"; /** * Props that are injected to the ViewWithUnifiedSelection HOC component. diff --git a/packages/components/src/test/TestUtils.tsx b/packages/components/src/test/TestUtils.tsx index 853859495..838134039 100644 --- a/packages/components/src/test/TestUtils.tsx +++ b/packages/components/src/test/TestUtils.tsx @@ -16,7 +16,7 @@ import { render as renderRTL, waitFor, } from "@testing-library/react"; -import userEvent, { UserEvent } from "@testing-library/user-event"; +import { userEvent, UserEvent } from "@testing-library/user-event"; function createWrapper(Outer: React.JSXElementConstructor<{ children: React.ReactNode }>) { return (Inner?: React.JSXElementConstructor<{ children: React.ReactNode }>) => { diff --git a/packages/components/src/test/_helpers/Common.ts b/packages/components/src/test/_helpers/Common.ts index 5c96bd5e3..082067f6a 100644 --- a/packages/components/src/test/_helpers/Common.ts +++ b/packages/components/src/test/_helpers/Common.ts @@ -7,8 +7,8 @@ import { Component } from "react"; import sinon from "sinon"; import { BeDuration } from "@itwin/core-bentley"; import { ClassInfo, InstanceKey, PropertyInfo, RelatedClassInfo, RelatedClassInfoWithOptionalRelationship, Ruleset } from "@itwin/presentation-common"; -import { PresentationInstanceFilterPropertyInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { createTestCategoryDescription, createTestPropertiesContentField } from "./Content"; +import { PresentationInstanceFilterPropertyInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { createTestCategoryDescription, createTestPropertiesContentField } from "./Content.js"; export function createTestECInstanceKey(key?: Partial): InstanceKey { return { diff --git a/packages/components/src/test/_helpers/Content.ts b/packages/components/src/test/_helpers/Content.ts index a46d3dfd0..d13a068f2 100644 --- a/packages/components/src/test/_helpers/Content.ts +++ b/packages/components/src/test/_helpers/Content.ts @@ -26,7 +26,7 @@ import { TypeDescription, ValuesMap, } from "@itwin/presentation-common"; -import { createTestECClassInfo, createTestECInstanceKey, createTestRelationshipPath } from "./Common"; +import { createTestECClassInfo, createTestECInstanceKey, createTestRelationshipPath } from "./Common.js"; export const createTestCategoryDescription = (props?: Partial) => ({ name: "test-category", diff --git a/packages/components/src/test/_helpers/Hierarchy.ts b/packages/components/src/test/_helpers/Hierarchy.ts index 24f96e047..18e0d06ad 100644 --- a/packages/components/src/test/_helpers/Hierarchy.ts +++ b/packages/components/src/test/_helpers/Hierarchy.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { ECClassGroupingNodeKey, ECInstancesNodeKey, Node, NodePathElement, StandardNodeTypes } from "@itwin/presentation-common"; -import { createTestECInstanceKey } from "./Common"; -import { createTestLabelDefinition } from "./LabelDefinition"; +import { createTestECInstanceKey } from "./Common.js"; +import { createTestLabelDefinition } from "./LabelDefinition.js"; export function createTestECInstancesNodeKey(key?: Partial): ECInstancesNodeKey { return { diff --git a/packages/components/src/test/_helpers/UiComponents.ts b/packages/components/src/test/_helpers/UiComponents.ts index 180d9baeb..b5b09babb 100644 --- a/packages/components/src/test/_helpers/UiComponents.ts +++ b/packages/components/src/test/_helpers/UiComponents.ts @@ -6,8 +6,8 @@ import { PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { DelayLoadedTreeNodeItem } from "@itwin/components-react"; import { NodeKey } from "@itwin/presentation-common"; -import { PresentationTreeNodeItem } from "../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestECInstancesNodeKey } from "./Hierarchy"; +import { PresentationTreeNodeItem } from "../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestECInstancesNodeKey } from "./Hierarchy.js"; export function createTestTreeNodeItem(key?: NodeKey, partialNode?: Partial): PresentationTreeNodeItem { const node = { diff --git a/packages/components/src/test/common/ContentBuilder.test.ts b/packages/components/src/test/common/ContentBuilder.test.ts index 8ba2a2968..637c0c441 100644 --- a/packages/components/src/test/common/ContentBuilder.test.ts +++ b/packages/components/src/test/common/ContentBuilder.test.ts @@ -6,10 +6,10 @@ import { expect } from "chai"; import { ArrayValue, PropertyRecord, StandardTypeNames, StructValue, PropertyValueFormat as UiPropertyValueFormat } from "@itwin/appui-abstract"; import { EnumerationInfo, PropertyValueFormat, traverseContentItem } from "@itwin/presentation-common"; -import { PropertyRecordsBuilder } from "../../presentation-components/common/PropertyRecordsBuilder"; -import { NumericEditorName } from "../../presentation-components/properties/editors/NumericPropertyEditor"; -import { QuantityEditorName } from "../../presentation-components/properties/editors/QuantityPropertyEditor"; -import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common"; +import { PropertyRecordsBuilder } from "../../presentation-components/common/PropertyRecordsBuilder.js"; +import { NumericEditorName } from "../../presentation-components/properties/editors/NumericPropertyEditor.js"; +import { QuantityEditorName } from "../../presentation-components/properties/editors/QuantityPropertyEditor.js"; +import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, @@ -17,8 +17,8 @@ import { createTestNestedContentField, createTestPropertiesContentField, createTestSimpleContentField, -} from "../_helpers/Content"; -import { createTestLabelDefinition } from "../_helpers/LabelDefinition"; +} from "../_helpers/Content.js"; +import { createTestLabelDefinition } from "../_helpers/LabelDefinition.js"; class TestPropertyRecordsBuilder extends PropertyRecordsBuilder { public entries: Array = []; diff --git a/packages/components/src/test/common/ContentDataProvider.test.ts b/packages/components/src/test/common/ContentDataProvider.test.ts index d9ed354ba..d774f501a 100644 --- a/packages/components/src/test/common/ContentDataProvider.test.ts +++ b/packages/components/src/test/common/ContentDataProvider.test.ts @@ -25,15 +25,15 @@ import { VariableValue, } from "@itwin/presentation-common"; import { IModelContentChangeEventArgs, Presentation, PresentationManager, RulesetManager, RulesetVariablesManager } from "@itwin/presentation-frontend"; -import { CacheInvalidationProps, ContentDataProvider, ContentDataProviderProps } from "../../presentation-components/common/ContentDataProvider"; -import { createTestECInstanceKey, createTestPropertyInfo, createTestRuleset } from "../_helpers/Common"; +import { CacheInvalidationProps, ContentDataProvider, ContentDataProviderProps } from "../../presentation-components/common/ContentDataProvider.js"; +import { createTestECInstanceKey, createTestPropertyInfo, createTestRuleset } from "../_helpers/Common.js"; import { createTestContentDescriptor, createTestContentItem, createTestNestedContentField, createTestPropertiesContentField, createTestSimpleContentField, -} from "../_helpers/Content"; +} from "../_helpers/Content.js"; /** * The Provider class is used to make protected [[ContentDataProvider]] diff --git a/packages/components/src/test/common/Diagnostics.test.ts b/packages/components/src/test/common/Diagnostics.test.ts index 8e01a5206..af210b147 100644 --- a/packages/components/src/test/common/Diagnostics.test.ts +++ b/packages/components/src/test/common/Diagnostics.test.ts @@ -5,8 +5,8 @@ import { expect } from "chai"; import * as sinon from "sinon"; -import * as PresentationFrontendDiagnostics from "@itwin/presentation-frontend/lib/cjs/presentation-frontend/Diagnostics"; -import { createDiagnosticsOptions } from "../../presentation-components/common/Diagnostics"; +import * as PresentationFrontendDiagnostics from "@itwin/presentation-frontend/lib/cjs/presentation-frontend/Diagnostics.js"; +import { createDiagnosticsOptions } from "../../presentation-components/common/Diagnostics.js"; describe("createDiagnosticsOptions", () => { afterEach(() => { diff --git a/packages/components/src/test/common/RulesetRegistrationHelper.test.ts b/packages/components/src/test/common/RulesetRegistrationHelper.test.ts index 85a1670b9..23480a9f4 100644 --- a/packages/components/src/test/common/RulesetRegistrationHelper.test.ts +++ b/packages/components/src/test/common/RulesetRegistrationHelper.test.ts @@ -9,9 +9,9 @@ import * as sinon from "sinon"; import { BeDuration, using } from "@itwin/core-bentley"; import { RegisteredRuleset } from "@itwin/presentation-common"; import { Presentation, RulesetManager } from "@itwin/presentation-frontend"; -import { RulesetRegistrationHelper } from "../../presentation-components/common/RulesetRegistrationHelper"; -import { createTestRuleset } from "../_helpers/Common"; -import { createStub } from "../TestUtils"; +import { RulesetRegistrationHelper } from "../../presentation-components/common/RulesetRegistrationHelper.js"; +import { createTestRuleset } from "../_helpers/Common.js"; +import { createStub } from "../TestUtils.js"; describe("RulesetRegistrationHelper", () => { const rulesetManager = { diff --git a/packages/components/src/test/common/StyleHelper.test.ts b/packages/components/src/test/common/StyleHelper.test.ts index 1ce306797..12a846353 100644 --- a/packages/components/src/test/common/StyleHelper.test.ts +++ b/packages/components/src/test/common/StyleHelper.test.ts @@ -5,8 +5,8 @@ import { expect } from "chai"; import { LabelDefinition, Node } from "@itwin/presentation-common"; -import { StyleHelper } from "../../presentation-components/common/StyleHelper"; -import { createTestECInstancesNodeKey } from "../_helpers/Hierarchy"; +import { StyleHelper } from "../../presentation-components/common/StyleHelper.js"; +import { createTestECInstancesNodeKey } from "../_helpers/Hierarchy.js"; describe("StyleHelper", () => { const createNodeBase = (): Node => ({ diff --git a/packages/components/src/test/common/Utils.test.ts b/packages/components/src/test/common/Utils.test.ts index 11c568510..94169f93d 100644 --- a/packages/components/src/test/common/Utils.test.ts +++ b/packages/components/src/test/common/Utils.test.ts @@ -20,11 +20,16 @@ import { getDisplayName, initializeLocalization, initializePropertyValueRenderers, -} from "../../presentation-components/common/Utils"; -import { createTestPropertyInfo } from "../_helpers/Common"; -import { createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField, createTestSimpleContentField } from "../_helpers/Content"; -import { createTestLabelCompositeValue, createTestLabelDefinition } from "../_helpers/LabelDefinition"; -import { createStub } from "../TestUtils"; +} from "../../presentation-components/common/Utils.js"; +import { createTestPropertyInfo } from "../_helpers/Common.js"; +import { + createTestContentDescriptor, + createTestNestedContentField, + createTestPropertiesContentField, + createTestSimpleContentField, +} from "../_helpers/Content.js"; +import { createTestLabelCompositeValue, createTestLabelDefinition } from "../_helpers/LabelDefinition.js"; +import { createStub } from "../TestUtils.js"; class TestComponent extends Component {} diff --git a/packages/components/src/test/favorite-properties/DataProvider.test.ts b/packages/components/src/test/favorite-properties/DataProvider.test.ts index 666d35d6a..689af5377 100644 --- a/packages/components/src/test/favorite-properties/DataProvider.test.ts +++ b/packages/components/src/test/favorite-properties/DataProvider.test.ts @@ -11,9 +11,9 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelConnection } from "@itwin/core-frontend"; import { KeySet, Ruleset } from "@itwin/presentation-common"; import { FavoritePropertiesManager, Presentation, PresentationManager, SelectionManager } from "@itwin/presentation-frontend"; -import { FavoritePropertiesDataProvider } from "../../presentation-components/favorite-properties/DataProvider"; -import { getFavoritesCategory } from "../../presentation-components/favorite-properties/Utils"; -import { PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; +import { FavoritePropertiesDataProvider } from "../../presentation-components/favorite-properties/DataProvider.js"; +import { getFavoritesCategory } from "../../presentation-components/favorite-properties/Utils.js"; +import { PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; describe("FavoritePropertiesDataProvider", () => { let provider: FavoritePropertiesDataProvider; diff --git a/packages/components/src/test/hooks/UseRulesetRegistration.test.ts b/packages/components/src/test/hooks/UseRulesetRegistration.test.ts index 359af3cca..fcbff3e90 100644 --- a/packages/components/src/test/hooks/UseRulesetRegistration.test.ts +++ b/packages/components/src/test/hooks/UseRulesetRegistration.test.ts @@ -8,8 +8,8 @@ import { ResolvablePromise } from "presentation-test-utilities"; import sinon from "sinon"; import { RegisteredRuleset, Ruleset } from "@itwin/presentation-common"; import { Presentation, RulesetManager } from "@itwin/presentation-frontend"; -import { useRulesetRegistration } from "../../presentation-components/hooks/UseRulesetRegistration"; -import { renderHook } from "../TestUtils"; +import { useRulesetRegistration } from "../../presentation-components/hooks/UseRulesetRegistration.js"; +import { renderHook } from "../TestUtils.js"; /* eslint-disable deprecation/deprecation */ diff --git a/packages/components/src/test/instance-filter-builder/InstanceFilterConverter.test.ts b/packages/components/src/test/instance-filter-builder/InstanceFilterConverter.test.ts index 2937fb1e4..7c715528d 100644 --- a/packages/components/src/test/instance-filter-builder/InstanceFilterConverter.test.ts +++ b/packages/components/src/test/instance-filter-builder/InstanceFilterConverter.test.ts @@ -10,15 +10,15 @@ import { PropertyFilterRuleGroupOperator, PropertyFilterRuleOperator } from "@it import { BeEvent } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { ClassInfo, RelationshipPath, PropertyValueFormat as TypeValueFormat, Value } from "@itwin/presentation-common"; -import { serializeUniqueValues, UniqueValue } from "../../presentation-components/common/Utils"; -import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider"; -import { PresentationInstanceFilterCondition } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter"; -import { createTestECClassInfo, createTestPropertyInfo } from "../_helpers/Common"; -import { createTestNestedContentField, createTestPropertiesContentField } from "../_helpers/Content"; +import { serializeUniqueValues, UniqueValue } from "../../presentation-components/common/Utils.js"; +import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider.js"; import { createInstanceFilterDefinition, PresentationInstanceFilterInfo, -} from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; +} from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationInstanceFilterCondition } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter.js"; +import { createTestECClassInfo, createTestPropertyInfo } from "../_helpers/Common.js"; +import { createTestNestedContentField, createTestPropertiesContentField } from "../_helpers/Content.js"; describe("createInstanceFilterDefinition", () => { describe("converts single condition with", () => { diff --git a/packages/components/src/test/instance-filter-builder/IntanceFilterBuilder.test.tsx b/packages/components/src/test/instance-filter-builder/IntanceFilterBuilder.test.tsx index e12742792..a6d81f767 100644 --- a/packages/components/src/test/instance-filter-builder/IntanceFilterBuilder.test.tsx +++ b/packages/components/src/test/instance-filter-builder/IntanceFilterBuilder.test.tsx @@ -12,12 +12,12 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { ClassInfo, Descriptor } from "@itwin/presentation-common"; import { Presentation } from "@itwin/presentation-frontend"; -import { translate } from "../../presentation-components/common/Utils"; -import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider"; -import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "../../presentation-components/instance-filter-builder/InstanceFilterBuilder"; -import { createTestECClassInfo, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common"; -import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content"; -import { act, fireEvent, render, renderHook, waitFor } from "../TestUtils"; +import { translate } from "../../presentation-components/common/Utils.js"; +import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider.js"; +import { InstanceFilterBuilder, usePresentationInstanceFilteringProps } from "../../presentation-components/instance-filter-builder/InstanceFilterBuilder.js"; +import { createTestECClassInfo, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common.js"; +import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content.js"; +import { act, fireEvent, render, renderHook, waitFor } from "../TestUtils.js"; describe("InstanceFilterBuilder", () => { stubRaf(); diff --git a/packages/components/src/test/instance-filter-builder/PresentationFilterBuilder.test.tsx b/packages/components/src/test/instance-filter-builder/PresentationFilterBuilder.test.tsx index 450e302d0..78b831fa2 100644 --- a/packages/components/src/test/instance-filter-builder/PresentationFilterBuilder.test.tsx +++ b/packages/components/src/test/instance-filter-builder/PresentationFilterBuilder.test.tsx @@ -9,14 +9,14 @@ import { BeEvent } from "@itwin/core-bentley"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Presentation } from "@itwin/presentation-frontend"; -import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider"; +import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider.js"; import { PresentationInstanceFilterBuilder, PresentationInstanceFilterInfo, -} from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { createTestECClassInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common"; -import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content"; -import { render, waitFor, waitForElement } from "../TestUtils"; +} from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { createTestECClassInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common.js"; +import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content.js"; +import { render, waitFor, waitForElement } from "../TestUtils.js"; describe("PresentationInstanceFilter", () => { stubRaf(); diff --git a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilter.test.ts b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilter.test.ts index 5ee7edb9a..ab1394b80 100644 --- a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilter.test.ts +++ b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilter.test.ts @@ -8,16 +8,16 @@ import { PrimitiveValue, PropertyDescription, PropertyValueFormat } from "@itwin import { PropertyFilter, PropertyFilterRule, PropertyFilterRuleGroup } from "@itwin/components-react"; import { GenericInstanceFilter } from "@itwin/core-common"; import { Field } from "@itwin/presentation-common"; -import { serializeUniqueValues } from "../../presentation-components/common/Utils"; -import { PresentationInstanceFilter } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter"; -import { INSTANCE_FILTER_FIELD_SEPARATOR } from "../../presentation-components/instance-filter-builder/Utils"; -import { createTestECClassInfo } from "../_helpers/Common"; +import { serializeUniqueValues } from "../../presentation-components/common/Utils.js"; +import { PresentationInstanceFilter } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter.js"; +import { INSTANCE_FILTER_FIELD_SEPARATOR } from "../../presentation-components/instance-filter-builder/Utils.js"; +import { createTestECClassInfo } from "../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField, -} from "../_helpers/Content"; +} from "../_helpers/Content.js"; describe("PresentationInstanceFilter", () => { const category = createTestCategoryDescription({ name: "root", label: "Root" }); diff --git a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterDialog.test.tsx b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterDialog.test.tsx index 606b1661a..741c7bd22 100644 --- a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterDialog.test.tsx +++ b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterDialog.test.tsx @@ -12,16 +12,16 @@ import { BeEvent } from "@itwin/core-bentley"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Presentation } from "@itwin/presentation-frontend"; -import { translate } from "../../presentation-components/common/Utils"; -import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider"; -import { PresentationInstanceFilterInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { PresentationInstanceFilter } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter"; +import { translate } from "../../presentation-components/common/Utils.js"; +import { ECClassInfo, getIModelMetadataProvider } from "../../presentation-components/instance-filter-builder/ECMetadataProvider.js"; +import { PresentationInstanceFilterInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationInstanceFilter } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilter.js"; import { PresentationInstanceFilterDialog, PresentationInstanceFilterPropertiesSource, -} from "../../presentation-components/instance-filter-builder/PresentationInstanceFilterDialog"; -import { createTestECClassInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common"; -import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content"; +} from "../../presentation-components/instance-filter-builder/PresentationInstanceFilterDialog.js"; +import { createTestECClassInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../_helpers/Common.js"; +import { createTestCategoryDescription, createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content.js"; import { act, getAllByRole, @@ -36,7 +36,7 @@ import { waitFor, waitForElement, within, -} from "../TestUtils"; +} from "../TestUtils.js"; describe("PresentationInstanceFilterDialog", () => { stubRaf(); diff --git a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterProperty.test.tsx b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterProperty.test.tsx index f2a132d1e..d932f367a 100644 --- a/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterProperty.test.tsx +++ b/packages/components/src/test/instance-filter-builder/PresentationInstanceFilterProperty.test.tsx @@ -8,9 +8,9 @@ import sinon from "sinon"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp } from "@itwin/core-frontend"; import { Presentation } from "@itwin/presentation-frontend"; -import { PresentationInstanceFilterProperty } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilterProperty"; -import { createTestPresentationInstanceFilterPropertyInfo, stubRaf } from "../_helpers/Common"; -import { render, waitFor } from "../TestUtils"; +import { PresentationInstanceFilterProperty } from "../../presentation-components/instance-filter-builder/PresentationInstanceFilterProperty.js"; +import { createTestPresentationInstanceFilterPropertyInfo, stubRaf } from "../_helpers/Common.js"; +import { render, waitFor } from "../TestUtils.js"; describe("PresentationInstanceFilterProperty", () => { stubRaf(); diff --git a/packages/components/src/test/instance-filter-builder/Utils.test.ts b/packages/components/src/test/instance-filter-builder/Utils.test.ts index 79f869a91..b54729260 100644 --- a/packages/components/src/test/instance-filter-builder/Utils.test.ts +++ b/packages/components/src/test/instance-filter-builder/Utils.test.ts @@ -17,16 +17,16 @@ import { filterRuleValidator, INSTANCE_FILTER_FIELD_SEPARATOR, useFilterBuilderNavigationPropertyEditorContextProviderProps, -} from "../../presentation-components/instance-filter-builder/Utils"; -import { createTestECClassInfo } from "../_helpers/Common"; +} from "../../presentation-components/instance-filter-builder/Utils.js"; +import { createTestECClassInfo } from "../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField, createTestSimpleContentField, -} from "../_helpers/Content"; -import { renderHook } from "../TestUtils"; +} from "../_helpers/Content.js"; +import { renderHook } from "../TestUtils.js"; describe("createInstanceFilterPropertyInfos", () => { it("creates property infos when fields are in root category", () => { diff --git a/packages/components/src/test/labels/LabelsProvider.test.ts b/packages/components/src/test/labels/LabelsProvider.test.ts index cce21a053..857f9557b 100644 --- a/packages/components/src/test/labels/LabelsProvider.test.ts +++ b/packages/components/src/test/labels/LabelsProvider.test.ts @@ -10,8 +10,8 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelConnection } from "@itwin/core-frontend"; import { DEFAULT_KEYS_BATCH_SIZE, InstanceKey } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { PresentationLabelsProvider } from "../../presentation-components/labels/LabelsProvider"; -import { createTestECInstanceKey } from "../_helpers/Common"; +import { PresentationLabelsProvider } from "../../presentation-components/labels/LabelsProvider.js"; +import { createTestECInstanceKey } from "../_helpers/Common.js"; describe("PresentationLabelsProvider", () => { let provider: PresentationLabelsProvider; diff --git a/packages/components/src/test/properties/InstanceKeyValueRenderer.test.tsx b/packages/components/src/test/properties/InstanceKeyValueRenderer.test.tsx index 752d8c11d..d7581b09a 100644 --- a/packages/components/src/test/properties/InstanceKeyValueRenderer.test.tsx +++ b/packages/components/src/test/properties/InstanceKeyValueRenderer.test.tsx @@ -10,9 +10,9 @@ import { TypeConverter, TypeConverterManager } from "@itwin/components-react"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Presentation, SelectionManager } from "@itwin/presentation-frontend"; -import { InstanceKeyValueRenderer } from "../../presentation-components/properties/InstanceKeyValueRenderer"; -import { UnifiedSelectionContextProvider } from "../../presentation-components/unified-selection/UnifiedSelectionContext"; -import { act, cleanup, render, waitFor } from "../TestUtils"; +import { InstanceKeyValueRenderer } from "../../presentation-components/properties/InstanceKeyValueRenderer.js"; +import { UnifiedSelectionContextProvider } from "../../presentation-components/unified-selection/UnifiedSelectionContext.js"; +import { act, cleanup, render, waitFor } from "../TestUtils.js"; describe("InstanceKeyValueRenderer", () => { const renderer = new InstanceKeyValueRenderer(); diff --git a/packages/components/src/test/properties/editors/NavigationPropertyEditor.test.tsx b/packages/components/src/test/properties/editors/NavigationPropertyEditor.test.tsx index f2021ffa0..6feeac5f2 100644 --- a/packages/components/src/test/properties/editors/NavigationPropertyEditor.test.tsx +++ b/packages/components/src/test/properties/editors/NavigationPropertyEditor.test.tsx @@ -11,17 +11,17 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Content, KeySet, LabelDefinition, NavigationPropertyInfo } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import userEvent from "@testing-library/user-event"; -import { IContentDataProvider } from "../../../presentation-components/common/ContentDataProvider"; -import { NavigationPropertyTargetEditor } from "../../../presentation-components/properties/editors/NavigationPropertyEditor"; +import { userEvent } from "@testing-library/user-event"; +import { IContentDataProvider } from "../../../presentation-components/common/ContentDataProvider.js"; +import { NavigationPropertyTargetEditor } from "../../../presentation-components/properties/editors/NavigationPropertyEditor.js"; import { NavigationPropertyEditorContextProvider, NavigationPropertyEditorContextProviderProps, useNavigationPropertyEditorContextProviderProps, -} from "../../../presentation-components/properties/editors/NavigationPropertyEditorContext"; -import { createTestContentDescriptor, createTestContentItem, createTestPropertiesContentField, createTestSimpleContentField } from "../../_helpers/Content"; -import { createTestPropertyRecord } from "../../_helpers/UiComponents"; -import { renderHook, render as renderRTL, waitFor } from "../../TestUtils"; +} from "../../../presentation-components/properties/editors/NavigationPropertyEditorContext.js"; +import { createTestContentDescriptor, createTestContentItem, createTestPropertiesContentField, createTestSimpleContentField } from "../../_helpers/Content.js"; +import { createTestPropertyRecord } from "../../_helpers/UiComponents.js"; +import { renderHook, render as renderRTL, waitFor } from "../../TestUtils.js"; function createNavigationPropertyInfo(): NavigationPropertyInfo { return { diff --git a/packages/components/src/test/properties/editors/NumericPropertyEditor.test.tsx b/packages/components/src/test/properties/editors/NumericPropertyEditor.test.tsx index 8f63a1c9e..b21d32ca9 100644 --- a/packages/components/src/test/properties/editors/NumericPropertyEditor.test.tsx +++ b/packages/components/src/test/properties/editors/NumericPropertyEditor.test.tsx @@ -6,9 +6,9 @@ import { expect } from "chai"; import sinon from "sinon"; import { StandardTypeNames } from "@itwin/appui-abstract"; -import { NumericEditorName, NumericPropertyEditor } from "../../../presentation-components/properties/editors/NumericPropertyEditor"; -import { createTestPropertyRecord } from "../../_helpers/UiComponents"; -import { render, waitFor } from "../../TestUtils"; +import { NumericEditorName, NumericPropertyEditor } from "../../../presentation-components/properties/editors/NumericPropertyEditor.js"; +import { createTestPropertyRecord } from "../../_helpers/UiComponents.js"; +import { render, waitFor } from "../../TestUtils.js"; const createRecord = (initialValue?: number) => { return createTestPropertyRecord( diff --git a/packages/components/src/test/properties/editors/QuantityPropertyEditor.test.tsx b/packages/components/src/test/properties/editors/QuantityPropertyEditor.test.tsx index 5f881e0fd..b6687119f 100644 --- a/packages/components/src/test/properties/editors/QuantityPropertyEditor.test.tsx +++ b/packages/components/src/test/properties/editors/QuantityPropertyEditor.test.tsx @@ -11,10 +11,10 @@ import { FormattingUnitSystemChangedArgs, IModelApp, IModelConnection } from "@i import { Format, FormatterSpec, ParserSpec } from "@itwin/core-quantity"; import { SchemaContext } from "@itwin/ecschema-metadata"; import { KoqPropertyValueFormatter } from "@itwin/presentation-common"; -import { SchemaMetadataContextProvider } from "../../../presentation-components/common/SchemaMetadataContext"; -import { QuantityEditorName, QuantityPropertyEditor } from "../../../presentation-components/properties/editors/QuantityPropertyEditor"; -import { createTestPropertyRecord } from "../../_helpers/UiComponents"; -import { render, waitFor } from "../../TestUtils"; +import { SchemaMetadataContextProvider } from "../../../presentation-components/common/SchemaMetadataContext.js"; +import { QuantityEditorName, QuantityPropertyEditor } from "../../../presentation-components/properties/editors/QuantityPropertyEditor.js"; +import { createTestPropertyRecord } from "../../_helpers/UiComponents.js"; +import { render, waitFor } from "../../TestUtils.js"; const createRecord = ({ initialValue, quantityType }: { initialValue?: number; quantityType?: string }) => { return createTestPropertyRecord( diff --git a/packages/components/src/test/properties/inputs/NavigationPropertyTargetSelector.test.tsx b/packages/components/src/test/properties/inputs/NavigationPropertyTargetSelector.test.tsx index c4ee1967e..5fd771615 100644 --- a/packages/components/src/test/properties/inputs/NavigationPropertyTargetSelector.test.tsx +++ b/packages/components/src/test/properties/inputs/NavigationPropertyTargetSelector.test.tsx @@ -11,14 +11,14 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Content, Item, LabelDefinition, NavigationPropertyInfo } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common"; -import { VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader"; +import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common.js"; +import { VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader.js"; import { NavigationPropertyTargetSelector, NavigationPropertyTargetSelectorProps, -} from "../../../presentation-components/properties/inputs/NavigationPropertyTargetSelector"; -import { createTestContentDescriptor, createTestContentItem } from "../../_helpers/Content"; -import { render, waitFor } from "../../TestUtils"; +} from "../../../presentation-components/properties/inputs/NavigationPropertyTargetSelector.js"; +import { createTestContentDescriptor, createTestContentItem } from "../../_helpers/Content.js"; +import { render, waitFor } from "../../TestUtils.js"; function createNavigationPropertyDescription(): PropertyDescription { return { diff --git a/packages/components/src/test/properties/inputs/NumericPropertyInput.test.tsx b/packages/components/src/test/properties/inputs/NumericPropertyInput.test.tsx index 3c3160697..c77ca1e20 100644 --- a/packages/components/src/test/properties/inputs/NumericPropertyInput.test.tsx +++ b/packages/components/src/test/properties/inputs/NumericPropertyInput.test.tsx @@ -10,10 +10,10 @@ import { PrimitiveValue, StandardTypeNames } from "@itwin/appui-abstract"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp } from "@itwin/core-frontend"; import { Presentation } from "@itwin/presentation-frontend"; -import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common"; -import { NumericInput, NumericPropertyInput } from "../../../presentation-components/properties/inputs/NumericPropertyInput"; -import { createTestPropertyRecord } from "../../_helpers/UiComponents"; -import { render, waitFor } from "../../TestUtils"; +import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common.js"; +import { NumericInput, NumericPropertyInput } from "../../../presentation-components/properties/inputs/NumericPropertyInput.js"; +import { createTestPropertyRecord } from "../../_helpers/UiComponents.js"; +import { render, waitFor } from "../../TestUtils.js"; const createRecord = (initialValue?: number) => { return createTestPropertyRecord({ value: initialValue, displayValue: initialValue?.toString() }, { typename: StandardTypeNames.Double }); diff --git a/packages/components/src/test/properties/inputs/QuantityPropertyEditorInput.test.tsx b/packages/components/src/test/properties/inputs/QuantityPropertyEditorInput.test.tsx index 048729882..b937ad7d6 100644 --- a/packages/components/src/test/properties/inputs/QuantityPropertyEditorInput.test.tsx +++ b/packages/components/src/test/properties/inputs/QuantityPropertyEditorInput.test.tsx @@ -13,12 +13,12 @@ import { FormattingUnitSystemChangedArgs, IModelApp, IModelConnection } from "@i import { Format, FormatterSpec, FormatType, ParseError, ParserSpec, QuantityParseResult } from "@itwin/core-quantity"; import { SchemaContext } from "@itwin/ecschema-metadata"; import { KoqPropertyValueFormatter } from "@itwin/presentation-common"; -import { SchemaMetadataContextProvider } from "../../../presentation-components/common/SchemaMetadataContext"; -import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common"; -import { QuantityEditorName } from "../../../presentation-components/properties/editors/QuantityPropertyEditor"; -import { QuantityPropertyEditorInput } from "../../../presentation-components/properties/inputs/QuantityPropertyEditorInput"; -import { createTestPropertyRecord } from "../../_helpers/UiComponents"; -import { render, waitFor } from "../../TestUtils"; +import { SchemaMetadataContextProvider } from "../../../presentation-components/common/SchemaMetadataContext.js"; +import { PropertyEditorAttributes } from "../../../presentation-components/properties/editors/Common.js"; +import { QuantityEditorName } from "../../../presentation-components/properties/editors/QuantityPropertyEditor.js"; +import { QuantityPropertyEditorInput } from "../../../presentation-components/properties/inputs/QuantityPropertyEditorInput.js"; +import { createTestPropertyRecord } from "../../_helpers/UiComponents.js"; +import { render, waitFor } from "../../TestUtils.js"; const createRecord = ({ initialValue, quantityType }: { initialValue?: number; quantityType?: string }) => { return createTestPropertyRecord( diff --git a/packages/components/src/test/properties/inputs/UniquePropertyValuesSelector.test.tsx b/packages/components/src/test/properties/inputs/UniquePropertyValuesSelector.test.tsx index 5abbbc363..44f643cf6 100644 --- a/packages/components/src/test/properties/inputs/UniquePropertyValuesSelector.test.tsx +++ b/packages/components/src/test/properties/inputs/UniquePropertyValuesSelector.test.tsx @@ -20,18 +20,18 @@ import { Ruleset, } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { serializeUniqueValues, UniqueValue } from "../../../presentation-components/common/Utils"; -import { ItemsLoader, VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader"; -import { UniquePropertyValuesSelector } from "../../../presentation-components/properties/inputs/UniquePropertyValuesSelector"; -import { createTestECClassInfo, createTestPropertyInfo, createTestRelatedClassInfo, createTestRelationshipPath } from "../../_helpers/Common"; +import { serializeUniqueValues, UniqueValue } from "../../../presentation-components/common/Utils.js"; +import { ItemsLoader, VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader.js"; +import { UniquePropertyValuesSelector } from "../../../presentation-components/properties/inputs/UniquePropertyValuesSelector.js"; +import { createTestECClassInfo, createTestPropertyInfo, createTestRelatedClassInfo, createTestRelationshipPath } from "../../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField, -} from "../../_helpers/Content"; -import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy"; -import { render, waitFor } from "../../TestUtils"; +} from "../../_helpers/Content.js"; +import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy.js"; +import { render, waitFor } from "../../TestUtils.js"; describe("UniquePropertyValuesSelector", () => { let presentationManagerStub: sinon.SinonStub; diff --git a/packages/components/src/test/properties/inputs/UseNavigationPropertyTargetsLoader.test.ts b/packages/components/src/test/properties/inputs/UseNavigationPropertyTargetsLoader.test.ts index d1ded650d..fb9b84ab6 100644 --- a/packages/components/src/test/properties/inputs/UseNavigationPropertyTargetsLoader.test.ts +++ b/packages/components/src/test/properties/inputs/UseNavigationPropertyTargetsLoader.test.ts @@ -11,14 +11,14 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Content, Item, LabelDefinition, NavigationPropertyInfo } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader"; +import { VALUE_BATCH_SIZE } from "../../../presentation-components/properties/inputs/ItemsLoader.js"; import { NavigationPropertyItemsLoader, useNavigationPropertyTargetsLoader, useNavigationPropertyTargetsRuleset, -} from "../../../presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader"; -import { createTestContentDescriptor, createTestContentItem } from "../../_helpers/Content"; -import { renderHook, waitFor } from "../../TestUtils"; +} from "../../../presentation-components/properties/inputs/UseNavigationPropertyTargetsLoader.js"; +import { createTestContentDescriptor, createTestContentItem } from "../../_helpers/Content.js"; +import { renderHook, waitFor } from "../../TestUtils.js"; describe("useNavigationPropertyTargetsLoader", () => { let presentationManagerStub: sinon.SinonStub; diff --git a/packages/components/src/test/properties/inputs/UseQuantityValueInput.test.tsx b/packages/components/src/test/properties/inputs/UseQuantityValueInput.test.tsx index 6594aaf81..fddd67c33 100644 --- a/packages/components/src/test/properties/inputs/UseQuantityValueInput.test.tsx +++ b/packages/components/src/test/properties/inputs/UseQuantityValueInput.test.tsx @@ -11,8 +11,8 @@ import { FormattingUnitSystemChangedArgs, IModelApp } from "@itwin/core-frontend import { Format, FormatterSpec, ParseError, ParserSpec, QuantityParseResult } from "@itwin/core-quantity"; import { SchemaContext } from "@itwin/ecschema-metadata"; import { KoqPropertyValueFormatter } from "@itwin/presentation-common"; -import { QuantityValue, useQuantityValueInput, UseQuantityValueInputProps } from "../../../presentation-components/properties/inputs/UseQuantityValueInput"; -import { render, waitFor } from "../../TestUtils"; +import { QuantityValue, useQuantityValueInput, UseQuantityValueInputProps } from "../../../presentation-components/properties/inputs/UseQuantityValueInput.js"; +import { render, waitFor } from "../../TestUtils.js"; function TestInput({ onChange, ...restProps }: UseQuantityValueInputProps & { onChange?: (value: QuantityValue) => void }) { const { quantityValue, inputProps } = useQuantityValueInput(restProps); diff --git a/packages/components/src/test/properties/inputs/Utils.test.ts b/packages/components/src/test/properties/inputs/Utils.test.ts index 935d953fe..ed267c148 100644 --- a/packages/components/src/test/properties/inputs/Utils.test.ts +++ b/packages/components/src/test/properties/inputs/Utils.test.ts @@ -6,7 +6,7 @@ import { expect } from "chai"; import sinon from "sinon"; import { Format, FormatType, ParserSpec, QuantityParseResult } from "@itwin/core-quantity"; -import { getDecimalRoundingError, getPersistenceUnitRoundingError } from "../../../presentation-components/properties/inputs/Utils"; +import { getDecimalRoundingError, getPersistenceUnitRoundingError } from "../../../presentation-components/properties/inputs/Utils.js"; describe("getDecimalRoundingError", () => { it("returns correct results", () => { diff --git a/packages/components/src/test/propertygrid/DataProvider.test.ts b/packages/components/src/test/propertygrid/DataProvider.test.ts index b4b9ff2a8..025ed8a80 100644 --- a/packages/components/src/test/propertygrid/DataProvider.test.ts +++ b/packages/components/src/test/propertygrid/DataProvider.test.ts @@ -29,10 +29,10 @@ import { ValuesDictionary, } from "@itwin/presentation-common"; import { FavoritePropertiesManager, FavoritePropertiesScope, Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { CacheInvalidationProps } from "../../presentation-components/common/ContentDataProvider"; -import { FAVORITES_CATEGORY_NAME } from "../../presentation-components/favorite-properties/Utils"; -import { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; -import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common"; +import { CacheInvalidationProps } from "../../presentation-components/common/ContentDataProvider.js"; +import { FAVORITES_CATEGORY_NAME } from "../../presentation-components/favorite-properties/Utils.js"; +import { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; +import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, @@ -40,7 +40,7 @@ import { createTestNestedContentField, createTestPropertiesContentField, createTestSimpleContentField, -} from "../_helpers/Content"; +} from "../_helpers/Content.js"; /** * This is just a helper class to provide public access to diff --git a/packages/components/src/test/propertygrid/FavoritePropertiesDataFilterer.test.ts b/packages/components/src/test/propertygrid/FavoritePropertiesDataFilterer.test.ts index 4af261135..7e494094b 100644 --- a/packages/components/src/test/propertygrid/FavoritePropertiesDataFilterer.test.ts +++ b/packages/components/src/test/propertygrid/FavoritePropertiesDataFilterer.test.ts @@ -8,11 +8,11 @@ import sinon from "sinon"; import { PropertyDescription, PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { IModelConnection } from "@itwin/core-frontend"; import { FavoritePropertiesManager, FavoritePropertiesScope, Presentation } from "@itwin/presentation-frontend"; -import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; -import { FavoritePropertiesDataFilterer } from "../../presentation-components/propertygrid/FavoritePropertiesDataFilterer"; -import { createTestSimpleContentField } from "../_helpers/Content"; -import { createArrayProperty, createPrimitiveStringProperty, createStructProperty } from "../_helpers/Properties"; -import { createStub } from "../TestUtils"; +import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; +import { FavoritePropertiesDataFilterer } from "../../presentation-components/propertygrid/FavoritePropertiesDataFilterer.js"; +import { createTestSimpleContentField } from "../_helpers/Content.js"; +import { createArrayProperty, createPrimitiveStringProperty, createStructProperty } from "../_helpers/Properties.js"; +import { createStub } from "../TestUtils.js"; describe("FavoritePropertiesDataFilterer", () => { const imodel = {} as IModelConnection; diff --git a/packages/components/src/test/propertygrid/UseUnifiedSelection.test.tsx b/packages/components/src/test/propertygrid/UseUnifiedSelection.test.tsx index 33d3e45b7..c730d5578 100644 --- a/packages/components/src/test/propertygrid/UseUnifiedSelection.test.tsx +++ b/packages/components/src/test/propertygrid/UseUnifiedSelection.test.tsx @@ -9,10 +9,13 @@ import sinon from "sinon"; import { IModelConnection } from "@itwin/core-frontend"; import { KeySet } from "@itwin/presentation-common"; import { ISelectionProvider, SelectionChangeEventArgs, SelectionChangeType, SelectionHandler } from "@itwin/presentation-frontend"; -import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; -import { SelectionHandlerContextProvider, usePropertyDataProviderWithUnifiedSelection } from "../../presentation-components/propertygrid/UseUnifiedSelection"; -import { createTestECInstanceKey } from "../_helpers/Common"; -import { act, renderHook } from "../TestUtils"; +import { IPresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; +import { + SelectionHandlerContextProvider, + usePropertyDataProviderWithUnifiedSelection, +} from "../../presentation-components/propertygrid/UseUnifiedSelection.js"; +import { createTestECInstanceKey } from "../_helpers/Common.js"; +import { act, renderHook } from "../TestUtils.js"; describe("usePropertyDataProviderWithUnifiedSelection", () => { let selectionHandler: sinon.SinonStubbedInstance; diff --git a/packages/components/src/test/propertygrid/VirtualizedPropertyGrid.test.tsx b/packages/components/src/test/propertygrid/VirtualizedPropertyGrid.test.tsx index c8f98ceff..9552436e7 100644 --- a/packages/components/src/test/propertygrid/VirtualizedPropertyGrid.test.tsx +++ b/packages/components/src/test/propertygrid/VirtualizedPropertyGrid.test.tsx @@ -23,10 +23,10 @@ import { VirtualizedPropertyGridWithDataProvider, } from "@itwin/components-react"; import { InstanceKey } from "@itwin/presentation-common"; -import { PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider"; -import { createTestCategoryDescription } from "../_helpers/Content"; -import { createPrimitiveStringProperty } from "../_helpers/Properties"; -import { render, renderHook, waitFor } from "../TestUtils"; +import { PresentationPropertyDataProvider } from "../../presentation-components/propertygrid/DataProvider.js"; +import { createTestCategoryDescription } from "../_helpers/Content.js"; +import { createPrimitiveStringProperty } from "../_helpers/Properties.js"; +import { render, renderHook, waitFor } from "../TestUtils.js"; describe("Category renderer customization", () => { describe("documentation snippets", () => { diff --git a/packages/components/src/test/setup.ts b/packages/components/src/test/setup.ts index 187bb78e5..cc66fe067 100644 --- a/packages/components/src/test/setup.ts +++ b/packages/components/src/test/setup.ts @@ -53,22 +53,17 @@ export const mochaHooks = { }, }; function getGlobalThis(): typeof globalThis & { IS_REACT_ACT_ENVIRONMENT?: boolean } { - /* istanbul ignore else */ if (typeof globalThis !== "undefined") { return globalThis; } - /* istanbul ignore next */ if (typeof self !== "undefined") { return self; } - /* istanbul ignore next */ if (typeof window !== "undefined") { return window; } - /* istanbul ignore next */ if (typeof global !== "undefined") { return global; } - /* istanbul ignore next */ throw new Error("unable to locate global object"); } diff --git a/packages/components/src/test/table/CellRenderer.test.tsx b/packages/components/src/test/table/CellRenderer.test.tsx index 13eb9e7d7..4bb301777 100644 --- a/packages/components/src/test/table/CellRenderer.test.tsx +++ b/packages/components/src/test/table/CellRenderer.test.tsx @@ -5,8 +5,8 @@ import { expect } from "chai"; import { ArrayValue, PrimitiveValue, PropertyDescription, PropertyRecord, PropertyValue, PropertyValueFormat, StructValue } from "@itwin/appui-abstract"; -import { TableCellRenderer } from "../../presentation-components/table/CellRenderer"; -import { fireEvent, render, waitFor } from "../TestUtils"; +import { TableCellRenderer } from "../../presentation-components/table/CellRenderer.js"; +import { fireEvent, render, waitFor } from "../TestUtils.js"; describe("TableCellRenderer", () => { function createRecord(value: PropertyValue, propDescription?: Partial) { diff --git a/packages/components/src/test/table/UseColumns.test.tsx b/packages/components/src/test/table/UseColumns.test.tsx index 9707d1757..13d7f1aa7 100644 --- a/packages/components/src/test/table/UseColumns.test.tsx +++ b/packages/components/src/test/table/UseColumns.test.tsx @@ -8,10 +8,10 @@ import sinon from "sinon"; import { IModelConnection } from "@itwin/core-frontend"; import { KeySet } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { useColumns, UseColumnsProps } from "../../presentation-components/table/UseColumns"; -import { createTestECInstanceKey, TestErrorBoundary } from "../_helpers/Common"; -import { createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField } from "../_helpers/Content"; -import { render, renderHook, waitFor } from "../TestUtils"; +import { useColumns, UseColumnsProps } from "../../presentation-components/table/UseColumns.js"; +import { createTestECInstanceKey, TestErrorBoundary } from "../_helpers/Common.js"; +import { createTestContentDescriptor, createTestNestedContentField, createTestPropertiesContentField } from "../_helpers/Content.js"; +import { render, renderHook, waitFor } from "../TestUtils.js"; describe("useColumns", () => { const imodel = {} as IModelConnection; diff --git a/packages/components/src/test/table/UsePresentationTable.test.tsx b/packages/components/src/test/table/UsePresentationTable.test.tsx index bf75beff7..645517ee7 100644 --- a/packages/components/src/test/table/UsePresentationTable.test.tsx +++ b/packages/components/src/test/table/UsePresentationTable.test.tsx @@ -10,15 +10,15 @@ import { BeUiEvent } from "@itwin/core-bentley"; import { FormattingUnitSystemChangedArgs, IModelApp, IModelConnection } from "@itwin/core-frontend"; import { ContentDescriptorRequestOptions, InstanceKey, Item, KeySet, RulesetVariable } from "@itwin/presentation-common"; import { Presentation, PresentationManager, SelectionManager } from "@itwin/presentation-frontend"; -import { TableColumnDefinition, TableRowDefinition } from "../../presentation-components/table/Types"; +import { TableColumnDefinition, TableRowDefinition } from "../../presentation-components/table/Types.js"; import { usePresentationTable, UsePresentationTableProps, usePresentationTableWithUnifiedSelection, -} from "../../presentation-components/table/UsePresentationTable"; -import { createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common"; -import { createTestContentDescriptor, createTestContentItem, createTestPropertiesContentField } from "../_helpers/Content"; -import { act, renderHook, waitFor } from "../TestUtils"; +} from "../../presentation-components/table/UsePresentationTable.js"; +import { createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common.js"; +import { createTestContentDescriptor, createTestContentItem, createTestPropertiesContentField } from "../_helpers/Content.js"; +import { act, renderHook, waitFor } from "../TestUtils.js"; describe("usePresentationTable", () => { const imodel = { diff --git a/packages/components/src/test/table/UseRows.test.tsx b/packages/components/src/test/table/UseRows.test.tsx index 5eb0f5211..71fbf385d 100644 --- a/packages/components/src/test/table/UseRows.test.tsx +++ b/packages/components/src/test/table/UseRows.test.tsx @@ -10,16 +10,16 @@ import { BeUiEvent } from "@itwin/core-bentley"; import { FormattingUnitSystemChangedArgs, IModelApp, IModelConnection, QuantityFormatter } from "@itwin/core-frontend"; import { Content, DescriptorOverrides, KeySet, SortDirection } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { ROWS_RELOAD_PAGE_SIZE, useRows, UseRowsProps } from "../../presentation-components/table/UseRows"; -import { createTestECInstanceKey, createTestPropertyInfo, TestErrorBoundary } from "../_helpers/Common"; +import { ROWS_RELOAD_PAGE_SIZE, useRows, UseRowsProps } from "../../presentation-components/table/UseRows.js"; +import { createTestECInstanceKey, createTestPropertyInfo, TestErrorBoundary } from "../_helpers/Common.js"; import { createTestCategoryDescription, createTestContentDescriptor, createTestContentItem, createTestNestedContentField, createTestPropertiesContentField, -} from "../_helpers/Content"; -import { act, render, renderHook, waitFor } from "../TestUtils"; +} from "../_helpers/Content.js"; +import { act, render, renderHook, waitFor } from "../TestUtils.js"; describe("useRows", () => { let onActiveFormattingUnitSystemChanged: QuantityFormatter["onActiveFormattingUnitSystemChanged"]; diff --git a/packages/components/src/test/table/UseTableOptions.test.ts b/packages/components/src/test/table/UseTableOptions.test.ts index 3e90ed265..71729021f 100644 --- a/packages/components/src/test/table/UseTableOptions.test.ts +++ b/packages/components/src/test/table/UseTableOptions.test.ts @@ -5,10 +5,10 @@ import { expect } from "chai"; import { FieldDescriptorType, SortDirection } from "@itwin/presentation-common"; -import { useTableOptions, UseTableOptionsProps } from "../../presentation-components/table/UseTableOptions"; -import { createTestPropertyInfo } from "../_helpers/Common"; -import { createTestPropertiesContentField } from "../_helpers/Content"; -import { act, renderHook, waitFor } from "../TestUtils"; +import { useTableOptions, UseTableOptionsProps } from "../../presentation-components/table/UseTableOptions.js"; +import { createTestPropertyInfo } from "../_helpers/Common.js"; +import { createTestPropertiesContentField } from "../_helpers/Content.js"; +import { act, renderHook, waitFor } from "../TestUtils.js"; describe("useTableOptions", () => { const propertiesField = createTestPropertiesContentField({ name: "prop_field", label: "Prop Field", properties: [{ property: createTestPropertyInfo() }] }); diff --git a/packages/components/src/test/tree/DataProvider.test.ts b/packages/components/src/test/tree/DataProvider.test.ts index 72037e400..3563d33f7 100644 --- a/packages/components/src/test/tree/DataProvider.test.ts +++ b/packages/components/src/test/tree/DataProvider.test.ts @@ -27,19 +27,19 @@ import { RulesetVariable, } from "@itwin/presentation-common"; import { Presentation, PresentationManager, RulesetVariablesManager } from "@itwin/presentation-frontend"; -import { translate } from "../../presentation-components/common/Utils"; -import { PresentationInstanceFilterInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { PresentationTreeDataProvider } from "../../presentation-components/tree/DataProvider"; +import { translate } from "../../presentation-components/common/Utils.js"; +import { PresentationInstanceFilterInfo } from "../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationTreeDataProvider } from "../../presentation-components/tree/DataProvider.js"; import { PresentationInfoTreeNodeItem, PresentationTreeNodeItem, PresentationTreeNodeItemFilteringInfo, -} from "../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common"; -import { createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content"; -import { createTestECClassGroupingNodeKey, createTestECInstancesNode, createTestECInstancesNodeKey, createTestNodePathElement } from "../_helpers/Hierarchy"; -import { createTestLabelDefinition } from "../_helpers/LabelDefinition"; -import { createTestTreeNodeItem } from "../_helpers/UiComponents"; +} from "../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestECClassInfo, createTestECInstanceKey, createTestPropertyInfo } from "../_helpers/Common.js"; +import { createTestContentDescriptor, createTestPropertiesContentField } from "../_helpers/Content.js"; +import { createTestECClassGroupingNodeKey, createTestECInstancesNode, createTestECInstancesNodeKey, createTestNodePathElement } from "../_helpers/Hierarchy.js"; +import { createTestLabelDefinition } from "../_helpers/LabelDefinition.js"; +import { createTestTreeNodeItem } from "../_helpers/UiComponents.js"; function createTestECInstancesNodeKeyWithId(id?: string) { return createTestECInstancesNodeKey({ diff --git a/packages/components/src/test/tree/FilteredDataProvider.test.ts b/packages/components/src/test/tree/FilteredDataProvider.test.ts index b0caff958..3fecbc32c 100644 --- a/packages/components/src/test/tree/FilteredDataProvider.test.ts +++ b/packages/components/src/test/tree/FilteredDataProvider.test.ts @@ -10,13 +10,13 @@ import { BeEvent } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { InstanceFilterDefinition, LabelDefinition, NodePathElement } from "@itwin/presentation-common"; import { Presentation, PresentationManager, RulesetVariablesManager } from "@itwin/presentation-frontend"; -import { PresentationTreeDataProvider } from "../../presentation-components/tree/DataProvider"; -import { FilteredPresentationTreeDataProvider } from "../../presentation-components/tree/FilteredDataProvider"; -import { IPresentationTreeDataProvider } from "../../presentation-components/tree/IPresentationTreeDataProvider"; -import { createTreeNodeItem } from "../../presentation-components/tree/Utils"; -import { createTestECInstanceKey } from "../_helpers/Common"; -import { createTestECInstancesNode, createTestECInstancesNodeKey, createTestNodePathElement } from "../_helpers/Hierarchy"; -import { createStub } from "../TestUtils"; +import { PresentationTreeDataProvider } from "../../presentation-components/tree/DataProvider.js"; +import { FilteredPresentationTreeDataProvider } from "../../presentation-components/tree/FilteredDataProvider.js"; +import { IPresentationTreeDataProvider } from "../../presentation-components/tree/IPresentationTreeDataProvider.js"; +import { createTreeNodeItem } from "../../presentation-components/tree/Utils.js"; +import { createTestECInstanceKey } from "../_helpers/Common.js"; +import { createTestECInstancesNode, createTestECInstancesNodeKey, createTestNodePathElement } from "../_helpers/Hierarchy.js"; +import { createStub } from "../TestUtils.js"; describe("FilteredTreeDataProvider", () => { function createTestNodePathElementWithId(id: string) { diff --git a/packages/components/src/test/tree/PresentationTreeNodeItem.test.ts b/packages/components/src/test/tree/PresentationTreeNodeItem.test.ts index 05d58d004..8332a77c6 100644 --- a/packages/components/src/test/tree/PresentationTreeNodeItem.test.ts +++ b/packages/components/src/test/tree/PresentationTreeNodeItem.test.ts @@ -12,8 +12,8 @@ import { isPresentationTreeNodeItem, PresentationInfoTreeNodeItem, PresentationTreeNodeItem, -} from "../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestECInstancesNodeKey } from "../_helpers/Hierarchy"; +} from "../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestECInstancesNodeKey } from "../_helpers/Hierarchy.js"; describe("isPresentationTreeNodeItem", () => { it("returns correct values", () => { diff --git a/packages/components/src/test/tree/ReportingTreeNodeLoader.test.ts b/packages/components/src/test/tree/ReportingTreeNodeLoader.test.ts index 8b6831fd2..20fb94ff3 100644 --- a/packages/components/src/test/tree/ReportingTreeNodeLoader.test.ts +++ b/packages/components/src/test/tree/ReportingTreeNodeLoader.test.ts @@ -15,8 +15,8 @@ import { TreeNodeItem, TreeNodeLoadResult, } from "@itwin/components-react"; -import { ReportingTreeNodeLoader } from "../../presentation-components/tree/ReportingTreeNodeLoader"; -import { waitFor } from "../TestUtils"; +import { ReportingTreeNodeLoader } from "../../presentation-components/tree/ReportingTreeNodeLoader.js"; +import { waitFor } from "../TestUtils.js"; describe("ReportingTreeNodeLoader", () => { let reportingNodeLoader: ReportingTreeNodeLoader; diff --git a/packages/components/src/test/tree/Utils.test.ts b/packages/components/src/test/tree/Utils.test.ts index 0573ae81a..f03531e01 100644 --- a/packages/components/src/test/tree/Utils.test.ts +++ b/packages/components/src/test/tree/Utils.test.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { expect } from "chai"; -import { LabelDefinition, Node } from "@itwin/presentation-common"; import { PageOptions } from "@itwin/components-react"; -import { createPartialTreeNodeItem, createTreeNodeItem, createTreeNodeItems, pageOptionsUiToPresentation } from "../../presentation-components/tree/Utils"; -import { createTestECClassGroupingNodeKey, createTestECInstancesNode } from "../_helpers/Hierarchy"; +import { LabelDefinition, Node } from "@itwin/presentation-common"; +import { createPartialTreeNodeItem, createTreeNodeItem, createTreeNodeItems, pageOptionsUiToPresentation } from "../../presentation-components/tree/Utils.js"; +import { createTestECClassGroupingNodeKey, createTestECInstancesNode } from "../_helpers/Hierarchy.js"; describe("Utils", () => { describe("createTreeNodeItem", () => { diff --git a/packages/components/src/test/tree/controlled/Helpers.ts b/packages/components/src/test/tree/controlled/Helpers.ts index 32c69e15e..3c68ba2e6 100644 --- a/packages/components/src/test/tree/controlled/Helpers.ts +++ b/packages/components/src/test/tree/controlled/Helpers.ts @@ -5,8 +5,12 @@ import { PropertyRecord } from "@itwin/appui-abstract"; import { CheckBoxState, TreeModelNode, TreeModelNodeInput, TreeNodeItem } from "@itwin/components-react"; -import { InfoTreeNodeItemType, PresentationInfoTreeNodeItem, PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy"; +import { + InfoTreeNodeItemType, + PresentationInfoTreeNodeItem, + PresentationTreeNodeItem, +} from "../../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy.js"; export function createTreeNodeItem(item?: Partial): PresentationTreeNodeItem { return { diff --git a/packages/components/src/test/tree/controlled/PresentationTreeNodeRenderer.test.tsx b/packages/components/src/test/tree/controlled/PresentationTreeNodeRenderer.test.tsx index 84fff703b..3bd3ad90d 100644 --- a/packages/components/src/test/tree/controlled/PresentationTreeNodeRenderer.test.tsx +++ b/packages/components/src/test/tree/controlled/PresentationTreeNodeRenderer.test.tsx @@ -10,13 +10,13 @@ import { TreeActions } from "@itwin/components-react"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp } from "@itwin/core-frontend"; import { Presentation } from "@itwin/presentation-frontend"; -import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { PresentationTreeNodeRenderer } from "../../../presentation-components/tree/controlled/PresentationTreeNodeRenderer"; -import { InfoTreeNodeItemType, PresentationInfoTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestPropertyInfo } from "../../_helpers/Common"; -import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content"; -import { fireEvent, render, waitFor } from "../../TestUtils"; -import { createInfoTreeNodeItem, createTreeModelNode, createTreeNodeItem } from "./Helpers"; +import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationTreeNodeRenderer } from "../../../presentation-components/tree/controlled/PresentationTreeNodeRenderer.js"; +import { InfoTreeNodeItemType, PresentationInfoTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestPropertyInfo } from "../../_helpers/Common.js"; +import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content.js"; +import { fireEvent, render, waitFor } from "../../TestUtils.js"; +import { createInfoTreeNodeItem, createTreeModelNode, createTreeNodeItem } from "./Helpers.js"; function createFilterInfo(propName: string = "prop"): PresentationInstanceFilterInfo { const property = createTestPropertyInfo({ name: propName }); diff --git a/packages/components/src/test/tree/controlled/PresentationTreeRenderer.test.tsx b/packages/components/src/test/tree/controlled/PresentationTreeRenderer.test.tsx index e8919ed71..3886ddea8 100644 --- a/packages/components/src/test/tree/controlled/PresentationTreeRenderer.test.tsx +++ b/packages/components/src/test/tree/controlled/PresentationTreeRenderer.test.tsx @@ -22,16 +22,16 @@ import { EmptyLocalization } from "@itwin/core-common"; import { IModelApp, IModelConnection } from "@itwin/core-frontend"; import { Descriptor, PresentationError, PresentationStatus, PropertyValueFormat } from "@itwin/presentation-common"; import { Presentation, PresentationManager } from "@itwin/presentation-frontend"; -import { translate } from "../../../presentation-components/common/Utils"; -import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { PresentationTreeRenderer } from "../../../presentation-components/tree/controlled/PresentationTreeRenderer"; -import { PresentationTreeDataProvider } from "../../../presentation-components/tree/DataProvider"; -import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider"; -import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestPropertyInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../../_helpers/Common"; -import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content"; -import { act, render, waitFor } from "../../TestUtils"; -import { createTreeModelNodeInput } from "./Helpers"; +import { translate } from "../../../presentation-components/common/Utils.js"; +import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { PresentationTreeRenderer } from "../../../presentation-components/tree/controlled/PresentationTreeRenderer.js"; +import { PresentationTreeDataProvider } from "../../../presentation-components/tree/DataProvider.js"; +import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider.js"; +import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestPropertyInfo, stubDOMMatrix, stubGetBoundingClientRect, stubRaf } from "../../_helpers/Common.js"; +import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content.js"; +import { act, render, waitFor } from "../../TestUtils.js"; +import { createTreeModelNodeInput } from "./Helpers.js"; describe("PresentationTreeRenderer", () => { stubRaf(); diff --git a/packages/components/src/test/tree/controlled/TreeHooks.test.ts b/packages/components/src/test/tree/controlled/TreeHooks.test.ts index 8e01cc800..be2b760f4 100644 --- a/packages/components/src/test/tree/controlled/TreeHooks.test.ts +++ b/packages/components/src/test/tree/controlled/TreeHooks.test.ts @@ -25,10 +25,10 @@ import { PresentationTreeNodeLoaderProps, useControlledPresentationTreeFiltering, usePresentationTreeNodeLoader, -} from "../../../presentation-components/tree/controlled/TreeHooks"; -import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider"; -import { createTreeNodeItem } from "../../../presentation-components/tree/Utils"; -import { renderHook, waitFor } from "../../TestUtils"; +} from "../../../presentation-components/tree/controlled/TreeHooks.js"; +import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider.js"; +import { createTreeNodeItem } from "../../../presentation-components/tree/Utils.js"; +import { renderHook, waitFor } from "../../TestUtils.js"; /* eslint-disable deprecation/deprecation */ diff --git a/packages/components/src/test/tree/controlled/TreeReloader.test.ts b/packages/components/src/test/tree/controlled/TreeReloader.test.ts index fe4c22391..e01fcc96a 100644 --- a/packages/components/src/test/tree/controlled/TreeReloader.test.ts +++ b/packages/components/src/test/tree/controlled/TreeReloader.test.ts @@ -10,8 +10,8 @@ import { PropertyRecord, PropertyValueFormat } from "@itwin/appui-abstract"; import { DelayLoadedTreeNodeItem, MutableTreeModel, RenderedItemsRange, TreeModelNodeInput, TreeModelSource, UiComponents } from "@itwin/components-react"; import { EmptyLocalization } from "@itwin/core-common"; import { IModelConnection } from "@itwin/core-frontend"; -import { reloadTree } from "../../../presentation-components/tree/controlled/TreeReloader"; -import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider"; +import { reloadTree } from "../../../presentation-components/tree/controlled/TreeReloader.js"; +import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider.js"; describe("reloadTree", () => { let dataProvider: IPresentationTreeDataProvider; diff --git a/packages/components/src/test/tree/controlled/UseControlledTreeFiltering.test.ts b/packages/components/src/test/tree/controlled/UseControlledTreeFiltering.test.ts index 81ab7899f..3de8d4c67 100644 --- a/packages/components/src/test/tree/controlled/UseControlledTreeFiltering.test.ts +++ b/packages/components/src/test/tree/controlled/UseControlledTreeFiltering.test.ts @@ -10,11 +10,11 @@ import { TreeModelNode, TreeNodeItem, UiComponents } from "@itwin/components-rea import { EmptyLocalization } from "@itwin/core-common"; import { IModelConnection } from "@itwin/core-frontend"; import { NodePathElement } from "@itwin/presentation-common"; -import { useFilteredNodeLoader, useNodeHighlightingProps } from "../../../presentation-components/tree/controlled/UseControlledTreeFiltering"; -import { FilteredPresentationTreeDataProvider } from "../../../presentation-components/tree/FilteredDataProvider"; -import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider"; -import { createTestPropertyRecord, createTestTreeNodeItem } from "../../_helpers/UiComponents"; -import { act, createStub, renderHook, waitFor } from "../../TestUtils"; +import { useFilteredNodeLoader, useNodeHighlightingProps } from "../../../presentation-components/tree/controlled/UseControlledTreeFiltering.js"; +import { FilteredPresentationTreeDataProvider } from "../../../presentation-components/tree/FilteredDataProvider.js"; +import { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider.js"; +import { createTestPropertyRecord, createTestTreeNodeItem } from "../../_helpers/UiComponents.js"; +import { act, createStub, renderHook, waitFor } from "../../TestUtils.js"; describe("useFilteredNodeLoader", () => { const imodel = {} as IModelConnection; diff --git a/packages/components/src/test/tree/controlled/UseHierarchyLevelFiltering.test.ts b/packages/components/src/test/tree/controlled/UseHierarchyLevelFiltering.test.ts index ea7051512..d648d634d 100644 --- a/packages/components/src/test/tree/controlled/UseHierarchyLevelFiltering.test.ts +++ b/packages/components/src/test/tree/controlled/UseHierarchyLevelFiltering.test.ts @@ -10,13 +10,13 @@ import sinon from "sinon"; import { PropertyRecord } from "@itwin/appui-abstract"; import { ITreeNodeLoader, TreeModelNode, TreeModelNodeInput, TreeModelSource, TreeNodeLoadResult, UiComponents } from "@itwin/components-react"; import { EmptyLocalization } from "@itwin/core-common"; -import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder"; -import { useHierarchyLevelFiltering } from "../../../presentation-components/tree/controlled/UseHierarchyLevelFiltering"; -import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestPropertyInfo } from "../../_helpers/Common"; -import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content"; -import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy"; -import { createStub, renderHook } from "../../TestUtils"; +import { PresentationInstanceFilterInfo } from "../../../presentation-components/instance-filter-builder/PresentationFilterBuilder.js"; +import { useHierarchyLevelFiltering } from "../../../presentation-components/tree/controlled/UseHierarchyLevelFiltering.js"; +import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestPropertyInfo } from "../../_helpers/Common.js"; +import { createTestContentDescriptor, createTestPropertiesContentField } from "../../_helpers/Content.js"; +import { createTestECInstancesNodeKey } from "../../_helpers/Hierarchy.js"; +import { createStub, renderHook } from "../../TestUtils.js"; function createTreeModelInput(input?: Partial, treeItem?: Partial): TreeModelNodeInput { const item: PresentationTreeNodeItem = { diff --git a/packages/components/src/test/tree/controlled/UsePresentationTreeState.test.ts b/packages/components/src/test/tree/controlled/UsePresentationTreeState.test.ts index dbaef9c4a..c5d393086 100644 --- a/packages/components/src/test/tree/controlled/UsePresentationTreeState.test.ts +++ b/packages/components/src/test/tree/controlled/UsePresentationTreeState.test.ts @@ -35,11 +35,11 @@ import { usePresentationTreeState, UsePresentationTreeStateProps, UsePresentationTreeStateResult, -} from "../../../presentation-components/tree/controlled/UsePresentationTreeState"; -import { PresentationTreeDataProvider } from "../../../presentation-components/tree/DataProvider"; -import { ReportingTreeNodeLoader } from "../../../presentation-components/tree/ReportingTreeNodeLoader"; -import { createTreeNodeItem } from "../../../presentation-components/tree/Utils"; -import { renderHook, waitFor } from "../../TestUtils"; +} from "../../../presentation-components/tree/controlled/UsePresentationTreeState.js"; +import { PresentationTreeDataProvider } from "../../../presentation-components/tree/DataProvider.js"; +import { ReportingTreeNodeLoader } from "../../../presentation-components/tree/ReportingTreeNodeLoader.js"; +import { createTreeNodeItem } from "../../../presentation-components/tree/Utils.js"; +import { renderHook, waitFor } from "../../TestUtils.js"; describe("usePresentationTreeState", () => { const onIModelHierarchyChanged: PresentationManager["onIModelHierarchyChanged"] = new BeEvent<(args: IModelHierarchyChangeEventArgs) => void>(); diff --git a/packages/components/src/test/tree/controlled/UseUnifiedSelection.test.ts b/packages/components/src/test/tree/controlled/UseUnifiedSelection.test.ts index 233acf1dd..6f9950eed 100644 --- a/packages/components/src/test/tree/controlled/UseUnifiedSelection.test.ts +++ b/packages/components/src/test/tree/controlled/UseUnifiedSelection.test.ts @@ -37,12 +37,12 @@ import { UnifiedSelectionTreeEventHandler, UnifiedSelectionTreeEventHandlerParams, useUnifiedSelectionTreeEventHandler, -} from "../../../presentation-components/tree/controlled/UseUnifiedSelection"; -import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider"; -import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem"; -import { createTestECClassGroupingNodeKey, createTestECInstancesNodeKey } from "../../_helpers/Hierarchy"; -import { createTestTreeNodeItem } from "../../_helpers/UiComponents"; -import { renderHook } from "../../TestUtils"; +} from "../../../presentation-components/tree/controlled/UseUnifiedSelection.js"; +import { IPresentationTreeDataProvider } from "../../../presentation-components/tree/IPresentationTreeDataProvider.js"; +import { PresentationTreeNodeItem } from "../../../presentation-components/tree/PresentationTreeNodeItem.js"; +import { createTestECClassGroupingNodeKey, createTestECInstancesNodeKey } from "../../_helpers/Hierarchy.js"; +import { createTestTreeNodeItem } from "../../_helpers/UiComponents.js"; +import { renderHook } from "../../TestUtils.js"; const awaitableObservable = (input: ObservableInput) => { const promise = new ResolvablePromise(); diff --git a/packages/components/src/test/unified-selection/UnifiedSelectionContext.test.tsx b/packages/components/src/test/unified-selection/UnifiedSelectionContext.test.tsx index ce2748234..4d85f11c9 100644 --- a/packages/components/src/test/unified-selection/UnifiedSelectionContext.test.tsx +++ b/packages/components/src/test/unified-selection/UnifiedSelectionContext.test.tsx @@ -13,8 +13,8 @@ import { UnifiedSelectionContext, UnifiedSelectionContextProvider, useUnifiedSelectionContext, -} from "../../presentation-components/unified-selection/UnifiedSelectionContext"; -import { act, render, renderHook, RenderHookResult, waitFor } from "../TestUtils"; +} from "../../presentation-components/unified-selection/UnifiedSelectionContext.js"; +import { act, render, renderHook, RenderHookResult, waitFor } from "../TestUtils.js"; describe("UnifiedSelectionContext", () => { const testIModel = {} as IModelConnection; diff --git a/packages/components/src/test/viewport/WithUnifiedSelection.test.tsx b/packages/components/src/test/viewport/WithUnifiedSelection.test.tsx index 47b12f07d..f50c9675b 100644 --- a/packages/components/src/test/viewport/WithUnifiedSelection.test.tsx +++ b/packages/components/src/test/viewport/WithUnifiedSelection.test.tsx @@ -20,10 +20,10 @@ import { SelectionChangeType, SelectionManager, } from "@itwin/presentation-frontend"; -import { ViewportSelectionHandler } from "../../presentation-components/viewport/ViewportSelectionHandler"; -import { ViewportSelectionHandlerContextProvider, viewWithUnifiedSelection } from "../../presentation-components/viewport/WithUnifiedSelection"; -import { createTestECInstanceKey } from "../_helpers/Common"; -import { render, waitFor } from "../TestUtils"; +import { ViewportSelectionHandler } from "../../presentation-components/viewport/ViewportSelectionHandler.js"; +import { ViewportSelectionHandlerContextProvider, viewWithUnifiedSelection } from "../../presentation-components/viewport/WithUnifiedSelection.js"; +import { createTestECInstanceKey } from "../_helpers/Common.js"; +import { render, waitFor } from "../TestUtils.js"; const PresentationViewport = viewWithUnifiedSelection(ViewportComponent); diff --git a/packages/components/tsconfig.esm.json b/packages/components/tsconfig.esm.json index 3fad0684c..43f442763 100644 --- a/packages/components/tsconfig.esm.json +++ b/packages/components/tsconfig.esm.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "module": "ES2020", - "moduleResolution": "Node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "outDir": "lib/esm" } } diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 9527f0690..946541d1f 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -7,7 +7,6 @@ "inlineSources": true, "declaration": true, "declarationMap": true, - "allowSyntheticDefaultImports": true, "resolveJsonModule": true }, "include": ["src"] diff --git a/packages/hierarchies-react/package.json b/packages/hierarchies-react/package.json index ab3eafdde..d36ad1b72 100644 --- a/packages/hierarchies-react/package.json +++ b/packages/hierarchies-react/package.json @@ -49,7 +49,6 @@ "lint": "eslint ./src/**/*.{ts,tsx}", "test": "mocha --enable-source-maps --parallel --config ./.mocharc.json", "test:dev": "mocha --enable-source-maps --config ./.mocharc.json", - "test:watch": "npm run -s test:dev -- --reporter min --watch-extensions ts,tsx --watch", "extract-api": "extract-api --entry=presentation-hierarchies-react --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api", "check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/presentation-hierarchies-react.api.md", "update-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md", diff --git a/packages/testing/.mocharc.json b/packages/testing/.mocharc.json index 8aadb903d..2286fb814 100644 --- a/packages/testing/.mocharc.json +++ b/packages/testing/.mocharc.json @@ -1,5 +1,5 @@ { - "require": ["global-jsdom/register", "ignore-styles", "./lib/cjs/test/setup"], + "require": ["global-jsdom/register", "ignore-styles", "./lib/cjs/test/setup.js"], "checkLeaks": true, "timeout": 60000, "parallel": false, diff --git a/packages/testing/.nycrc b/packages/testing/.nycrc index b76d6b7b2..a365e9d16 100644 --- a/packages/testing/.nycrc +++ b/packages/testing/.nycrc @@ -4,9 +4,7 @@ "functions": 100, "branches": 100, "lines": 100, - "include": ["src/**/*", "lib/cjs/**/*"], - "exclude": ["src/presentation-testing.ts", "src/test/**", "lib/cjs/test/**"], - "extension": [".ts"], + "include": ["src/presentation-testing/**/*", "lib/cjs/presentation-testing/**/*"], "temp-dir": "./lib/test/coverage/.nyc_output", "report-dir": "./lib/test/coverage", "reporter": ["text-summary", "lcov", "cobertura"] diff --git a/packages/testing/api/presentation-testing.api.md b/packages/testing/api/presentation-testing.api.md index c71a91e1f..dd8668f52 100644 --- a/packages/testing/api/presentation-testing.api.md +++ b/packages/testing/api/presentation-testing.api.md @@ -18,6 +18,7 @@ import { IModelConnection } from '@itwin/core-frontend'; import { IModelHostOptions } from '@itwin/core-backend'; import { InstanceKey } from '@itwin/presentation-common'; import { KeySet } from '@itwin/presentation-common'; +import { LocalFileName } from '@itwin/core-common'; import { ModelProps } from '@itwin/core-common'; import { Omit as Omit_2 } from '@itwin/presentation-common'; import { PageOptions } from '@itwin/presentation-common'; @@ -65,9 +66,15 @@ export interface ContentBuilderResult { records: PropertyRecord[]; } +// @public +export function createFileNameFromString(str: string): string; + // @public export const defaultNodeMappingFunc: NodeMappingFunc; +// @public +export function getTestOutputDir(): string; + // @public export class HierarchyBuilder { constructor(props: HierarchyBuilderProps); @@ -97,6 +104,9 @@ export interface IContentBuilderDataProvider { // @public export const initialize: (props?: PresentationTestingInitProps) => Promise; +// @public +export function limitFilePathLength(filePath: string): string; + // @public export interface MappedNode { [index: string]: any; @@ -123,6 +133,12 @@ export interface PresentationTestingInitProps { testOutputDir?: string; } +// @public +export function setTestOutputDir(directoryPath: string | undefined): void; + +// @public +export function setupOutputFileLocation(fileName: string): LocalFileName; + // @public export const terminate: (frontendApp?: typeof IModelApp) => Promise; diff --git a/packages/testing/api/presentation-testing.exports.csv b/packages/testing/api/presentation-testing.exports.csv index 262f6f43f..0f4688ccd 100644 --- a/packages/testing/api/presentation-testing.exports.csv +++ b/packages/testing/api/presentation-testing.exports.csv @@ -9,14 +9,19 @@ beta;function;buildTestIModel public;class;ContentBuilder public;interface;ContentBuilderProps public;interface;ContentBuilderResult +public;function;createFileNameFromString public;const;defaultNodeMappingFunc +public;function;getTestOutputDir public;class;HierarchyBuilder public;interface;HierarchyBuilderProps public;interface;HierarchyNode public;interface;IContentBuilderDataProvider public;const;initialize +public;function;limitFilePathLength public;interface;MappedNode public;type;NodeMappingFunc public;interface;PresentationTestingInitProps +public;function;setTestOutputDir +public;function;setupOutputFileLocation public;const;terminate beta;interface;TestIModelBuilder \ No newline at end of file diff --git a/packages/testing/package.json b/packages/testing/package.json index 56e2ab91b..10e4ed869 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -18,14 +18,21 @@ "name": "Bentley Systems, Inc.", "url": "http://www.bentley.com" }, + "type": "module", "main": "lib/cjs/presentation-testing.js", + "types": "lib/cjs/presentation-testing", "module": "lib/esm/presentation-testing.js", - "types": "lib/cjs/presentation-testing.d.ts", + "exports": { + ".": { + "import": "./lib/esm/presentation-testing.js", + "require": "./lib/cjs/presentation-testing.js" + }, + "./package.json": "./package.json" + }, "scripts": { "build": "npm run -s build:cjs && npm run -s build:esm", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/package-cjs.mjs ./lib/cjs && tsc -p tsconfig.cjs.json", "build:esm": "tsc -p tsconfig.esm.json", - "build:watch": "npm run -s build:cjs -- -w", "clean": "rimraf lib build", "cover": "nyc npm -s test", "docs": "npm run -s docs:reference && npm run -s docs:changelog", diff --git a/packages/testing/src/presentation-testing.ts b/packages/testing/src/presentation-testing.ts index 5683f25f8..ffe21b9c3 100644 --- a/packages/testing/src/presentation-testing.ts +++ b/packages/testing/src/presentation-testing.ts @@ -11,7 +11,7 @@ import { PresentationManagerMode } from "@itwin/presentation-backend"; * @docs-group-description Hierarchies * Types for testing hierarchies. */ -export * from "./presentation-testing/HierarchyBuilder"; +export * from "./presentation-testing/HierarchyBuilder.js"; /** * @module Content @@ -19,7 +19,7 @@ export * from "./presentation-testing/HierarchyBuilder"; * @docs-group-description Content * Types for testing content. */ -export * from "./presentation-testing/ContentBuilder"; +export * from "./presentation-testing/ContentBuilder.js"; /** * @module Helpers @@ -27,7 +27,14 @@ export * from "./presentation-testing/ContentBuilder"; * @docs-group-description Helpers * Various test helpers. */ -export * from "./presentation-testing/Helpers"; +export * from "./presentation-testing/Helpers.js"; +export { + createFileNameFromString, + getTestOutputDir, + limitFilePathLength, + setTestOutputDir, + setupOutputFileLocation, +} from "./presentation-testing/FilenameUtils.js"; /** * @module IModel @@ -35,6 +42,6 @@ export * from "./presentation-testing/Helpers"; * @docs-group-description IModel * Utilities for creating test iModels that can be used to exercise presentation rules. */ -export * from "./presentation-testing/IModelUtilities"; +export * from "./presentation-testing/IModelUtilities.js"; export { PresentationManagerMode }; // eslint-disable-line deprecation/deprecation diff --git a/packages/testing/src/presentation-testing/InternalUtils.ts b/packages/testing/src/presentation-testing/FilenameUtils.ts similarity index 71% rename from packages/testing/src/presentation-testing/InternalUtils.ts rename to packages/testing/src/presentation-testing/FilenameUtils.ts index e09a714b4..655223f72 100644 --- a/packages/testing/src/presentation-testing/InternalUtils.ts +++ b/packages/testing/src/presentation-testing/FilenameUtils.ts @@ -12,34 +12,46 @@ import { LocalFileName } from "@itwin/core-common"; const defaultTestOutputDir = tmpdir(); let testOutputDir: string | undefined; -/** @internal */ +/** + * Get the output directory used by `setupOutputFileLocation` utility. + * @public + */ export function getTestOutputDir() { return testOutputDir ?? defaultTestOutputDir; } -/** @internal */ +/** + * Set the output directory used by `setupOutputFileLocation` utility. + * @public + */ export function setTestOutputDir(directoryPath: string | undefined) { testOutputDir = directoryPath; } /** - * Prepare for an output file by: - * - Resolving the output file name under the known test output directory - * - Making directories as necessary - * - Removing a previous copy of the output file + * Prepare for an output file path by: + * - Resolving the output file name under the known test output directory (see `getTestOutputDir` & `setTestOutputDir`). + * - Making sure the output directories exist. + * - Removing a previous copy of the output file. + * * @param fileName Name of output file. The actual file name may get modified to fit within the file system limits. - * @internal + * + * @public */ export function setupOutputFileLocation(fileName: string): LocalFileName { const outputDirectoryPath = getTestOutputDir(); !IModelJsFs.existsSync(outputDirectoryPath) && IModelJsFs.mkdirSync(outputDirectoryPath); - - const outputFilePath = limitFilePathLength(path.join(outputDirectoryPath, `${fileName}.bim`)); + const outputFilePath = limitFilePathLength(path.join(outputDirectoryPath, fileName)); IModelJsFs.existsSync(outputFilePath) && IModelJsFs.unlinkSync(outputFilePath); return outputFilePath; } -/** @internal */ +/** + * An utility to create a valid file name from any string. Sanitizes all invalid characters, + * replaces spaces with `-`, makes everything lower case. + * + * @public + */ export function createFileNameFromString(str: string) { return sanitize(str.replace(/[ ]+/g, "-").replaceAll("`", "").replaceAll("'", "")).toLocaleLowerCase(); } @@ -51,7 +63,16 @@ export function createFileNameFromString(str: string) { */ export const FILE_PATH_RESERVED_CHARACTERS = 13; -/** @internal */ +/** + * An utility to make sure file path is shorter than 260 characters. + * + * 1. Takes a full file path, splits into directory and file name parts. + * 2. If the path is already short enough, returns it. + * 3. Else, calculates tha max allowed file name length, and shortens the file name by replacing the middle part with `...`. + * 4. Joins back the directory with the shortened file name and returns it. + * + * @public + */ export function limitFilePathLength(filePath: string) { const { dir, name, ext } = path.parse(filePath); const THREE_DOTS_LENGTH = 3; diff --git a/packages/testing/src/presentation-testing/Helpers.ts b/packages/testing/src/presentation-testing/Helpers.ts index 2a44c9631..730c7e52b 100644 --- a/packages/testing/src/presentation-testing/Helpers.ts +++ b/packages/testing/src/presentation-testing/Helpers.ts @@ -15,7 +15,7 @@ import { IModelApp, IModelAppOptions, NoRenderApp } from "@itwin/core-frontend"; import { HierarchyCacheMode, Presentation as PresentationBackend, PresentationManagerProps as PresentationBackendProps } from "@itwin/presentation-backend"; import { PresentationRpcInterface } from "@itwin/presentation-common"; import { Presentation as PresentationFrontend, PresentationProps as PresentationFrontendProps } from "@itwin/presentation-frontend"; -import { setTestOutputDir } from "./InternalUtils"; +import { setTestOutputDir } from "./FilenameUtils.js"; function initializeRpcInterfaces(interfaces: RpcInterfaceDefinition[]) { const config = class extends RpcDefaultConfiguration { diff --git a/packages/testing/src/presentation-testing/IModelBuilderImpl.ts b/packages/testing/src/presentation-testing/IModelBuilderImpl.ts index 45379e1ea..74cd1ecc8 100644 --- a/packages/testing/src/presentation-testing/IModelBuilderImpl.ts +++ b/packages/testing/src/presentation-testing/IModelBuilderImpl.ts @@ -9,7 +9,7 @@ import { IModelDb } from "@itwin/core-backend"; import { Id64String } from "@itwin/core-bentley"; import { BisCodeSpec, Code, CodeScopeProps, CodeSpec, ElementAspectProps, ElementProps, ModelProps, RelationshipProps } from "@itwin/core-common"; -import { TestIModelBuilder } from "./IModelUtilities"; +import { TestIModelBuilder } from "./IModelUtilities.js"; /** * Default implementation of the IModel builder interface. diff --git a/packages/testing/src/presentation-testing/IModelUtilities.ts b/packages/testing/src/presentation-testing/IModelUtilities.ts index e60a06d67..1af953265 100644 --- a/packages/testing/src/presentation-testing/IModelUtilities.ts +++ b/packages/testing/src/presentation-testing/IModelUtilities.ts @@ -10,8 +10,8 @@ import { SnapshotDb } from "@itwin/core-backend"; import { Id64String } from "@itwin/core-bentley"; import { BisCodeSpec, Code, CodeScopeProps, ElementAspectProps, ElementProps, ModelProps, RelationshipProps } from "@itwin/core-common"; import { IModelConnection, SnapshotConnection } from "@itwin/core-frontend"; -import { TestIModelBuilderImpl } from "./IModelBuilderImpl"; -import { createFileNameFromString, setupOutputFileLocation } from "./InternalUtils"; +import { createFileNameFromString, setupOutputFileLocation } from "./FilenameUtils.js"; +import { TestIModelBuilderImpl } from "./IModelBuilderImpl.js"; /** * Interface for IModel builder pattern. Used for building IModels to test rulesets. @@ -75,7 +75,7 @@ export async function buildTestIModel(mochaContext: Mocha.Context, cb: (builder: export async function buildTestIModel(mochaContext: Mocha.Context, cb: (builder: TestIModelBuilder) => Promise): Promise; export async function buildTestIModel(nameParam: string | Mocha.Context, cb: (builder: TestIModelBuilder) => void | Promise): Promise { const name = typeof nameParam === "string" ? nameParam : createFileNameFromString(nameParam.test!.fullTitle()); - const outputFile = setupOutputFileLocation(name); + const outputFile = setupOutputFileLocation(`${name}.bim`); const db = SnapshotDb.createEmpty(outputFile, { rootSubject: { name } }); const builder = new TestIModelBuilderImpl(db); try { diff --git a/packages/testing/src/test/ContentBuilder.test.ts b/packages/testing/src/test/ContentBuilder.test.ts index 7843ca8c0..2dff85f3b 100644 --- a/packages/testing/src/test/ContentBuilder.test.ts +++ b/packages/testing/src/test/ContentBuilder.test.ts @@ -28,8 +28,8 @@ import { } from "@itwin/presentation-common"; import { ContentDataProvider } from "@itwin/presentation-components"; import { Presentation, PresentationManager, RulesetManager } from "@itwin/presentation-frontend"; -import { ContentBuilder, IContentBuilderDataProvider } from "../presentation-testing/ContentBuilder"; -import { createStub } from "./Utils"; +import { ContentBuilder, IContentBuilderDataProvider } from "../presentation-testing/ContentBuilder.js"; +import { createStub } from "./Utils.js"; class EmptyDataProvider implements IContentBuilderDataProvider { // Verifies that given keyset matches a template, otherwise it throws an error diff --git a/packages/testing/src/test/InternalUtils.test.ts b/packages/testing/src/test/FilenameUtils.test.ts similarity index 98% rename from packages/testing/src/test/InternalUtils.test.ts rename to packages/testing/src/test/FilenameUtils.test.ts index 3332b99c2..7e5f9c6b6 100644 --- a/packages/testing/src/test/InternalUtils.test.ts +++ b/packages/testing/src/test/FilenameUtils.test.ts @@ -5,7 +5,7 @@ import { expect } from "chai"; import * as path from "path"; -import { FILE_PATH_RESERVED_CHARACTERS, limitFilePathLength } from "../presentation-testing/InternalUtils"; +import { FILE_PATH_RESERVED_CHARACTERS, limitFilePathLength } from "../presentation-testing/FilenameUtils.js"; describe("limitFilePathLength", () => { it("returns given file path when length is within limits", async () => { diff --git a/packages/testing/src/test/Helpers.test.ts b/packages/testing/src/test/Helpers.test.ts index c8def86e4..f3d4c5a57 100644 --- a/packages/testing/src/test/Helpers.test.ts +++ b/packages/testing/src/test/Helpers.test.ts @@ -11,7 +11,7 @@ import { Guid } from "@itwin/core-bentley"; import { IModelApp, NoRenderApp } from "@itwin/core-frontend"; import { Presentation as PresentationBackend, PresentationProps } from "@itwin/presentation-backend"; import { Presentation as PresentationFrontend } from "@itwin/presentation-frontend"; -import { HierarchyCacheMode, initialize, PresentationTestingInitProps, terminate } from "../presentation-testing/Helpers"; +import { HierarchyCacheMode, initialize, PresentationTestingInitProps, terminate } from "../presentation-testing/Helpers.js"; describe("Helpers", () => { let backendInitializationStub: sinon.SinonStub; diff --git a/packages/testing/src/test/HierarchyBuilder.test.ts b/packages/testing/src/test/HierarchyBuilder.test.ts index f655903d9..e324ec2a3 100644 --- a/packages/testing/src/test/HierarchyBuilder.test.ts +++ b/packages/testing/src/test/HierarchyBuilder.test.ts @@ -11,8 +11,8 @@ import { BeEvent, Guid } from "@itwin/core-bentley"; import { IModelConnection } from "@itwin/core-frontend"; import { HierarchyRequestOptions, LabelDefinition, Node, NodeKey, RegisteredRuleset, Ruleset } from "@itwin/presentation-common"; import { Presentation, PresentationManager, RulesetManager, RulesetVariablesManager } from "@itwin/presentation-frontend"; -import { HierarchyBuilder, NodeMappingFunc } from "../presentation-testing/HierarchyBuilder"; -import { createStub } from "./Utils"; +import { HierarchyBuilder, NodeMappingFunc } from "../presentation-testing/HierarchyBuilder.js"; +import { createStub } from "./Utils.js"; async function getRootNodes() { const root: Node = { diff --git a/packages/testing/src/test/IModelBuilderImpl.test.ts b/packages/testing/src/test/IModelBuilderImpl.test.ts index 9f9f8d67b..cc3ec9693 100644 --- a/packages/testing/src/test/IModelBuilderImpl.test.ts +++ b/packages/testing/src/test/IModelBuilderImpl.test.ts @@ -7,8 +7,8 @@ import { expect } from "chai"; import sinon from "sinon"; import { CodeSpecs, IModelDb, Relationships } from "@itwin/core-backend"; import { BisCodeSpec, Code, CodeScopeProps, CodeSpec, ElementAspectProps, ElementProps, ModelProps, RelationshipProps } from "@itwin/core-common"; -import { TestIModelBuilderImpl } from "../presentation-testing/IModelBuilderImpl"; -import { createStub } from "./Utils"; +import { TestIModelBuilderImpl } from "../presentation-testing/IModelBuilderImpl.js"; +import { createStub } from "./Utils.js"; describe("TestIModelBuilderImpl", () => { it("insertModel calls iModel.models.insertModel", async () => { diff --git a/packages/testing/src/test/IModelUtilities.test.ts b/packages/testing/src/test/IModelUtilities.test.ts index b397559cd..3a43cdf0e 100644 --- a/packages/testing/src/test/IModelUtilities.test.ts +++ b/packages/testing/src/test/IModelUtilities.test.ts @@ -9,9 +9,9 @@ import sinon, { SinonStub } from "sinon"; import { IModelJsFs, SnapshotDb } from "@itwin/core-backend"; import { CreateEmptySnapshotIModelProps } from "@itwin/core-common"; import { SnapshotConnection } from "@itwin/core-frontend"; -import { buildTestIModel } from "../presentation-testing/IModelUtilities"; -import { createFileNameFromString, getTestOutputDir } from "../presentation-testing/InternalUtils"; -import { createStub } from "./Utils"; +import { createFileNameFromString, getTestOutputDir } from "../presentation-testing/FilenameUtils.js"; +import { buildTestIModel } from "../presentation-testing/IModelUtilities.js"; +import { createStub } from "./Utils.js"; describe("buildTestIModel", () => { const snapshotDb = { @@ -53,7 +53,7 @@ describe("buildTestIModel", () => { // eslint-disable-next-line deprecation/deprecation await buildTestIModel(fileName, async () => {}); - const outputFile = join(getTestOutputDir(), `${fileName}.bim`); + const outputFile = join(getTestOutputDir(), fileName); expect(unlinkFake.calledOnceWith(outputFile)); }); @@ -89,7 +89,7 @@ describe("buildTestIModel", () => { // eslint-disable-next-line deprecation/deprecation await buildTestIModel(fileName, async () => {}); - expect(createSnapshotDb.firstCall.args[0]).to.include(`${fileName}.bim`); + expect(createSnapshotDb.firstCall.args[0]).to.include(fileName); expect(createSnapshotDb.firstCall.lastArg).to.deep.equal({ rootSubject: { name: fileName } }); }); @@ -99,7 +99,7 @@ describe("buildTestIModel", () => { // eslint-disable-next-line deprecation/deprecation await buildTestIModel(this, async () => {}); - expect(createSnapshotDb.firstCall.args[0]).to.include(`${fileName}.bim`); + expect(createSnapshotDb.firstCall.args[0]).to.include(fileName); expect(createSnapshotDb.firstCall.lastArg).to.deep.equal({ rootSubject: { name: fileName } }); }); diff --git a/packages/testing/tsconfig.esm.json b/packages/testing/tsconfig.esm.json index 3fad0684c..43f442763 100644 --- a/packages/testing/tsconfig.esm.json +++ b/packages/testing/tsconfig.esm.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "module": "ES2020", - "moduleResolution": "Node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "outDir": "lib/esm" } } diff --git a/packages/unified-selection/package.json b/packages/unified-selection/package.json index 80675e8fe..2259c6796 100644 --- a/packages/unified-selection/package.json +++ b/packages/unified-selection/package.json @@ -44,7 +44,6 @@ "lint": "eslint ./src/**/*.ts", "test": "mocha --enable-source-maps --config ./.mocharc.json", "test:dev": "mocha --enable-source-maps --config ./.mocharc.json", - "test:watch": "npm -s test -- --reporter min --watch-extensions ts --watch", "extract-api": "extract-api --entry=unified-selection --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api", "check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/unified-selection.api.md", "validate-markdowns": "node ../../scripts/validateMarkdowns.js README.md"