Skip to content

Commit a022738

Browse files
Presentation: Customization rules documentation improvement (#3267)
* Update StyleOverride rule docs * Update LabelOverride rule docs * Update ImageIdOverride rule docs * Update CheckBoxRule docs * Add way to customize tree node items in data provider * Deprecated some customization rules and corresponding node properties * Add learning snippets for customization rules * Add example snippets for SortingRule attributes * Add example snippets for InstanceLabelOverride rule attributes * Add example snippets for ExtendedDataRule attributes * Restructure customization rules docs index * Deprecated Item.imageId property * Add docs for ExtendedDataRule usage * Cleanup ExtendedDataUsage docs * Add example images * Fix node order check in hierarchies test * Add links to attributes table * Deprecate showImages attribute * Make types referenced comment into links * Sort imports * Commit missing snapshot * Fix typo in ExtendedDataRule ruleset snippet * Fix typo * Update instance label override class attribute snippet * Fix identation * Remove unnecessary suggestion to use InstanceLabelOverride * Add more links to extended data usage page * Update callouts in example images * Improve sorting rule required schemas example * extract-api * Fix typos * Fix typo * Fix ruleset description * Add better examples for disabled sorting rule * Remove remark * Rush change * Add illustrations for requiredSchemas attribute * Improve condition result value column naming * Add missing comma * Fix test Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent a8f0eb8 commit a022738

File tree

78 files changed

+2277
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2277
-294
lines changed

common/api/presentation-common.api.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export interface CategoryDescriptionJSON {
141141
// @public
142142
export type CategoryIdentifier = ParentCategoryIdentifier | RootCategoryIdentifier | IdCategoryIdentifier;
143143

144-
// @public
144+
// @public @deprecated
145145
export interface CheckBoxRule extends RuleBase, ConditionContainer {
146146
condition?: string;
147147
defaultValue?: boolean;
@@ -270,6 +270,7 @@ export enum ContentFlags {
270270
KeysOnly = 1,
271271
MergeResults = 8,
272272
NoFields = 32,
273+
// @deprecated
273274
ShowImages = 2,
274275
ShowLabels = 4
275276
}
@@ -363,6 +364,7 @@ export interface ContentSpecificationBase extends ContentModifiersList {
363364
onlyIfNotHandled?: boolean;
364365
priority?: number;
365366
relatedInstances?: RelatedInstanceSpecification[];
367+
// @deprecated
366368
showImages?: boolean;
367369
specType: ContentSpecificationTypes;
368370
}
@@ -384,8 +386,11 @@ export type ContentUpdateInfo = typeof UPDATE_FULL;
384386
export function createFieldHierarchies(fields: Field[], ignoreCategories?: Boolean): FieldHierarchy[];
385387

386388
// @public
387-
export type CustomizationRule = InstanceLabelOverride | CheckBoxRule | GroupingRule | ImageIdOverride | LabelOverride | // eslint-disable-line deprecation/deprecation
388-
SortingRule | StyleOverride | ExtendedDataRule | NodeArtifactsRule;
389+
export type CustomizationRule = InstanceLabelOverride | CheckBoxRule | // eslint-disable-line deprecation/deprecation
390+
GroupingRule | ImageIdOverride | // eslint-disable-line deprecation/deprecation
391+
LabelOverride | // eslint-disable-line deprecation/deprecation
392+
SortingRule | StyleOverride | // eslint-disable-line deprecation/deprecation
393+
ExtendedDataRule | NodeArtifactsRule;
389394

390395
// @public
391396
export interface CustomNodeSpecification extends ChildNodeSpecificationBase {
@@ -1129,7 +1134,7 @@ export interface IdCategoryIdentifier {
11291134
type: "Id";
11301135
}
11311136

1132-
// @public
1137+
// @public @deprecated
11331138
export interface ImageIdOverride extends RuleBase, ConditionContainer {
11341139
condition?: string;
11351140
imageIdExpression: string;
@@ -1313,6 +1318,7 @@ export class Item {
13131318
[key: string]: any;
13141319
};
13151320
static fromJSON(json: ItemJSON | string | undefined): Item | undefined;
1321+
// @deprecated
13161322
imageId: string;
13171323
// @beta
13181324
inputKeys?: InstanceKey[];
@@ -1336,7 +1342,7 @@ export interface ItemJSON {
13361342
extendedData?: {
13371343
[key: string]: any;
13381344
};
1339-
// (undocumented)
1345+
// @deprecated (undocumented)
13401346
imageId: string;
13411347
// @beta (undocumented)
13421348
inputKeys?: InstanceKeyJSON[];
@@ -1472,7 +1478,7 @@ export interface LabelGroupingNodeKeyJSON extends GroupingNodeKeyJSON {
14721478
type: StandardNodeTypes.DisplayLabelGroupingNode;
14731479
}
14741480

1475-
// @public
1481+
// @public @deprecated
14761482
export interface LabelOverride extends RuleBase, ConditionContainer {
14771483
condition?: string;
14781484
description?: string;
@@ -1592,17 +1598,24 @@ export interface NoCategoryIdentifier {
15921598

15931599
// @public
15941600
export interface Node {
1601+
// @deprecated
15951602
backColor?: string;
15961603
description?: string;
15971604
extendedData?: {
15981605
[key: string]: any;
15991606
};
1607+
// @deprecated
16001608
fontStyle?: string;
1609+
// @deprecated
16011610
foreColor?: string;
16021611
hasChildren?: boolean;
1612+
// @deprecated
16031613
imageId?: string;
1614+
// @deprecated
16041615
isCheckboxEnabled?: boolean;
1616+
// @deprecated
16051617
isCheckboxVisible?: boolean;
1618+
// @deprecated
16061619
isChecked?: boolean;
16071620
isEditable?: boolean;
16081621
isExpanded?: boolean;
@@ -1675,27 +1688,27 @@ export interface NodeInsertionInfoJSON {
16751688

16761689
// @public
16771690
export interface NodeJSON {
1678-
// (undocumented)
1691+
// @deprecated (undocumented)
16791692
backColor?: string;
16801693
// (undocumented)
16811694
description?: string;
16821695
// (undocumented)
16831696
extendedData?: {
16841697
[key: string]: any;
16851698
};
1686-
// (undocumented)
1699+
// @deprecated (undocumented)
16871700
fontStyle?: string;
1688-
// (undocumented)
1701+
// @deprecated (undocumented)
16891702
foreColor?: string;
16901703
// (undocumented)
16911704
hasChildren?: boolean;
1692-
// (undocumented)
1705+
// @deprecated (undocumented)
16931706
imageId?: string;
1694-
// (undocumented)
1707+
// @deprecated (undocumented)
16951708
isCheckboxEnabled?: boolean;
1696-
// (undocumented)
1709+
// @deprecated (undocumented)
16971710
isCheckboxVisible?: boolean;
1698-
// (undocumented)
1711+
// @deprecated (undocumented)
16991712
isChecked?: boolean;
17001713
// (undocumented)
17011714
isEditable?: boolean;
@@ -2807,7 +2820,7 @@ export interface StructTypeDescription extends BaseTypeDescription {
28072820
valueFormat: PropertyValueFormat.Struct;
28082821
}
28092822

2810-
// @public
2823+
// @public @deprecated
28112824
export interface StyleOverride extends RuleBase, ConditionContainer {
28122825
backColor?: string;
28132826
condition?: string;

common/api/presentation-components.api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ export interface PresentationTreeDataProviderDataSourceEntryPoints {
500500
export interface PresentationTreeDataProviderProps extends DiagnosticsProps {
501501
appendChildrenCountForGroupingNodes?: boolean;
502502
// @beta
503+
customizeTreeNodeItem?: (item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) => void;
504+
// @beta
503505
dataSourceOverrides?: Partial<PresentationTreeDataProviderDataSourceEntryPoints>;
504506
imodel: IModelConnection;
505507
pagingSize?: number;

common/api/summary/presentation-common.exports.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public;CategoryDescription
1616
public;CategoryDescriptionJSON
1717
public;CategoryIdentifier = ParentCategoryIdentifier | RootCategoryIdentifier | IdCategoryIdentifier
1818
public;CheckBoxRule
19+
deprecated;CheckBoxRule
1920
public;ChildNodeRule
2021
public;ChildNodeSpecification = CustomNodeSpecification | InstanceNodesOfSpecificClassesSpecification | RelatedInstanceNodesSpecification | CustomQueryInstanceNodesSpecification
2122
public;ChildNodeSpecificationBase
@@ -155,6 +156,7 @@ public;Id64sRulesetVariable
155156
public;Id64sRulesetVariableJSON
156157
public;IdCategoryIdentifier
157158
public;ImageIdOverride
159+
deprecated;ImageIdOverride
158160
public;InstanceId = Id64String
159161
public;InstanceKey
160162
public;InstanceKey
@@ -197,6 +199,7 @@ public;LabelDefinitionJSON
197199
public;LabelGroupingNodeKey
198200
public;LabelGroupingNodeKeyJSON
199201
public;LabelOverride
202+
deprecated;LabelOverride
200203
public;LabelRawValue = string | number | boolean | LabelCompositeValue
201204
public;LabelRawValueJSON = string | number | boolean | LabelCompositeValueJSON
202205
beta;MultiElementPropertiesRequestOptions
@@ -368,6 +371,7 @@ public;StrippedRelationshipPath = StrippedRelatedClassInfo[]
368371
public;StructFieldMemberDescription
369372
public;StructTypeDescription
370373
public;StyleOverride
374+
deprecated;StyleOverride
371375
public;SubCondition
372376
public;Subtract
373377
public;SupplementationInfo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/presentation-common",
5+
"comment": "Deprecated StyleOverrideRule, ImageIdOverrideRule, CheckboxRule and LabelOverrideRule",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/presentation-common"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@itwin/presentation-components",
5+
"comment": "Added ability to customize TreeNodeItems produced by PresentationTreeDataProvider",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@itwin/presentation-components"
10+
}

docs/presentation/Content/ContentInstancesOfSpecificClasses.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ This specification creates content for all instances of specific ECClasses.
2121
| [`calculatedProperties`](#attribute-calculatedproperties) | No | `CalculatedPropertiesSpecification[]` | `[]` |
2222
| [`propertyCategories`](#attribute-propertycategories) | No | `PropertyCategorySpecification[]` | `[]` |
2323
| [`propertyOverrides`](#attribute-propertyoverrides) | No | `PropertySpecification[]` | `[]` |
24-
| [`showImages`](#attribute-showimages) | No | `boolean` | `false` |
2524
| *Misc.* |
2625
| [`relatedInstances`](#attribute-relatedinstances) | No | [`RelatedInstanceSpecification[]`](../RelatedInstanceSpecification.md) | `[]` |
2726

@@ -150,12 +149,6 @@ Specifications of various [property overrides](./PropertySpecification.md) that
150149
| before | ![Example when doing normal property select](./media/sharedattributes-with-propertyoverrides-1.png) |
151150
| after | ![Example when selecting with "property overrides"](./media/sharedattributes-with-propertyoverrides-2.png) |
152151

153-
### Attribute: `showImages`
154-
155-
> **Default value:** `false`
156-
157-
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
158-
159152
### Attribute: `relatedInstances`
160153

161154
Specifications of [related instances](../RelatedInstanceSpecification.md) that can be used when creating the content. There are several use cases when this is useful:
@@ -190,3 +183,13 @@ Tells whether selecting instances from ECClasses specified in [`classes`](#attri
190183

191184
The attribute was replaced by [MultiSchemaClasses.arePolymorphic](../MultiSchemaClassesSpecification.md#attribute-arepolymorphic) attribute specified individually for each class definition under [`classes`](#attribute-classes)
192185
and [`excludedClasses`](#attribute-excludedclasses) attributes. At the moment, to keep backwards compatibility, this attribute acts as a fallback value in case the flag is not specified individually for a class definition.
186+
187+
## Deprecated attributes
188+
189+
### Attribute: `showImages`
190+
191+
> **Default value:** `false`
192+
193+
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
194+
195+
[ExtendedDataRule](../customization/ExtendedDataRule.md) should be used instead to provide image data to content items created by this specification. See [extended data usage page](../customization/ExtendedDataUsage.md) for more details

docs/presentation/Content/ContentRelatedInstances.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Returns content for instances related to the selected (input) instances.
1919
| [`calculatedProperties`](#attribute-calculatedproperties) | No | `CalculatedPropertiesSpecification[]` | `[]` |
2020
| [`propertyCategories`](#attribute-propertycategories) | No | `PropertyCategorySpecification[]` | `[]` |
2121
| [`propertyOverrides`](#attribute-propertyoverrides) | No | `PropertySpecification[]` | `[]` |
22-
| [`showImages`](#attribute-showimages) | No | `boolean` | `false` |
2322
| *Misc.* |
2423
| [`relatedInstances`](#attribute-relatedinstances) | No | [`RelatedInstanceSpecification[]`](../RelatedInstanceSpecification.md) | `[]` |
2524

@@ -122,12 +121,6 @@ Specifications of various [property overrides](./PropertySpecification.md) that
122121
| before | ![Example when doing normal property select](./media/sharedattributes-with-propertyoverrides-1.png) |
123122
| after | ![Example when selecting with "property overrides"](./media/sharedattributes-with-propertyoverrides-2.png) |
124123

125-
### Attribute: `showImages`
126-
127-
> **Default value:** `false`
128-
129-
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
130-
131124
### Attribute: `relatedInstances`
132125

133126
Specifications of [related instances](../RelatedInstanceSpecification.md) that can be used when creating the content. There are several use cases when this is useful:
@@ -151,3 +144,13 @@ Specifications of [related instances](../RelatedInstanceSpecification.md) that c
151144
| `SpatialViewDefinition` instances | ![A list of spatial view definitions](./media/sharedattributes-with-relatedinstances-3.png) |
152145
| `ModelSelector` instances | ![A list of model selectors](./media/sharedattributes-with-relatedinstances-2.png) |
153146
| `ModelSelector` instances filtered by `SpatialViewDefinition.Yaw` | ![A list of model selectors filtered by yaw of related spatial view definition](./media/sharedattributes-with-relatedinstances-1.png) |
147+
148+
## Deprecated attributes
149+
150+
### Attribute: `showImages`
151+
152+
> **Default value:** `false`
153+
154+
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
155+
156+
[ExtendedDataRule](../customization/ExtendedDataRule.md) should be used instead to provide image data to content items created by this specification. See [extended data usage page](../customization/ExtendedDataUsage.md) for more details.

docs/presentation/Content/SelectedNodeInstances.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Returns content for selected (input) instances.
2020
| [`calculatedProperties`](#attribute-calculatedproperties) | No | `CalculatedPropertiesSpecification[]` | `[]` |
2121
| [`propertyCategories`](#attribute-propertycategories) | No | `PropertyCategorySpecification[]` | `[]` |
2222
| [`propertyOverrides`](#attribute-propertyoverrides) | No | `PropertySpecification[]` | `[]` |
23-
| [`showImages`](#attribute-showimages) | No | `boolean` | `false` |
2423
| *Misc.* |
2524
| [`relatedInstances`](#attribute-relatedinstances) | No | [`RelatedInstanceSpecification[]`](../RelatedInstanceSpecification.md) | `[]` |
2625

@@ -143,12 +142,6 @@ Specifications of various [property overrides](./PropertySpecification.md) that
143142
| before | ![Example when doing normal property select](./media/sharedattributes-with-propertyoverrides-1.png) |
144143
| after | ![Example when selecting with "property overrides"](./media/sharedattributes-with-propertyoverrides-2.png) |
145144

146-
### Attribute: `showImages`
147-
148-
> **Default value:** `false`
149-
150-
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
151-
152145
### Attribute: `relatedInstances`
153146

154147
Specifications of [related instances](../RelatedInstanceSpecification.md) that can be used when creating the content. There are several use cases when this is useful:
@@ -172,3 +165,13 @@ Specifications of [related instances](../RelatedInstanceSpecification.md) that c
172165
| `SpatialViewDefinition` instances | ![A list of spatial view definitions](./media/sharedattributes-with-relatedinstances-3.png) |
173166
| `ModelSelector` instances | ![A list of model selectors](./media/sharedattributes-with-relatedinstances-2.png) |
174167
| `ModelSelector` instances filtered by `SpatialViewDefinition.Yaw` | ![A list of model selectors filtered by yaw of related spatial view definition](./media/sharedattributes-with-relatedinstances-1.png) |
168+
169+
## Deprecated attributes
170+
171+
### Attribute: `showImages`
172+
173+
> **Default value:** `false`
174+
175+
Should image IDs be calculated for the returned instances. When `true`, [ImageIdOverride](../customization/ImageIdOverride.md) rules get applied when creating the content.
176+
177+
[ExtendedDataRule](../customization/ExtendedDataRule.md) should be used instead to provide image data to content items created by this specification. See [extended data usage page](../customization/ExtendedDataUsage.md) for more details.

0 commit comments

Comments
 (0)