@itwin/presentation-components
Version:
React components based on iTwin.js Presentation library
840 lines (547 loc) • 83.6 kB
Markdown
# Change Log - @itwin/presentation-components
## 5.12.7
### Patch Changes
- [#1047](https://github.com/iTwin/presentation/pull/1047): Fix content data providers not reacting to formats' changes, resulting in content components (table, property grid) showing property values, formatted with stale formatting settings.
- [#1050](https://github.com/iTwin/presentation/pull/1050): Quantity properties editor now reacts to format settings change and updates value.
## 5.12.6
### Patch Changes
- [#1039](https://github.com/iTwin/presentation/pull/1039): Use `IModelApp.formatsProvider` when formatting numeric values with quantities in property editors.
- [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
- Updated dependencies:
- @itwin/presentation-shared@1.2.3
- @itwin/unified-selection@1.5.1
- @itwin/presentation-core-interop@1.3.4
## 5.12.5
### Patch Changes
- Updated dependencies:
- @itwin/unified-selection@1.5.0
## 5.12.4
### Patch Changes
- [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
- Updated dependencies:
- @itwin/presentation-core-interop@1.3.3
- @itwin/presentation-shared@1.2.2
- @itwin/unified-selection@1.4.2
- @itwin/unified-selection-react@1.0.1
## 5.12.3
### Patch Changes
- [#967](https://github.com/iTwin/presentation/pull/967): Fix potential infinite recursion when disposing objects of one of the following classes: `ContentDataProvider`, `PresentationPropertyDataProvider`, `UnifiedSelectionTreeEventHandler`, `PresentationTreeDataProvider`.
## 5.12.2
### Patch Changes
- [#958](https://github.com/iTwin/presentation/pull/958): Fix support for `itwinjs-core@5.0-rc`.
- Updated dependencies:
- @itwin/presentation-core-interop@1.3.2
## 5.12.1
### Patch Changes
- Updated dependencies:
- @itwin/unified-selection@1.4.1
- @itwin/presentation-shared@1.2.1
- @itwin/presentation-core-interop@1.3.1
## 5.12.0
### Minor Changes
- [#902](https://github.com/iTwin/presentation/pull/902): Updated `PresentationTreeDataProvider` to correctly handle new errors thrown by `PresentationManager` in 5.x version.
- [#902](https://github.com/iTwin/presentation/pull/902): Deprecated `IUnifiedSelectionComponent`. `SelectionStorage` from `@itwin/unified-selection` should be used directly instead.
### Patch Changes
- [#886](https://github.com/iTwin/presentation/pull/886): Fix package compatibility with `itwinjs-core` peer dependencies at version `4.x`.
- Updated dependencies:
- @itwin/unified-selection@1.4.0
## 5.11.0
### Minor Changes
- [#834](https://github.com/iTwin/presentation/pull/834): Apply and use property value constraints for numeric properties
- [#834](https://github.com/iTwin/presentation/pull/834): Updated peer dependencies to support iTwin.js Core v5 packages.
### Patch Changes
- [#868](https://github.com/iTwin/presentation/pull/868): Make sure resource that use `dispose` method instead of `Symbol.dispose` are properly disposed.
- Updated dependencies:
- @itwin/presentation-core-interop@1.3.0
## 5.10.0
### Minor Changes
- [#841](https://github.com/iTwin/presentation/pull/841): Changed how unified selection-enabled components access unified selection storage.
- Added `selectionStorage` prop to `usePresentationTableWithUnifiedSelection` and `usePropertyDataProviderWithUnifiedSelection`.
When the prop is provided, the hooks will use the provided selection storage instead of `Presentation.selection` global storage from `@itwin/presentation-frontend` package. This makes the dependencies clear and hooks ready for deprecation of the selection APIs in the `@itwin/presentation-frontend` package. At the moment the prop is optional, but will be made required in the next major release of the package.
- Deprecated `UnifiedSelectionContext`, `UnifiedSelectionContextProvider`, `UnifiedSelectionContextProviderProps`, `UnifiedSelectionState` and `useUnifiedSelectionContext`. All of them are being replaced by the APIs in the new `@itwin/unified-selection-react` package, which now is an optional peer dependency of this package.
One of the property renderers - `InstanceKeyValueRenderer` was relying on the deprecated context to access unified selection storage. It now prefers the context provided with `UnifiedSelectionContextProvider` from `@itwin/unified-selection-react` package. If the context is not provided, the renderer falls back to the deprecated context.
- [#841](https://github.com/iTwin/presentation/pull/841): Added `activeScopeProvider` prop to `FavoritePropertiesDataProvider` constructor.
The new prop is a function that returns the active scope. When not provided, the provider uses the old way of getting the active scope - `SelectionScopesManager`, accessed through `Presentation.selection.scopes` global from `@itwin/presentation-frontend` package. The selection APIs in that package are about to be deprecated and this change makes the provider ready for that. The `activeScopeProvider` prop will be made required in the next major release of this package.
In addition, the `FavoritePropertiesDataProvider` now uses `@itwin/unified-selection` package for adjusting selection based on selection scope. This change does not affect the results.
### Patch Changes
- Updated dependencies:
- @itwin/unified-selection@1.3.0
- @itwin/unified-selection-react@1.0.0
## 5.9.0
### Minor Changes
- [#842](https://github.com/iTwin/presentation/pull/842): Updated peer dependencies to support AppUI v5.
## 5.8.0
### Minor Changes
- [#825](https://github.com/iTwin/presentation/pull/825): `PresentationInstanceFilterDialog` and `PresentationInstanceFilterBuilder`: Fix classes selector not being updated with all classes that contain selected property. `PresentationInstanceFilterPropertyInfo` now has `sourceClassIds` and `sourceClassId` is deprecated.
### Patch Changes
- [#828](https://github.com/iTwin/presentation/pull/828): Polyfill `Symbol.dispose` and `Symbol.asyncDispose` to make sure that code using the upcoming JS recource management API works in all environments.
## 5.7.0
### Minor Changes
- [#804](https://github.com/iTwin/presentation/pull/804): Deprecated all tree-related APIs.
As the new generation hierarchy building APIs are now available, the old tree-related APIs are now deprecated. See reasoning and migration guide [here](https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/packages/hierarchies/learning/PresentationRulesMigrationGuide.md).
- [#800](https://github.com/iTwin/presentation/pull/800): Deprecate `viewWithUnifiedSelection` in favor of `enableUnifiedSelectionSyncWithIModel` from `@itwin/unified-selection` package.
See [iModel selection synchronization with unified selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#imodel-selection-synchronization-with-unified-selection) and [Using with legacy components](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#imodel-selection-synchronization-with-unified-selection#using-with-legacy-components) for details on how to use `enableUnifiedSelectionSyncWithIModel` in React apps.
- [#802](https://github.com/iTwin/presentation/pull/802): Prefer `Symbol.dispose` over `dispose` for disposable objects.
The package contained a number of types for disposable objects, that had a requirement of `dispose` method being called on them after they are no longer needed. In conjunction with the `using` utility from `@itwin/core-bentley`, usage of such objects looked like this:
```ts
class MyDisposable() {
dispose() {
// do some cleanup
}
}
using(new MyDisposable(), (obj) => {
// do something with obj, it'll get disposed when the callback returns
});
```
In version `5.2`, TypeScript [introduced](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management) `Disposable` type and `using` declarations (from the upcoming [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management) feature in ECMAScript). Now we're making use of those new utilities in this package (while still supporting the old `dispose` method), which allows using `MyDisposable` from the above snippet like this:
```ts
using obj = new MyDisposable();
// do something with obj, it'll get disposed when it goes out of scope
```
## 5.6.1
### Patch Changes
- [#786](https://github.com/iTwin/presentation/pull/786): Bump package dependencies.
- [#794](https://github.com/iTwin/presentation/pull/794): Do not clear filter in `UniqueValuesSelector` when value is selected.
## 5.6.0
### Minor Changes
- [#747](https://github.com/iTwin/presentation/pull/747): KoQ and numeric editor improvements.
- ReadOnly properties now open a disabled input in property grid.
- KoQ input placeholder is now determined by initial value if one exists.
- Selecting/clicking a numeric or KoQ input will select all the text.
- [#739](https://github.com/iTwin/presentation/pull/739): Replaced `react-select` with [iTwinUI's ComboBox](https://itwinui.bentley.com/docs/combobox).
- The number of select options is limited to 100. When more items exist, a non-selectable option is displayed at the bottom of the list, prompting users to provide an items filter. Previously, additional pages of select options was loaded when user scrolled to the bottom of the list.
- Deprecated `PortalTargetContext`. It is no longer needed.
This affects `PresentationInstanceFilterBuilder` and `NavigationPropertyEditor` components.
- [#754](https://github.com/iTwin/presentation/pull/754): 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.
## 5.5.0
### Minor Changes
- [#704](https://github.com/iTwin/presentation/pull/704): `PresentationFilterBuilderValueRendererProps` now includes an optional `selectedClasses` property to enhance filter value list relevance when specified.
- [#705](https://github.com/iTwin/presentation/pull/705): Updated numeric and quantity value inputs to calculate rounding error. It is calculated based on entered value precision and can be used to find all values that rounds to the entered value.
### Patch Changes
- [#699](https://github.com/iTwin/presentation/pull/699): Use `label` prop instead of `title` on `IconButton` to have consistent tooltips and better accessibility support.
## 5.4.2
### Patch Changes
- [#664](https://github.com/iTwin/presentation/pull/664): Pass nested content value label to property records.
## 5.4.1
### Patch Changes
- [#683](https://github.com/iTwin/presentation/pull/683): Added tree reloading when changes to the briefcase are applied in `useTreeReload`.
- [#684](https://github.com/iTwin/presentation/pull/684): Disabled property editors from propagating key down events.
- [#687](https://github.com/iTwin/presentation/pull/687): Updated `NumericPropertyEditor` to use raw values instead of display values.
## 5.4.0
### Minor Changes
- [#662](https://github.com/iTwin/presentation/pull/662): Refactored `@beta` `NavigationPropertyEditorContext` API and made it `@public`. The changes:
- `NavigationPropertyEditorContextProps` has been renamed to `NavigationPropertyEditorContextProviderProps`.
- Previously `@beta` `navigationPropertyEditorContext` is now not exported anymore. Instead, the context should be set up using newly introduced `NavigationPropertyEditorContextProvider`.
- [#662](https://github.com/iTwin/presentation/pull/662): Remove `@alpha` attributes related to content and hierarchy auto-update. Now these features are always enabled by default.
### Patch Changes
- [#662](https://github.com/iTwin/presentation/pull/662): API promotions
- [#655](https://github.com/iTwin/presentation/pull/655): Remove exposed internal APIs.
## 5.3.3
### Patch Changes
- [#638](https://github.com/iTwin/presentation/pull/638): Fixed `UniquePropertyValuesSelector` not always showing values that are not yet loaded when search filter is applied.
## 5.3.2
### Patch Changes
- [#609](https://github.com/iTwin/presentation/pull/609): Fixed shift select not selecting nodes that are not yet loaded in `UnifiedSelectionTreeEventHandler`.
## 5.3.1
### Patch Changes
- [#581](https://github.com/iTwin/presentation/pull/581): Switch from using deprecated `UnderlinedButton` (`@itwin/components-react`) to `Anchor` (`@itwin/itwinui-react`).
## 5.3.0
### Minor Changes
- [#572](https://github.com/iTwin/presentation/pull/572): Moved `@itwin/itwinui-react` from direct dependencies to peer. Technically this is a breaking change but `@itwin/presentation-components` had requirement to be used with `@itwin/itwinui-react` >3.0.0 since 5.0.0 so all consumers of >5.0.0 should already have dependency on `@itwin/itwinui-react` >3.0.0.
### Patch Changes
- [#573](https://github.com/iTwin/presentation/pull/573): Cancel ongoing tree reload when new one is started.
## 5.2.4
### Patch Changes
- [#564](https://github.com/iTwin/presentation/pull/564): Fixed initial tree load duration not always being reported.
## 5.2.3
### Patch Changes
- [#561](https://github.com/iTwin/presentation/pull/561): Fix instance filter builder component's unique values selector not filtering values by provided instance keys.
- [#560](https://github.com/iTwin/presentation/pull/560): Fixed `usePresentationTreeState` callback prop `onNodeLoaded` not being called under certain race conditions.
## 5.2.2
### Patch Changes
- [#550](https://github.com/iTwin/presentation/pull/550): Disabled `onMouseDown` event propagation for hierarchy filtering buttons.
- [#552](https://github.com/iTwin/presentation/pull/552): Fixed tree reloading when unit system, ruleset variables or data in iModel changes.
## 5.2.1
### Patch Changes
- [#541](https://github.com/iTwin/presentation/pull/541): Fixed `PresentationInstanceFilter.toGenericInstanceFilter` conversion when condition is using numeric string values.
## 5.2.0
### Minor Changes
- [#536](https://github.com/iTwin/presentation/pull/536): Added `onFilterApplied` and `onHierarchyLimitExceeded` callbacks for tracking when hierarchy level is filtered or exceeds the limit.
- [#531](https://github.com/iTwin/presentation/pull/531): Added the ability to search for values in `UniqueValuesSelector`.
- [#527](https://github.com/iTwin/presentation/pull/527): Start using new features available in `@itwin/presentation-frontend` `4.5` release.
- Added support for `FavoritePropertiesDataFiltererProps.isFavorite` to return `Promise<boolean>` in addition to already supported `boolean`.
- Added `PresentationPropertyDataProvider.isFieldFavoriteAsync` in favor of now deprecated `isFieldFavorite`.
- Added `PresentationPropertyDataProvider.sortFieldsAsync` in favor of now deprecated `sortFields`.
- Added `PresentationTreeDataProviderDataSourceEntryPoints.getNodesIterator` in favor of now deprecated `getNodesAndCount`.
In all of the above cases the deprecated overrides are still being used, if supplied.
### Patch Changes
- [#538](https://github.com/iTwin/presentation/pull/538): Avoid removing and adding back elements from/to `selectionSet` when unified selection is changed when selecting something in the `Viewport`.
## 5.1.0
### Minor Changes
- [#499](https://github.com/iTwin/presentation/pull/499): Added `PresentationInstanceFilter.createPrimitiveValueEqualityCondition` function to provide a convenient way for creating equality filter conditions compatible with `UniquePropertyValuesSelector`.
- [#520](https://github.com/iTwin/presentation/pull/520): Added callback to `usePresentationTreeState` for reporting node load durations.
### Patch Changes
- [#519](https://github.com/iTwin/presentation/pull/519): Use private fields in `UnifiedSelectionTreeEventHandler` to avoid clashing private property names when extending it.
## 5.0.1
### Patch Changes
- [#492](https://github.com/iTwin/presentation/pull/492): Avoid removing instances explicitly added to unified selection when grouping node is unselected.
- [#494](https://github.com/iTwin/presentation/pull/494): Updated `usePresentationTableWithUnifiedSelection` to work outside `UnifiedSelectionContextProvider`
- [#464](https://github.com/iTwin/presentation/pull/464): Fixed navigation property editor dropdown layout in property grid.
- [#493](https://github.com/iTwin/presentation/pull/493): Updated `UnifiedSelectionTreeEventHandler` to correctly handle unified selection change when it is not updated immediatly after `add`|`replace`|`remove`|`clear` action.
## 5.0.0
### Major Changes
- [#412](https://github.com/iTwin/presentation/pull/412): **Dependencies:** Bumped peer dependency version of all [itwinjs-core](https://github.com/iTwin/itwinjs-core) packages to `^4.4.0`.
- [#399](https://github.com/iTwin/presentation/pull/399): **Dependencies:** Bumped peer dependency version of all [appui](https://github.com/iTwin/appui) packages to `^4.9.0`.
- [#398](https://github.com/iTwin/presentation/pull/398): **Dependencies:** Bumped `@itwin/itwinui-react` package dependency version to `3.x`. This entails that all components from `@itwin/presentation-components` must be wrapped in `ThemeProvider` from `itwinui-react@3`. [See more](https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v3-migration-guide#themeprovider).
- [#222](https://github.com/iTwin/presentation/pull/222): **Tree:** Show the size of filtered tree hierarchy level while building a filter.
Includes breaking `@beta` API change in `PresentationTreeRenderer` - instead of taking [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), [TreeModelSource](https://www.itwinjs.org/reference/components-react/tree/treemodelsource/) and [ITreeNodeLoader](https://www.itwinjs.org/reference/components-react/tree/itreenodeloader/) as 3 separate props, it now takes a single `AbstractTreeNodeLoaderWithProvider<IPresentationTreeDataProvider>` prop. Implementing the feature required adding an `IPresentationTreeDataProvider` to props, however requesting a single, more specific, node loader instead of 4 different props that are tightly coupled was a much cleaner solution, especially since using `PresentationTreeRenderer` with node loaders other than `AbstractTreeNodeLoaderWithProvider<IPresentationTreeDataProvider>` made little sense.
Generally, reacting to the change is as simple as removing `imodel` and `modelSource` from the list of props, passed to `PresentationTreeRenderer`. In case the type of `nodeLoader` prop doesn't match, we recommend using the new `usePresentationTreeState` for creating one. Or, if the tree is not based on presentation rules, not using the `PresentationTreeRenderer` at all and instead switching to [TreeRenderer](https://www.itwinjs.org/reference/components-react/tree/treerenderer/).
- [#313](https://github.com/iTwin/presentation/pull/313): **Tree:** Added interactive and more detailed informational messages in the tree and its hierarchy level filtering components:
- When a hierarchy level size exceeds given limit, a message is displayed, suggesting the results should be filtered to reduce the result set.
- The hierarchy level filtering dialog informs whether provided filters reduce the result set to a small enough size to be displayed in the tree.
Includes 2 breaking `@beta` API changes:
- `PresentationTreeNodeRenderer` now takes `onClearFilterClick` and `onFilterClick` callback props with node identifier argument rather than `PresentationTreeNodeItem`. This was a necessary change to allow opening filtering dialog for a parent node from its child node. To react to this breaking change:
_before_
```tsx
const [clickedNode, setClickedNode] = useState<PresentationTreeNodeItem>();
<PresentationTreeNodeRenderer
{...nodeProps}
onFilterClick={(node: PresentationTreeNodeItem) => {
setClickedNode(node);
}}
/>;
```
_after_
```tsx
const [clickedNode, setClickedNode] = useState<PresentationTreeNodeItem>();
<PresentationTreeNodeRenderer
{...nodeProps}
onFilterClick={(nodeId: string) => {
const node = modelSource.getModel().getNode(nodeId);
if (isTreeModelNode(node) && isPresentationTreeNodeItem(node.item)) {
setClickedNode(node.item);
}
}}
/>;
```
- `useHierarchyLevelFiltering` hook's result now contains functions `applyFilter` and `clearFilter` that take node identifier argument rather than a [TreeNodeItem](https://www.itwinjs.org/reference/components-react/tree/treenodeitem/). The change was made to help reacting to the above `PresentationTreeNodeRenderer` change by requiring the same types of arguments as what `onClearFilterClick` and `onFilterClick` get. In case these functions are used outside of `PresentationTreeNodeRenderer` workflows, reacting to the breaking change is as follows:
_before_
```tsx
const { applyFilter } = useHierarchyLevelFiltering({
nodeLoader,
modelSource,
});
const [filterNode, setFilterNode] = useState<PresentationTreeNodeItem>();
const onFilterChanged = (filter: PresentationInstanceFilterInfo) => {
if (filterNode) {
applyFilter(filterNode, filter);
}
};
```
_after_
```tsx
const { applyFilter } = useHierarchyLevelFiltering({
nodeLoader,
modelSource,
});
const [filterNodeId, setFilterNodeId] = useState<string>();
const onFilterChanged = (filter: PresentationInstanceFilterInfo) => {
if (filterNodeId) {
applyFilter(filterNodeId, filter);
}
};
```
Generally, the above two APIs are used together, which means no changes should be necessary.
- [#438](https://github.com/iTwin/presentation/pull/438): **Instance filter builder / dialog:** Changed `PresentationInstanceFilterDialogProps.descriptor` attribute to `propertiesSource`, which associates `Descriptor` with input keys used to create the descriptor. This allows the dialog to use the `Keys` information, which is required for loading suggestions in value inputs.
_before_
```tsx
const [inputKeys] = useState<Keys>();
<PresentationInstanceFilterDialog descriptor={async () => loadDescriptor(inputKeys)} />;
```
_after_
```tsx
const [inputKeys] = useState<Keys>();
<PresentationInstanceFilterDialog
propertiesSource={async () => {
const descriptor = await loadDescriptor(inputKeys);
return { descriptor, inputKeys };
}}
/>;
```
### Minor Changes
- [#316](https://github.com/iTwin/presentation/pull/316): **Instance filter builder / dialog:** Promoted some `@internal` APIs to `@beta`
- `useInstanceFilterPropertyInfos` - a hook for creating a property list based on supplied [Descriptor](https://www.itwinjs.org/reference/presentation-common/content/descriptor/). The property list is necessary for rendering the [PropertyFilterBuilder](https://www.itwinjs.org/reference/components-react/propertyfilterbuilder/propertyfilterbuilder/) component.
- `PresentationInstanceFilter.fromComponentsPropertyFilter` - for adding presentation data to [PropertyFilter](https://www.itwinjs.org/reference/components-react/propertyfilterbuilder/propertyfilter/) built by [usePropertyFilterBuilder](https://www.itwinjs.org/reference/components-react/propertyfilterbuilder/usepropertyfilterbuilder/).
- `PresentationInstanceFilter.toComponentsPropertyFilter` - for stripping out presentation data from filter for usage with [usePropertyFilterBuilder](https://www.itwinjs.org/reference/components-react/propertyfilterbuilder/usepropertyfilterbuilder/).
- `PresentationFilterBuilderValueRenderer` - a custom renderer for property value input. It renders unique values selector for `Equal` / `NotEqual` rules and handles numeric values' unit conversion on top of the general value input.
- `PresentationInstanceFilterPropertyInfo` - a data structure defining a property used in instance filter.
- [#316](https://github.com/iTwin/presentation/pull/316), [#407](https://github.com/iTwin/presentation/pull/407): **Instance filter builder / dialog:** Added utilities `PresentationInstanceFilter.fromGenericInstanceFilter` and `PresentationInstanceFilter.toGenericInstanceFilter` to help with parsing the `PresentationInstanceFilter` data structure into a more consumer-friendly, lower-level [GenericInstanceFilter](https://www.itwinjs.org/reference/core-common/utils/genericinstancefilter/).
- [#193](https://github.com/iTwin/presentation/pull/193): **Instance filter builder / dialog:** Show a validation error message when entered property value is invalid.
- [#176](https://github.com/iTwin/presentation/pull/176): **Instance filter builder / dialog:** Added unique values selector when using `Equal` or `Not Equal` operators. The component provides a drop-down of values available for selected property.
- `null` values are omitted. `"Is Null"` and `"Is Not Null"` operators should be used instead.
- For empty non `null` values _Empty Value_ option is shown in selector.
- [#356](https://github.com/iTwin/presentation/pull/356): **Instance filter builder / dialog:** UX enhancements.
- Changed the "Apply" button to always be enabled, even when no filtering rules are selected. In such situations, the calling component may clear the filter.
- Added a "Reset" button which clears all the filtering rules in the dialog.
- Added a `toolbarButtonsRenderer` prop to allow rendering custom toolbar buttons at the bottom of the dialog.
- [#447](https://github.com/iTwin/presentation/pull/447): **Instance filter builder / dialog:** Added ability to pass initial filter as a callback that will be invoked when descriptor is loaded.
- [#358](https://github.com/iTwin/presentation/pull/358): **Instance filter builder / dialog:** Show a union of properties of selected classes rather than intersection.
- [#416](https://github.com/iTwin/presentation/pull/416): **Instance filter builder / dialog:** `PresentationInstanceFilterDialog` now allows applying filter when only classes are selected.
- Added `createInstanceFilterDefinition` that creates `InstanceFilterDefinition` from `PresentationInstanceFilterInfo`. Created definition can be passed to `PresentationManager` to filter results when creating content or hierarchies.
- [#388](https://github.com/iTwin/presentation/pull/388): **Tree:** Adjust API of `PresentationTreeRenderer` by separating `PresentationTreeRenderer` hierarchy level filtering logic into `useFilterablePresentationTree` hook.
- [#421](https://github.com/iTwin/presentation/pull/421): **Tree:** Simplify / clarify `PresentationTree` and `PresentationTreeRenderer` APIs.
- Change `PresentationTreeProps.treeRenderer` type to make it compatible with what `PresentationTreeRenderer` expects.
_before_
```tsx
<PresentationTree {...props} state={state} treeRenderer={(treeProps) => <PresentationTreeRenderer {...treeProps} nodeLoader={state.nodeLoader} />} />
```
_after_
```tsx
<PresentationTree {...props} state={state} treeRenderer={(treeProps) => <PresentationTreeRenderer {...treeProps} />} />
```
- Removed `nodeRenderer` prop from `PresentationTreeRendererProps`. The prop is not used by `PresentationTreeRenderer` as it always uses its own `PresentationTreeNodeRenderer` to render nodes.
- [#305](https://github.com/iTwin/presentation/pull/305): **Property grid:** Added an editor for editing values of properties with quantity / units information.
Editor works only if there is `SchemaMetadataContextProvider` in React component tree above property grid components. Otherwise simple numeric editor is used.
```tsx
// somewhere at the global level
import { IModelConnection } from "@itwin/core-frontend";
import { SchemaContext } from "@itwin/ecschema-metadata";
function getIModelSchemaContext(imodel: IModelConnection): SchemaContext {
// return a cached instance of SchemaContext for given IModelConnection
}
// in the component render function
<SchemaMetadataContextProvider imodel={imodel} schemaContextProvider={getIModelSchemaContext}>
<VirtualizedPropertyGridWithDataProvider {...props} />
</SchemaMetadataContextProvider>;
```
### Patch Changes
- [#273](https://github.com/iTwin/presentation/pull/273), [#451](https://github.com/iTwin/presentation/pull/451): **Instance filter builder / dialog:** Fixed tooltip appearing under property selector in property filter builder.
- [#456](https://github.com/iTwin/presentation/pull/456): **Instance filter builder / dialog:** Reduced amount of tooltips rendered in filter builder property selector.
- [#312](https://github.com/iTwin/presentation/pull/312): **Instance filter builder / dialog:** Fixed class label shown in tooltip for related properties when building a filter. It now shows label of related class that was used to access that property instead of class where that property is defined.
- [#362](https://github.com/iTwin/presentation/pull/362): **Instance filter builder / dialog:** Change class selector placeholder value to emphasize the fact that selecting a class is optional.
- [#371](https://github.com/iTwin/presentation/pull/371): **Instance filter builder / dialog:** Clear all property filtering rules when selected class list changes.
- [#296](https://github.com/iTwin/presentation/pull/296): **Instance filter builder / dialog:** Format date values in the property value selector.
- [#373](https://github.com/iTwin/presentation/pull/373): **Instance filter builder / dialog:** Fix selected class information not being retained when using React 18 strict mode.
- [#437](https://github.com/iTwin/presentation/pull/437): **Content:** Sort struct property members by label when creating content for property grid, table, and other content components.
- [#427](https://github.com/iTwin/presentation/pull/427): **Property grid:** Inline default property grid ruleset instead of loading it from JSON file.
- [#418](https://github.com/iTwin/presentation/pull/418): **Tree:** Updated message shown in hierarchy level filtering dialog when built filter still produces too many results.
- [#446](https://github.com/iTwin/presentation/pull/446): **Tree:** Added custom CSS class on tree node actions buttons to allow customizing them.
- [#354](https://github.com/iTwin/presentation/pull/354): **Unified selection:** Cancel ongoing hilite set request when unified selection changes.
- [#348](https://github.com/iTwin/presentation/pull/348): Clean up `@internal` APIs exposed through the barrel exports file.
## 5.0.0-dev.6
### Patch Changes
- [#453](https://github.com/iTwin/presentation/pull/453): Fixed instance filter builder unique values selector dropdown menu layout.
- [#451](https://github.com/iTwin/presentation/pull/451): Fixed tooltip appearing under property selector in property filter builder.
## 5.0.0-dev.5
### Major Changes
- [#438](https://github.com/iTwin/presentation/pull/438): Merged `PresentationInstanceFilterDialogProps.descriptor` and `PresentationInstanceFilterDialogProps.descriptorInputKeys` into single property `PresentationInstanceFilterDialogProps.propertiesSource`. This explicitly associates `Descriptor` with input keys. It provides more convenient API in case `Descriptor` is lazy loaded and input keys are known only after loading.
Before:
```tsx
const [inputKey, setInputKeys] = useState([]);
<PresentationInstanceFilterDialog
descriptor={async () => {
const { descriptor, keys } = loadDescriptorAndKeys();
setInputKeys(keys);
return descriptor;
}}
descriptorInputKeys={inputKeys}
/>;
```
After:
```tsx
<PresentationInstanceFilterDialog
propertiesSource={async () => {
const { descriptor, keys } = loadDescriptorAndKeys();
return {
descriptor,
inputKeys: keys,
};
}}
/>
```
### Patch Changes
- [#437](https://github.com/iTwin/presentation/pull/437): Sort struct property members by label when creating content for property grid, table, and other content components.
- [#448](https://github.com/iTwin/presentation/pull/448): Fixed `UniqueValueSelector` loading only the first page of values.
- [#444](https://github.com/iTwin/presentation/pull/444): Updated UniqueValueSelector dropdown menu to open upwards when there is not enough space below.
- [#446](https://github.com/iTwin/presentation/pull/446): Added custom CSS class on tree node actions buttons to allow customizing them.
- [#427](https://github.com/iTwin/presentation/pull/427): Inline default property grid ruleset instead of loading it from JSON file.
## 5.0.0-dev.4
### Minor Changes
- [#421](https://github.com/iTwin/presentation/pull/421): Simplify / clarify `PresentationTree` and `PresentationTreeRenderer` APIs.
- Change `PresentationTreeProps.treeRenderer` type to make it compatible with what `PresentationTreeRenderer` expects.
Before:
```tsx
return (
<PresentationTree {...props} state={state} treeRenderer={(treeProps) => <PresentationTreeRenderer {...treeProps} nodeLoader={state.nodeLoader} />} />
);
```
After:
```tsx
return <PresentationTree {...props} state={state} treeRenderer={(treeProps) => <PresentationTreeRenderer {...treeProps} />} />;
```
- Removed `nodeRenderer` prop from `PresentationTreeRendererProps`. The prop is not used by `PresentationTreeRenderer` as it always uses its own `PresentationTreeNodeRenderer` to render nodes.
- [#416](https://github.com/iTwin/presentation/pull/416): `PresentationInstanceFilterDialog` now allows applying filter when only classes are selected.
Added `createInstanceFilterDefinition` that creates `InstanceFilterDefinition` from `PresentationInstanceFilterInfo`. Created definition can be passed to `PresentationManager` to filter results when creating content or hierarchies.
### Patch Changes
- [#417](https://github.com/iTwin/presentation/pull/417): Added missing "No values" localized string in unique values selector.
- [#418](https://github.com/iTwin/presentation/pull/418): Updated message shown in hierarchy level filtering dialog when built filter still produces too many results.
## 5.0.0-dev.3
### Major Changes
- [#412](https://github.com/iTwin/presentation/pull/412): Bumped peer dependency version of all `itwinjs-core` packages to `^4.4.0`.
- [#398](https://github.com/iTwin/presentation/pull/398): Bump `iTwinUI` package dependencies to 3.x. This is entails that all components from `presentation-components` must be wrapped in `ThemeProvider` from `iTwinUI` 3.x. [See more](https://github.com/iTwin/iTwinUI/wiki/iTwinUI-react-v3-migration-guide#themeprovider)
- [#399](https://github.com/iTwin/presentation/pull/399): Bumped AppUI peer dependency to `^4.9.0`.
### Minor Changes
- [#407](https://github.com/iTwin/presentation/pull/407): Removed `GenericInstanceFilter` in favor of the one delivered in `@itwin/core-common`.
Added `PresentationInstanceFilter.fromGenericInstanceFilter` function for creating `PresentationInstanceFilter` from `GenericInstanceFilter`.
- [#399](https://github.com/iTwin/presentation/pull/399): Added validation for `Between` and `Not Between` operator values.
### Patch Changes
- [#405](https://github.com/iTwin/presentation/pull/405): Fixed unique values selector loading unique values of only the first field property.
## 5.0.0-dev.2
### Minor Changes
- [#358](https://github.com/iTwin/presentation/pull/358): Instance filter builder / dialog: Show a union of properties of selected classes rather than intersection.
- [#356](https://github.com/iTwin/presentation/pull/356): Instance filter builder / dialog: UX enhancements.
- Changed the "Apply" button to always be enabled, even when no filtering rules are selected. In such situations, `PresentationTreeRenderer` clears the hierarchy level filter.
- Added a "Reset" button which clears all the filtering rules in the dialog.
- Added a `toolbarButtonsRenderer` prop to allow rendering custom toolbar buttons at the bottom of the dialog.
- [#363](https://github.com/iTwin/presentation/pull/363): Instance filter builder / dialog: Include selected classes' information in the `GenericInstanceFilter` data structure to allow filtering by them. Use this information when building hierararchy level filters to allow users filter-out instances of specific class(es).
- [#388](https://github.com/iTwin/presentation/pull/388): Adjust API of `PresentationTreeRenderer` by separating `PresentationTreeRenderer` hierarchy level filtering logic into `useFilterablePresentationTree` hook.
### Patch Changes
- [#354](https://github.com/iTwin/presentation/pull/354): Unified selection: Cancel ongoing hilite set request when unified selection changes.
- [#362](https://github.com/iTwin/presentation/pull/362): Instance filter builder / dialog: Change class selector placeholder value to emphasize the fact that selecting a class is optional.
- [#371](https://github.com/iTwin/presentation/pull/371): Instance filter builder / dialog: Clear all property filtering rules when selected class list changes.
- [#348](https://github.com/iTwin/presentation/pull/348): Clean up `@internal` APIs exposed through the barrel exports file.
- [#373](https://github.com/iTwin/presentation/pull/373): Instance filter builder / dialog: Fix selected class information not being retained when using React 18 strict mode.
## 4.4.0
This release brings official React 18 support. Components and hooks provided by this package were updated to work with [`StrictMode` in React 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-strict-mode).
### Minor Changes
- [#333](https://github.com/iTwin/presentation/pull/333): Deprecated `useRulesetRegistration` because it is not compatible with React 18
- [#328](https://github.com/iTwin/presentation/pull/328): Added `usePresentationTreeState` and `PresentationTree` for using presentation data with `ControlledTree`. This is a replacement for `usePresentationTreeNodeLoader` which is not fully compatible with React 18 and now is deprecated.
Old API:
```tsx
function Tree(props) {
const { nodeLoader } = usePresentationTreeNodeLoader({
imodel: props.imodel,
ruleset: TREE_RULESET,
pagingSize: PAGING_SIZE,
});
const eventHandler = useUnifiedSelectionTreeEventHandler({ nodeLoader });
const treeModel = useTreeModel(nodeLoader.modelSource);
return (
<ControlledTree width={200} height={400} model={treeModel} nodeLoader={nodeLoader} eventsHandler={eventHandler} selectionMode={SelectionMode.Single} />
);
}
```
New API:
```tsx
function Tree(props) {
const state = usePresentationTreeState({
imodel: props.imodel,
ruleset: TREE_RULESET,
pagingSize: PAGING_SIZE,
eventHandlerFactory: useCallback(
(handlerProps: TreeEventHandlerProps) =>
new UnifiedSelectionTreeEventHandler({
nodeLoader: handlerProps.nodeLoader,
}),
[],
),
});
if (!state) {
return null;
}
return <PresentationTree width={200} height={400} state={state} selectionMode={SelectionMode.Single} />;
}
```
## 5.0.0-dev.1
### Minor Changes
- [#316](https://github.com/iTwin/presentation/pull/316): Added `GenericInstanceFilter` data structure that has all the data needed to convert an instance filter to `ECSQL`, `ECExpression` or other formats. The data structure can be created from `PresentationInstanceFilter` using the `GenericInstanceFilter.fromPresentationInstanceFilter` call.
- [#316](https://github.com/iTwin/presentation/pull/316): Promoted some instance filtering - related `internal` APIs to `beta`:
- `useInstanceFilterPropertyInfos` - for creating a property list based on supplied `Descriptor`. The property list is necessary for rendering the `PropertyFilterBuilder` component from `@itwin/components-react` package.
- `PresentationFilterBuilderValueRenderer` - a custom renderer for property value input. It renders unique values selector for `Equal` / `NotEqual` rules and handles unit conversion on top of the general value input.
- `PresentationInstanceFilter.fromComponentsPropertyFilter` - for adding presentation data to `PropertyFilter` built by `usePropertyFilterBuilder`.
- `PresentationInstanceFilter.toComponentsPropertyFilter` - for stripping out presentation data from filter for usage with `usePropertyFilterBuilder`.
- `PresentationInstanceFilterPropertyInfo` - data structure defining a property used in instance filter.
Also, moved a couple of beta APIs to a common namespace to make them more discoverable:
- `convertToInstanceFilterDefinition` -> `PresentationInstanceFilter.toInstanceFilterDefinition`,
- `isPresentationInstanceFilterConditionGroup` -> `PresentationInstanceFilter.isConditionGroup`.
- [#313](https://github.com/iTwin/presentation/pull/313): Add interactive and more detailed informational messages in tree and instance filter components.
- [#305](https://github.com/iTwin/presentation/pull/305): Added editor for editing quantity property values in property grid. Editor works only if there is `SchemaMetadataContextProvider` in React component tree above property grid components. Otherwise simple numeric editor is used.
### Patch Changes
- [#317](https://github.com/iTwin/presentation/pull/317): Fix unique value selector placeholder formatting in instance filter builder.
- [#312](https://github.com/iTwin/presentation/pull/312): Fixed class name shown in tooltip for related properties when building filter. It now shows name of related class that was used to access that property instead of class where that property is defined.
## 5.0.0-dev.0
The `5.0` release is targeted towards getting instance filtering production-ready and contains a number of bug fixes and enhancements for the `PresentationInstanceFilterDialog` component.
The release does not contain any breaking API changes and the bump in peer-depenendecies is the only reason this is a major release.
### Major Changes
- [#299](https://github.com/iTwin/presentation/pull/299): Bumped `AppUI` peer dependencies to `4.6.0`. Bumped `itwinjs-core` peer dependencies to `^4.1.0`.
### Minor Changes
- [#213](https://github.com/iTwin/presentation/pull/213): `PresentationInstanceFilterDialog`: Added support for quantity values.
- [#193](https://github.com/iTwin/presentation/pull/193): `PresentationInstanceFilterDialog`: Show error message when value input is invalid.
- [#222](https://github.com/iTwin/presentation/pull/222): `PresentationInstanceFilterDialog`: Show results count while building instance filter.
- [#176](https://github.com/iTwin/presentation/pull/176): `PresentationInstanceFilterDialog`: Added unique values value selector when using `Equal` or `Not Equal` operators. It loads unique property values that are associated with node on which filter is placed.
- `null` values are omitted. `"Is Null"` and `"Is Not Null"` operators should be used instead.
- For empty non `null` values _Empty Value_ option is shown in selector.
- [#296](https://github.com/iTwin/presentation/pull/296): `PresentationInstanceFilterDialog`: Add formatting to dates that are displayed in the property value selector.
### Patch Changes
- [#273](https://github.com/iTwin/presentation/pull/273): Fixed property tooltip appearing behind the property selector.
- [#206](https://github.com/iTwin/presentation/pull/206): Fix filtering when `Like` operator is selected.
## 4.3.0
### Minor Changes
- [#289](https://github.com/iTwin/presentation/pull/289): Removed dependency on `@itwin/itwinui-css` and switched to using components from `@itwin/itwinui-react` instead.
- [#284](https://github.com/iTwin/presentation/pull/284): Fix for missing/incomplete category labels in the property selector of the instance filter builder.
- [#231](https://github.com/iTwin/presentation/pull/231): Expand the `usePresentationTableWithUnifiedSelection()` hook to additionally return:
- an `onSelect()` callback which will update the `unifiedSelection` one level above it (+1) with the keys that are passed to it.
- `selectedRows` which is updated every time `unifiedSelection` changes one level above the table component.
### Patch Changes
- [#292](https://github.com/iTwin/presentation/pull/292): Broaden default instance filter builder dialog.
- [#289](https://github.com/iTwin/presentation/pull/289): Fixed navigation property value selector dropdown menu to be visible when used inside dialog.
- [#291](https://github.com/iTwin/presentation/pull/291): Updated `@itwin/itwinui-react` dependency version to consume the latest fixes.
- [#264](https://github.com/iTwin/presentation/pull/264): Change `NumericPropertyEditor` logic to only commit changes on `onBlur` event rather than every time the value is changed.
## 4.2.1
### Patch Changes
- [#230](https://github.com/iTwin/presentation/pull/230): Fixed hierarchy level filtering under grouping nodes.
This log was last generated on Thu, 31 Aug 2023 11:51:06 GMT and should not be manually modified.
<!-- Start content -->
## 4.2.0
Thu, 31 Aug 2023 11:51:06 GMT
### Minor changes
- Reload content and hierarchies when active unit system is changed. ([commit](https://github.com/iTwin/presentation/commit/326dd33a9e40659f6b6af4a0dd100948798db6c8))
### Patches
- Update dependencies ([commit](https://github.com/iTwin/presentation/commit/585bfe098c3c388c48ffa4f311c4722f1b6835df))
## 4.1.0
Wed, 09 Aug 2023 11:47:16 GMT
### Minor changes
- Make sure `FilteredPresentationTreeDataProvider` creates same tree node items as parent `PresentationTreeDataProvider`. ([commit](https://github.com/iTwin/presentation/commit/3d770080cb55dcfef0cb39a32119ad8ce042aad6))
### Patches
- `InstanceFilterDialog`: fix resize observer error when navigation property is selected. ([commit](https://github.com/iTwin/presentation/commit/11ad3f98efde2a8eb78aa9f2c986472a34c66ea7))
- Update package dependencies ([commit](https://github.com/iTwin/presentation/commit/22593a8fddc52b5c547c024d64e7cc5659c81d01))
- Add `Home` and `End` buttons functionality to the navigation property value selector. ([commit](https://github.com/iTwin/presentation/commit/0840ddf4b9ac098eb457169696bd48ea88797095))
- Remove dead code ([commit](https://github.com/iTwin/presentation/commit/f18cae3e518e50265c39ae2684fe91bc56cf38de))
- `useControlledPresentationTreeFiltering`: Reset `filteredNodeLoader` after filter string is changed and filtering is in progress. ([commit](https://github.com/iTwin/presentation/commit/3f36136778e2444c1224a5b68b0a21f707b5685f))
- `InstanceFilterDialog`: Add filter expression for `Point` type. ([commit](https://github.com/iTwin/presentation/commit/a9f4c2b467bfdd75501f4e48bfaadd51108665b1))
- Add custom numeric property editor. ([commit](https://github.com/iTwin/presentation/commit/aeae3ff736d772ce61b0dfdb34335f1a7d76f1ce))
- Update `rxjs` dependency to `7.8.1` ([commit](https://github.com/iTwin/presentation/commit/cfef82ba0050915a1d2bb5d3bd9538737bc47326))
## 4.0.1
Thu, 15 Jun 2023 07:31:33 GMT
### Patches
- `InstanceFilterDialog`: Make dialog width and height larger. ([commit](https://github.com/iTwin/presentation/commit/676e370cf2f76863ee595fb8b2c3270281de5ba8))
- Small documentation improvements ([commit](https://github.com/iTwin/presentation/commit/5bdb5ab060142225d5249b52cdb5fd9520d112ed))
- `InstanceFilterDialog`: Make dialog resizable and draggable. ([commit](https://github.com/iTwin/presentation/commit/676e370cf2f76863ee595fb8b2c3270281de5ba8))
- `InstanceFilterDialog`: Show loading spinner when filtering is in progress. ([commit](https://github.com/iTwin/presentation/commit/55e97cb3c74c15c32aae9ea61c94b568c4461b7b))
## 4.0.0
Tue, 02 May 2023 11:39:31 GMT
### Major changes
- Upgrade to AppUI 4.0 ([commit](https://github.com/iTwin/presentation/commit/c869d568d3b462670d20e1ec31807aee15a0857e))
### Minor changes
- Deprecate `IContentDataProvider.getFieldByPropertyRecord` in favor of the new `IContentDataProvider.getFieldByPropertyDescription`. ([commit](https://github.com/iTwin/presentation/commit/4c31428c0bff68186256b9375edf41e68c75c4f2))
- Unified hierarchy update handling in all situations (after iModel change, ruleset change or ruleset variables change) ([commit](https://github.com/iTwin/presentation/commit/ba7ef1aab92651f624c6d9190e150c438f8cfab8))
- Add support for hierarchy level size limiting ([commit](https://github.com/iTwin/presentation/commit/6bf1a99ec570751e16f30af658e0fa7e27e7631f))
- Updated `@itwinui-react` package to `^2.5.0` ([commit](https://github.com/iTwin/presentation/commit/fbbb45e2a75fb11f282f2474f6419cd20a65829c))
- Prepared package to be used with React 18. Updated React `peerDependency` to `^17.0.0 || ^18.0.0` ([commit](https://github.com/iTwin/presentation/commit/d46358ebcd7e035d36e700b2a76c581922e1053b))
- Bump minimum required `itwinjs-core` version to `3.6.3` ([commit](https://github.com/iTwin/presentation/commit/7bf12337f09b7fda0362474d3d63b18bb4b07aab))
- Added custom hook to get Presentation data for displaying it in table components. ([commit](https://github.com/iTwin/presentation/commit/90d197c1949d05f456d818a32c150e0096b85747))
- `IPresentationTreeDataProvider`: deprecated `getNodeKey` method in favor of getting `NodeKey` directly from `TreeNodeItem` using `isPresentationTreeNodeItem` typeguard. ([commit](https://github.com/iTwin/presentation/commit/f24452ceeb1277d85e0f515d8e18a24493242833))
### Patches
- Fixed Table rows not loading with latest `presentation-frontend` version ([commit](https://gi