UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

978 lines (655 loc) 91.1 kB
# Change Log - @itwin/presentation-components ## 5.15.0 ### Minor Changes - [#1370](https://github.com/iTwin/presentation/pull/1370): Deprecated `FavoritePropertiesDataProvider.includeFieldsWithNoValues` and `FavoritePropertiesDataProvider.includeFieldsWithCompositeValues`. ## 5.14.0 ### Minor Changes - [#1362](https://github.com/iTwin/presentation/pull/1362): Deprecated `NavigationPropertyEditorContextProvider` and `useNavigationPropertyEditorContextProviderProps`. They are used by navigation property editor based on old editor system that is now deprecated. ### Patch Changes - Updated dependencies: - @itwin/presentation-shared@1.2.14 - @itwin/unified-selection@1.7.5 ## 5.13.7 ### Patch Changes - [#1338](https://github.com/iTwin/presentation/pull/1338): Bump AppUI dependencies to `^5.29.0`. - [#1338](https://github.com/iTwin/presentation/pull/1338): Bump iTwin.js core dependencies to `^5.9.1`. - Updated dependencies: - @itwin/unified-selection@1.7.3 - @itwin/presentation-core-interop@1.3.13 - @itwin/presentation-shared@1.2.13 ## 5.13.6 ### Patch Changes - [#1323](https://github.com/iTwin/presentation/pull/1323): Enforce ECProperty `minimumValue`/`maximumValue` constraints in the quantity property editor. Previously, the quantity editor (`QuantityPropertyEditorInput`) did not clamp values to the range defined in the ECSchema. Now, when a user commits a value (on blur), it is clamped to the constraint range before being committed. ## 5.13.5 ### Patch Changes - [#1312](https://github.com/iTwin/presentation/pull/1312): Numeric property editor now displays `--` and quantity property editor displays `-- <unit>` for merged values. `PresentationPropertyDataProvider` now formats merged quantity fields with a `-- <unit>` display value. - [#1313](https://github.com/iTwin/presentation/pull/1313): Bump dependencies. - Updated dependencies: - @itwin/presentation-shared@1.2.12 - @itwin/unified-selection@1.7.1 - @itwin/presentation-core-interop@1.3.12 ## 5.13.4 ### Patch Changes - [#1296](https://github.com/iTwin/presentation/pull/1296): `PresentationPropertyDataProvider`: Fix nested array properties being mistakenly destructured when there was only 1 array item. ## 5.13.3 ### Patch Changes - [#1294](https://github.com/iTwin/presentation/pull/1294): Fix quantities-enabled numeric property editor rendering just the unit when the raw value is `0`, e.g. "ft" instead of expected "0 ft". ## 5.13.2 ### Patch Changes - [#1286](https://github.com/iTwin/presentation/pull/1286): Bump dependencies. - Updated dependencies: - @itwin/presentation-core-interop@1.3.11 - @itwin/presentation-shared@1.2.11 - @itwin/unified-selection@1.7.0 ## 5.13.1 ### Patch Changes - [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies. - Updated dependencies: - @itwin/presentation-core-interop@1.3.10 - @itwin/presentation-shared@1.2.10 - @itwin/unified-selection@1.6.8 ## 5.13.0 ### Minor Changes - [#1213](https://github.com/iTwin/presentation/pull/1213): Improved numeric and quantity property editors keyboard interactions and changed quantity editor placeholders to display only units. - Quantity editor placeholders now show only the unit label instead of full formatted values. - Escape key now calls `onCancel`. - Enter key commits changes and removes focus from the input. ### Patch Changes - [#1215](https://github.com/iTwin/presentation/pull/1215): Update dependencies. - Updated dependencies: - @itwin/presentation-core-interop@1.3.9 - @itwin/presentation-shared@1.2.9 - @itwin/unified-selection@1.6.7 ## 5.12.18 ### Patch Changes - [#1208](https://github.com/iTwin/presentation/pull/1208): Bump dependencies. - Updated dependencies: - @itwin/presentation-shared@1.2.8 - @itwin/unified-selection@1.6.6 ## 5.12.17 ### Patch Changes - [#1168](https://github.com/iTwin/presentation/pull/1168): Bump dependencies. - [#1161](https://github.com/iTwin/presentation/pull/1161): Bump iTwin.js dependencies to `^5.5.0`. - [#1177](https://github.com/iTwin/presentation/pull/1177): Fix quantity editor displaying placeholder instead of actual values when always displaying editors. - The editor now correctly displays 0 as the actual value instead of showing the placeholder. - The editor now correctly displays an empty value for multiple node selections instead of showing the placeholder. - [#1161](https://github.com/iTwin/presentation/pull/1161): Fix `ContentDataProvider.getFieldByPropertyDescription` not finding array item and struct member fields. The fix requires the `@itwin/presentation-common` peer dependency to be at least version `5.6.0`. - Updated dependencies: - @itwin/presentation-core-interop@1.3.8 - @itwin/presentation-shared@1.2.7 - @itwin/unified-selection@1.6.5 - @itwin/unified-selection-react@1.0.5 ## 5.12.16 ### Patch Changes - [#1152](https://github.com/iTwin/presentation/pull/1152): Bump dependencies. - Updated dependencies: - @itwin/presentation-core-interop@1.3.7 - @itwin/presentation-shared@1.2.6 - @itwin/unified-selection@1.6.4 - @itwin/unified-selection-react@1.0.4 ## 5.12.15 ### Patch Changes - [#1139](https://github.com/iTwin/presentation/pull/1139): Bump dependencies. - Updated dependencies: - @itwin/presentation-core-interop@1.3.6 - @itwin/presentation-shared@1.2.5 - @itwin/unified-selection@1.6.3 - @itwin/unified-selection-react@1.0.3 ## 5.12.14 ### Patch Changes - [#1121](https://github.com/iTwin/presentation/pull/1121): Changed quantity editor value to be adjusted to consumer precision in edit mode and to precision of 12 on focus. - [#1124](https://github.com/iTwin/presentation/pull/1124): Bump dependencies. - Updated dependencies: - @itwin/unified-selection@1.6.2 - @itwin/presentation-core-interop@1.3.5 - @itwin/presentation-shared@1.2.4 - @itwin/unified-selection-react@1.0.2 ## 5.12.13 ### Patch Changes - [#1091](https://github.com/iTwin/presentation/pull/1091): Fixed merged property records being set as read-only. ## 5.12.12 ### Patch Changes - [#1088](https://github.com/iTwin/presentation/pull/1088): Fix restart tokens not being unique when they need to, causing queries to be cancelled. - Updated dependencies: - @itwin/unified-selection@1.6.1 ## 5.12.11 ### Patch Changes - [#1083](https://github.com/iTwin/presentation/pull/1083): Add unique guid to existing restart tokens, and add restart tokens to executed queries. - Updated dependencies: - @itwin/unified-selection@1.6.0 ## 5.12.10 ### Patch Changes - [#1082](https://github.com/iTwin/presentation/pull/1082): Fixed quantity-based property editors overriding precision for non-decimal values, causing errors when parsing and formatting fractional values. ## 5.12.9 ### Patch Changes - [#1072](https://github.com/iTwin/presentation/pull/1072): Fixed `usePresentationTable` not loading data when grouping node is selected. ## 5.12.8 ### Patch Changes - [#1065](https://github.com/iTwin/presentation/pull/1065): Increase kind of quantity property editor precision to make sure initial formatted value closer matches raw value. ## 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 depe