@itwin/presentation-common 5.3.0-dev.6 → 5.3.0-dev.7

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.
Files changed (204) hide show
  1. package/Ruleset.schema.json +18 -18
  2. package/lib/assets/locales/en/Presentation.json +19 -19
  3. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  4. package/lib/cjs/presentation-common/CommonLoggerCategory.js.map +1 -1
  5. package/lib/cjs/presentation-common/Diagnostics.js.map +1 -1
  6. package/lib/cjs/presentation-common/EC.js.map +1 -1
  7. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  8. package/lib/cjs/presentation-common/Error.js.map +1 -1
  9. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  10. package/lib/cjs/presentation-common/KeySet.d.ts +4 -4
  11. package/lib/cjs/presentation-common/KeySet.js +3 -3
  12. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  13. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  14. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  15. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  16. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  17. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +5 -5
  18. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  19. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +4 -4
  20. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  21. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  22. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  23. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  24. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  25. package/lib/cjs/presentation-common/Update.d.ts +7 -7
  26. package/lib/cjs/presentation-common/Update.js.map +1 -1
  27. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  28. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  29. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  30. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  31. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  32. package/lib/cjs/presentation-common/content/DisplayTypes.js.map +1 -1
  33. package/lib/cjs/presentation-common/content/Editor.js.map +1 -1
  34. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  35. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  36. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  37. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  38. package/lib/cjs/presentation-common/content/Renderer.js.map +1 -1
  39. package/lib/cjs/presentation-common/content/TypeDescription.js.map +1 -1
  40. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  41. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -1
  42. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  43. package/lib/cjs/presentation-common/hierarchy/Key.d.ts +10 -10
  44. package/lib/cjs/presentation-common/hierarchy/Key.js +2 -2
  45. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  46. package/lib/cjs/presentation-common/hierarchy/Node.d.ts +2 -2
  47. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  48. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +2 -2
  49. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  50. package/lib/cjs/presentation-common/rules/ClassSpecifications.js.map +1 -1
  51. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  52. package/lib/cjs/presentation-common/rules/RelationshipDirection.js.map +1 -1
  53. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  54. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  55. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  56. package/lib/cjs/presentation-common/rules/SchemasSpecification.js.map +1 -1
  57. package/lib/cjs/presentation-common/rules/Variables.js.map +1 -1
  58. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  59. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  60. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  61. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  62. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  63. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  64. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  65. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  66. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  67. package/lib/cjs/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  68. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  69. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  70. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  71. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  72. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  73. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +9 -9
  74. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +2 -2
  75. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  76. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  77. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  78. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
  79. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  80. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +4 -4
  81. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js +1 -1
  82. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  83. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +1 -1
  84. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  85. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +6 -6
  86. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +1 -1
  87. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  88. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +1 -1
  89. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  90. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts +2 -2
  91. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  92. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
  93. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  94. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +1 -1
  95. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  96. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
  97. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  98. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts +1 -1
  99. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  100. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  101. package/lib/cjs/presentation-common-internal.js.map +1 -1
  102. package/lib/cjs/presentation-common.js.map +1 -1
  103. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  104. package/lib/esm/presentation-common/CommonLoggerCategory.js.map +1 -1
  105. package/lib/esm/presentation-common/Diagnostics.js.map +1 -1
  106. package/lib/esm/presentation-common/EC.js.map +1 -1
  107. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  108. package/lib/esm/presentation-common/Error.js.map +1 -1
  109. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  110. package/lib/esm/presentation-common/KeySet.d.ts +4 -4
  111. package/lib/esm/presentation-common/KeySet.js +3 -3
  112. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  113. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  114. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  115. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  116. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  117. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +5 -5
  118. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  119. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +4 -4
  120. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  121. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  122. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  123. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  124. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  125. package/lib/esm/presentation-common/Update.d.ts +7 -7
  126. package/lib/esm/presentation-common/Update.js.map +1 -1
  127. package/lib/esm/presentation-common/Utils.js.map +1 -1
  128. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  129. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  130. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  131. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  132. package/lib/esm/presentation-common/content/DisplayTypes.js.map +1 -1
  133. package/lib/esm/presentation-common/content/Editor.js.map +1 -1
  134. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  135. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  136. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  137. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  138. package/lib/esm/presentation-common/content/Renderer.js.map +1 -1
  139. package/lib/esm/presentation-common/content/TypeDescription.js.map +1 -1
  140. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  141. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -1
  142. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  143. package/lib/esm/presentation-common/hierarchy/Key.d.ts +10 -10
  144. package/lib/esm/presentation-common/hierarchy/Key.js +2 -2
  145. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  146. package/lib/esm/presentation-common/hierarchy/Node.d.ts +2 -2
  147. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  148. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +2 -2
  149. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  150. package/lib/esm/presentation-common/rules/ClassSpecifications.js.map +1 -1
  151. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  152. package/lib/esm/presentation-common/rules/RelationshipDirection.js.map +1 -1
  153. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  154. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  155. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  156. package/lib/esm/presentation-common/rules/SchemasSpecification.js.map +1 -1
  157. package/lib/esm/presentation-common/rules/Variables.js.map +1 -1
  158. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  159. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  160. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  161. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  162. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  163. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  164. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  165. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  166. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  167. package/lib/esm/presentation-common/rules/content/modifiers/CustomRendererSpecification.js.map +1 -1
  168. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  169. package/lib/esm/presentation-common/rules/content/modifiers/PropertyEditorsSpecification.js.map +1 -1
  170. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  171. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  172. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  173. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +9 -9
  174. package/lib/esm/presentation-common/rules/customization/GroupingRule.js +2 -2
  175. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  176. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  177. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  178. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
  179. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  180. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +4 -4
  181. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js +1 -1
  182. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  183. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +1 -1
  184. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  185. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +6 -6
  186. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js +1 -1
  187. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  188. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +1 -1
  189. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  190. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts +2 -2
  191. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  192. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
  193. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  194. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +1 -1
  195. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  196. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
  197. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  198. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts +1 -1
  199. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  200. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  201. package/lib/esm/presentation-common-internal.js.map +1 -1
  202. package/lib/esm/presentation-common.js.map +1 -1
  203. package/lib/public/locales/en/Presentation.json +19 -19
  204. package/package.json +11 -11
