@itwin/presentation-common 3.1.0-dev.22 → 3.1.0-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,6 +148,11 @@ export interface PropertyGroup extends GroupingSpecificationBase {
148
148
  * overridden to display grouped instances count.
149
149
  *
150
150
  * **Warning:** Grouping by label and sorting by property value is not possible.
151
+ *
152
+ * @deprecated Display value should always be used for grouping. In cases when there's a
153
+ * need to show grouped instances count suffix, that can be achieved at the UI component
154
+ * layer by composing UI node's label from node's display label and
155
+ * [GroupingNodeKey.groupedInstancesCount]($presentation-common).
151
156
  */
152
157
  groupingValue?: PropertyGroupingValue;
153
158
  /**
@@ -159,6 +164,8 @@ export interface PropertyGroup extends GroupingSpecificationBase {
159
164
  * property value as well.
160
165
  *
161
166
  * **Warning:** Grouping by label and sorting by property value is not possible.
167
+ *
168
+ * @deprecated Property grouping nodes should always be sorted by display label.
162
169
  */
163
170
  sortingValue?: PropertyGroupingValue;
164
171
  /** Ranges into which the grouping values are divided */
@@ -169,6 +176,7 @@ export interface PropertyGroup extends GroupingSpecificationBase {
169
176
  * for grouping and sorting
170
177
  *
171
178
  * @public
179
+ * @deprecated The attributes using this enum are deprecated.
172
180
  */
173
181
  export declare enum PropertyGroupingValue {
174
182
  /** By property value */
@@ -1 +1 @@
1
- {"version":3,"file":"GroupingRule.d.ts","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,kBAAkB;IAChE,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC;IAE7B;;;;OA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AEnC;;;;;OAKG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAE1C;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IAEtC;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC,wDAAwD;IACxD,MAAM,CAAC,EAAE,+BAA+B,EAAE,CAAC;CAC5C;AAED;;;;;GAKG;AACH,oBAAY,qBAAqB;IAC/B,wBAAwB;IACxB,aAAa,kBAAkB;IAE/B,uBAAuB;IACvB,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"GroupingRule.d.ts","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,kBAAkB;IAChE,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC;IAE7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uEAAuE;IACvE,KAAK,EAAE,8BAA8B,CAAC;IAEtC,iFAAiF;IACjF,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,qBAAqB,GAAG,UAAU,GAAG,aAAa,GAAG,sBAAsB,CA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C;CAC5C;AAED;;;;;;GAMG;AACH,oBAAY,qBAAqB;IAC/B,wBAAwB;IACxB,aAAa,kBAAkB;IAE/B,uBAAuB;IACvB,YAAY,iBAAiB;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -40,6 +40,7 @@ var SameLabelInstanceGroupApplicationStage;
40
40
  * for grouping and sorting
41
41
  *
42
42
  * @public
43
+ * @deprecated The attributes using this enum are deprecated.
43
44
  */
44
45
  var PropertyGroupingValue;
45
46
  (function (PropertyGroupingValue) {
@@ -1 +1 @@
1
- {"version":3,"file":"GroupingRule.js","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAmDH;;;GAGG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,6CAAe,CAAA;IACf,mDAAqB,CAAA;IACrB,qEAAuC,CAAA;AACzC,CAAC,EAJW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAIrC;AAgDD;;;GAGG;AACH,IAAY,sCAYX;AAZD,WAAY,sCAAsC;IAChD,qCAAqC;IACrC,yDAAe,CAAA;IAEf;;;;;;OAMG;IACH,qEAA2B,CAAA;AAC7B,CAAC,EAZW,sCAAsC,GAAtC,8CAAsC,KAAtC,8CAAsC,QAYjD;AAgED;;;;;GAKG;AACH,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,wBAAwB;IACxB,wDAA+B,CAAA;IAE/B,uBAAuB;IACvB,sDAA6B,CAAA;AAC/B,CAAC,EANW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAMhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PresentationRules\r\n */\r\n\r\nimport { SingleSchemaClassSpecification } from \"../ClassSpecifications\";\r\nimport { ConditionContainer, RuleBase, RuleTypes } from \"../Rule\";\r\n\r\n/**\r\n * Grouping rule is an advanced way to configure node grouping.\r\n *\r\n * It allows to define these types of groupings:\r\n * - Group by base class.\r\n * - Group by any property of the instance by a common value or a range of values.\r\n * - Group multiple instances with the same label in to one ECInstance node. This can be used in cases when these\r\n * instances represent the same object for the user.\r\n *\r\n * The rule works in conjunction with other grouping options available in navigation specifications [[ChildNodeSpecification]]:\r\n * `groupByClass` and `groupByLabel`. The grouping hierarchy looks like this:\r\n * - Base ECClass grouping node (specified by base class grouping specification [[ClassGroup]])\r\n * - ECClass grouping node (specified by `groupByClass` property)\r\n * - ECProperty grouping node 1 (specified by 1st [[PropertyGroup]])\r\n * - ECProperty grouping node 2 (specified by 2nd [[PropertyGroup]])\r\n * - ECProperty grouping node n (specified by n-th [[PropertyGroup]])\r\n * - Display label grouping node (specified by `groupByLabel` property)\r\n * - ECInstance nodes (may be grouped under a single node by [[SameLabelInstanceGroup]])\r\n *\r\n * @see [More details]($docs/presentation/Hierarchies/GroupingRule.md)\r\n * @public\r\n */\r\nexport interface GroupingRule extends RuleBase, ConditionContainer {\r\n /** Used for serializing to JSON. */\r\n ruleType: RuleTypes.Grouping;\r\n\r\n /**\r\n * Defines a condition for the rule, which needs to be met in order to execute it. Condition\r\n * is an [ECExpression]($docs/presentation/Advanced/ECExpressions.md), which can use\r\n * a [limited set of symbols]($docs/presentation/Hierarchies/ECExpressions.md#rule-condition).\r\n */\r\n condition?: string;\r\n\r\n /** Specification of ECClass which should be grouped using this rule */\r\n class: SingleSchemaClassSpecification;\r\n\r\n /** Specifications of grouping which should be applied to matching ECInstances */\r\n groups: GroupingSpecification[];\r\n}\r\n\r\n/**\r\n * Grouping rule specifications\r\n * @public\r\n */\r\nexport declare type GroupingSpecification = ClassGroup | PropertyGroup | SameLabelInstanceGroup;\r\n\r\n/**\r\n * Available types of [[GroupingSpecification]]\r\n * @public\r\n */\r\nexport enum GroupingSpecificationTypes {\r\n Class = \"Class\",\r\n Property = \"Property\",\r\n SameLabelInstance = \"SameLabelInstance\",\r\n}\r\n\r\n/**\r\n * Base interface for all [[GroupingSpecification]] implementations. Not\r\n * meant to be used directly, see `GroupingSpecification`.\r\n *\r\n * @public\r\n */\r\nexport interface GroupingSpecificationBase {\r\n /** Type of the subclass */\r\n specType: GroupingSpecificationTypes;\r\n}\r\n\r\n/**\r\n * Allows grouping ECInstance nodes by their base class.\r\n * @public\r\n */\r\nexport interface ClassGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Class;\r\n\r\n /** Should the grouping node be created if there is only one item in that group. */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /** Specification of the base ECClass to group by. Defaults to rule's class. */\r\n baseClass?: SingleSchemaClassSpecification;\r\n}\r\n\r\n/**\r\n * Allows grouping multiple instances with the same label into one ECInstance node.\r\n * It can be used in cases when these instances represent the same object for the user.\r\n *\r\n * When multiple instances are grouped, an ECInstance node is created instead of a\r\n * grouping node and the ECInstance key for the node is assigned to key of one of grouped\r\n * instances.\r\n *\r\n * @public\r\n */\r\nexport interface SameLabelInstanceGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.SameLabelInstance;\r\n /**\r\n * Stage of hierarchy creation at which the rule is applied.\r\n * Defaults to [[SameLabelInstanceGroupApplicationStage.Query]].\r\n */\r\n applicationStage?: SameLabelInstanceGroupApplicationStage;\r\n}\r\n\r\n/**\r\n * Specifies hierarchy creation stages used to apply [[SameLabelInstanceGroup]] grouping.\r\n * @public\r\n */\r\nexport enum SameLabelInstanceGroupApplicationStage {\r\n /** Apply grouping at query stage. */\r\n Query = \"Query\",\r\n\r\n /**\r\n * Apply grouping at post-processing stage.\r\n *\r\n * This allows grouping nodes created by different hierarchy specifications at\r\n * a higher performance cost as it requires loading the whole hierarchy level before\r\n * returning even the first node - avoid using with large numbers of nodes.\r\n */\r\n PostProcess = \"PostProcess\",\r\n}\r\n\r\n/**\r\n * Allows grouping by property of the instance\r\n * by a common value or by range of values.\r\n *\r\n * @public\r\n */\r\nexport interface PropertyGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Property;\r\n\r\n /**\r\n * Name of the ECProperty which is used for grouping.\r\n *\r\n * @minLength 1\r\n */\r\n propertyName: string;\r\n\r\n /**\r\n * ID of an image to use for the grouping node\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /** Should the grouping node be created if there is only one item in that group */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /**\r\n * Should a separate grouping node be created for nodes whose grouping value is not\r\n * set or is an empty string.\r\n *\r\n * Defaults to `true`.\r\n */\r\n createGroupForUnspecifiedValues?: boolean;\r\n\r\n /**\r\n * Should the instances be grouped on display label or the grouping property value.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Grouping by property value is required if the display label is\r\n * overridden to display grouped instances count.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n */\r\n groupingValue?: PropertyGroupingValue;\r\n\r\n /**\r\n * Should the nodes be sorted by display label or the grouping property value. In most\r\n * cases the result is the same, unless [[LabelOverride]] rule is used to change the display label.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Sorting by property value only makes sense when instances are grouped by\r\n * property value as well.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n */\r\n sortingValue?: PropertyGroupingValue;\r\n\r\n /** Ranges into which the grouping values are divided */\r\n ranges?: PropertyRangeGroupSpecification[];\r\n}\r\n\r\n/**\r\n * Used in [[PropertyGroup]] to specify the type of value to use\r\n * for grouping and sorting\r\n *\r\n * @public\r\n */\r\nexport enum PropertyGroupingValue {\r\n /** By property value */\r\n PropertyValue = \"PropertyValue\",\r\n\r\n /** By display label */\r\n DisplayLabel = \"DisplayLabel\",\r\n}\r\n\r\n/**\r\n * Describes a grouping range\r\n * @public\r\n */\r\nexport interface PropertyRangeGroupSpecification {\r\n /**\r\n * ID of an image to use for the grouping node. Defaults to [[PropertyGroup.imageId]] specified in [[PropertyGroup]].\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /**\r\n * Grouping node label. May be [localized]($docs/presentation/Advanced/Localization.md).\r\n * Defaults to `{from value} - {to value}`\r\n *\r\n * @minLength 1\r\n */\r\n label?: string;\r\n\r\n /**\r\n * Value that defines the range start (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n fromValue: string;\r\n\r\n /**\r\n * Value that defines the range end (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n toValue: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"GroupingRule.js","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAmDH;;;GAGG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,6CAAe,CAAA;IACf,mDAAqB,CAAA;IACrB,qEAAuC,CAAA;AACzC,CAAC,EAJW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAIrC;AAgDD;;;GAGG;AACH,IAAY,sCAYX;AAZD,WAAY,sCAAsC;IAChD,qCAAqC;IACrC,yDAAe,CAAA;IAEf;;;;;;OAMG;IACH,qEAA2B,CAAA;AAC7B,CAAC,EAZW,sCAAsC,GAAtC,8CAAsC,KAAtC,8CAAsC,QAYjD;AAuED;;;;;;GAMG;AACH,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,wBAAwB;IACxB,wDAA+B,CAAA;IAE/B,uBAAuB;IACvB,sDAA6B,CAAA;AAC/B,CAAC,EANW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAMhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PresentationRules\r\n */\r\n\r\nimport { SingleSchemaClassSpecification } from \"../ClassSpecifications\";\r\nimport { ConditionContainer, RuleBase, RuleTypes } from \"../Rule\";\r\n\r\n/**\r\n * Grouping rule is an advanced way to configure node grouping.\r\n *\r\n * It allows to define these types of groupings:\r\n * - Group by base class.\r\n * - Group by any property of the instance by a common value or a range of values.\r\n * - Group multiple instances with the same label in to one ECInstance node. This can be used in cases when these\r\n * instances represent the same object for the user.\r\n *\r\n * The rule works in conjunction with other grouping options available in navigation specifications [[ChildNodeSpecification]]:\r\n * `groupByClass` and `groupByLabel`. The grouping hierarchy looks like this:\r\n * - Base ECClass grouping node (specified by base class grouping specification [[ClassGroup]])\r\n * - ECClass grouping node (specified by `groupByClass` property)\r\n * - ECProperty grouping node 1 (specified by 1st [[PropertyGroup]])\r\n * - ECProperty grouping node 2 (specified by 2nd [[PropertyGroup]])\r\n * - ECProperty grouping node n (specified by n-th [[PropertyGroup]])\r\n * - Display label grouping node (specified by `groupByLabel` property)\r\n * - ECInstance nodes (may be grouped under a single node by [[SameLabelInstanceGroup]])\r\n *\r\n * @see [More details]($docs/presentation/Hierarchies/GroupingRule.md)\r\n * @public\r\n */\r\nexport interface GroupingRule extends RuleBase, ConditionContainer {\r\n /** Used for serializing to JSON. */\r\n ruleType: RuleTypes.Grouping;\r\n\r\n /**\r\n * Defines a condition for the rule, which needs to be met in order to execute it. Condition\r\n * is an [ECExpression]($docs/presentation/Advanced/ECExpressions.md), which can use\r\n * a [limited set of symbols]($docs/presentation/Hierarchies/ECExpressions.md#rule-condition).\r\n */\r\n condition?: string;\r\n\r\n /** Specification of ECClass which should be grouped using this rule */\r\n class: SingleSchemaClassSpecification;\r\n\r\n /** Specifications of grouping which should be applied to matching ECInstances */\r\n groups: GroupingSpecification[];\r\n}\r\n\r\n/**\r\n * Grouping rule specifications\r\n * @public\r\n */\r\nexport declare type GroupingSpecification = ClassGroup | PropertyGroup | SameLabelInstanceGroup;\r\n\r\n/**\r\n * Available types of [[GroupingSpecification]]\r\n * @public\r\n */\r\nexport enum GroupingSpecificationTypes {\r\n Class = \"Class\",\r\n Property = \"Property\",\r\n SameLabelInstance = \"SameLabelInstance\",\r\n}\r\n\r\n/**\r\n * Base interface for all [[GroupingSpecification]] implementations. Not\r\n * meant to be used directly, see `GroupingSpecification`.\r\n *\r\n * @public\r\n */\r\nexport interface GroupingSpecificationBase {\r\n /** Type of the subclass */\r\n specType: GroupingSpecificationTypes;\r\n}\r\n\r\n/**\r\n * Allows grouping ECInstance nodes by their base class.\r\n * @public\r\n */\r\nexport interface ClassGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Class;\r\n\r\n /** Should the grouping node be created if there is only one item in that group. */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /** Specification of the base ECClass to group by. Defaults to rule's class. */\r\n baseClass?: SingleSchemaClassSpecification;\r\n}\r\n\r\n/**\r\n * Allows grouping multiple instances with the same label into one ECInstance node.\r\n * It can be used in cases when these instances represent the same object for the user.\r\n *\r\n * When multiple instances are grouped, an ECInstance node is created instead of a\r\n * grouping node and the ECInstance key for the node is assigned to key of one of grouped\r\n * instances.\r\n *\r\n * @public\r\n */\r\nexport interface SameLabelInstanceGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.SameLabelInstance;\r\n /**\r\n * Stage of hierarchy creation at which the rule is applied.\r\n * Defaults to [[SameLabelInstanceGroupApplicationStage.Query]].\r\n */\r\n applicationStage?: SameLabelInstanceGroupApplicationStage;\r\n}\r\n\r\n/**\r\n * Specifies hierarchy creation stages used to apply [[SameLabelInstanceGroup]] grouping.\r\n * @public\r\n */\r\nexport enum SameLabelInstanceGroupApplicationStage {\r\n /** Apply grouping at query stage. */\r\n Query = \"Query\",\r\n\r\n /**\r\n * Apply grouping at post-processing stage.\r\n *\r\n * This allows grouping nodes created by different hierarchy specifications at\r\n * a higher performance cost as it requires loading the whole hierarchy level before\r\n * returning even the first node - avoid using with large numbers of nodes.\r\n */\r\n PostProcess = \"PostProcess\",\r\n}\r\n\r\n/**\r\n * Allows grouping by property of the instance\r\n * by a common value or by range of values.\r\n *\r\n * @public\r\n */\r\nexport interface PropertyGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Property;\r\n\r\n /**\r\n * Name of the ECProperty which is used for grouping.\r\n *\r\n * @minLength 1\r\n */\r\n propertyName: string;\r\n\r\n /**\r\n * ID of an image to use for the grouping node\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /** Should the grouping node be created if there is only one item in that group */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /**\r\n * Should a separate grouping node be created for nodes whose grouping value is not\r\n * set or is an empty string.\r\n *\r\n * Defaults to `true`.\r\n */\r\n createGroupForUnspecifiedValues?: boolean;\r\n\r\n /**\r\n * Should the instances be grouped on display label or the grouping property value.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Grouping by property value is required if the display label is\r\n * overridden to display grouped instances count.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n *\r\n * @deprecated Display value should always be used for grouping. In cases when there's a\r\n * need to show grouped instances count suffix, that can be achieved at the UI component\r\n * layer by composing UI node's label from node's display label and\r\n * [GroupingNodeKey.groupedInstancesCount]($presentation-common).\r\n */\r\n groupingValue?: PropertyGroupingValue; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * Should the nodes be sorted by display label or the grouping property value. In most\r\n * cases the result is the same, unless [[LabelOverride]] rule is used to change the display label.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Sorting by property value only makes sense when instances are grouped by\r\n * property value as well.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n *\r\n * @deprecated Property grouping nodes should always be sorted by display label.\r\n */\r\n sortingValue?: PropertyGroupingValue; // eslint-disable-line deprecation/deprecation\r\n\r\n /** Ranges into which the grouping values are divided */\r\n ranges?: PropertyRangeGroupSpecification[];\r\n}\r\n\r\n/**\r\n * Used in [[PropertyGroup]] to specify the type of value to use\r\n * for grouping and sorting\r\n *\r\n * @public\r\n * @deprecated The attributes using this enum are deprecated.\r\n */\r\nexport enum PropertyGroupingValue {\r\n /** By property value */\r\n PropertyValue = \"PropertyValue\",\r\n\r\n /** By display label */\r\n DisplayLabel = \"DisplayLabel\",\r\n}\r\n\r\n/**\r\n * Describes a grouping range\r\n * @public\r\n */\r\nexport interface PropertyRangeGroupSpecification {\r\n /**\r\n * ID of an image to use for the grouping node. Defaults to [[PropertyGroup.imageId]] specified in [[PropertyGroup]].\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /**\r\n * Grouping node label. May be [localized]($docs/presentation/Advanced/Localization.md).\r\n * Defaults to `{from value} - {to value}`\r\n *\r\n * @minLength 1\r\n */\r\n label?: string;\r\n\r\n /**\r\n * Value that defines the range start (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n fromValue: string;\r\n\r\n /**\r\n * Value that defines the range end (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n toValue: string;\r\n}\r\n"]}
@@ -148,6 +148,11 @@ export interface PropertyGroup extends GroupingSpecificationBase {
148
148
  * overridden to display grouped instances count.
149
149
  *
150
150
  * **Warning:** Grouping by label and sorting by property value is not possible.
151
+ *
152
+ * @deprecated Display value should always be used for grouping. In cases when there's a
153
+ * need to show grouped instances count suffix, that can be achieved at the UI component
154
+ * layer by composing UI node's label from node's display label and
155
+ * [GroupingNodeKey.groupedInstancesCount]($presentation-common).
151
156
  */
152
157
  groupingValue?: PropertyGroupingValue;
153
158
  /**
@@ -159,6 +164,8 @@ export interface PropertyGroup extends GroupingSpecificationBase {
159
164
  * property value as well.
160
165
  *
161
166
  * **Warning:** Grouping by label and sorting by property value is not possible.
167
+ *
168
+ * @deprecated Property grouping nodes should always be sorted by display label.
162
169
  */
163
170
  sortingValue?: PropertyGroupingValue;
164
171
  /** Ranges into which the grouping values are divided */
@@ -169,6 +176,7 @@ export interface PropertyGroup extends GroupingSpecificationBase {
169
176
  * for grouping and sorting
170
177
  *
171
178
  * @public
179
+ * @deprecated The attributes using this enum are deprecated.
172
180
  */
173
181
  export declare enum PropertyGroupingValue {
174
182
  /** By property value */
@@ -1 +1 @@
1
- {"version":3,"file":"GroupingRule.d.ts","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,kBAAkB;IAChE,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC;IAE7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uEAAuE;IACvE,KAAK,EAAE,8BAA8B,CAAC;IAEtC,iFAAiF;IACjF,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,qBAAqB,GAAG,UAAU,GAAG,aAAa,GAAG,sBAAsB,CAAC;AAEhG;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;CACxC;AAED;;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C9B;AAED;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"GroupingRule.d.ts","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,kBAAkB;IAChE,oCAAoC;IACpC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC;IAE7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uEAAuE;IACvE,KAAK,EAAE,8BAA8B,CAAC;IAEtC,iFAAiF;IACjF,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,qBAAqB,GAAG,UAAU,GAAG,aAAa,GAAG,sBAAsB,CAAC;AAEhG;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC,2BAA2B;IAC3B,QAAQ,EAAE,0BAA0B,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,yBAAyB;IAC3D,oCAAoC;IACpC,QAAQ,EAAE,0BAA0B,CAAC,KAAK,CAAC;IAE3C,mFAAmF;IACnF,wBAAwB,CAAC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AM,CAAC;CACjB"}
@@ -37,6 +37,7 @@ export var SameLabelInstanceGroupApplicationStage;
37
37
  * for grouping and sorting
38
38
  *
39
39
  * @public
40
+ * @deprecated The attributes using this enum are deprecated.
40
41
  */
41
42
  export var PropertyGroupingValue;
42
43
  (function (PropertyGroupingValue) {
@@ -1 +1 @@
1
- {"version":3,"file":"GroupingRule.js","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAmDH;;;GAGG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,6CAAe,CAAA;IACf,mDAAqB,CAAA;IACrB,qEAAuC,CAAA;AACzC,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAgDD;;;GAGG;AACH,MAAM,CAAN,IAAY,sCAYX;AAZD,WAAY,sCAAsC;IAChD,qCAAqC;IACrC,yDAAe,CAAA;IAEf;;;;;;OAMG;IACH,qEAA2B,CAAA;AAC7B,CAAC,EAZW,sCAAsC,KAAtC,sCAAsC,QAYjD;AAgED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,wBAAwB;IACxB,wDAA+B,CAAA;IAE/B,uBAAuB;IACvB,sDAA6B,CAAA;AAC/B,CAAC,EANW,qBAAqB,KAArB,qBAAqB,QAMhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PresentationRules\r\n */\r\n\r\nimport { SingleSchemaClassSpecification } from \"../ClassSpecifications\";\r\nimport { ConditionContainer, RuleBase, RuleTypes } from \"../Rule\";\r\n\r\n/**\r\n * Grouping rule is an advanced way to configure node grouping.\r\n *\r\n * It allows to define these types of groupings:\r\n * - Group by base class.\r\n * - Group by any property of the instance by a common value or a range of values.\r\n * - Group multiple instances with the same label in to one ECInstance node. This can be used in cases when these\r\n * instances represent the same object for the user.\r\n *\r\n * The rule works in conjunction with other grouping options available in navigation specifications [[ChildNodeSpecification]]:\r\n * `groupByClass` and `groupByLabel`. The grouping hierarchy looks like this:\r\n * - Base ECClass grouping node (specified by base class grouping specification [[ClassGroup]])\r\n * - ECClass grouping node (specified by `groupByClass` property)\r\n * - ECProperty grouping node 1 (specified by 1st [[PropertyGroup]])\r\n * - ECProperty grouping node 2 (specified by 2nd [[PropertyGroup]])\r\n * - ECProperty grouping node n (specified by n-th [[PropertyGroup]])\r\n * - Display label grouping node (specified by `groupByLabel` property)\r\n * - ECInstance nodes (may be grouped under a single node by [[SameLabelInstanceGroup]])\r\n *\r\n * @see [More details]($docs/presentation/Hierarchies/GroupingRule.md)\r\n * @public\r\n */\r\nexport interface GroupingRule extends RuleBase, ConditionContainer {\r\n /** Used for serializing to JSON. */\r\n ruleType: RuleTypes.Grouping;\r\n\r\n /**\r\n * Defines a condition for the rule, which needs to be met in order to execute it. Condition\r\n * is an [ECExpression]($docs/presentation/Advanced/ECExpressions.md), which can use\r\n * a [limited set of symbols]($docs/presentation/Hierarchies/ECExpressions.md#rule-condition).\r\n */\r\n condition?: string;\r\n\r\n /** Specification of ECClass which should be grouped using this rule */\r\n class: SingleSchemaClassSpecification;\r\n\r\n /** Specifications of grouping which should be applied to matching ECInstances */\r\n groups: GroupingSpecification[];\r\n}\r\n\r\n/**\r\n * Grouping rule specifications\r\n * @public\r\n */\r\nexport declare type GroupingSpecification = ClassGroup | PropertyGroup | SameLabelInstanceGroup;\r\n\r\n/**\r\n * Available types of [[GroupingSpecification]]\r\n * @public\r\n */\r\nexport enum GroupingSpecificationTypes {\r\n Class = \"Class\",\r\n Property = \"Property\",\r\n SameLabelInstance = \"SameLabelInstance\",\r\n}\r\n\r\n/**\r\n * Base interface for all [[GroupingSpecification]] implementations. Not\r\n * meant to be used directly, see `GroupingSpecification`.\r\n *\r\n * @public\r\n */\r\nexport interface GroupingSpecificationBase {\r\n /** Type of the subclass */\r\n specType: GroupingSpecificationTypes;\r\n}\r\n\r\n/**\r\n * Allows grouping ECInstance nodes by their base class.\r\n * @public\r\n */\r\nexport interface ClassGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Class;\r\n\r\n /** Should the grouping node be created if there is only one item in that group. */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /** Specification of the base ECClass to group by. Defaults to rule's class. */\r\n baseClass?: SingleSchemaClassSpecification;\r\n}\r\n\r\n/**\r\n * Allows grouping multiple instances with the same label into one ECInstance node.\r\n * It can be used in cases when these instances represent the same object for the user.\r\n *\r\n * When multiple instances are grouped, an ECInstance node is created instead of a\r\n * grouping node and the ECInstance key for the node is assigned to key of one of grouped\r\n * instances.\r\n *\r\n * @public\r\n */\r\nexport interface SameLabelInstanceGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.SameLabelInstance;\r\n /**\r\n * Stage of hierarchy creation at which the rule is applied.\r\n * Defaults to [[SameLabelInstanceGroupApplicationStage.Query]].\r\n */\r\n applicationStage?: SameLabelInstanceGroupApplicationStage;\r\n}\r\n\r\n/**\r\n * Specifies hierarchy creation stages used to apply [[SameLabelInstanceGroup]] grouping.\r\n * @public\r\n */\r\nexport enum SameLabelInstanceGroupApplicationStage {\r\n /** Apply grouping at query stage. */\r\n Query = \"Query\",\r\n\r\n /**\r\n * Apply grouping at post-processing stage.\r\n *\r\n * This allows grouping nodes created by different hierarchy specifications at\r\n * a higher performance cost as it requires loading the whole hierarchy level before\r\n * returning even the first node - avoid using with large numbers of nodes.\r\n */\r\n PostProcess = \"PostProcess\",\r\n}\r\n\r\n/**\r\n * Allows grouping by property of the instance\r\n * by a common value or by range of values.\r\n *\r\n * @public\r\n */\r\nexport interface PropertyGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Property;\r\n\r\n /**\r\n * Name of the ECProperty which is used for grouping.\r\n *\r\n * @minLength 1\r\n */\r\n propertyName: string;\r\n\r\n /**\r\n * ID of an image to use for the grouping node\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /** Should the grouping node be created if there is only one item in that group */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /**\r\n * Should a separate grouping node be created for nodes whose grouping value is not\r\n * set or is an empty string.\r\n *\r\n * Defaults to `true`.\r\n */\r\n createGroupForUnspecifiedValues?: boolean;\r\n\r\n /**\r\n * Should the instances be grouped on display label or the grouping property value.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Grouping by property value is required if the display label is\r\n * overridden to display grouped instances count.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n */\r\n groupingValue?: PropertyGroupingValue;\r\n\r\n /**\r\n * Should the nodes be sorted by display label or the grouping property value. In most\r\n * cases the result is the same, unless [[LabelOverride]] rule is used to change the display label.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Sorting by property value only makes sense when instances are grouped by\r\n * property value as well.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n */\r\n sortingValue?: PropertyGroupingValue;\r\n\r\n /** Ranges into which the grouping values are divided */\r\n ranges?: PropertyRangeGroupSpecification[];\r\n}\r\n\r\n/**\r\n * Used in [[PropertyGroup]] to specify the type of value to use\r\n * for grouping and sorting\r\n *\r\n * @public\r\n */\r\nexport enum PropertyGroupingValue {\r\n /** By property value */\r\n PropertyValue = \"PropertyValue\",\r\n\r\n /** By display label */\r\n DisplayLabel = \"DisplayLabel\",\r\n}\r\n\r\n/**\r\n * Describes a grouping range\r\n * @public\r\n */\r\nexport interface PropertyRangeGroupSpecification {\r\n /**\r\n * ID of an image to use for the grouping node. Defaults to [[PropertyGroup.imageId]] specified in [[PropertyGroup]].\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /**\r\n * Grouping node label. May be [localized]($docs/presentation/Advanced/Localization.md).\r\n * Defaults to `{from value} - {to value}`\r\n *\r\n * @minLength 1\r\n */\r\n label?: string;\r\n\r\n /**\r\n * Value that defines the range start (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n fromValue: string;\r\n\r\n /**\r\n * Value that defines the range end (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n toValue: string;\r\n}\r\n"]}
1
+ {"version":3,"file":"GroupingRule.js","sourceRoot":"","sources":["../../../../../src/presentation-common/rules/customization/GroupingRule.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAmDH;;;GAGG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,6CAAe,CAAA;IACf,mDAAqB,CAAA;IACrB,qEAAuC,CAAA;AACzC,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAgDD;;;GAGG;AACH,MAAM,CAAN,IAAY,sCAYX;AAZD,WAAY,sCAAsC;IAChD,qCAAqC;IACrC,yDAAe,CAAA;IAEf;;;;;;OAMG;IACH,qEAA2B,CAAA;AAC7B,CAAC,EAZW,sCAAsC,KAAtC,sCAAsC,QAYjD;AAuED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,wBAAwB;IACxB,wDAA+B,CAAA;IAE/B,uBAAuB;IACvB,sDAA6B,CAAA;AAC/B,CAAC,EANW,qBAAqB,KAArB,qBAAqB,QAMhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module PresentationRules\r\n */\r\n\r\nimport { SingleSchemaClassSpecification } from \"../ClassSpecifications\";\r\nimport { ConditionContainer, RuleBase, RuleTypes } from \"../Rule\";\r\n\r\n/**\r\n * Grouping rule is an advanced way to configure node grouping.\r\n *\r\n * It allows to define these types of groupings:\r\n * - Group by base class.\r\n * - Group by any property of the instance by a common value or a range of values.\r\n * - Group multiple instances with the same label in to one ECInstance node. This can be used in cases when these\r\n * instances represent the same object for the user.\r\n *\r\n * The rule works in conjunction with other grouping options available in navigation specifications [[ChildNodeSpecification]]:\r\n * `groupByClass` and `groupByLabel`. The grouping hierarchy looks like this:\r\n * - Base ECClass grouping node (specified by base class grouping specification [[ClassGroup]])\r\n * - ECClass grouping node (specified by `groupByClass` property)\r\n * - ECProperty grouping node 1 (specified by 1st [[PropertyGroup]])\r\n * - ECProperty grouping node 2 (specified by 2nd [[PropertyGroup]])\r\n * - ECProperty grouping node n (specified by n-th [[PropertyGroup]])\r\n * - Display label grouping node (specified by `groupByLabel` property)\r\n * - ECInstance nodes (may be grouped under a single node by [[SameLabelInstanceGroup]])\r\n *\r\n * @see [More details]($docs/presentation/Hierarchies/GroupingRule.md)\r\n * @public\r\n */\r\nexport interface GroupingRule extends RuleBase, ConditionContainer {\r\n /** Used for serializing to JSON. */\r\n ruleType: RuleTypes.Grouping;\r\n\r\n /**\r\n * Defines a condition for the rule, which needs to be met in order to execute it. Condition\r\n * is an [ECExpression]($docs/presentation/Advanced/ECExpressions.md), which can use\r\n * a [limited set of symbols]($docs/presentation/Hierarchies/ECExpressions.md#rule-condition).\r\n */\r\n condition?: string;\r\n\r\n /** Specification of ECClass which should be grouped using this rule */\r\n class: SingleSchemaClassSpecification;\r\n\r\n /** Specifications of grouping which should be applied to matching ECInstances */\r\n groups: GroupingSpecification[];\r\n}\r\n\r\n/**\r\n * Grouping rule specifications\r\n * @public\r\n */\r\nexport declare type GroupingSpecification = ClassGroup | PropertyGroup | SameLabelInstanceGroup;\r\n\r\n/**\r\n * Available types of [[GroupingSpecification]]\r\n * @public\r\n */\r\nexport enum GroupingSpecificationTypes {\r\n Class = \"Class\",\r\n Property = \"Property\",\r\n SameLabelInstance = \"SameLabelInstance\",\r\n}\r\n\r\n/**\r\n * Base interface for all [[GroupingSpecification]] implementations. Not\r\n * meant to be used directly, see `GroupingSpecification`.\r\n *\r\n * @public\r\n */\r\nexport interface GroupingSpecificationBase {\r\n /** Type of the subclass */\r\n specType: GroupingSpecificationTypes;\r\n}\r\n\r\n/**\r\n * Allows grouping ECInstance nodes by their base class.\r\n * @public\r\n */\r\nexport interface ClassGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Class;\r\n\r\n /** Should the grouping node be created if there is only one item in that group. */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /** Specification of the base ECClass to group by. Defaults to rule's class. */\r\n baseClass?: SingleSchemaClassSpecification;\r\n}\r\n\r\n/**\r\n * Allows grouping multiple instances with the same label into one ECInstance node.\r\n * It can be used in cases when these instances represent the same object for the user.\r\n *\r\n * When multiple instances are grouped, an ECInstance node is created instead of a\r\n * grouping node and the ECInstance key for the node is assigned to key of one of grouped\r\n * instances.\r\n *\r\n * @public\r\n */\r\nexport interface SameLabelInstanceGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.SameLabelInstance;\r\n /**\r\n * Stage of hierarchy creation at which the rule is applied.\r\n * Defaults to [[SameLabelInstanceGroupApplicationStage.Query]].\r\n */\r\n applicationStage?: SameLabelInstanceGroupApplicationStage;\r\n}\r\n\r\n/**\r\n * Specifies hierarchy creation stages used to apply [[SameLabelInstanceGroup]] grouping.\r\n * @public\r\n */\r\nexport enum SameLabelInstanceGroupApplicationStage {\r\n /** Apply grouping at query stage. */\r\n Query = \"Query\",\r\n\r\n /**\r\n * Apply grouping at post-processing stage.\r\n *\r\n * This allows grouping nodes created by different hierarchy specifications at\r\n * a higher performance cost as it requires loading the whole hierarchy level before\r\n * returning even the first node - avoid using with large numbers of nodes.\r\n */\r\n PostProcess = \"PostProcess\",\r\n}\r\n\r\n/**\r\n * Allows grouping by property of the instance\r\n * by a common value or by range of values.\r\n *\r\n * @public\r\n */\r\nexport interface PropertyGroup extends GroupingSpecificationBase {\r\n /** Used for serializing to JSON. */\r\n specType: GroupingSpecificationTypes.Property;\r\n\r\n /**\r\n * Name of the ECProperty which is used for grouping.\r\n *\r\n * @minLength 1\r\n */\r\n propertyName: string;\r\n\r\n /**\r\n * ID of an image to use for the grouping node\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /** Should the grouping node be created if there is only one item in that group */\r\n createGroupForSingleItem?: boolean;\r\n\r\n /**\r\n * Should a separate grouping node be created for nodes whose grouping value is not\r\n * set or is an empty string.\r\n *\r\n * Defaults to `true`.\r\n */\r\n createGroupForUnspecifiedValues?: boolean;\r\n\r\n /**\r\n * Should the instances be grouped on display label or the grouping property value.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Grouping by property value is required if the display label is\r\n * overridden to display grouped instances count.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n *\r\n * @deprecated Display value should always be used for grouping. In cases when there's a\r\n * need to show grouped instances count suffix, that can be achieved at the UI component\r\n * layer by composing UI node's label from node's display label and\r\n * [GroupingNodeKey.groupedInstancesCount]($presentation-common).\r\n */\r\n groupingValue?: PropertyGroupingValue; // eslint-disable-line deprecation/deprecation\r\n\r\n /**\r\n * Should the nodes be sorted by display label or the grouping property value. In most\r\n * cases the result is the same, unless [[LabelOverride]] rule is used to change the display label.\r\n * Defaults to [[PropertyGroupingValue.DisplayLabel]].\r\n *\r\n * **Note:** Sorting by property value only makes sense when instances are grouped by\r\n * property value as well.\r\n *\r\n * **Warning:** Grouping by label and sorting by property value is not possible.\r\n *\r\n * @deprecated Property grouping nodes should always be sorted by display label.\r\n */\r\n sortingValue?: PropertyGroupingValue; // eslint-disable-line deprecation/deprecation\r\n\r\n /** Ranges into which the grouping values are divided */\r\n ranges?: PropertyRangeGroupSpecification[];\r\n}\r\n\r\n/**\r\n * Used in [[PropertyGroup]] to specify the type of value to use\r\n * for grouping and sorting\r\n *\r\n * @public\r\n * @deprecated The attributes using this enum are deprecated.\r\n */\r\nexport enum PropertyGroupingValue {\r\n /** By property value */\r\n PropertyValue = \"PropertyValue\",\r\n\r\n /** By display label */\r\n DisplayLabel = \"DisplayLabel\",\r\n}\r\n\r\n/**\r\n * Describes a grouping range\r\n * @public\r\n */\r\nexport interface PropertyRangeGroupSpecification {\r\n /**\r\n * ID of an image to use for the grouping node. Defaults to [[PropertyGroup.imageId]] specified in [[PropertyGroup]].\r\n *\r\n * @minLength 1\r\n */\r\n imageId?: string;\r\n\r\n /**\r\n * Grouping node label. May be [localized]($docs/presentation/Advanced/Localization.md).\r\n * Defaults to `{from value} - {to value}`\r\n *\r\n * @minLength 1\r\n */\r\n label?: string;\r\n\r\n /**\r\n * Value that defines the range start (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n fromValue: string;\r\n\r\n /**\r\n * Value that defines the range end (inclusive)\r\n *\r\n * @minLength 1\r\n */\r\n toValue: string;\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/presentation-common",
3
- "version": "3.1.0-dev.22",
3
+ "version": "3.1.0-dev.23",
4
4
  "description": "Common pieces for iModel.js presentation packages",
5
5
  "imodeljsSharedLibrary": true,
6
6
  "license": "MIT",
@@ -22,16 +22,16 @@
22
22
  "module": "lib/esm/presentation-common.js",
23
23
  "typings": "lib/cjs/presentation-common",
24
24
  "peerDependencies": {
25
- "@itwin/core-bentley": "^3.1.0-dev.22",
26
- "@itwin/core-common": "^3.1.0-dev.22",
27
- "@itwin/core-quantity": "^3.1.0-dev.22"
25
+ "@itwin/core-bentley": "^3.1.0-dev.23",
26
+ "@itwin/core-common": "^3.1.0-dev.23",
27
+ "@itwin/core-quantity": "^3.1.0-dev.23"
28
28
  },
29
29
  "devDependencies": {
30
- "@itwin/build-tools": "3.1.0-dev.22",
31
- "@itwin/core-bentley": "3.1.0-dev.22",
32
- "@itwin/core-common": "3.1.0-dev.22",
33
- "@itwin/core-quantity": "3.1.0-dev.22",
34
- "@itwin/eslint-plugin": "3.1.0-dev.22",
30
+ "@itwin/build-tools": "3.1.0-dev.23",
31
+ "@itwin/core-bentley": "3.1.0-dev.23",
32
+ "@itwin/core-common": "3.1.0-dev.23",
33
+ "@itwin/core-quantity": "3.1.0-dev.23",
34
+ "@itwin/eslint-plugin": "3.1.0-dev.23",
35
35
  "@types/chai": "^4.1.4",
36
36
  "@types/chai-as-promised": "^7",
37
37
  "@types/chai-jest-snapshot": "^1.3.0",