@@ -1 +1 @@
1
- {"version":3,"file":"ContentTraverser.js","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EAAE,CAAC;QAC1B,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,SAAS,GAAG,sDAAsD,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACnG,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC;QAC7B,GAAG,IAAI;QACP,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE;QACtC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE;QACjD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC","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 Content\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { LabelDefinition } from \"../LabelDefinition.js\";\r\nimport { CategoryDescription } from \"./Category.js\";\r\nimport { Content } from \"./Content.js\";\r\nimport { Descriptor } from \"./Descriptor.js\";\r\nimport { Field, NestedContentField } from \"./Fields.js\";\r\nimport { Item } from \"./Item.js\";\r\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription.js\";\r\nimport {\r\n DisplayValue,\r\n DisplayValuesArray,\r\n DisplayValuesMap,\r\n NestedContentValue,\r\n Value as PresentationValue,\r\n ValuesArray as PresentationValuesArray,\r\n ValuesMap as PresentationValuesMap,\r\n} from \"./Value.js\";\r\n\r\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\r\n\r\ntype ValuesMap = PresentationValuesMap & {\r\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\r\n};\r\n\r\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\r\n\r\ntype ValuesArray = Array<Value>;\r\n\r\n/**\r\n * A data structure to define a hierarchy of [[Field]] objects.\r\n * @public\r\n */\r\nexport interface FieldHierarchy {\r\n /** Parent field. */\r\n field: Field;\r\n /** Nested fields. */\r\n childFields: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startContent]] call.\r\n * @public\r\n */\r\nexport interface StartContentProps {\r\n /** Descriptor of the visited content. */\r\n descriptor: Descriptor;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\r\n * @public\r\n */\r\nexport interface ProcessFieldHierarchiesProps {\r\n /**\r\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\r\n * add new fields, etc.\r\n */\r\n hierarchies: FieldHierarchy[];\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startItem]] call.\r\n * @public\r\n */\r\nexport interface StartItemProps {\r\n /** The content item that's about to be visited. */\r\n item: Item;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startCategory]] call.\r\n * @public\r\n */\r\nexport interface StartCategoryProps {\r\n /** The content category that's about to be visited. */\r\n category: CategoryDescription;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startField]] call.\r\n * @public\r\n */\r\nexport interface StartFieldProps {\r\n /** The field that's about to be visited. */\r\n hierarchy: FieldHierarchy;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startStruct]] call.\r\n * @public\r\n */\r\nexport interface StartStructProps {\r\n /** Field that describes the struct. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the struct. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Member raw values. */\r\n rawValues: PresentationValuesMap;\r\n /** Member display values. */\r\n displayValues: DisplayValuesMap;\r\n /** Label definition of the ECInstance that the struct represents. */\r\n label?: LabelDefinition;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.startArray]] call.\r\n * @public\r\n */\r\nexport interface StartArrayProps {\r\n /** Field that describes the array. */\r\n hierarchy: FieldHierarchy;\r\n /** Type of the array. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Item raw values. */\r\n rawValues: PresentationValuesArray;\r\n /** Item display values. */\r\n displayValues: DisplayValuesArray;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processMergedValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessMergedValueProps {\r\n /** The field whose values are merged. */\r\n mergedField: Field;\r\n /**\r\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\r\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\r\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\r\n * process is going to be represented by [[requestedField]].\r\n */\r\n requestedField: Field;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n}\r\n\r\n/**\r\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\r\n * @public\r\n */\r\nexport interface ProcessPrimitiveValueProps {\r\n /** Field whose value is being processed. */\r\n field: Field;\r\n /** Type of the value. */\r\n valueType: TypeDescription;\r\n /** Name of the parent field (if there is one). */\r\n parentFieldName?: string;\r\n /** Raw value. */\r\n rawValue: PresentationValue;\r\n /** Display value. */\r\n displayValue: DisplayValue;\r\n}\r\n\r\n/**\r\n * An interface for a visitor that can be passed to the [[traverseContent]] function\r\n * to be called on each piece of content.\r\n *\r\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\r\n *\r\n * ```\r\n * startContent\r\n * processFieldHierarchies\r\n * for each content item:\r\n * startItem\r\n * for each field in root level:\r\n * for each category in field's category stack from root to field's category:\r\n * startCategory\r\n * startField\r\n * valueProcessing:\r\n * if item's value for this field is merged:\r\n * processMergedValue\r\n * else if the field is struct:\r\n * startStruct\r\n * for each struct member:\r\n * recurse into the valueProcessing step\r\n * finishStruct\r\n * else if the field is array:\r\n * startArray\r\n * for each array item:\r\n * recurse into the valueProcessing step\r\n * finishArray\r\n * else if the field is primitive:\r\n * processPrimitiveValue\r\n * finishField\r\n * finishItem\r\n * finishContent\r\n * ```\r\n * @public\r\n */\r\nexport interface IContentVisitor {\r\n /**\r\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\r\n * for parsing content.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\r\n */\r\n startContent(props: StartContentProps): boolean;\r\n /** Called after processing of [[Content]] is complete. */\r\n finishContent(): void;\r\n\r\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\r\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\r\n\r\n /**\r\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\r\n * set up a new row in table.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\r\n */\r\n startItem(props: StartItemProps): boolean;\r\n /**\r\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\r\n * values for one content item have been processed.\r\n */\r\n finishItem(): void;\r\n\r\n /**\r\n * Called before processing a content item field ([[startField]] call) for each category in the field's\r\n * category stack, starting from the root and finishing with the field's category.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\r\n */\r\n startCategory(props: StartCategoryProps): boolean;\r\n /** Called after processing of field is complete for every category in the field's category stack. */\r\n finishCategory(): void;\r\n\r\n /**\r\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\r\n * to skip a field if it doesn't need to be handled.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\r\n */\r\n startField(props: StartFieldProps): boolean;\r\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\r\n finishField(): void;\r\n\r\n /**\r\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\r\n * for struct member values handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\r\n */\r\n startStruct(props: StartStructProps): boolean;\r\n /** Called after processing of struct value is complete. */\r\n finishStruct(): void;\r\n\r\n /**\r\n * Called before processing an array value. This is a good callback to skip handling the value or set up\r\n * for array items handling.\r\n *\r\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\r\n */\r\n startArray(props: StartArrayProps): boolean;\r\n /** Called after processing of array value is complete. */\r\n finishArray(): void;\r\n\r\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\r\n processMergedValue(props: ProcessMergedValueProps): void;\r\n /** Called to process a primitive value. */\r\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\r\n}\r\n\r\n/**\r\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\r\n * @public\r\n */\r\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\r\n if (cb(hierarchy)) {\r\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\r\n }\r\n}\r\n\r\n/**\r\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\r\n * for different components.\r\n * @public\r\n */\r\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\r\n if (!visitor.startContent({ descriptor: content.descriptor })) {\r\n return;\r\n }\r\n\r\n try {\r\n const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);\r\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\r\n content.contentSet.forEach((item) => {\r\n traverseContentItemFields(visitor, fieldHierarchies, item);\r\n });\r\n } finally {\r\n visitor.finishContent();\r\n }\r\n}\r\n\r\n/**\r\n * An utility for calling [[traverseContent]] when there's only one content item.\r\n * @public\r\n */\r\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\r\n traverseContent(visitor, new Content(descriptor, [item]));\r\n}\r\n\r\nclass VisitedCategories implements Disposable {\r\n private _visitedCategories: CategoryDescription[];\r\n private _didVisitAllHierarchy: boolean;\r\n constructor(\r\n private _visitor: IContentVisitor,\r\n category: CategoryDescription,\r\n ) {\r\n const stack: CategoryDescription[] = [];\r\n let curr: CategoryDescription | undefined = category;\r\n while (curr) {\r\n stack.push(curr);\r\n curr = curr.parent;\r\n }\r\n stack.reverse();\r\n\r\n this._didVisitAllHierarchy = true;\r\n this._visitedCategories = [];\r\n for (curr of stack) {\r\n if (this._visitor.startCategory({ category: curr })) {\r\n this._visitedCategories.push(curr);\r\n } else {\r\n this._didVisitAllHierarchy = false;\r\n break;\r\n }\r\n }\r\n }\r\n public [Symbol.dispose]() {\r\n while (this._visitedCategories.pop()) {\r\n this._visitor.finishCategory();\r\n }\r\n }\r\n public get shouldContinue(): boolean {\r\n return this._didVisitAllHierarchy;\r\n }\r\n}\r\n\r\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\r\n if (!visitor.startItem({ item })) {\r\n return;\r\n }\r\n\r\n try {\r\n fieldHierarchies.forEach((fieldHierarchy) => {\r\n using res = new VisitedCategories(visitor, fieldHierarchy.field.category);\r\n if (res.shouldContinue) {\r\n traverseContentItemField(visitor, fieldHierarchy, item);\r\n }\r\n });\r\n } finally {\r\n visitor.finishItem();\r\n }\r\n}\r\n\r\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\r\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\r\n return;\r\n }\r\n\r\n try {\r\n const rootToThisField = createFieldPath(fieldHierarchy.field);\r\n let parentFieldName: string | undefined;\r\n const pathUpToField = rootToThisField.slice(undefined, -1);\r\n for (let i = 0; i < pathUpToField.length; ++i) {\r\n const parentField = pathUpToField[i] as NestedContentField;\r\n const nextField = rootToThisField[i + 1];\r\n\r\n if (item.isFieldMerged(parentField.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\r\n return;\r\n }\r\n\r\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n\r\n item = convertedItem;\r\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\r\n }\r\n\r\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\r\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\r\n if (emptyNestedItem) {\r\n return;\r\n }\r\n item = convertedItem;\r\n } else if (pathUpToField.length > 0) {\r\n fieldHierarchy = {\r\n ...fieldHierarchy,\r\n field: (function () {\r\n const clone = fieldHierarchy.field.clone();\r\n clone.type = {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: fieldHierarchy.field.type,\r\n };\r\n return clone;\r\n })(),\r\n };\r\n }\r\n\r\n traverseContentItemFieldValue(\r\n visitor,\r\n fieldHierarchy,\r\n item.mergedFieldNames,\r\n fieldHierarchy.field.type,\r\n parentFieldName,\r\n item.values[fieldHierarchy.field.name],\r\n item.displayValues[fieldHierarchy.field.name],\r\n );\r\n } finally {\r\n visitor.finishField();\r\n }\r\n}\r\n\r\nfunction traverseContentItemFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (rawValue !== undefined) {\r\n if (valueType.valueFormat === PropertyValueFormat.Array) {\r\n assert(PresentationValue.isArray(rawValue));\r\n assert(DisplayValue.isArray(displayValue));\r\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\r\n assert(PresentationValue.isMap(rawValue));\r\n assert(DisplayValue.isMap(displayValue));\r\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n }\r\n }\r\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\r\n}\r\n\r\nfunction traverseContentItemArrayFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesArray,\r\n displayValues: DisplayValuesArray,\r\n) {\r\n assert(rawValues.length === displayValues.length);\r\n assert(valueType.valueFormat === PropertyValueFormat.Array);\r\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\r\n return;\r\n }\r\n\r\n try {\r\n const itemType = valueType.memberType;\r\n rawValues.forEach((_, i) => {\r\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\r\n });\r\n } finally {\r\n visitor.finishArray();\r\n }\r\n}\r\n\r\nfunction traverseContentItemStructFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValues: ValuesMap,\r\n displayValues: DisplayValuesMap,\r\n) {\r\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\r\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\r\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\r\n return;\r\n }\r\n\r\n try {\r\n if (fieldHierarchy.field.isNestedContentField()) {\r\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\r\n }\r\n\r\n valueType.members.forEach((memberDescription) => {\r\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\r\n if (!memberField) {\r\n // Not finding a member field means we're traversing an ECStruct. If current field is `StructPropertiesField`\r\n // try looking up member field in there. Otherwise, just create fake field to propagate information.\r\n const structMemberField =\r\n fieldHierarchy.field.isPropertiesField() && fieldHierarchy.field.isStructPropertiesField()\r\n ? fieldHierarchy.field.memberFields.find((mf) => mf.name === memberDescription.name)\r\n : undefined;\r\n\r\n memberField = {\r\n field:\r\n structMemberField ??\r\n new Field({\r\n category: fieldHierarchy.field.category,\r\n name: memberDescription.name,\r\n label: memberDescription.label,\r\n type: memberDescription.type,\r\n isReadonly: fieldHierarchy.field.isReadonly,\r\n priority: 0,\r\n }),\r\n childFields: [],\r\n };\r\n }\r\n traverseContentItemFieldValue(\r\n visitor,\r\n memberField,\r\n mergedFieldNames,\r\n memberDescription.type,\r\n parentFieldName,\r\n rawValues[memberDescription.name],\r\n displayValues[memberDescription.name],\r\n );\r\n });\r\n } finally {\r\n visitor.finishStruct();\r\n }\r\n}\r\n\r\nfunction traverseContentItemPrimitiveFieldValue(\r\n visitor: IContentVisitor,\r\n fieldHierarchy: FieldHierarchy,\r\n mergedFieldNames: string[],\r\n valueType: TypeDescription,\r\n parentFieldName: string | undefined,\r\n rawValue: Value,\r\n displayValue: DisplayValue,\r\n) {\r\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\r\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\r\n return;\r\n }\r\n\r\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\r\n}\r\n\r\n/**\r\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\r\n *\r\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\r\n * without considering categories.\r\n *\r\n * @public\r\n */\r\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean) {\r\n const hierarchies = new Array<FieldHierarchy>();\r\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\r\n let childFields: FieldHierarchy[] = [];\r\n if (field.isNestedContentField()) {\r\n // visit all nested fields\r\n childFields = visitFields(field.nestedFields, field);\r\n if (0 === childFields.length) {\r\n return undefined;\r\n }\r\n }\r\n const fieldHierarchy = { field, childFields };\r\n if (category === parentField?.category || (ignoreCategories && parentField)) {\r\n // if categories of this field and its parent field match - return the field hierarchy without\r\n // including it as a top level field\r\n return fieldHierarchy;\r\n }\r\n addFieldHierarchy(hierarchies, fieldHierarchy);\r\n return undefined;\r\n };\r\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\r\n const includedFields: FieldHierarchy[] = [];\r\n visitedFields.forEach((field) => {\r\n const visitedField = visitField(field.category, field, parentField);\r\n if (visitedField) {\r\n includedFields.push(visitedField);\r\n }\r\n });\r\n return includedFields;\r\n };\r\n visitFields(fields, undefined);\r\n return hierarchies;\r\n}\r\n\r\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\r\n // build a list of parent fields in hierarchy\r\n const fields: Field[] = [];\r\n let currField: Field | undefined = hierarchy.field;\r\n while (currField) {\r\n fields.push(currField);\r\n currField = currField.parent;\r\n }\r\n\r\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\r\n const rootFieldHierarchy = rootFields[rootIndex];\r\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\r\n // only interested in fields with the same category\r\n continue;\r\n }\r\n\r\n let first = true;\r\n currField = rootFieldHierarchy.field;\r\n while (currField) {\r\n const index = fields.findIndex((f) => f.name === currField!.name);\r\n if (-1 !== index) {\r\n return {\r\n existing: {\r\n field: currField,\r\n hierarchy: first ? rootFieldHierarchy : undefined,\r\n index: rootIndex,\r\n },\r\n matchingField: fields[index],\r\n };\r\n }\r\n currField = currField.parent;\r\n first = false;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\r\n // note: parentField is found by walking up the parentship relationship\r\n // from hierarchy.field, so we expect to always find it here\r\n while (hierarchy.field !== parentField) {\r\n const hierarchyParent = hierarchy.field.parent;\r\n assert(hierarchyParent !== undefined);\r\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\r\n }\r\n return hierarchy;\r\n}\r\n\r\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\r\n assert(lhs.field.name === rhs.field.name);\r\n const result: FieldHierarchy = {\r\n field: lhs.field.clone(),\r\n childFields: [...lhs.childFields],\r\n };\r\n rhs.childFields.forEach((rhsChildHierarchy) => {\r\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\r\n if (indexInResult !== -1) {\r\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\r\n } else {\r\n result.childFields.push(rhsChildHierarchy);\r\n }\r\n });\r\n return result;\r\n}\r\n\r\n/**\r\n * Adds a field hierarchy into root field hierarchies list.\r\n * @public\r\n */\r\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\r\n const match = findRelatedFields(rootHierarchies, hierarchy);\r\n if (!match) {\r\n rootHierarchies.push(hierarchy);\r\n return;\r\n }\r\n\r\n const targetHierarchy = rootHierarchies[match.existing.index];\r\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\r\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\r\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\r\n mergedHierarchy.field.category = hierarchy.field.category;\r\n rootHierarchies[match.existing.index] = mergedHierarchy;\r\n}\r\n\r\nfunction createFieldPath(field: Field): Field[] {\r\n const path = [field];\r\n let currField = field;\r\n while (currField.parent) {\r\n currField = currField.parent;\r\n path.push(currField);\r\n }\r\n path.reverse();\r\n return path;\r\n}\r\n\r\n/** @internal */\r\nexport const FIELD_NAMES_SEPARATOR = \"$\";\r\n/**\r\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\r\n * @public\r\n */\r\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\r\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\r\n}\r\n/**\r\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\r\n * @public\r\n */\r\nexport function parseCombinedFieldNames(combinedName: string) {\r\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\r\n}\r\n\r\ninterface NestedItemConversionResult {\r\n emptyNestedItem: boolean;\r\n convertedItem: Item;\r\n}\r\n\r\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\r\n const value = item.values[field.name] ?? [];\r\n assert(PresentationValue.isNestedContent(value));\r\n if (value.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n let nextFieldValues: { raw: PresentationValuesArray | NestedContentValue[]; display: DisplayValuesArray } = { raw: [], display: [] };\r\n if (nextField.isNestedContentField()) {\r\n const nextNestedContent: NestedContentValue[] = [];\r\n value.forEach((ncv) => {\r\n const nextRawValue = ncv.values[nextField.name];\r\n if (nextRawValue) {\r\n assert(PresentationValue.isNestedContent(nextRawValue));\r\n nextNestedContent.push(...nextRawValue);\r\n }\r\n });\r\n nextFieldValues.raw = nextNestedContent;\r\n } else {\r\n const nextValues: { raw: PresentationValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\r\n value.forEach((ncv) => {\r\n nextValues.raw.push(ncv.values[nextField.name]);\r\n nextValues.display.push(ncv.displayValues[nextField.name]);\r\n });\r\n nextFieldValues = nextValues;\r\n }\r\n const convertedItem = new Item({\r\n ...item,\r\n values: { [nextField.name]: nextFieldValues.raw },\r\n displayValues: { [nextField.name]: nextFieldValues.display },\r\n });\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\r\n const fieldName = fieldHierarchy.field.name;\r\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\r\n if (child.field.isNestedContentField()) {\r\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\r\n }\r\n return child;\r\n });\r\n const convertedFieldHierarchy: FieldHierarchy = {\r\n field: (function () {\r\n const clone = fieldHierarchy.field.clone();\r\n clone.type = {\r\n valueFormat: PropertyValueFormat.Array,\r\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\r\n memberType: {\r\n valueFormat: PropertyValueFormat.Struct,\r\n typeName: fieldHierarchy.field.type.typeName,\r\n members: convertedChildFieldHierarchies.map((member) => ({\r\n name: member.field.name,\r\n label: member.field.label,\r\n type: member.field.type,\r\n })),\r\n },\r\n };\r\n return clone;\r\n })(),\r\n childFields: convertedChildFieldHierarchies,\r\n };\r\n return convertedFieldHierarchy;\r\n}\r\n\r\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\r\n const result: {\r\n raw: ValuesArray;\r\n display: DisplayValuesArray;\r\n mergedFieldNames: string[];\r\n } = { raw: [], display: [], mergedFieldNames: [] };\r\n\r\n ncvs.forEach((ncv) => {\r\n const values: ValuesMap = { ...ncv.values };\r\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\r\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.label ?? ncv.labelDefinition;\r\n\r\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\r\n const childFieldName = childFieldHierarchy.field.name;\r\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\r\n return;\r\n }\r\n if (childFieldHierarchy.field.isNestedContentField()) {\r\n const value = values[childFieldName];\r\n assert(PresentationValue.isNestedContent(value));\r\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\r\n values[childFieldName] = convertedValues.raw;\r\n displayValues[childFieldName] = convertedValues.display;\r\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\r\n }\r\n });\r\n result.raw.push(values);\r\n result.display.push(displayValues);\r\n result.mergedFieldNames.push(...mergedFieldNames);\r\n });\r\n return result;\r\n}\r\n\r\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\r\n const fieldName = fieldHierarchy.field.name;\r\n const rawValue = item.values[fieldName];\r\n assert(PresentationValue.isNestedContent(rawValue));\r\n if (rawValue.length === 0) {\r\n return { emptyNestedItem: true, convertedItem: item };\r\n }\r\n\r\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\r\n const convertedItem = new Item({\r\n ...item,\r\n values: { [fieldName]: converted.raw },\r\n displayValues: { [fieldName]: converted.display },\r\n mergedFieldNames: converted.mergedFieldNames,\r\n });\r\n return { emptyNestedItem: false, convertedItem };\r\n}\r\n"]}
1
+ {"version":3,"file":"ContentTraverser.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/ContentTraverser.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAsB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,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;QACjD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACnD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { LabelDefinition } from \"../LabelDefinition.js\";\nimport { CategoryDescription } from \"./Category.js\";\nimport { Content } from \"./Content.js\";\nimport { Descriptor } from \"./Descriptor.js\";\nimport { Field, NestedContentField } from \"./Fields.js\";\nimport { Item } from \"./Item.js\";\nimport { PropertyValueFormat, TypeDescription } from \"./TypeDescription.js\";\nimport {\n DisplayValue,\n DisplayValuesArray,\n DisplayValuesMap,\n NestedContentValue,\n Value as PresentationValue,\n ValuesArray as PresentationValuesArray,\n ValuesMap as PresentationValuesMap,\n} from \"./Value.js\";\n\nconst NESTED_CONTENT_LABEL_SYMBOL = Symbol();\n\ntype ValuesMap = PresentationValuesMap & {\n [NESTED_CONTENT_LABEL_SYMBOL]?: LabelDefinition;\n};\n\ntype Value = Exclude<PresentationValue, PresentationValuesMap> | ValuesMap;\n\ntype ValuesArray = Array<Value>;\n\n/**\n * A data structure to define a hierarchy of [[Field]] objects.\n * @public\n */\nexport interface FieldHierarchy {\n /** Parent field. */\n field: Field;\n /** Nested fields. */\n childFields: FieldHierarchy[];\n}\n\n/**\n * Props for the [[IContentVisitor.startContent]] call.\n * @public\n */\nexport interface StartContentProps {\n /** Descriptor of the visited content. */\n descriptor: Descriptor;\n}\n\n/**\n * Props for the [[IContentVisitor.processFieldHierarchies]] call.\n * @public\n */\nexport interface ProcessFieldHierarchiesProps {\n /**\n * The root list of fields, which may be mutated by the visitor to change order or the fields,\n * add new fields, etc.\n */\n hierarchies: FieldHierarchy[];\n}\n\n/**\n * Props for the [[IContentVisitor.startItem]] call.\n * @public\n */\nexport interface StartItemProps {\n /** The content item that's about to be visited. */\n item: Item;\n}\n\n/**\n * Props for the [[IContentVisitor.startCategory]] call.\n * @public\n */\nexport interface StartCategoryProps {\n /** The content category that's about to be visited. */\n category: CategoryDescription;\n}\n\n/**\n * Props for the [[IContentVisitor.startField]] call.\n * @public\n */\nexport interface StartFieldProps {\n /** The field that's about to be visited. */\n hierarchy: FieldHierarchy;\n}\n\n/**\n * Props for the [[IContentVisitor.startStruct]] call.\n * @public\n */\nexport interface StartStructProps {\n /** Field that describes the struct. */\n hierarchy: FieldHierarchy;\n /** Type of the struct. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Member raw values. */\n rawValues: PresentationValuesMap;\n /** Member display values. */\n displayValues: DisplayValuesMap;\n /** Label definition of the ECInstance that the struct represents. */\n label?: LabelDefinition;\n}\n\n/**\n * Props for the [[IContentVisitor.startArray]] call.\n * @public\n */\nexport interface StartArrayProps {\n /** Field that describes the array. */\n hierarchy: FieldHierarchy;\n /** Type of the array. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Item raw values. */\n rawValues: PresentationValuesArray;\n /** Item display values. */\n displayValues: DisplayValuesArray;\n}\n\n/**\n * Props for the [[IContentVisitor.processMergedValue]] call.\n * @public\n */\nexport interface ProcessMergedValueProps {\n /** The field whose values are merged. */\n mergedField: Field;\n /**\n * Generally this matches the [[mergedField]], but there are situations when a nested field is propagated\n * up to display it as if it wasn't nested its parent fields. In those cases, if one of the parent fields\n * is merged, the merged parent is going to be represented by [[mergedField]] and the field we wanted to\n * process is going to be represented by [[requestedField]].\n */\n requestedField: Field;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n}\n\n/**\n * Props for the [[IContentVisitor.processPrimitiveValue]] call.\n * @public\n */\nexport interface ProcessPrimitiveValueProps {\n /** Field whose value is being processed. */\n field: Field;\n /** Type of the value. */\n valueType: TypeDescription;\n /** Name of the parent field (if there is one). */\n parentFieldName?: string;\n /** Raw value. */\n rawValue: PresentationValue;\n /** Display value. */\n displayValue: DisplayValue;\n}\n\n/**\n * An interface for a visitor that can be passed to the [[traverseContent]] function\n * to be called on each piece of content.\n *\n * The order of calls when using the visitor with [[traverseContent]] or [[traverseContentItem]]:\n *\n * ```\n * startContent\n * processFieldHierarchies\n * for each content item:\n * startItem\n * for each field in root level:\n * for each category in field's category stack from root to field's category:\n * startCategory\n * startField\n * valueProcessing:\n * if item's value for this field is merged:\n * processMergedValue\n * else if the field is struct:\n * startStruct\n * for each struct member:\n * recurse into the valueProcessing step\n * finishStruct\n * else if the field is array:\n * startArray\n * for each array item:\n * recurse into the valueProcessing step\n * finishArray\n * else if the field is primitive:\n * processPrimitiveValue\n * finishField\n * finishItem\n * finishContent\n * ```\n * @public\n */\nexport interface IContentVisitor {\n /**\n * Called before starting [[Content]] processing. This is a good place to initialize various caches and prepare\n * for parsing content.\n *\n * Processing is skipped if the function returns `false` and [[finishContent]] is not called in that case.\n */\n startContent(props: StartContentProps): boolean;\n /** Called after processing of [[Content]] is complete. */\n finishContent(): void;\n\n /** Called to post-process field hierarchies after they're extracted from [[Descriptor]] in processed [[Content]]. */\n processFieldHierarchies(props: ProcessFieldHierarchiesProps): void;\n\n /**\n * Called before starting each [[Item]] processing. This is a good place to initialize for a new content item, e.g.\n * set up a new row in table.\n *\n * Processing is skipped if the function returns `false` and [[finishItem]] is not called in that case.\n */\n startItem(props: StartItemProps): boolean;\n /**\n * Called after processing of [[Item]] is complete. May be used to do any kind of post-processing after all\n * values for one content item have been processed.\n */\n finishItem(): void;\n\n /**\n * Called before processing a content item field ([[startField]] call) for each category in the field's\n * category stack, starting from the root and finishing with the field's category.\n *\n * Processing is skipped if the function returns `false` and [[finishCategory]] is not called in that case.\n */\n startCategory(props: StartCategoryProps): boolean;\n /** Called after processing of field is complete for every category in the field's category stack. */\n finishCategory(): void;\n\n /**\n * Called before starting [[Field]] processing for each individual [[Item]]. This is a good callback\n * to skip a field if it doesn't need to be handled.\n *\n * Processing is skipped if the function returns `false` and [[finishField]] is not called in that case.\n */\n startField(props: StartFieldProps): boolean;\n /** Called after processing of [[Field]] for individual [[Item]] is complete. */\n finishField(): void;\n\n /**\n * Called before processing a struct value. This is a good callback to skip handling the value or set up\n * for struct member values handling.\n *\n * Processing is skipped if the function returns `false` and [[finishStruct]] is not called in that case.\n */\n startStruct(props: StartStructProps): boolean;\n /** Called after processing of struct value is complete. */\n finishStruct(): void;\n\n /**\n * Called before processing an array value. This is a good callback to skip handling the value or set up\n * for array items handling.\n *\n * Processing is skipped if the function returns `false` and [[finishArray]] is not called in that case.\n */\n startArray(props: StartArrayProps): boolean;\n /** Called after processing of array value is complete. */\n finishArray(): void;\n\n /** Called to process a [merged value]($docs/presentation/content/Terminology.md#value-merging). */\n processMergedValue(props: ProcessMergedValueProps): void;\n /** Called to process a primitive value. */\n processPrimitiveValue(props: ProcessPrimitiveValueProps): void;\n}\n\n/**\n * An utility for traversing field hierarchy. Stops traversal as soon as `cb` returns `false`.\n * @public\n */\nexport function traverseFieldHierarchy(hierarchy: FieldHierarchy, cb: (h: FieldHierarchy) => boolean) {\n if (cb(hierarchy)) {\n hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));\n }\n}\n\n/**\n * An utility to traverse content using provided visitor. Provides means to parse content into different formats,\n * for different components.\n * @public\n */\nexport function traverseContent(visitor: IContentVisitor, content: Content) {\n if (!visitor.startContent({ descriptor: content.descriptor })) {\n return;\n }\n\n try {\n const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);\n visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });\n content.contentSet.forEach((item) => {\n traverseContentItemFields(visitor, fieldHierarchies, item);\n });\n } finally {\n visitor.finishContent();\n }\n}\n\n/**\n * An utility for calling [[traverseContent]] when there's only one content item.\n * @public\n */\nexport function traverseContentItem(visitor: IContentVisitor, descriptor: Descriptor, item: Item) {\n traverseContent(visitor, new Content(descriptor, [item]));\n}\n\nclass VisitedCategories implements Disposable {\n private _visitedCategories: CategoryDescription[];\n private _didVisitAllHierarchy: boolean;\n constructor(\n private _visitor: IContentVisitor,\n category: CategoryDescription,\n ) {\n const stack: CategoryDescription[] = [];\n let curr: CategoryDescription | undefined = category;\n while (curr) {\n stack.push(curr);\n curr = curr.parent;\n }\n stack.reverse();\n\n this._didVisitAllHierarchy = true;\n this._visitedCategories = [];\n for (curr of stack) {\n if (this._visitor.startCategory({ category: curr })) {\n this._visitedCategories.push(curr);\n } else {\n this._didVisitAllHierarchy = false;\n break;\n }\n }\n }\n public [Symbol.dispose]() {\n while (this._visitedCategories.pop()) {\n this._visitor.finishCategory();\n }\n }\n public get shouldContinue(): boolean {\n return this._didVisitAllHierarchy;\n }\n}\n\nfunction traverseContentItemFields(visitor: IContentVisitor, fieldHierarchies: FieldHierarchy[], item: Item) {\n if (!visitor.startItem({ item })) {\n return;\n }\n\n try {\n fieldHierarchies.forEach((fieldHierarchy) => {\n using res = new VisitedCategories(visitor, fieldHierarchy.field.category);\n if (res.shouldContinue) {\n traverseContentItemField(visitor, fieldHierarchy, item);\n }\n });\n } finally {\n visitor.finishItem();\n }\n}\n\nfunction traverseContentItemField(visitor: IContentVisitor, fieldHierarchy: FieldHierarchy, item: Item) {\n if (!visitor.startField({ hierarchy: fieldHierarchy })) {\n return;\n }\n\n try {\n const rootToThisField = createFieldPath(fieldHierarchy.field);\n let parentFieldName: string | undefined;\n const pathUpToField = rootToThisField.slice(undefined, -1);\n for (let i = 0; i < pathUpToField.length; ++i) {\n const parentField = pathUpToField[i] as NestedContentField;\n const nextField = rootToThisField[i + 1];\n\n if (item.isFieldMerged(parentField.name)) {\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: parentField, parentFieldName });\n return;\n }\n\n const { emptyNestedItem, convertedItem } = convertNestedContentItemToStructArrayItem(item, parentField, nextField);\n if (emptyNestedItem) {\n return;\n }\n\n item = convertedItem;\n parentFieldName = combineFieldNames(parentField.name, parentFieldName);\n }\n\n if (item.isFieldMerged(fieldHierarchy.field.name)) {\n visitor.processMergedValue({ requestedField: fieldHierarchy.field, mergedField: fieldHierarchy.field, parentFieldName });\n return;\n }\n\n if (fieldHierarchy.field.isNestedContentField()) {\n fieldHierarchy = convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy, parentFieldName);\n const { emptyNestedItem, convertedItem } = convertNestedContentFieldHierarchyItemToStructArrayItem(item, fieldHierarchy);\n if (emptyNestedItem) {\n return;\n }\n item = convertedItem;\n } else if (pathUpToField.length > 0) {\n fieldHierarchy = {\n ...fieldHierarchy,\n field: (function () {\n const clone = fieldHierarchy.field.clone();\n clone.type = {\n valueFormat: PropertyValueFormat.Array,\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\n memberType: fieldHierarchy.field.type,\n };\n return clone;\n })(),\n };\n }\n\n traverseContentItemFieldValue(\n visitor,\n fieldHierarchy,\n item.mergedFieldNames,\n fieldHierarchy.field.type,\n parentFieldName,\n item.values[fieldHierarchy.field.name],\n item.displayValues[fieldHierarchy.field.name],\n );\n } finally {\n visitor.finishField();\n }\n}\n\nfunction traverseContentItemFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValue: Value,\n displayValue: DisplayValue,\n) {\n if (rawValue !== undefined) {\n if (valueType.valueFormat === PropertyValueFormat.Array) {\n assert(PresentationValue.isArray(rawValue));\n assert(DisplayValue.isArray(displayValue));\n return traverseContentItemArrayFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n }\n if (valueType.valueFormat === PropertyValueFormat.Struct) {\n assert(PresentationValue.isMap(rawValue));\n assert(DisplayValue.isMap(displayValue));\n return traverseContentItemStructFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n }\n }\n traverseContentItemPrimitiveFieldValue(visitor, fieldHierarchy, mergedFieldNames, valueType, parentFieldName, rawValue, displayValue);\n}\n\nfunction traverseContentItemArrayFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValues: ValuesArray,\n displayValues: DisplayValuesArray,\n) {\n assert(rawValues.length === displayValues.length);\n assert(valueType.valueFormat === PropertyValueFormat.Array);\n if (!visitor.startArray({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues })) {\n return;\n }\n\n try {\n const itemType = valueType.memberType;\n rawValues.forEach((_, i) => {\n traverseContentItemFieldValue(visitor, fieldHierarchy, mergedFieldNames, itemType, parentFieldName, rawValues[i], displayValues[i]);\n });\n } finally {\n visitor.finishArray();\n }\n}\n\nfunction traverseContentItemStructFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValues: ValuesMap,\n displayValues: DisplayValuesMap,\n) {\n assert(valueType.valueFormat === PropertyValueFormat.Struct);\n const label = rawValues[NESTED_CONTENT_LABEL_SYMBOL];\n if (!visitor.startStruct({ hierarchy: fieldHierarchy, valueType, parentFieldName, rawValues, displayValues, label })) {\n return;\n }\n\n try {\n if (fieldHierarchy.field.isNestedContentField()) {\n parentFieldName = combineFieldNames(fieldHierarchy.field.name, parentFieldName);\n }\n\n valueType.members.forEach((memberDescription) => {\n let memberField = fieldHierarchy.childFields.find((f) => f.field.name === memberDescription.name);\n if (!memberField) {\n // Not finding a member field means we're traversing an ECStruct. If current field is `StructPropertiesField`\n // try looking up member field in there. Otherwise, just create fake field to propagate information.\n const structMemberField =\n fieldHierarchy.field.isPropertiesField() && fieldHierarchy.field.isStructPropertiesField()\n ? fieldHierarchy.field.memberFields.find((mf) => mf.name === memberDescription.name)\n : undefined;\n\n memberField = {\n field:\n structMemberField ??\n new Field({\n category: fieldHierarchy.field.category,\n name: memberDescription.name,\n label: memberDescription.label,\n type: memberDescription.type,\n isReadonly: fieldHierarchy.field.isReadonly,\n priority: 0,\n }),\n childFields: [],\n };\n }\n traverseContentItemFieldValue(\n visitor,\n memberField,\n mergedFieldNames,\n memberDescription.type,\n parentFieldName,\n rawValues[memberDescription.name],\n displayValues[memberDescription.name],\n );\n });\n } finally {\n visitor.finishStruct();\n }\n}\n\nfunction traverseContentItemPrimitiveFieldValue(\n visitor: IContentVisitor,\n fieldHierarchy: FieldHierarchy,\n mergedFieldNames: string[],\n valueType: TypeDescription,\n parentFieldName: string | undefined,\n rawValue: Value,\n displayValue: DisplayValue,\n) {\n if (-1 !== mergedFieldNames.indexOf(fieldHierarchy.field.name)) {\n visitor.processMergedValue({ mergedField: fieldHierarchy.field, requestedField: fieldHierarchy.field, parentFieldName });\n return;\n }\n\n visitor.processPrimitiveValue({ field: fieldHierarchy.field, valueType, parentFieldName, rawValue, displayValue });\n}\n\n/**\n * Parses a list of [[Field]] objects into a list of [[FieldHierarchy]].\n *\n * @param ignoreCategories Enables adding all of the `nestedFields` to parent field's `childFields`\n * without considering categories.\n *\n * @public\n */\nexport function createFieldHierarchies(fields: Field[], ignoreCategories?: boolean) {\n const hierarchies = new Array<FieldHierarchy>();\n const visitField = (category: CategoryDescription, field: Field, parentField: Field | undefined): FieldHierarchy | undefined => {\n let childFields: FieldHierarchy[] = [];\n if (field.isNestedContentField()) {\n // visit all nested fields\n childFields = visitFields(field.nestedFields, field);\n if (0 === childFields.length) {\n return undefined;\n }\n }\n const fieldHierarchy = { field, childFields };\n if (category === parentField?.category || (ignoreCategories && parentField)) {\n // if categories of this field and its parent field match - return the field hierarchy without\n // including it as a top level field\n return fieldHierarchy;\n }\n addFieldHierarchy(hierarchies, fieldHierarchy);\n return undefined;\n };\n const visitFields = (visitedFields: Field[], parentField: NestedContentField | undefined) => {\n const includedFields: FieldHierarchy[] = [];\n visitedFields.forEach((field) => {\n const visitedField = visitField(field.category, field, parentField);\n if (visitedField) {\n includedFields.push(visitedField);\n }\n });\n return includedFields;\n };\n visitFields(fields, undefined);\n return hierarchies;\n}\n\nfunction findRelatedFields(rootFields: FieldHierarchy[], hierarchy: FieldHierarchy) {\n // build a list of parent fields in hierarchy\n const fields: Field[] = [];\n let currField: Field | undefined = hierarchy.field;\n while (currField) {\n fields.push(currField);\n currField = currField.parent;\n }\n\n for (let rootIndex = 0; rootIndex < rootFields.length; ++rootIndex) {\n const rootFieldHierarchy = rootFields[rootIndex];\n if (rootFieldHierarchy.field.category !== hierarchy.field.category) {\n // only interested in fields with the same category\n continue;\n }\n\n let first = true;\n currField = rootFieldHierarchy.field;\n while (currField) {\n const index = fields.findIndex((f) => f.name === currField!.name);\n if (-1 !== index) {\n return {\n existing: {\n field: currField,\n hierarchy: first ? rootFieldHierarchy : undefined,\n index: rootIndex,\n },\n matchingField: fields[index],\n };\n }\n currField = currField.parent;\n first = false;\n }\n }\n\n return undefined;\n}\n\nfunction buildParentHierarchy(hierarchy: FieldHierarchy, parentField: Field) {\n // note: parentField is found by walking up the parentship relationship\n // from hierarchy.field, so we expect to always find it here\n while (hierarchy.field !== parentField) {\n const hierarchyParent = hierarchy.field.parent;\n assert(hierarchyParent !== undefined);\n hierarchy = { field: hierarchyParent, childFields: [hierarchy] };\n }\n return hierarchy;\n}\n\nfunction mergeHierarchies(lhs: FieldHierarchy, rhs: FieldHierarchy) {\n assert(lhs.field.name === rhs.field.name);\n const result: FieldHierarchy = {\n field: lhs.field.clone(),\n childFields: [...lhs.childFields],\n };\n rhs.childFields.forEach((rhsChildHierarchy) => {\n const indexInResult = result.childFields.findIndex((resultHierarchy) => resultHierarchy.field.name === rhsChildHierarchy.field.name);\n if (indexInResult !== -1) {\n result.childFields[indexInResult] = mergeHierarchies(result.childFields[indexInResult], rhsChildHierarchy);\n } else {\n result.childFields.push(rhsChildHierarchy);\n }\n });\n return result;\n}\n\n/**\n * Adds a field hierarchy into root field hierarchies list.\n * @public\n */\nexport function addFieldHierarchy(rootHierarchies: FieldHierarchy[], hierarchy: FieldHierarchy): void {\n const match = findRelatedFields(rootHierarchies, hierarchy);\n if (!match) {\n rootHierarchies.push(hierarchy);\n return;\n }\n\n const targetHierarchy = rootHierarchies[match.existing.index];\n const existingHierarchy = match.existing.hierarchy ?? buildParentHierarchy(targetHierarchy, match.existing.field);\n const insertHierarchy = buildParentHierarchy(hierarchy, match.matchingField);\n const mergedHierarchy = mergeHierarchies(existingHierarchy, insertHierarchy);\n mergedHierarchy.field.category = hierarchy.field.category;\n rootHierarchies[match.existing.index] = mergedHierarchy;\n}\n\nfunction createFieldPath(field: Field): Field[] {\n const path = [field];\n let currField = field;\n while (currField.parent) {\n currField = currField.parent;\n path.push(currField);\n }\n path.reverse();\n return path;\n}\n\n/** @internal */\nexport const FIELD_NAMES_SEPARATOR = \"$\";\n/**\n * Combines given field names in a way that allows them to be parsed back into a list of individual names using the [[parseCombinedFieldNames]] function.\n * @public\n */\nexport function combineFieldNames(fieldName: string, parentFieldName?: string) {\n return parentFieldName ? `${parentFieldName}${FIELD_NAMES_SEPARATOR}${fieldName}` : fieldName;\n}\n/**\n * Parses given combined field names string, constructed using [[combineFieldNames]], into a list of individual field names.\n * @public\n */\nexport function parseCombinedFieldNames(combinedName: string) {\n return combinedName ? combinedName.split(FIELD_NAMES_SEPARATOR) : [];\n}\n\ninterface NestedItemConversionResult {\n emptyNestedItem: boolean;\n convertedItem: Item;\n}\n\nfunction convertNestedContentItemToStructArrayItem(item: Readonly<Item>, field: Field, nextField: Field): NestedItemConversionResult {\n const value = item.values[field.name] ?? [];\n assert(PresentationValue.isNestedContent(value));\n if (value.length === 0) {\n return { emptyNestedItem: true, convertedItem: item };\n }\n\n let nextFieldValues: { raw: PresentationValuesArray | NestedContentValue[]; display: DisplayValuesArray } = { raw: [], display: [] };\n if (nextField.isNestedContentField()) {\n const nextNestedContent: NestedContentValue[] = [];\n value.forEach((ncv) => {\n const nextRawValue = ncv.values[nextField.name];\n if (nextRawValue) {\n assert(PresentationValue.isNestedContent(nextRawValue));\n nextNestedContent.push(...nextRawValue);\n }\n });\n nextFieldValues.raw = nextNestedContent;\n } else {\n const nextValues: { raw: PresentationValuesArray; display: DisplayValuesArray } = { raw: [], display: [] };\n value.forEach((ncv) => {\n nextValues.raw.push(ncv.values[nextField.name]);\n nextValues.display.push(ncv.displayValues[nextField.name]);\n });\n nextFieldValues = nextValues;\n }\n const convertedItem = new Item({\n ...item,\n values: { [nextField.name]: nextFieldValues.raw },\n displayValues: { [nextField.name]: nextFieldValues.display },\n });\n return { emptyNestedItem: false, convertedItem };\n}\n\nfunction convertNestedContentFieldHierarchyToStructArrayHierarchy(fieldHierarchy: FieldHierarchy, parentFieldName: string | undefined) {\n const fieldName = fieldHierarchy.field.name;\n const convertedChildFieldHierarchies = fieldHierarchy.childFields.map((child) => {\n if (child.field.isNestedContentField()) {\n return convertNestedContentFieldHierarchyToStructArrayHierarchy(child, combineFieldNames(fieldName, parentFieldName));\n }\n return child;\n });\n const convertedFieldHierarchy: FieldHierarchy = {\n field: (function () {\n const clone = fieldHierarchy.field.clone();\n clone.type = {\n valueFormat: PropertyValueFormat.Array,\n typeName: `${fieldHierarchy.field.type.typeName}[]`,\n memberType: {\n valueFormat: PropertyValueFormat.Struct,\n typeName: fieldHierarchy.field.type.typeName,\n members: convertedChildFieldHierarchies.map((member) => ({\n name: member.field.name,\n label: member.field.label,\n type: member.field.type,\n })),\n },\n };\n return clone;\n })(),\n childFields: convertedChildFieldHierarchies,\n };\n return convertedFieldHierarchy;\n}\n\nfunction convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy: FieldHierarchy, ncvs: ReadonlyArray<NestedContentValue>) {\n const result: {\n raw: ValuesArray;\n display: DisplayValuesArray;\n mergedFieldNames: string[];\n } = { raw: [], display: [], mergedFieldNames: [] };\n\n ncvs.forEach((ncv) => {\n const values: ValuesMap = { ...ncv.values };\n const displayValues: DisplayValuesMap = { ...ncv.displayValues };\n const mergedFieldNames: string[] = [...ncv.mergedFieldNames];\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n values[NESTED_CONTENT_LABEL_SYMBOL] = ncv.label ?? ncv.labelDefinition;\n\n fieldHierarchy.childFields.forEach((childFieldHierarchy) => {\n const childFieldName = childFieldHierarchy.field.name;\n if (-1 !== ncv.mergedFieldNames.indexOf(childFieldName)) {\n return;\n }\n if (childFieldHierarchy.field.isNestedContentField()) {\n const value = values[childFieldName];\n assert(PresentationValue.isNestedContent(value));\n const convertedValues = convertNestedContentValuesToStructArrayValuesRecursive(childFieldHierarchy, value);\n values[childFieldName] = convertedValues.raw;\n displayValues[childFieldName] = convertedValues.display;\n mergedFieldNames.push(...convertedValues.mergedFieldNames);\n }\n });\n result.raw.push(values);\n result.display.push(displayValues);\n result.mergedFieldNames.push(...mergedFieldNames);\n });\n return result;\n}\n\nfunction convertNestedContentFieldHierarchyItemToStructArrayItem(item: Readonly<Item>, fieldHierarchy: FieldHierarchy): NestedItemConversionResult {\n const fieldName = fieldHierarchy.field.name;\n const rawValue = item.values[fieldName];\n assert(PresentationValue.isNestedContent(rawValue));\n if (rawValue.length === 0) {\n return { emptyNestedItem: true, convertedItem: item };\n }\n\n const converted = convertNestedContentValuesToStructArrayValuesRecursive(fieldHierarchy, rawValue);\n const convertedItem = new Item({\n ...item,\n values: { [fieldName]: converted.raw },\n displayValues: { [fieldName]: converted.display },\n mergedFieldNames: converted.mergedFieldNames,\n });\n return { emptyNestedItem: false, convertedItem };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Descriptor.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Descriptor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,gBAAgB,EAEhB,wCAAwC,GAIzC,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBA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oBAAoB,CAAC,eAAgC,EAAE,OAAiB;QAC7E,OAAO,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,yBAAyB;QAC9B,MAAM,SAAS,GAAwB,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;YAC5B,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,CAAC;QACD,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAChC,SAAS,CAAC,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACjE,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAClI,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","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 Content\r\n */\r\n\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n ClassInfo,\r\n CompressedClassInfoJSON,\r\n RelatedClassInfo,\r\n RelatedClassInfoJSON,\r\n RelatedClassInfoWithOptionalRelationship,\r\n RelatedClassInfoWithOptionalRelationshipJSON,\r\n RelationshipPath,\r\n RelationshipPathJSON,\r\n} from \"../EC.js\";\r\nimport { InstanceFilterDefinition } from \"../InstanceFilterDefinition.js\";\r\nimport { Ruleset } from \"../rules/Ruleset.js\";\r\nimport { omitUndefined } from \"../Utils.js\";\r\nimport { CategoryDescription, CategoryDescriptionJSON } from \"./Category.js\";\r\nimport { Field, FieldDescriptor, FieldJSON, getFieldByDescriptor, getFieldByName } from \"./Fields.js\";\r\n\r\n/**\r\n * Data structure that describes an ECClass in content [[Descriptor]].\r\n * @public\r\n */\r\nexport interface SelectClassInfo {\r\n /** Information about the ECClass */\r\n selectClassInfo: ClassInfo;\r\n\r\n /** Is the class handled polymorphically */\r\n isSelectPolymorphic: boolean;\r\n\r\n /** Relationship path from input class to the select class. */\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationship[];\r\n\r\n /** Relationship paths to [related property]($docs/presentation/content/Terminology#related-properties) classes */\r\n relatedPropertyPaths?: RelationshipPath[];\r\n\r\n /** Relationship paths to navigation property classes */\r\n navigationPropertyClasses?: RelatedClassInfo[];\r\n\r\n /** Relationship paths to [related instance]($docs/presentation/content/Terminology#related-instance) classes. */\r\n relatedInstancePaths?: RelationshipPath[];\r\n}\r\n\r\n/**\r\n * Serialized [[SelectClassInfo]] JSON representation\r\n * @public\r\n */\r\nexport interface SelectClassInfoJSON<TClassInfoJSON = ClassInfo> {\r\n selectClassInfo: TClassInfoJSON;\r\n isSelectPolymorphic: boolean;\r\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationshipJSON<TClassInfoJSON>[];\r\n relatedPropertyPaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n navigationPropertyClasses?: RelatedClassInfoJSON<TClassInfoJSON>[];\r\n relatedInstancePaths?: RelationshipPathJSON<TClassInfoJSON>[];\r\n}\r\n\r\n/** @public */\r\nexport namespace SelectClassInfo {\r\n /** Deserialize [[SelectClassInfo]] from compressed JSON */\r\n export function fromCompressedJSON(json: SelectClassInfoJSON<string>, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo {\r\n assert(classesMap.hasOwnProperty(json.selectClassInfo));\r\n return {\r\n selectClassInfo: { id: json.selectClassInfo, ...classesMap[json.selectClassInfo] },\r\n isSelectPolymorphic: json.isSelectPolymorphic,\r\n ...(json.navigationPropertyClasses\r\n ? { navigationPropertyClasses: json.navigationPropertyClasses.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap)) }\r\n : undefined),\r\n ...(json.relatedInstancePaths\r\n ? { relatedInstancePaths: json.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(json.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: json.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.fromCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(json.relatedPropertyPaths\r\n ? { relatedPropertyPaths: json.relatedPropertyPaths.map((path) => path.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n };\r\n }\r\n\r\n /** Serialize [[SelectClassInfo]] to compressed JSON */\r\n export function toCompressedJSON(selectClass: SelectClassInfo, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfoJSON<string> {\r\n const { id, ...leftOverClassInfo } = selectClass.selectClassInfo;\r\n classesMap[id] = leftOverClassInfo;\r\n return {\r\n selectClassInfo: id,\r\n isSelectPolymorphic: selectClass.isSelectPolymorphic,\r\n ...(selectClass.relatedInstancePaths\r\n ? { relatedInstancePaths: selectClass.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.toCompressedJSON(item, classesMap))) }\r\n : undefined),\r\n ...(selectClass.navigationPropertyClasses\r\n ? {\r\n navigationPropertyClasses: selectClass.navigationPropertyClasses.map((propertyClass) =>\r\n RelatedClassInfo.toCompressedJSON(propertyClass, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.pathFromInputToSelectClass\r\n ? {\r\n pathFromInputToSelectClass: selectClass.pathFromInputToSelectClass.map((item) =>\r\n RelatedClassInfoWithOptionalRelationship.toCompressedJSON(item, classesMap),\r\n ),\r\n }\r\n : undefined),\r\n ...(selectClass.relatedPropertyPaths\r\n ? {\r\n relatedPropertyPaths: selectClass.relatedPropertyPaths.map((path) =>\r\n path.map((relatedClass) => RelatedClassInfo.toCompressedJSON(relatedClass, classesMap)),\r\n ),\r\n }\r\n : undefined),\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Flags that control content format.\r\n * @public\r\n */\r\nexport enum ContentFlags {\r\n /** Each content record only has [[InstanceKey]] and no data */\r\n KeysOnly = 1 << 0,\r\n\r\n /** Each content record additionally has a display label */\r\n ShowLabels = 1 << 2,\r\n\r\n /** All content records are merged into a single record (see [Merging values]($docs/presentation/content/terminology#value-merging)) */\r\n MergeResults = 1 << 3,\r\n\r\n /** Content has only distinct values */\r\n DistinctValues = 1 << 4,\r\n\r\n /** Doesn't create property or calculated fields. Can be used in conjunction with [[ShowLabels]]. */\r\n NoFields = 1 << 5,\r\n\r\n /**\r\n * Set related input keys on [[Item]] objects when creating content. This helps identify which [[Item]] is associated to which\r\n * given input key at the cost of performance creating those items.\r\n */\r\n IncludeInputKeys = 1 << 8,\r\n}\r\n\r\n/**\r\n * Data sorting direction\r\n * @public\r\n */\r\nexport enum SortDirection {\r\n Ascending,\r\n Descending,\r\n}\r\n\r\n/**\r\n * Data structure that contains selection information. Used\r\n * for cases when requesting content after a selection change.\r\n *\r\n * @public\r\n */\r\nexport interface SelectionInfo {\r\n /** Name of selection provider which cause the selection change */\r\n providerName: string;\r\n /** Level of selection that changed */\r\n level?: number;\r\n}\r\n\r\n/**\r\n * Serialized [[Descriptor]] JSON representation.\r\n * @public\r\n */\r\nexport interface DescriptorJSON {\r\n classesMap: { [id: string]: CompressedClassInfoJSON };\r\n connectionId: string;\r\n inputKeysHash: string;\r\n selectionInfo?: SelectionInfo;\r\n displayType: string;\r\n selectClasses: SelectClassInfoJSON<Id64String>[];\r\n categories: CategoryDescriptionJSON[];\r\n fields: FieldJSON<Id64String>[];\r\n sortingFieldName?: string;\r\n sortDirection?: SortDirection;\r\n contentFlags: number;\r\n fieldsFilterExpression?: string;\r\n instanceFilter?: InstanceFilterDefinition;\r\n ruleset?: Ruleset;\r\n}\r\n\r\n/**\r\n * Descriptor overrides that can be used to customize content\r\n * @public\r\n */\r\nexport interface DescriptorOverrides {\r\n /**\r\n * Content display type. Can be accessed in presentation rules and used\r\n * to modify content in various ways. Defaults to empty string.\r\n */\r\n displayType?: string;\r\n\r\n /** Content flags used for content customization. See [[ContentFlags]] */\r\n contentFlags?: number;\r\n\r\n /** Fields selector that allows excluding or including only specified fields. */\r\n fieldsSelector?: {\r\n /** Should the specified fields be included or excluded */\r\n type: \"include\" | \"exclude\";\r\n /** A list of field descriptors that identify fields to include / exclude */\r\n fields: FieldDescriptor[];\r\n };\r\n\r\n /** Specification for sorting data. */\r\n sorting?: {\r\n /** Identifier of the field to use for sorting */\r\n field: FieldDescriptor;\r\n /** Sort direction */\r\n direction: SortDirection;\r\n };\r\n\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Descriptor properties\r\n * @public\r\n */\r\nexport interface DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n readonly inputKeysHash?: string;\r\n /** Selection info used to create the descriptor */\r\n readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n readonly displayType: string;\r\n /** A list of classes that will be selected from when creating content with this descriptor */\r\n readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n readonly contentFlags: number;\r\n /** Field used to sort the content */\r\n readonly sortingField?: Field;\r\n /** Sorting direction */\r\n readonly sortDirection?: SortDirection;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n readonly ruleset?: Ruleset;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n instanceFilter?: InstanceFilterDefinition;\r\n}\r\n\r\n/**\r\n * Data structure that describes content: fields, sorting, filtering, format, etc.\r\n * Descriptor may be changed to control how content is created.\r\n *\r\n * @public\r\n */\r\nexport class Descriptor implements DescriptorSource {\r\n /** Id of the connection used to create the descriptor */\r\n public readonly connectionId?: string;\r\n /** Hash of the input keys used to create the descriptor */\r\n public readonly inputKeysHash?: string;\r\n /** Selection info used to create the descriptor */\r\n public readonly selectionInfo?: SelectionInfo;\r\n /** Display type used to create the descriptor */\r\n public readonly displayType: string;\r\n /** A list of classes that will be selected when creating content with this descriptor */\r\n public readonly selectClasses: SelectClassInfo[];\r\n /** A list of content field categories used in this descriptor */\r\n public readonly categories: CategoryDescription[];\r\n /** A list of fields contained in the descriptor */\r\n public readonly fields: Field[];\r\n /** [[ContentFlags]] used to create the descriptor */\r\n public readonly contentFlags: number;\r\n /**\r\n * A ruleset used to create this descriptor.\r\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\r\n */\r\n public readonly ruleset?: Ruleset;\r\n /** Field used to sort the content */\r\n public sortingField?: Field;\r\n /** Sorting direction */\r\n public sortDirection?: SortDirection;\r\n /**\r\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\r\n * select fields.\r\n *\r\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\r\n * which removes access to content instance property values. Instead of referencing properties\r\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\r\n * when properties field merges multiple properties, this allows applying the filter on all of them\r\n * at once. This is useful for filtering table rows by column value, when content is displayed in\r\n * table format.\r\n */\r\n public fieldsFilterExpression?: string;\r\n /**\r\n * Instances filter that allows filtering content by class, properties of specific class\r\n * or properties of instances related to the content instance.\r\n *\r\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\r\n * specific select class rather than a union of multiple select classes. This means the filter has\r\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\r\n * This is useful for filtering instances of specific class.\r\n */\r\n public instanceFilter?: InstanceFilterDefinition;\r\n\r\n /** Construct a new Descriptor using a [[DescriptorSource]] */\r\n public constructor(source: DescriptorSource) {\r\n this.connectionId = source.connectionId;\r\n this.inputKeysHash = source.inputKeysHash;\r\n this.selectionInfo = source.selectionInfo;\r\n this.displayType = source.displayType;\r\n this.contentFlags = source.contentFlags;\r\n this.selectClasses = [...source.selectClasses];\r\n this.categories = [...source.categories];\r\n this.fields = [...source.fields];\r\n this.sortingField = source.sortingField;\r\n this.sortDirection = source.sortDirection;\r\n this.fieldsFilterExpression = source.fieldsFilterExpression;\r\n this.instanceFilter = source.instanceFilter;\r\n this.ruleset = source.ruleset;\r\n }\r\n\r\n /** Serialize [[Descriptor]] to JSON */\r\n public toJSON(): DescriptorJSON {\r\n const classesMap: { [id: string]: CompressedClassInfoJSON } = {};\r\n const selectClasses: SelectClassInfoJSON<string>[] = this.selectClasses.map((selectClass) => SelectClassInfo.toCompressedJSON(selectClass, classesMap));\r\n const fields: FieldJSON<string>[] = this.fields.map((field) => field.toCompressedJSON(classesMap));\r\n return omitUndefined({\r\n displayType: this.displayType,\r\n contentFlags: this.contentFlags,\r\n categories: this.categories.map(CategoryDescription.toJSON),\r\n fields,\r\n selectClasses,\r\n classesMap,\r\n connectionId: this.connectionId ?? \"\",\r\n inputKeysHash: this.inputKeysHash ?? \"\",\r\n sortingFieldName: this.sortingField?.name,\r\n sortDirection: this.sortDirection,\r\n fieldsFilterExpression: this.fieldsFilterExpression,\r\n instanceFilter: this.instanceFilter,\r\n selectionInfo: this.selectionInfo,\r\n ruleset: this.ruleset,\r\n });\r\n }\r\n\r\n /** Deserialize [[Descriptor]] from JSON */\r\n public static fromJSON(json: DescriptorJSON | undefined): Descriptor | undefined {\r\n if (!json) {\r\n return undefined;\r\n }\r\n\r\n const {\r\n categories: jsonCategories,\r\n selectClasses: jsonSelectClasses,\r\n fields: jsonFields,\r\n connectionId,\r\n inputKeysHash,\r\n classesMap,\r\n sortingFieldName,\r\n ...leftOverJson\r\n } = json;\r\n const categories = CategoryDescription.listFromJSON(jsonCategories);\r\n const selectClasses = jsonSelectClasses.map((jsc) => SelectClassInfo.fromCompressedJSON(jsc, classesMap));\r\n const fields = this.getFieldsFromJSON(jsonFields, (fieldJson) => Field.fromCompressedJSON(fieldJson, classesMap, categories));\r\n return new Descriptor({\r\n ...leftOverJson,\r\n ...(connectionId ? /* c8 ignore next */ { connectionId } : undefined),\r\n ...(inputKeysHash ? /* c8 ignore next */ { inputKeysHash } : undefined),\r\n selectClasses,\r\n categories,\r\n fields,\r\n sortingField: getFieldByName(fields, sortingFieldName, true),\r\n });\r\n }\r\n\r\n private static getFieldsFromJSON(json: FieldJSON[], factory: (json: FieldJSON) => Field | undefined): Field[] {\r\n return json\r\n .map((fieldJson: FieldJSON) => {\r\n const field = factory(fieldJson);\r\n if (field) {\r\n field.rebuildParentship();\r\n }\r\n return field;\r\n })\r\n .filter((field): field is Field => !!field);\r\n }\r\n\r\n /**\r\n * Get field by its name\r\n * @param name Name of the field to find\r\n * @param recurse Recurse into nested fields\r\n */\r\n public getFieldByName(name: string, recurse?: boolean): Field | undefined {\r\n return getFieldByName(this.fields, name, recurse);\r\n }\r\n\r\n /**\r\n * Get field by its descriptor.\r\n */\r\n public getFieldByDescriptor(fieldDescriptor: FieldDescriptor, recurse?: boolean): Field | undefined {\r\n return getFieldByDescriptor(this.fields, fieldDescriptor, recurse);\r\n }\r\n\r\n /**\r\n * Create descriptor overrides object from this descriptor.\r\n * @public\r\n */\r\n public createDescriptorOverrides(): DescriptorOverrides {\r\n const overrides: DescriptorOverrides = {};\r\n if (this.displayType) {\r\n overrides.displayType = this.displayType;\r\n }\r\n if (this.contentFlags !== 0) {\r\n overrides.contentFlags = this.contentFlags;\r\n }\r\n if (this.fieldsFilterExpression) {\r\n overrides.fieldsFilterExpression = this.fieldsFilterExpression;\r\n }\r\n if (this.instanceFilter) {\r\n overrides.instanceFilter = this.instanceFilter;\r\n }\r\n if (this.sortingField) {\r\n overrides.sorting = { field: this.sortingField.getFieldDescriptor(), direction: this.sortDirection ?? SortDirection.Ascending };\r\n }\r\n return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cesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport {\n ClassInfo,\n CompressedClassInfoJSON,\n RelatedClassInfo,\n RelatedClassInfoJSON,\n RelatedClassInfoWithOptionalRelationship,\n RelatedClassInfoWithOptionalRelationshipJSON,\n RelationshipPath,\n RelationshipPathJSON,\n} from \"../EC.js\";\nimport { InstanceFilterDefinition } from \"../InstanceFilterDefinition.js\";\nimport { Ruleset } from \"../rules/Ruleset.js\";\nimport { omitUndefined } from \"../Utils.js\";\nimport { CategoryDescription, CategoryDescriptionJSON } from \"./Category.js\";\nimport { Field, FieldDescriptor, FieldJSON, getFieldByDescriptor, getFieldByName } from \"./Fields.js\";\n\n/**\n * Data structure that describes an ECClass in content [[Descriptor]].\n * @public\n */\nexport interface SelectClassInfo {\n /** Information about the ECClass */\n selectClassInfo: ClassInfo;\n\n /** Is the class handled polymorphically */\n isSelectPolymorphic: boolean;\n\n /** Relationship path from input class to the select class. */\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationship[];\n\n /** Relationship paths to [related property]($docs/presentation/content/Terminology#related-properties) classes */\n relatedPropertyPaths?: RelationshipPath[];\n\n /** Relationship paths to navigation property classes */\n navigationPropertyClasses?: RelatedClassInfo[];\n\n /** Relationship paths to [related instance]($docs/presentation/content/Terminology#related-instance) classes. */\n relatedInstancePaths?: RelationshipPath[];\n}\n\n/**\n * Serialized [[SelectClassInfo]] JSON representation\n * @public\n */\nexport interface SelectClassInfoJSON<TClassInfoJSON = ClassInfo> {\n selectClassInfo: TClassInfoJSON;\n isSelectPolymorphic: boolean;\n pathFromInputToSelectClass?: RelatedClassInfoWithOptionalRelationshipJSON<TClassInfoJSON>[];\n relatedPropertyPaths?: RelationshipPathJSON<TClassInfoJSON>[];\n navigationPropertyClasses?: RelatedClassInfoJSON<TClassInfoJSON>[];\n relatedInstancePaths?: RelationshipPathJSON<TClassInfoJSON>[];\n}\n\n/** @public */\nexport namespace SelectClassInfo {\n /** Deserialize [[SelectClassInfo]] from compressed JSON */\n export function fromCompressedJSON(json: SelectClassInfoJSON<string>, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfo {\n assert(classesMap.hasOwnProperty(json.selectClassInfo));\n return {\n selectClassInfo: { id: json.selectClassInfo, ...classesMap[json.selectClassInfo] },\n isSelectPolymorphic: json.isSelectPolymorphic,\n ...(json.navigationPropertyClasses\n ? { navigationPropertyClasses: json.navigationPropertyClasses.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap)) }\n : undefined),\n ...(json.relatedInstancePaths\n ? { relatedInstancePaths: json.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\n : undefined),\n ...(json.pathFromInputToSelectClass\n ? {\n pathFromInputToSelectClass: json.pathFromInputToSelectClass.map((item) =>\n RelatedClassInfoWithOptionalRelationship.fromCompressedJSON(item, classesMap),\n ),\n }\n : undefined),\n ...(json.relatedPropertyPaths\n ? { relatedPropertyPaths: json.relatedPropertyPaths.map((path) => path.map((item) => RelatedClassInfo.fromCompressedJSON(item, classesMap))) }\n : undefined),\n };\n }\n\n /** Serialize [[SelectClassInfo]] to compressed JSON */\n export function toCompressedJSON(selectClass: SelectClassInfo, classesMap: { [id: string]: CompressedClassInfoJSON }): SelectClassInfoJSON<string> {\n const { id, ...leftOverClassInfo } = selectClass.selectClassInfo;\n classesMap[id] = leftOverClassInfo;\n return {\n selectClassInfo: id,\n isSelectPolymorphic: selectClass.isSelectPolymorphic,\n ...(selectClass.relatedInstancePaths\n ? { relatedInstancePaths: selectClass.relatedInstancePaths.map((rip) => rip.map((item) => RelatedClassInfo.toCompressedJSON(item, classesMap))) }\n : undefined),\n ...(selectClass.navigationPropertyClasses\n ? {\n navigationPropertyClasses: selectClass.navigationPropertyClasses.map((propertyClass) =>\n RelatedClassInfo.toCompressedJSON(propertyClass, classesMap),\n ),\n }\n : undefined),\n ...(selectClass.pathFromInputToSelectClass\n ? {\n pathFromInputToSelectClass: selectClass.pathFromInputToSelectClass.map((item) =>\n RelatedClassInfoWithOptionalRelationship.toCompressedJSON(item, classesMap),\n ),\n }\n : undefined),\n ...(selectClass.relatedPropertyPaths\n ? {\n relatedPropertyPaths: selectClass.relatedPropertyPaths.map((path) =>\n path.map((relatedClass) => RelatedClassInfo.toCompressedJSON(relatedClass, classesMap)),\n ),\n }\n : undefined),\n };\n }\n}\n\n/**\n * Flags that control content format.\n * @public\n */\nexport enum ContentFlags {\n /** Each content record only has [[InstanceKey]] and no data */\n KeysOnly = 1 << 0,\n\n /** Each content record additionally has a display label */\n ShowLabels = 1 << 2,\n\n /** All content records are merged into a single record (see [Merging values]($docs/presentation/content/terminology#value-merging)) */\n MergeResults = 1 << 3,\n\n /** Content has only distinct values */\n DistinctValues = 1 << 4,\n\n /** Doesn't create property or calculated fields. Can be used in conjunction with [[ShowLabels]]. */\n NoFields = 1 << 5,\n\n /**\n * Set related input keys on [[Item]] objects when creating content. This helps identify which [[Item]] is associated to which\n * given input key at the cost of performance creating those items.\n */\n IncludeInputKeys = 1 << 8,\n}\n\n/**\n * Data sorting direction\n * @public\n */\nexport enum SortDirection {\n Ascending,\n Descending,\n}\n\n/**\n * Data structure that contains selection information. Used\n * for cases when requesting content after a selection change.\n *\n * @public\n */\nexport interface SelectionInfo {\n /** Name of selection provider which cause the selection change */\n providerName: string;\n /** Level of selection that changed */\n level?: number;\n}\n\n/**\n * Serialized [[Descriptor]] JSON representation.\n * @public\n */\nexport interface DescriptorJSON {\n classesMap: { [id: string]: CompressedClassInfoJSON };\n connectionId: string;\n inputKeysHash: string;\n selectionInfo?: SelectionInfo;\n displayType: string;\n selectClasses: SelectClassInfoJSON<Id64String>[];\n categories: CategoryDescriptionJSON[];\n fields: FieldJSON<Id64String>[];\n sortingFieldName?: string;\n sortDirection?: SortDirection;\n contentFlags: number;\n fieldsFilterExpression?: string;\n instanceFilter?: InstanceFilterDefinition;\n ruleset?: Ruleset;\n}\n\n/**\n * Descriptor overrides that can be used to customize content\n * @public\n */\nexport interface DescriptorOverrides {\n /**\n * Content display type. Can be accessed in presentation rules and used\n * to modify content in various ways. Defaults to empty string.\n */\n displayType?: string;\n\n /** Content flags used for content customization. See [[ContentFlags]] */\n contentFlags?: number;\n\n /** Fields selector that allows excluding or including only specified fields. */\n fieldsSelector?: {\n /** Should the specified fields be included or excluded */\n type: \"include\" | \"exclude\";\n /** A list of field descriptors that identify fields to include / exclude */\n fields: FieldDescriptor[];\n };\n\n /** Specification for sorting data. */\n sorting?: {\n /** Identifier of the field to use for sorting */\n field: FieldDescriptor;\n /** Sort direction */\n direction: SortDirection;\n };\n\n /**\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\n * select fields.\n *\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\n * which removes access to content instance property values. Instead of referencing properties\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\n * when properties field merges multiple properties, this allows applying the filter on all of them\n * at once. This is useful for filtering table rows by column value, when content is displayed in\n * table format.\n */\n fieldsFilterExpression?: string;\n /**\n * Instances filter that allows filtering content by class, properties of specific class\n * or properties of instances related to the content instance.\n *\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\n * specific select class rather than a union of multiple select classes. This means the filter has\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\n * This is useful for filtering instances of specific class.\n */\n instanceFilter?: InstanceFilterDefinition;\n}\n\n/**\n * Descriptor properties\n * @public\n */\nexport interface DescriptorSource {\n /** Id of the connection used to create the descriptor */\n readonly connectionId?: string;\n /** Hash of the input keys used to create the descriptor */\n readonly inputKeysHash?: string;\n /** Selection info used to create the descriptor */\n readonly selectionInfo?: SelectionInfo;\n /** Display type used to create the descriptor */\n readonly displayType: string;\n /** A list of classes that will be selected from when creating content with this descriptor */\n readonly selectClasses: SelectClassInfo[];\n /** A list of content field categories used in this descriptor */\n readonly categories: CategoryDescription[];\n /** A list of fields contained in the descriptor */\n readonly fields: Field[];\n /** [[ContentFlags]] used to create the descriptor */\n readonly contentFlags: number;\n /** Field used to sort the content */\n readonly sortingField?: Field;\n /** Sorting direction */\n readonly sortDirection?: SortDirection;\n /**\n * A ruleset used to create this descriptor.\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\n */\n readonly ruleset?: Ruleset;\n /**\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\n * select fields.\n *\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\n * which removes access to content instance property values. Instead of referencing properties\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\n * when properties field merges multiple properties, this allows applying the filter on all of them\n * at once. This is useful for filtering table rows by column value, when content is displayed in\n * table format.\n */\n fieldsFilterExpression?: string;\n /**\n * Instances filter that allows filtering content by class, properties of specific class\n * or properties of instances related to the content instance.\n *\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\n * specific select class rather than a union of multiple select classes. This means the filter has\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\n * This is useful for filtering instances of specific class.\n */\n instanceFilter?: InstanceFilterDefinition;\n}\n\n/**\n * Data structure that describes content: fields, sorting, filtering, format, etc.\n * Descriptor may be changed to control how content is created.\n *\n * @public\n */\nexport class Descriptor implements DescriptorSource {\n /** Id of the connection used to create the descriptor */\n public readonly connectionId?: string;\n /** Hash of the input keys used to create the descriptor */\n public readonly inputKeysHash?: string;\n /** Selection info used to create the descriptor */\n public readonly selectionInfo?: SelectionInfo;\n /** Display type used to create the descriptor */\n public readonly displayType: string;\n /** A list of classes that will be selected when creating content with this descriptor */\n public readonly selectClasses: SelectClassInfo[];\n /** A list of content field categories used in this descriptor */\n public readonly categories: CategoryDescription[];\n /** A list of fields contained in the descriptor */\n public readonly fields: Field[];\n /** [[ContentFlags]] used to create the descriptor */\n public readonly contentFlags: number;\n /**\n * A ruleset used to create this descriptor.\n * Only set if descriptor is created using a ruleset different from the input ruleset, e.g. when creating a hierarchy level descriptor.\n */\n public readonly ruleset?: Ruleset;\n /** Field used to sort the content */\n public sortingField?: Field;\n /** Sorting direction */\n public sortDirection?: SortDirection;\n /**\n * [ECExpression]($docs/presentation/advanced/ECExpressions.md) for filtering content by\n * select fields.\n *\n * This is different from [[instanceFilter]] as filtering is applied on the union of all selects,\n * which removes access to content instance property values. Instead of referencing properties\n * through `this.PropertyName` alias, the expression should reference them by field names. In cases\n * when properties field merges multiple properties, this allows applying the filter on all of them\n * at once. This is useful for filtering table rows by column value, when content is displayed in\n * table format.\n */\n public fieldsFilterExpression?: string;\n /**\n * Instances filter that allows filtering content by class, properties of specific class\n * or properties of instances related to the content instance.\n *\n * This is different from [[fieldsFilterExpression]] as filter is applied at a lower level - on\n * specific select class rather than a union of multiple select classes. This means the filter has\n * access to properties of that class and they can be referenced using symbols like `this.Property`.\n * This is useful for filtering instances of specific class.\n */\n public instanceFilter?: InstanceFilterDefinition;\n\n /** Construct a new Descriptor using a [[DescriptorSource]] */\n public constructor(source: DescriptorSource) {\n this.connectionId = source.connectionId;\n this.inputKeysHash = source.inputKeysHash;\n this.selectionInfo = source.selectionInfo;\n this.displayType = source.displayType;\n this.contentFlags = source.contentFlags;\n this.selectClasses = [...source.selectClasses];\n this.categories = [...source.categories];\n this.fields = [...source.fields];\n this.sortingField = source.sortingField;\n this.sortDirection = source.sortDirection;\n this.fieldsFilterExpression = source.fieldsFilterExpression;\n this.instanceFilter = source.instanceFilter;\n this.ruleset = source.ruleset;\n }\n\n /** Serialize [[Descriptor]] to JSON */\n public toJSON(): DescriptorJSON {\n const classesMap: { [id: string]: CompressedClassInfoJSON } = {};\n const selectClasses: SelectClassInfoJSON<string>[] = this.selectClasses.map((selectClass) => SelectClassInfo.toCompressedJSON(selectClass, classesMap));\n const fields: FieldJSON<string>[] = this.fields.map((field) => field.toCompressedJSON(classesMap));\n return omitUndefined({\n displayType: this.displayType,\n contentFlags: this.contentFlags,\n categories: this.categories.map(CategoryDescription.toJSON),\n fields,\n selectClasses,\n classesMap,\n connectionId: this.connectionId ?? \"\",\n inputKeysHash: this.inputKeysHash ?? \"\",\n sortingFieldName: this.sortingField?.name,\n sortDirection: this.sortDirection,\n fieldsFilterExpression: this.fieldsFilterExpression,\n instanceFilter: this.instanceFilter,\n selectionInfo: this.selectionInfo,\n ruleset: this.ruleset,\n });\n }\n\n /** Deserialize [[Descriptor]] from JSON */\n public static fromJSON(json: DescriptorJSON | undefined): Descriptor | undefined {\n if (!json) {\n return undefined;\n }\n\n const {\n categories: jsonCategories,\n selectClasses: jsonSelectClasses,\n fields: jsonFields,\n connectionId,\n inputKeysHash,\n classesMap,\n sortingFieldName,\n ...leftOverJson\n } = json;\n const categories = CategoryDescription.listFromJSON(jsonCategories);\n const selectClasses = jsonSelectClasses.map((jsc) => SelectClassInfo.fromCompressedJSON(jsc, classesMap));\n const fields = this.getFieldsFromJSON(jsonFields, (fieldJson) => Field.fromCompressedJSON(fieldJson, classesMap, categories));\n return new Descriptor({\n ...leftOverJson,\n ...(connectionId ? /* c8 ignore next */ { connectionId } : undefined),\n ...(inputKeysHash ? /* c8 ignore next */ { inputKeysHash } : undefined),\n selectClasses,\n categories,\n fields,\n sortingField: getFieldByName(fields, sortingFieldName, true),\n });\n }\n\n private static getFieldsFromJSON(json: FieldJSON[], factory: (json: FieldJSON) => Field | undefined): Field[] {\n return json\n .map((fieldJson: FieldJSON) => {\n const field = factory(fieldJson);\n if (field) {\n field.rebuildParentship();\n }\n return field;\n })\n .filter((field): field is Field => !!field);\n }\n\n /**\n * Get field by its name\n * @param name Name of the field to find\n * @param recurse Recurse into nested fields\n */\n public getFieldByName(name: string, recurse?: boolean): Field | undefined {\n return getFieldByName(this.fields, name, recurse);\n }\n\n /**\n * Get field by its descriptor.\n */\n public getFieldByDescriptor(fieldDescriptor: FieldDescriptor, recurse?: boolean): Field | undefined {\n return getFieldByDescriptor(this.fields, fieldDescriptor, recurse);\n }\n\n /**\n * Create descriptor overrides object from this descriptor.\n * @public\n */\n public createDescriptorOverrides(): DescriptorOverrides {\n const overrides: DescriptorOverrides = {};\n if (this.displayType) {\n overrides.displayType = this.displayType;\n }\n if (this.contentFlags !== 0) {\n overrides.contentFlags = this.contentFlags;\n }\n if (this.fieldsFilterExpression) {\n overrides.fieldsFilterExpression = this.fieldsFilterExpression;\n }\n if (this.instanceFilter) {\n overrides.instanceFilter = this.instanceFilter;\n }\n if (this.sortingField) {\n overrides.sorting = { field: this.sortingField.getFieldDescriptor(), direction: this.sortDirection ?? SortDirection.Ascending };\n }\n return overrides;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayTypes.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/DisplayTypes.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,4BAA4B;IAC5B,qDAAuB,CAAA;IAEvB,yFAAyF;IACzF,2CAAa,CAAA;IAEb,sFAAsF;IACtF,2DAA6B,CAAA;IAE7B,yGAAyG;IACzG,2CAAa,CAAA;IAEb,6EAA6E;IAC7E,mDAAqB,CAAA;AACvB,CAAC,EAfW,0BAA0B,KAA1B,0BAA0B,QAerC","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 Content\r\n */\r\n\r\n/**\r\n * Displayed content types. Affects how the content is formatted, e.g.\r\n * the [[ContentFlags]].\r\n *\r\n * @public\r\n */\r\nexport enum DefaultContentDisplayTypes {\r\n /** Unknown content type. */\r\n Undefined = \"Undefined\", // eslint-disable-line id-denylist\r\n\r\n /** Grid or table view content type. By default adds [[ContentFlags.ShowLabels]] flag. */\r\n Grid = \"Grid\",\r\n\r\n /** Property pane content type. By default adds [[ContentFlags.MergeResults]] flag. */\r\n PropertyPane = \"PropertyPane\",\r\n\r\n /** List content type. By default adds [[ContentFlags.NoFields]] and [[ContentFlags.ShowLabels]] flags */\r\n List = \"List\",\r\n\r\n /** Viewport content type. By default adds [[ContentFlags.KeysOnly]] flag. */\r\n Viewport = \"Graphics\",\r\n}\r\n"]}
1
+ {"version":3,"file":"DisplayTypes.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/DisplayTypes.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,CAAN,IAAY,0BAeX;AAfD,WAAY,0BAA0B;IACpC,4BAA4B;IAC5B,qDAAuB,CAAA;IAEvB,yFAAyF;IACzF,2CAAa,CAAA;IAEb,sFAAsF;IACtF,2DAA6B,CAAA;IAE7B,yGAAyG;IACzG,2CAAa,CAAA;IAEb,6EAA6E;IAC7E,mDAAqB,CAAA;AACvB,CAAC,EAfW,0BAA0B,KAA1B,0BAA0B,QAerC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\n/**\n * Displayed content types. Affects how the content is formatted, e.g.\n * the [[ContentFlags]].\n *\n * @public\n */\nexport enum DefaultContentDisplayTypes {\n /** Unknown content type. */\n Undefined = \"Undefined\", // eslint-disable-line id-denylist\n\n /** Grid or table view content type. By default adds [[ContentFlags.ShowLabels]] flag. */\n Grid = \"Grid\",\n\n /** Property pane content type. By default adds [[ContentFlags.MergeResults]] flag. */\n PropertyPane = \"PropertyPane\",\n\n /** List content type. By default adds [[ContentFlags.NoFields]] and [[ContentFlags.ShowLabels]] flags */\n List = \"List\",\n\n /** Viewport content type. By default adds [[ContentFlags.KeysOnly]] flag. */\n Viewport = \"Graphics\",\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Editor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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 Content\r\n */\r\n\r\n/**\r\n * A data structure which describes property editor used\r\n * for a content [[Field]].\r\n *\r\n * @public\r\n */\r\nexport interface EditorDescription {\r\n /** Unique name */\r\n name: string;\r\n /** Editor-specific parameters */\r\n params?: any;\r\n}\r\n"]}
1
+ {"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../../../src/presentation-common/content/Editor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Content\n */\n\n/**\n * A data structure which describes property editor used\n * for a content [[Field]].\n *\n * @public\n */\nexport interface EditorDescription {\n /** Unique name */\n name: string;\n /** Editor-specific parameters */\n params?: any;\n}\n"]}