@itwin/presentation-common 5.0.0-dev.10 → 5.0.0-dev.102

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 (482) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/Ruleset.schema.json +3 -258
  3. package/lib/cjs/package.json +1 -0
  4. package/lib/cjs/presentation-common/AsyncTasks.d.ts +4 -4
  5. package/lib/cjs/presentation-common/AsyncTasks.d.ts.map +1 -1
  6. package/lib/cjs/presentation-common/AsyncTasks.js +5 -6
  7. package/lib/cjs/presentation-common/AsyncTasks.js.map +1 -1
  8. package/lib/cjs/presentation-common/EC.d.ts +37 -81
  9. package/lib/cjs/presentation-common/EC.d.ts.map +1 -1
  10. package/lib/cjs/presentation-common/EC.js +1 -97
  11. package/lib/cjs/presentation-common/EC.js.map +1 -1
  12. package/lib/cjs/presentation-common/ElementProperties.d.ts +2 -2
  13. package/lib/cjs/presentation-common/ElementProperties.d.ts.map +1 -1
  14. package/lib/cjs/presentation-common/ElementProperties.js +22 -15
  15. package/lib/cjs/presentation-common/ElementProperties.js.map +1 -1
  16. package/lib/cjs/presentation-common/Error.d.ts +2 -0
  17. package/lib/cjs/presentation-common/Error.d.ts.map +1 -1
  18. package/lib/cjs/presentation-common/Error.js +2 -0
  19. package/lib/cjs/presentation-common/Error.js.map +1 -1
  20. package/lib/cjs/presentation-common/InstanceFilterDefinition.d.ts +1 -1
  21. package/lib/cjs/presentation-common/InstanceFilterDefinition.d.ts.map +1 -1
  22. package/lib/cjs/presentation-common/InstanceFilterDefinition.js.map +1 -1
  23. package/lib/cjs/presentation-common/KeySet.d.ts +3 -3
  24. package/lib/cjs/presentation-common/KeySet.d.ts.map +1 -1
  25. package/lib/cjs/presentation-common/KeySet.js +20 -22
  26. package/lib/cjs/presentation-common/KeySet.js.map +1 -1
  27. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js +9 -7
  28. package/lib/cjs/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  29. package/lib/cjs/presentation-common/LabelDefinition.d.ts +2 -50
  30. package/lib/cjs/presentation-common/LabelDefinition.d.ts.map +1 -1
  31. package/lib/cjs/presentation-common/LabelDefinition.js +4 -47
  32. package/lib/cjs/presentation-common/LabelDefinition.js.map +1 -1
  33. package/lib/cjs/presentation-common/LocalizationHelper.d.ts +10 -10
  34. package/lib/cjs/presentation-common/LocalizationHelper.d.ts.map +1 -1
  35. package/lib/cjs/presentation-common/LocalizationHelper.js +13 -12
  36. package/lib/cjs/presentation-common/LocalizationHelper.js.map +1 -1
  37. package/lib/cjs/presentation-common/PresentationIpcInterface.d.ts +12 -7
  38. package/lib/cjs/presentation-common/PresentationIpcInterface.d.ts.map +1 -1
  39. package/lib/cjs/presentation-common/PresentationIpcInterface.js +9 -1
  40. package/lib/cjs/presentation-common/PresentationIpcInterface.js.map +1 -1
  41. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts +40 -25
  42. package/lib/cjs/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  43. package/lib/cjs/presentation-common/PresentationManagerOptions.js +0 -5
  44. package/lib/cjs/presentation-common/PresentationManagerOptions.js.map +1 -1
  45. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts +22 -29
  46. package/lib/cjs/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  47. package/lib/cjs/presentation-common/PresentationRpcInterface.js +41 -36
  48. package/lib/cjs/presentation-common/PresentationRpcInterface.js.map +1 -1
  49. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts +6 -5
  50. package/lib/cjs/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  51. package/lib/cjs/presentation-common/RegisteredRuleset.js +9 -1
  52. package/lib/cjs/presentation-common/RegisteredRuleset.js.map +1 -1
  53. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts +21 -24
  54. package/lib/cjs/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  55. package/lib/cjs/presentation-common/RpcRequestsHandler.js +42 -35
  56. package/lib/cjs/presentation-common/RpcRequestsHandler.js.map +1 -1
  57. package/lib/cjs/presentation-common/RulesetVariables.d.ts +1 -46
  58. package/lib/cjs/presentation-common/RulesetVariables.d.ts.map +1 -1
  59. package/lib/cjs/presentation-common/RulesetVariables.js.map +1 -1
  60. package/lib/cjs/presentation-common/RulesetsFactory.d.ts +4 -4
  61. package/lib/cjs/presentation-common/RulesetsFactory.d.ts.map +1 -1
  62. package/lib/cjs/presentation-common/RulesetsFactory.js +15 -15
  63. package/lib/cjs/presentation-common/RulesetsFactory.js.map +1 -1
  64. package/lib/cjs/presentation-common/Update.d.ts +2 -79
  65. package/lib/cjs/presentation-common/Update.d.ts.map +1 -1
  66. package/lib/cjs/presentation-common/Update.js +1 -104
  67. package/lib/cjs/presentation-common/Update.js.map +1 -1
  68. package/lib/cjs/presentation-common/Utils.d.ts +22 -1
  69. package/lib/cjs/presentation-common/Utils.d.ts.map +1 -1
  70. package/lib/cjs/presentation-common/Utils.js +59 -3
  71. package/lib/cjs/presentation-common/Utils.js.map +1 -1
  72. package/lib/cjs/presentation-common/content/Category.d.ts +1 -1
  73. package/lib/cjs/presentation-common/content/Category.d.ts.map +1 -1
  74. package/lib/cjs/presentation-common/content/Category.js.map +1 -1
  75. package/lib/cjs/presentation-common/content/Content.d.ts +2 -9
  76. package/lib/cjs/presentation-common/content/Content.d.ts.map +1 -1
  77. package/lib/cjs/presentation-common/content/Content.js +9 -14
  78. package/lib/cjs/presentation-common/content/Content.js.map +1 -1
  79. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts +9 -9
  80. package/lib/cjs/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  81. package/lib/cjs/presentation-common/content/ContentTraverser.js +138 -50
  82. package/lib/cjs/presentation-common/content/ContentTraverser.js.map +1 -1
  83. package/lib/cjs/presentation-common/content/Descriptor.d.ts +7 -52
  84. package/lib/cjs/presentation-common/content/Descriptor.d.ts.map +1 -1
  85. package/lib/cjs/presentation-common/content/Descriptor.js +82 -53
  86. package/lib/cjs/presentation-common/content/Descriptor.js.map +1 -1
  87. package/lib/cjs/presentation-common/content/Fields.d.ts +157 -33
  88. package/lib/cjs/presentation-common/content/Fields.d.ts.map +1 -1
  89. package/lib/cjs/presentation-common/content/Fields.js +275 -151
  90. package/lib/cjs/presentation-common/content/Fields.js.map +1 -1
  91. package/lib/cjs/presentation-common/content/Item.d.ts +28 -33
  92. package/lib/cjs/presentation-common/content/Item.d.ts.map +1 -1
  93. package/lib/cjs/presentation-common/content/Item.js +53 -68
  94. package/lib/cjs/presentation-common/content/Item.js.map +1 -1
  95. package/lib/cjs/presentation-common/content/Property.d.ts +2 -14
  96. package/lib/cjs/presentation-common/content/Property.d.ts.map +1 -1
  97. package/lib/cjs/presentation-common/content/Property.js +2 -20
  98. package/lib/cjs/presentation-common/content/Property.js.map +1 -1
  99. package/lib/cjs/presentation-common/content/PropertyValueFormatter.d.ts +6 -6
  100. package/lib/cjs/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  101. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js +12 -9
  102. package/lib/cjs/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  103. package/lib/cjs/presentation-common/content/Value.d.ts +8 -110
  104. package/lib/cjs/presentation-common/content/Value.d.ts.map +1 -1
  105. package/lib/cjs/presentation-common/content/Value.js +1 -215
  106. package/lib/cjs/presentation-common/content/Value.js.map +1 -1
  107. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
  108. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  109. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js +0 -23
  110. package/lib/cjs/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  111. package/lib/cjs/presentation-common/hierarchy/Key.d.ts +1 -84
  112. package/lib/cjs/presentation-common/hierarchy/Key.d.ts.map +1 -1
  113. package/lib/cjs/presentation-common/hierarchy/Key.js +8 -26
  114. package/lib/cjs/presentation-common/hierarchy/Key.js.map +1 -1
  115. package/lib/cjs/presentation-common/hierarchy/Node.d.ts +4 -107
  116. package/lib/cjs/presentation-common/hierarchy/Node.d.ts.map +1 -1
  117. package/lib/cjs/presentation-common/hierarchy/Node.js +0 -99
  118. package/lib/cjs/presentation-common/hierarchy/Node.js.map +1 -1
  119. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
  120. package/lib/cjs/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  121. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js +0 -117
  122. package/lib/cjs/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  123. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.d.ts +2 -2
  124. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.d.ts.map +1 -1
  125. package/lib/cjs/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  126. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.d.ts +2 -2
  127. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.d.ts.map +1 -1
  128. package/lib/cjs/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  129. package/lib/cjs/presentation-common/rules/Rule.d.ts +6 -20
  130. package/lib/cjs/presentation-common/rules/Rule.d.ts.map +1 -1
  131. package/lib/cjs/presentation-common/rules/Rule.js.map +1 -1
  132. package/lib/cjs/presentation-common/rules/Ruleset.d.ts +3 -3
  133. package/lib/cjs/presentation-common/rules/Ruleset.d.ts.map +1 -1
  134. package/lib/cjs/presentation-common/rules/Ruleset.js.map +1 -1
  135. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.d.ts +2 -2
  136. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.d.ts.map +1 -1
  137. package/lib/cjs/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  138. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.d.ts +2 -2
  139. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.d.ts.map +1 -1
  140. package/lib/cjs/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  141. package/lib/cjs/presentation-common/rules/content/ContentRule.d.ts +2 -2
  142. package/lib/cjs/presentation-common/rules/content/ContentRule.d.ts.map +1 -1
  143. package/lib/cjs/presentation-common/rules/content/ContentRule.js.map +1 -1
  144. package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts +5 -12
  145. package/lib/cjs/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  146. package/lib/cjs/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  147. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.d.ts +2 -2
  148. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.d.ts.map +1 -1
  149. package/lib/cjs/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  150. package/lib/cjs/presentation-common/rules/content/PropertySpecification.d.ts +3 -3
  151. package/lib/cjs/presentation-common/rules/content/PropertySpecification.d.ts.map +1 -1
  152. package/lib/cjs/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  153. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.d.ts +1 -1
  154. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.d.ts.map +1 -1
  155. package/lib/cjs/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  156. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.d.ts +3 -3
  157. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.d.ts.map +1 -1
  158. package/lib/cjs/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  159. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.d.ts +6 -6
  160. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.d.ts.map +1 -1
  161. package/lib/cjs/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  162. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.d.ts +1 -1
  163. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.d.ts.map +1 -1
  164. package/lib/cjs/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  165. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.d.ts +2 -2
  166. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.d.ts.map +1 -1
  167. package/lib/cjs/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  168. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts +6 -10
  169. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  170. package/lib/cjs/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  171. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.d.ts +1 -1
  172. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.d.ts.map +1 -1
  173. package/lib/cjs/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  174. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts +4 -30
  175. package/lib/cjs/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  176. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js +1 -15
  177. package/lib/cjs/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  178. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.d.ts +3 -3
  179. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.d.ts.map +1 -1
  180. package/lib/cjs/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  181. package/lib/cjs/presentation-common/rules/customization/SortingRule.d.ts +2 -2
  182. package/lib/cjs/presentation-common/rules/customization/SortingRule.d.ts.map +1 -1
  183. package/lib/cjs/presentation-common/rules/customization/SortingRule.js.map +1 -1
  184. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
  185. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
  186. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  187. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +6 -6
  188. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  189. package/lib/cjs/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  190. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +3 -1
  191. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  192. package/lib/cjs/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  193. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +2 -2
  194. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
  195. package/lib/cjs/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  196. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -11
  197. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  198. package/lib/cjs/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  199. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts +6 -6
  200. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
  201. package/lib/cjs/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  202. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
  203. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
  204. package/lib/cjs/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  205. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -2
  206. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
  207. package/lib/cjs/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  208. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
  209. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
  210. package/lib/cjs/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  211. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -2
  212. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
  213. package/lib/cjs/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  214. package/lib/cjs/presentation-common/selection/SelectionScope.d.ts +3 -0
  215. package/lib/cjs/presentation-common/selection/SelectionScope.d.ts.map +1 -1
  216. package/lib/cjs/presentation-common/selection/SelectionScope.js +1 -0
  217. package/lib/cjs/presentation-common/selection/SelectionScope.js.map +1 -1
  218. package/lib/cjs/presentation-common-internal.d.ts +10 -0
  219. package/lib/cjs/presentation-common-internal.d.ts.map +1 -0
  220. package/lib/cjs/presentation-common-internal.js +32 -0
  221. package/lib/cjs/presentation-common-internal.js.map +1 -0
  222. package/lib/cjs/presentation-common.d.ts +68 -77
  223. package/lib/cjs/presentation-common.d.ts.map +1 -1
  224. package/lib/cjs/presentation-common.js +110 -89
  225. package/lib/cjs/presentation-common.js.map +1 -1
  226. package/lib/esm/presentation-common/AsyncTasks.d.ts +4 -4
  227. package/lib/esm/presentation-common/AsyncTasks.d.ts.map +1 -1
  228. package/lib/esm/presentation-common/AsyncTasks.js +5 -6
  229. package/lib/esm/presentation-common/AsyncTasks.js.map +1 -1
  230. package/lib/esm/presentation-common/EC.d.ts +37 -81
  231. package/lib/esm/presentation-common/EC.d.ts.map +1 -1
  232. package/lib/esm/presentation-common/EC.js +0 -96
  233. package/lib/esm/presentation-common/EC.js.map +1 -1
  234. package/lib/esm/presentation-common/ElementProperties.d.ts +2 -2
  235. package/lib/esm/presentation-common/ElementProperties.d.ts.map +1 -1
  236. package/lib/esm/presentation-common/ElementProperties.js +18 -11
  237. package/lib/esm/presentation-common/ElementProperties.js.map +1 -1
  238. package/lib/esm/presentation-common/Error.d.ts +2 -0
  239. package/lib/esm/presentation-common/Error.d.ts.map +1 -1
  240. package/lib/esm/presentation-common/Error.js +2 -0
  241. package/lib/esm/presentation-common/Error.js.map +1 -1
  242. package/lib/esm/presentation-common/InstanceFilterDefinition.d.ts +1 -1
  243. package/lib/esm/presentation-common/InstanceFilterDefinition.d.ts.map +1 -1
  244. package/lib/esm/presentation-common/InstanceFilterDefinition.js.map +1 -1
  245. package/lib/esm/presentation-common/KeySet.d.ts +3 -3
  246. package/lib/esm/presentation-common/KeySet.d.ts.map +1 -1
  247. package/lib/esm/presentation-common/KeySet.js +10 -12
  248. package/lib/esm/presentation-common/KeySet.js.map +1 -1
  249. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js +10 -8
  250. package/lib/esm/presentation-common/KoqPropertyValueFormatter.js.map +1 -1
  251. package/lib/esm/presentation-common/LabelDefinition.d.ts +2 -50
  252. package/lib/esm/presentation-common/LabelDefinition.d.ts.map +1 -1
  253. package/lib/esm/presentation-common/LabelDefinition.js +3 -46
  254. package/lib/esm/presentation-common/LabelDefinition.js.map +1 -1
  255. package/lib/esm/presentation-common/LocalizationHelper.d.ts +10 -10
  256. package/lib/esm/presentation-common/LocalizationHelper.d.ts.map +1 -1
  257. package/lib/esm/presentation-common/LocalizationHelper.js +6 -5
  258. package/lib/esm/presentation-common/LocalizationHelper.js.map +1 -1
  259. package/lib/esm/presentation-common/PresentationIpcInterface.d.ts +12 -7
  260. package/lib/esm/presentation-common/PresentationIpcInterface.d.ts.map +1 -1
  261. package/lib/esm/presentation-common/PresentationIpcInterface.js +8 -0
  262. package/lib/esm/presentation-common/PresentationIpcInterface.js.map +1 -1
  263. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts +40 -25
  264. package/lib/esm/presentation-common/PresentationManagerOptions.d.ts.map +1 -1
  265. package/lib/esm/presentation-common/PresentationManagerOptions.js +0 -4
  266. package/lib/esm/presentation-common/PresentationManagerOptions.js.map +1 -1
  267. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts +22 -29
  268. package/lib/esm/presentation-common/PresentationRpcInterface.d.ts.map +1 -1
  269. package/lib/esm/presentation-common/PresentationRpcInterface.js +42 -36
  270. package/lib/esm/presentation-common/PresentationRpcInterface.js.map +1 -1
  271. package/lib/esm/presentation-common/RegisteredRuleset.d.ts +6 -5
  272. package/lib/esm/presentation-common/RegisteredRuleset.d.ts.map +1 -1
  273. package/lib/esm/presentation-common/RegisteredRuleset.js +9 -1
  274. package/lib/esm/presentation-common/RegisteredRuleset.js.map +1 -1
  275. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts +21 -24
  276. package/lib/esm/presentation-common/RpcRequestsHandler.d.ts.map +1 -1
  277. package/lib/esm/presentation-common/RpcRequestsHandler.js +42 -35
  278. package/lib/esm/presentation-common/RpcRequestsHandler.js.map +1 -1
  279. package/lib/esm/presentation-common/RulesetVariables.d.ts +1 -46
  280. package/lib/esm/presentation-common/RulesetVariables.d.ts.map +1 -1
  281. package/lib/esm/presentation-common/RulesetVariables.js.map +1 -1
  282. package/lib/esm/presentation-common/RulesetsFactory.d.ts +4 -4
  283. package/lib/esm/presentation-common/RulesetsFactory.d.ts.map +1 -1
  284. package/lib/esm/presentation-common/RulesetsFactory.js +6 -6
  285. package/lib/esm/presentation-common/RulesetsFactory.js.map +1 -1
  286. package/lib/esm/presentation-common/Update.d.ts +2 -79
  287. package/lib/esm/presentation-common/Update.d.ts.map +1 -1
  288. package/lib/esm/presentation-common/Update.js +0 -103
  289. package/lib/esm/presentation-common/Update.js.map +1 -1
  290. package/lib/esm/presentation-common/Utils.d.ts +22 -1
  291. package/lib/esm/presentation-common/Utils.d.ts.map +1 -1
  292. package/lib/esm/presentation-common/Utils.js +54 -1
  293. package/lib/esm/presentation-common/Utils.js.map +1 -1
  294. package/lib/esm/presentation-common/content/Category.d.ts +1 -1
  295. package/lib/esm/presentation-common/content/Category.d.ts.map +1 -1
  296. package/lib/esm/presentation-common/content/Category.js.map +1 -1
  297. package/lib/esm/presentation-common/content/Content.d.ts +2 -9
  298. package/lib/esm/presentation-common/content/Content.d.ts.map +1 -1
  299. package/lib/esm/presentation-common/content/Content.js +7 -12
  300. package/lib/esm/presentation-common/content/Content.js.map +1 -1
  301. package/lib/esm/presentation-common/content/ContentTraverser.d.ts +9 -9
  302. package/lib/esm/presentation-common/content/ContentTraverser.d.ts.map +1 -1
  303. package/lib/esm/presentation-common/content/ContentTraverser.js +123 -35
  304. package/lib/esm/presentation-common/content/ContentTraverser.js.map +1 -1
  305. package/lib/esm/presentation-common/content/Descriptor.d.ts +7 -52
  306. package/lib/esm/presentation-common/content/Descriptor.d.ts.map +1 -1
  307. package/lib/esm/presentation-common/content/Descriptor.js +71 -42
  308. package/lib/esm/presentation-common/content/Descriptor.js.map +1 -1
  309. package/lib/esm/presentation-common/content/Fields.d.ts +157 -33
  310. package/lib/esm/presentation-common/content/Fields.d.ts.map +1 -1
  311. package/lib/esm/presentation-common/content/Fields.js +268 -144
  312. package/lib/esm/presentation-common/content/Fields.js.map +1 -1
  313. package/lib/esm/presentation-common/content/Item.d.ts +28 -33
  314. package/lib/esm/presentation-common/content/Item.d.ts.map +1 -1
  315. package/lib/esm/presentation-common/content/Item.js +53 -68
  316. package/lib/esm/presentation-common/content/Item.js.map +1 -1
  317. package/lib/esm/presentation-common/content/Property.d.ts +2 -14
  318. package/lib/esm/presentation-common/content/Property.d.ts.map +1 -1
  319. package/lib/esm/presentation-common/content/Property.js +1 -19
  320. package/lib/esm/presentation-common/content/Property.js.map +1 -1
  321. package/lib/esm/presentation-common/content/PropertyValueFormatter.d.ts +6 -6
  322. package/lib/esm/presentation-common/content/PropertyValueFormatter.d.ts.map +1 -1
  323. package/lib/esm/presentation-common/content/PropertyValueFormatter.js +5 -2
  324. package/lib/esm/presentation-common/content/PropertyValueFormatter.js.map +1 -1
  325. package/lib/esm/presentation-common/content/Value.d.ts +8 -110
  326. package/lib/esm/presentation-common/content/Value.d.ts.map +1 -1
  327. package/lib/esm/presentation-common/content/Value.js +0 -214
  328. package/lib/esm/presentation-common/content/Value.js.map +1 -1
  329. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts +1 -22
  330. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.d.ts.map +1 -1
  331. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js +1 -22
  332. package/lib/esm/presentation-common/hierarchy/HierarchyLevel.js.map +1 -1
  333. package/lib/esm/presentation-common/hierarchy/Key.d.ts +1 -84
  334. package/lib/esm/presentation-common/hierarchy/Key.d.ts.map +1 -1
  335. package/lib/esm/presentation-common/hierarchy/Key.js +7 -25
  336. package/lib/esm/presentation-common/hierarchy/Key.js.map +1 -1
  337. package/lib/esm/presentation-common/hierarchy/Node.d.ts +4 -107
  338. package/lib/esm/presentation-common/hierarchy/Node.d.ts.map +1 -1
  339. package/lib/esm/presentation-common/hierarchy/Node.js +1 -98
  340. package/lib/esm/presentation-common/hierarchy/Node.js.map +1 -1
  341. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts +1 -67
  342. package/lib/esm/presentation-common/hierarchy/NodePathElement.d.ts.map +1 -1
  343. package/lib/esm/presentation-common/hierarchy/NodePathElement.js +1 -116
  344. package/lib/esm/presentation-common/hierarchy/NodePathElement.js.map +1 -1
  345. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.d.ts +2 -2
  346. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.d.ts.map +1 -1
  347. package/lib/esm/presentation-common/rules/RelatedInstanceSpecification.js.map +1 -1
  348. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.d.ts +2 -2
  349. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.d.ts.map +1 -1
  350. package/lib/esm/presentation-common/rules/RelationshipPathSpecification.js.map +1 -1
  351. package/lib/esm/presentation-common/rules/Rule.d.ts +6 -20
  352. package/lib/esm/presentation-common/rules/Rule.d.ts.map +1 -1
  353. package/lib/esm/presentation-common/rules/Rule.js.map +1 -1
  354. package/lib/esm/presentation-common/rules/Ruleset.d.ts +3 -3
  355. package/lib/esm/presentation-common/rules/Ruleset.d.ts.map +1 -1
  356. package/lib/esm/presentation-common/rules/Ruleset.js.map +1 -1
  357. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.d.ts +2 -2
  358. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.d.ts.map +1 -1
  359. package/lib/esm/presentation-common/rules/content/ContentInstancesOfSpecificClassesSpecification.js.map +1 -1
  360. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.d.ts +2 -2
  361. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.d.ts.map +1 -1
  362. package/lib/esm/presentation-common/rules/content/ContentRelatedInstancesSpecification.js.map +1 -1
  363. package/lib/esm/presentation-common/rules/content/ContentRule.d.ts +2 -2
  364. package/lib/esm/presentation-common/rules/content/ContentRule.d.ts.map +1 -1
  365. package/lib/esm/presentation-common/rules/content/ContentRule.js.map +1 -1
  366. package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts +5 -12
  367. package/lib/esm/presentation-common/rules/content/ContentSpecification.d.ts.map +1 -1
  368. package/lib/esm/presentation-common/rules/content/ContentSpecification.js.map +1 -1
  369. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.d.ts +2 -2
  370. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.d.ts.map +1 -1
  371. package/lib/esm/presentation-common/rules/content/DefaultPropertyCategoryOverride.js.map +1 -1
  372. package/lib/esm/presentation-common/rules/content/PropertySpecification.d.ts +3 -3
  373. package/lib/esm/presentation-common/rules/content/PropertySpecification.d.ts.map +1 -1
  374. package/lib/esm/presentation-common/rules/content/PropertySpecification.js.map +1 -1
  375. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.d.ts +1 -1
  376. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.d.ts.map +1 -1
  377. package/lib/esm/presentation-common/rules/content/SelectedNodeInstancesSpecification.js.map +1 -1
  378. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.d.ts +3 -3
  379. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.d.ts.map +1 -1
  380. package/lib/esm/presentation-common/rules/content/modifiers/CalculatedPropertiesSpecification.js.map +1 -1
  381. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.d.ts +6 -6
  382. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.d.ts.map +1 -1
  383. package/lib/esm/presentation-common/rules/content/modifiers/ContentModifier.js.map +1 -1
  384. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.d.ts +1 -1
  385. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.d.ts.map +1 -1
  386. package/lib/esm/presentation-common/rules/content/modifiers/PropertyCategorySpecification.js.map +1 -1
  387. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.d.ts +2 -2
  388. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.d.ts.map +1 -1
  389. package/lib/esm/presentation-common/rules/content/modifiers/RelatedPropertiesSpecification.js.map +1 -1
  390. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts +6 -10
  391. package/lib/esm/presentation-common/rules/customization/CustomizationRule.d.ts.map +1 -1
  392. package/lib/esm/presentation-common/rules/customization/CustomizationRule.js.map +1 -1
  393. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.d.ts +1 -1
  394. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.d.ts.map +1 -1
  395. package/lib/esm/presentation-common/rules/customization/ExtendedDataRule.js.map +1 -1
  396. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts +4 -30
  397. package/lib/esm/presentation-common/rules/customization/GroupingRule.d.ts.map +1 -1
  398. package/lib/esm/presentation-common/rules/customization/GroupingRule.js +0 -14
  399. package/lib/esm/presentation-common/rules/customization/GroupingRule.js.map +1 -1
  400. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.d.ts +3 -3
  401. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.d.ts.map +1 -1
  402. package/lib/esm/presentation-common/rules/customization/InstanceLabelOverride.js.map +1 -1
  403. package/lib/esm/presentation-common/rules/customization/SortingRule.d.ts +2 -2
  404. package/lib/esm/presentation-common/rules/customization/SortingRule.d.ts.map +1 -1
  405. package/lib/esm/presentation-common/rules/customization/SortingRule.js.map +1 -1
  406. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts +1 -1
  407. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.d.ts.map +1 -1
  408. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeRule.js.map +1 -1
  409. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts +6 -6
  410. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.d.ts.map +1 -1
  411. package/lib/esm/presentation-common/rules/hierarchy/ChildNodeSpecification.js.map +1 -1
  412. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts +3 -1
  413. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.d.ts.map +1 -1
  414. package/lib/esm/presentation-common/rules/hierarchy/CustomNodeSpecification.js.map +1 -1
  415. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts +2 -2
  416. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.d.ts.map +1 -1
  417. package/lib/esm/presentation-common/rules/hierarchy/CustomQueryInstanceNodesSpecification.js.map +1 -1
  418. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts +2 -11
  419. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.d.ts.map +1 -1
  420. package/lib/esm/presentation-common/rules/hierarchy/InstanceNodesOfSpecificClassesSpecification.js.map +1 -1
  421. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts +6 -6
  422. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.d.ts.map +1 -1
  423. package/lib/esm/presentation-common/rules/hierarchy/NavigationRule.js.map +1 -1
  424. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts +1 -1
  425. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.d.ts.map +1 -1
  426. package/lib/esm/presentation-common/rules/hierarchy/NodeArtifactsRule.js.map +1 -1
  427. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts +2 -2
  428. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.d.ts.map +1 -1
  429. package/lib/esm/presentation-common/rules/hierarchy/RelatedInstanceNodesSpecification.js.map +1 -1
  430. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts +1 -1
  431. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.d.ts.map +1 -1
  432. package/lib/esm/presentation-common/rules/hierarchy/RootNodeRule.js.map +1 -1
  433. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts +2 -2
  434. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.d.ts.map +1 -1
  435. package/lib/esm/presentation-common/rules/hierarchy/SubCondition.js.map +1 -1
  436. package/lib/esm/presentation-common/selection/SelectionScope.d.ts +3 -0
  437. package/lib/esm/presentation-common/selection/SelectionScope.d.ts.map +1 -1
  438. package/lib/esm/presentation-common/selection/SelectionScope.js +1 -0
  439. package/lib/esm/presentation-common/selection/SelectionScope.js.map +1 -1
  440. package/lib/esm/presentation-common-internal.d.ts +10 -0
  441. package/lib/esm/presentation-common-internal.d.ts.map +1 -0
  442. package/lib/esm/presentation-common-internal.js +16 -0
  443. package/lib/esm/presentation-common-internal.js.map +1 -0
  444. package/lib/esm/presentation-common.d.ts +68 -77
  445. package/lib/esm/presentation-common.d.ts.map +1 -1
  446. package/lib/esm/presentation-common.js +60 -89
  447. package/lib/esm/presentation-common.js.map +1 -1
  448. package/package.json +47 -36
  449. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
  450. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
  451. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js +0 -10
  452. package/lib/cjs/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
  453. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
  454. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
  455. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js +0 -10
  456. package/lib/cjs/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
  457. package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
  458. package/lib/cjs/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
  459. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js +0 -10
  460. package/lib/cjs/presentation-common/rules/customization/LabelOverride.js.map +0 -1
  461. package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
  462. package/lib/cjs/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
  463. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js +0 -10
  464. package/lib/cjs/presentation-common/rules/customization/StyleOverride.js.map +0 -1
  465. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts +0 -45
  466. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.d.ts.map +0 -1
  467. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js +0 -9
  468. package/lib/esm/presentation-common/rules/customization/CheckBoxRule.js.map +0 -1
  469. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts +0 -30
  470. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.d.ts.map +0 -1
  471. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js +0 -9
  472. package/lib/esm/presentation-common/rules/customization/ImageIdOverride.js.map +0 -1
  473. package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts +0 -41
  474. package/lib/esm/presentation-common/rules/customization/LabelOverride.d.ts.map +0 -1
  475. package/lib/esm/presentation-common/rules/customization/LabelOverride.js +0 -9
  476. package/lib/esm/presentation-common/rules/customization/LabelOverride.js.map +0 -1
  477. package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts +0 -49
  478. package/lib/esm/presentation-common/rules/customization/StyleOverride.d.ts.map +0 -1
  479. package/lib/esm/presentation-common/rules/customization/StyleOverride.js +0 -9
  480. package/lib/esm/presentation-common/rules/customization/StyleOverride.js.map +0 -1
  481. /package/lib/{cjs/assets → assets}/locales/en/Presentation.json +0 -0
  482. /package/lib/{cjs/assets → assets}/locales/en-PSEUDO/Presentation.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAoH;AACpH,gEAUkC;AAiDlC;;;GAGG;AACH,MAAa,yBAAyB;IAIpC,YACU,cAA6B,EACrC,cAA2B;QADnB,mBAAc,GAAd,cAAc,CAAe;QAGrC,IAAI,CAAC,cAAc,GAAG,IAAI,sCAAkB,CAAC,cAAc,CAAC,CAAC;QAC7D,IAAI,CAAC,eAAe,GAAG,cAAc;YACnC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC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Z,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 Core\r\n */\r\n\r\nimport { Format, FormatProps, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n getFormatProps,\r\n InvertedUnit,\r\n KindOfQuantity,\r\n SchemaContext,\r\n SchemaKey,\r\n SchemaMatchType,\r\n SchemaUnitProvider,\r\n Unit,\r\n UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * A data structure that associates unit systems with property value formatting props. The associations are used for\r\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\r\n *\r\n * @public\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * length: [{\r\n * unitSystems: [\"metric\"],\r\n * format: formatForCentimeters,\r\n * }, {\r\n * unitSystems: [\"imperial\", \"usCustomary\"],\r\n * format: formatForInches,\r\n * }, {\r\n * unitSystems: [\"usSurvey\"],\r\n * format: formatForUsSurveyInches,\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport interface FormatsMap {\r\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\r\n}\r\n\r\n/**\r\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\nexport interface FormatOptions {\r\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\r\n koqName: string;\r\n /** Unit system to use for formatting. */\r\n unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/**\r\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\r\n * @public\r\n */\r\nexport class KoqPropertyValueFormatter {\r\n private _unitsProvider: UnitsProvider;\r\n private _defaultFormats?: FormatsMap;\r\n\r\n constructor(\r\n private _schemaContext: SchemaContext,\r\n defaultFormats?: FormatsMap,\r\n ) {\r\n this._unitsProvider = new SchemaUnitProvider(_schemaContext);\r\n this._defaultFormats = defaultFormats\r\n ? Object.entries(defaultFormats).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\r\n : /* istanbul ignore next */ undefined;\r\n }\r\n\r\n public async format(value: number, options: FormatOptions) {\r\n const formatterSpec = await this.getFormatterSpec(options);\r\n if (!formatterSpec) {\r\n return undefined;\r\n }\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n\r\n public async getFormatterSpec(options: FormatOptions) {\r\n const formattingProps = await getFormattingProps(this._schemaContext, this._defaultFormats, options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\r\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n public async getParserSpec(options: FormatOptions) {\r\n const formattingProps = await getFormattingProps(this._schemaContext, this._defaultFormats, options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\r\n }\r\n}\r\n\r\ninterface FormattingProps {\r\n formatProps: FormatProps;\r\n persistenceUnitName: string;\r\n}\r\n\r\nasync function getFormattingProps(\r\n schemaLocater: SchemaContext,\r\n defaultFormats: FormatsMap | undefined,\r\n options: FormatOptions,\r\n): Promise<FormattingProps | undefined> {\r\n const { koqName, unitSystem } = options;\r\n\r\n const koq = await getKoq(schemaLocater, koqName);\r\n if (!koq) {\r\n return undefined;\r\n }\r\n\r\n const persistenceUnit = await koq.persistenceUnit;\r\n // istanbul ignore if\r\n if (!persistenceUnit) {\r\n return undefined;\r\n }\r\n\r\n const formatProps = await getKoqFormatProps(koq, persistenceUnit, defaultFormats, unitSystem);\r\n if (!formatProps) {\r\n return undefined;\r\n }\r\n\r\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\r\n}\r\n\r\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\r\n const [schemaName, propKoqName] = fullName.split(\":\");\r\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\r\n if (!schema) {\r\n return undefined;\r\n }\r\n return schema.getItem<KindOfQuantity>(propKoqName);\r\n}\r\n\r\nasync function getKoqFormatProps(\r\n koq: KindOfQuantity,\r\n persistenceUnit: Unit | InvertedUnit,\r\n defaultFormats: FormatsMap | undefined,\r\n unitSystem?: UnitSystemKey,\r\n) {\r\n const unitSystemMatchers = getUnitSystemGroupMatchers(unitSystem);\r\n // use one of KOQ presentation format that matches requested unit system\r\n const presentationFormat = await getKoqPresentationFormat(koq, unitSystemMatchers);\r\n if (presentationFormat) {\r\n return getFormatProps(presentationFormat);\r\n }\r\n\r\n // use one of the formats in default formats map if there is one for matching phenomena and requested unit\r\n // system combination\r\n if (defaultFormats && unitSystem) {\r\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* istanbul ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\r\n const phenomenon = await actualPersistenceUnit?.phenomenon;\r\n // istanbul ignore else\r\n if (phenomenon && defaultFormats[phenomenon.name.toUpperCase()]) {\r\n const defaultPhenomenonFormats = defaultFormats[phenomenon.name.toUpperCase()];\r\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\r\n ? /* istanbul ignore next */ defaultPhenomenonFormats\r\n : [defaultPhenomenonFormats]) {\r\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\r\n return defaultUnitSystemFormat.format;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // use persistence unit format if it matches requested unit system and matching presentation format was not found\r\n const persistenceUnitSystem = await persistenceUnit.unitSystem;\r\n if (persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\r\n return getPersistenceUnitFormatProps(persistenceUnit);\r\n }\r\n\r\n // use default presentation format if persistence unit does not match requested unit system\r\n if (koq.defaultPresentationFormat) {\r\n return getFormatProps(koq.defaultPresentationFormat);\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nasync function getKoqPresentationFormat(koq: KindOfQuantity, unitSystemMatchers: Array<(unitSystem: UnitSystem) => boolean>) {\r\n const presentationFormats = koq.presentationFormats;\r\n for (const matcher of unitSystemMatchers) {\r\n for (const format of presentationFormats) {\r\n const unit = format.units && format.units[0][0];\r\n // istanbul ignore if\r\n if (!unit) {\r\n continue;\r\n }\r\n const currentUnitSystem = await unit.unitSystem;\r\n if (currentUnitSystem && matcher(currentUnitSystem)) {\r\n return format;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\r\n // Same as Format \"DefaultRealU\" in Formats ecschema\r\n return {\r\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\r\n precision: 6,\r\n type: \"Decimal\",\r\n uomSeparator: \" \",\r\n decimalSeparator: \".\",\r\n composite: {\r\n units: [\r\n {\r\n name: persistenceUnit.fullName,\r\n label: persistenceUnit.label,\r\n },\r\n ],\r\n },\r\n };\r\n}\r\n\r\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\r\n function createMatcher(name: string | string[]) {\r\n const names = Array.isArray(name) ? name : [name];\r\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\r\n }\r\n switch (groupKey) {\r\n case \"imperial\":\r\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"metric\":\r\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"usCustomary\":\r\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"usSurvey\":\r\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n }\r\n return [];\r\n}\r\n"]}
1
+ {"version":3,"file":"KoqPropertyValueFormatter.js","sourceRoot":"","sources":["../../../src/presentation-common/KoqPropertyValueFormatter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,wDAAoH;AACpH,gEAUkC;AAiDlC;;;GAGG;AACH,MAAa,yBAAyB;IAK1B;IAJF,cAAc,CAAgB;IAC9B,eAAe,CAAc;IAErC,YACU,cAA6B,EACrC,cAA2B;QADnB,mBAAc,GAAd,cAAc,CAAe;QAGrC,IAAI,CAAC,cAAc,GAAG,IAAI,sCAAkB,CAAC,cAAc,CAAC,CAAC;QAC7D,IAAI,CAAC,eAAe,GAAG,cAAc;YACnC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,EAAE,CAAC;YAClJ,CAAC,CAAC,oBAAoB,CAAC,SAAS,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAAsB;QACvD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,SAAS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a,CAAC,IAAuB;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,CAAC,UAAsB,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACjF,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3E,KAAK,aAAa;YAChB,OAAO,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACrE,KAAK,UAAU;YACb,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACnF,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,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 Core\r\n */\r\n\r\nimport { Format, FormatProps, FormatterSpec, ParserSpec, UnitsProvider, UnitSystemKey } from \"@itwin/core-quantity\";\r\nimport {\r\n getFormatProps,\r\n InvertedUnit,\r\n KindOfQuantity,\r\n SchemaContext,\r\n SchemaKey,\r\n SchemaMatchType,\r\n SchemaUnitProvider,\r\n Unit,\r\n UnitSystem,\r\n} from \"@itwin/ecschema-metadata\";\r\n\r\n/**\r\n * A data structure that associates unit systems with property value formatting props. The associations are used for\r\n * assigning formatting props for specific phenomenon and unit system combinations (see [[FormatsMap]]).\r\n *\r\n * @public\r\n */\r\nexport interface UnitSystemFormat {\r\n unitSystems: UnitSystemKey[];\r\n format: FormatProps;\r\n}\r\n\r\n/**\r\n * A data structure that associates specific phenomenon with one or more formatting props for specific unit system.\r\n *\r\n * Example:\r\n * ```json\r\n * {\r\n * length: [{\r\n * unitSystems: [\"metric\"],\r\n * format: formatForCentimeters,\r\n * }, {\r\n * unitSystems: [\"imperial\", \"usCustomary\"],\r\n * format: formatForInches,\r\n * }, {\r\n * unitSystems: [\"usSurvey\"],\r\n * format: formatForUsSurveyInches,\r\n * }]\r\n * }\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport interface FormatsMap {\r\n [phenomenon: string]: UnitSystemFormat | UnitSystemFormat[];\r\n}\r\n\r\n/**\r\n * Options for finding a formatter spec to use in [[KoqPropertyValueFormatter]].\r\n * @public\r\n */\r\nexport interface FormatOptions {\r\n /** Full name of the `KindOfQuantity`, e.g. `SchemaName:KoqName`. */\r\n koqName: string;\r\n /** Unit system to use for formatting. */\r\n unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/**\r\n * An utility for formatting property values based on `KindOfQuantity` and unit system.\r\n * @public\r\n */\r\nexport class KoqPropertyValueFormatter {\r\n private _unitsProvider: UnitsProvider;\r\n private _defaultFormats?: FormatsMap;\r\n\r\n constructor(\r\n private _schemaContext: SchemaContext,\r\n defaultFormats?: FormatsMap,\r\n ) {\r\n this._unitsProvider = new SchemaUnitProvider(_schemaContext);\r\n this._defaultFormats = defaultFormats\r\n ? Object.entries(defaultFormats).reduce((acc, [phenomenon, unitSystemFormats]) => ({ ...acc, [phenomenon.toUpperCase()]: unitSystemFormats }), {})\r\n : /* c8 ignore next */ undefined;\r\n }\r\n\r\n public async format(value: number, options: FormatOptions) {\r\n const formatterSpec = await this.getFormatterSpec(options);\r\n if (!formatterSpec) {\r\n return undefined;\r\n }\r\n return formatterSpec.applyFormatting(value);\r\n }\r\n\r\n public async getFormatterSpec(options: FormatOptions) {\r\n const formattingProps = await getFormattingProps(this._schemaContext, this._defaultFormats, options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\r\n return FormatterSpec.create(\"\", format, this._unitsProvider, persistenceUnit);\r\n }\r\n\r\n public async getParserSpec(options: FormatOptions) {\r\n const formattingProps = await getFormattingProps(this._schemaContext, this._defaultFormats, options);\r\n if (!formattingProps) {\r\n return undefined;\r\n }\r\n const { formatProps, persistenceUnitName } = formattingProps;\r\n const persistenceUnit = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(\"\", this._unitsProvider, formatProps);\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnit);\r\n }\r\n}\r\n\r\ninterface FormattingProps {\r\n formatProps: FormatProps;\r\n persistenceUnitName: string;\r\n}\r\n\r\nasync function getFormattingProps(\r\n schemaLocater: SchemaContext,\r\n defaultFormats: FormatsMap | undefined,\r\n options: FormatOptions,\r\n): Promise<FormattingProps | undefined> {\r\n const { koqName, unitSystem } = options;\r\n\r\n const koq = await getKoq(schemaLocater, koqName);\r\n if (!koq) {\r\n return undefined;\r\n }\r\n\r\n const persistenceUnit = await koq.persistenceUnit;\r\n /* c8 ignore next 3 */\r\n if (!persistenceUnit) {\r\n return undefined;\r\n }\r\n\r\n const formatProps = await getKoqFormatProps(koq, persistenceUnit, defaultFormats, unitSystem);\r\n if (!formatProps) {\r\n return undefined;\r\n }\r\n\r\n return { formatProps, persistenceUnitName: persistenceUnit.fullName };\r\n}\r\n\r\nasync function getKoq(schemaLocater: SchemaContext, fullName: string) {\r\n const [schemaName, propKoqName] = fullName.split(\":\");\r\n const schema = await schemaLocater.getSchema(new SchemaKey(schemaName), SchemaMatchType.Latest);\r\n if (!schema) {\r\n return undefined;\r\n }\r\n return schema.getItem(propKoqName, KindOfQuantity);\r\n}\r\n\r\nasync function getKoqFormatProps(\r\n koq: KindOfQuantity,\r\n persistenceUnit: Unit | InvertedUnit,\r\n defaultFormats: FormatsMap | undefined,\r\n unitSystem?: UnitSystemKey,\r\n) {\r\n const unitSystemMatchers = getUnitSystemGroupMatchers(unitSystem);\r\n // use one of KOQ presentation format that matches requested unit system\r\n const presentationFormat = await getKoqPresentationFormat(koq, unitSystemMatchers);\r\n if (presentationFormat) {\r\n return getFormatProps(presentationFormat);\r\n }\r\n\r\n // use one of the formats in default formats map if there is one for matching phenomena and requested unit\r\n // system combination\r\n if (defaultFormats && unitSystem) {\r\n const actualPersistenceUnit = persistenceUnit instanceof InvertedUnit ? /* c8 ignore next */ await persistenceUnit.invertsUnit : persistenceUnit;\r\n const phenomenon = await actualPersistenceUnit?.phenomenon;\r\n if (phenomenon && defaultFormats[phenomenon.name.toUpperCase()]) {\r\n const defaultPhenomenonFormats = defaultFormats[phenomenon.name.toUpperCase()];\r\n for (const defaultUnitSystemFormat of Array.isArray(defaultPhenomenonFormats)\r\n ? /* c8 ignore next */ defaultPhenomenonFormats\r\n : [defaultPhenomenonFormats]) {\r\n if (defaultUnitSystemFormat.unitSystems.includes(unitSystem)) {\r\n return defaultUnitSystemFormat.format;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // use persistence unit format if it matches requested unit system and matching presentation format was not found\r\n const persistenceUnitSystem = await persistenceUnit.unitSystem;\r\n if (persistenceUnitSystem && unitSystemMatchers.some((matcher) => matcher(persistenceUnitSystem))) {\r\n return getPersistenceUnitFormatProps(persistenceUnit);\r\n }\r\n\r\n // use default presentation format if persistence unit does not match requested unit system\r\n if (koq.defaultPresentationFormat) {\r\n return getFormatProps(koq.defaultPresentationFormat);\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nasync function getKoqPresentationFormat(koq: KindOfQuantity, unitSystemMatchers: Array<(unitSystem: UnitSystem) => boolean>) {\r\n const presentationFormats = koq.presentationFormats;\r\n for (const matcher of unitSystemMatchers) {\r\n for (const format of presentationFormats) {\r\n const unit = format.units && format.units[0][0];\r\n /* c8 ignore next 3 */\r\n if (!unit) {\r\n continue;\r\n }\r\n const currentUnitSystem = await unit.unitSystem;\r\n if (currentUnitSystem && matcher(currentUnitSystem)) {\r\n return format;\r\n }\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getPersistenceUnitFormatProps(persistenceUnit: Unit | InvertedUnit): FormatProps {\r\n // Same as Format \"DefaultRealU\" in Formats ecschema\r\n return {\r\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\r\n precision: 6,\r\n type: \"Decimal\",\r\n uomSeparator: \" \",\r\n decimalSeparator: \".\",\r\n composite: {\r\n units: [\r\n {\r\n name: persistenceUnit.fullName,\r\n label: persistenceUnit.label,\r\n },\r\n ],\r\n },\r\n };\r\n}\r\n\r\nfunction getUnitSystemGroupMatchers(groupKey?: UnitSystemKey) {\r\n function createMatcher(name: string | string[]) {\r\n const names = Array.isArray(name) ? name : [name];\r\n return (unitSystem: UnitSystem) => names.some((n) => n === unitSystem.name.toUpperCase());\r\n }\r\n switch (groupKey) {\r\n case \"imperial\":\r\n return [\"IMPERIAL\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"metric\":\r\n return [[\"SI\", \"METRIC\"], \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"usCustomary\":\r\n return [\"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n case \"usSurvey\":\r\n return [\"USSURVEY\", \"USCUSTOM\", \"INTERNATIONAL\", \"FINANCE\"].map(createMatcher);\r\n }\r\n return [];\r\n}\r\n"]}
@@ -9,39 +9,11 @@ export interface LabelCompositeValue {
9
9
  separator: string;
10
10
  values: LabelDefinition[];
11
11
  }
12
- /**
13
- * JSON representation of [[LabelCompositeValue]]
14
- * @public
15
- * @deprecated in 3.x. Use [[LabelCompositeValue]].
16
- */
17
- export interface LabelCompositeValueJSON {
18
- separator: string;
19
- values: LabelDefinition[];
20
- }
21
- /** @public */
22
- export declare namespace LabelCompositeValue {
23
- /**
24
- * Serialize given [[LabelCompositeValue]] to JSON
25
- * @deprecated in 3.x. Use [[LabelCompositeValue]].
26
- */
27
- function toJSON(compositeValue: LabelCompositeValue): LabelCompositeValueJSON;
28
- /**
29
- * Deserialize [[LabelCompositeValue]] from JSON
30
- * @deprecated in 3.x. Use [[LabelCompositeValue]].
31
- */
32
- function fromJSON(json: LabelCompositeValueJSON): LabelCompositeValue;
33
- }
34
12
  /**
35
13
  * Type definition of label raw value.
36
14
  * @public
37
15
  */
38
16
  export type LabelRawValue = string | number | boolean | LabelCompositeValue;
39
- /**
40
- * JSON representation of [[LabelRawValue]]
41
- * @public
42
- * @deprecated in 3.x. Use [[LabelRawValue]].
43
- */
44
- export type LabelRawValueJSON = LabelRawValue;
45
17
  /**
46
18
  * Data structure that describes label definition.
47
19
  * @public
@@ -54,30 +26,10 @@ export interface LabelDefinition {
54
26
  /** Type name of raw value */
55
27
  typeName: string;
56
28
  }
57
- /**
58
- * JSON representation of [[LabelDefinition]]
59
- * @public
60
- * @deprecated in 3.x. Use [[LabelDefinition]].
61
- */
62
- export interface LabelDefinitionJSON {
63
- displayValue: string;
64
- rawValue: LabelRawValue;
65
- typeName: string;
66
- }
29
+ /** @internal */
30
+ export declare const COMPOSITE_LABEL_DEFINITION_TYPENAME = "composite";
67
31
  /** @public */
68
32
  export declare namespace LabelDefinition {
69
- /**
70
- * Serialize given [[LabelDefinition]] to JSON
71
- * @deprecated in 3.x. Use [[LabelDefinition]].
72
- */
73
- function toJSON(labelDefinition: LabelDefinition): LabelDefinitionJSON;
74
- /**
75
- * Deserialize [[LabelDefinition]] from JSON
76
- * @deprecated in 3.x. Use [[LabelDefinition]].
77
- */
78
- function fromJSON(json: LabelDefinitionJSON | string): LabelDefinition;
79
- /** @internal */
80
- const COMPOSITE_DEFINITION_TYPENAME = "composite";
81
33
  /**
82
34
  * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].
83
35
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"LabelDefinition.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,cAAc;AACd,yBAAiB,mBAAmB,CAAC;IACnC;;;OAGG;IAEH,SAAgB,MAAM,CAAC,cAAc,EAAE,mBAAmB,GAAG,uBAAuB,CAEnF;IAED;;;OAGG;IAEH,SAAgB,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,mBAAmB,CAE3E;CACF;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,QAAQ,EAAE,aAAa,CAAC;IACxB,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,cAAc;AACd,yBAAiB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Ae,CAM9D;CACF"}
@@ -7,61 +7,18 @@
7
7
  * @module Hierarchies
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.LabelDefinition = exports.LabelCompositeValue = void 0;
11
- /** @public */
12
- var LabelCompositeValue;
13
- (function (LabelCompositeValue) {
14
- /**
15
- * Serialize given [[LabelCompositeValue]] to JSON
16
- * @deprecated in 3.x. Use [[LabelCompositeValue]].
17
- */
18
- // eslint-disable-next-line @typescript-eslint/no-deprecated
19
- function toJSON(compositeValue) {
20
- return { ...compositeValue };
21
- }
22
- LabelCompositeValue.toJSON = toJSON;
23
- /**
24
- * Deserialize [[LabelCompositeValue]] from JSON
25
- * @deprecated in 3.x. Use [[LabelCompositeValue]].
26
- */
27
- // eslint-disable-next-line @typescript-eslint/no-deprecated
28
- function fromJSON(json) {
29
- return { ...json };
30
- }
31
- LabelCompositeValue.fromJSON = fromJSON;
32
- })(LabelCompositeValue || (exports.LabelCompositeValue = LabelCompositeValue = {}));
10
+ exports.LabelDefinition = exports.COMPOSITE_LABEL_DEFINITION_TYPENAME = void 0;
11
+ /** @internal */
12
+ exports.COMPOSITE_LABEL_DEFINITION_TYPENAME = "composite";
33
13
  /** @public */
34
14
  var LabelDefinition;
35
15
  (function (LabelDefinition) {
36
- /**
37
- * Serialize given [[LabelDefinition]] to JSON
38
- * @deprecated in 3.x. Use [[LabelDefinition]].
39
- */
40
- // eslint-disable-next-line @typescript-eslint/no-deprecated
41
- function toJSON(labelDefinition) {
42
- return { ...labelDefinition };
43
- }
44
- LabelDefinition.toJSON = toJSON;
45
- /**
46
- * Deserialize [[LabelDefinition]] from JSON
47
- * @deprecated in 3.x. Use [[LabelDefinition]].
48
- */
49
- // eslint-disable-next-line @typescript-eslint/no-deprecated
50
- function fromJSON(json) {
51
- if (typeof json === "string") {
52
- return JSON.parse(json);
53
- }
54
- return { ...json };
55
- }
56
- LabelDefinition.fromJSON = fromJSON;
57
- /** @internal */
58
- LabelDefinition.COMPOSITE_DEFINITION_TYPENAME = "composite";
59
16
  /**
60
17
  * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].
61
18
  * @public
62
19
  */
63
20
  function isCompositeDefinition(def) {
64
- return def.typeName === LabelDefinition.COMPOSITE_DEFINITION_TYPENAME;
21
+ return def.typeName === exports.COMPOSITE_LABEL_DEFINITION_TYPENAME;
65
22
  }
66
23
  LabelDefinition.isCompositeDefinition = isCompositeDefinition;
67
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAqBH,cAAc;AACd,IAAiB,mBAAmB,CAkBnC;AAlBD,WAAiB,mBAAmB;IAClC;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,cAAmC;QACxD,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;IAFe,0BAAM,SAErB,CAAA;IAED;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,QAAQ,CAAC,IAA6B;QACpD,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IACrB,CAAC;IAFe,4BAAQ,WAEvB,CAAA;AACH,CAAC,EAlBgB,mBAAmB,mCAAnB,mBAAmB,QAkBnC;AAuCD,cAAc;AACd,IAAiB,eAAe,CA4C/B;AA5CD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,MAAM,CAAC,eAAgC;QACrD,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;IAChC,CAAC;IAFe,sBAAM,SAErB,CAAA;IAED;;;OAGG;IACH,4DAA4D;IAC5D,SAAgB,QAAQ,CAAC,IAAkC;QACzD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IACrB,CAAC;IALe,wBAAQ,WAKvB,CAAA;IAED,gBAAgB;IACH,6CAA6B,GAAG,WAAW,CAAC;IAEzD;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,gBAAA,6BAA6B,CAAC;IACxD,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EA5CgB,eAAe,+BAAf,eAAe,QA4C/B","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 Hierarchies\r\n */\r\n\r\n/**\r\n * Data structure that describes raw composite label value.\r\n * @public\r\n */\r\nexport interface LabelCompositeValue {\r\n separator: string;\r\n values: LabelDefinition[];\r\n}\r\n\r\n/**\r\n * JSON representation of [[LabelCompositeValue]]\r\n * @public\r\n * @deprecated in 3.x. Use [[LabelCompositeValue]].\r\n */\r\nexport interface LabelCompositeValueJSON {\r\n separator: string;\r\n values: LabelDefinition[];\r\n}\r\n\r\n/** @public */\r\nexport namespace LabelCompositeValue {\r\n /**\r\n * Serialize given [[LabelCompositeValue]] to JSON\r\n * @deprecated in 3.x. Use [[LabelCompositeValue]].\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(compositeValue: LabelCompositeValue): LabelCompositeValueJSON {\r\n return { ...compositeValue };\r\n }\r\n\r\n /**\r\n * Deserialize [[LabelCompositeValue]] from JSON\r\n * @deprecated in 3.x. Use [[LabelCompositeValue]].\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: LabelCompositeValueJSON): LabelCompositeValue {\r\n return { ...json };\r\n }\r\n}\r\n\r\n/**\r\n * Type definition of label raw value.\r\n * @public\r\n */\r\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\r\n\r\n/**\r\n * JSON representation of [[LabelRawValue]]\r\n * @public\r\n * @deprecated in 3.x. Use [[LabelRawValue]].\r\n */\r\nexport type LabelRawValueJSON = LabelRawValue;\r\n\r\n/**\r\n * Data structure that describes label definition.\r\n * @public\r\n */\r\nexport interface LabelDefinition {\r\n /** Display value of label */\r\n displayValue: string;\r\n /** Raw value of label */\r\n rawValue: LabelRawValue;\r\n /** Type name of raw value */\r\n typeName: string;\r\n}\r\n\r\n/**\r\n * JSON representation of [[LabelDefinition]]\r\n * @public\r\n * @deprecated in 3.x. Use [[LabelDefinition]].\r\n */\r\nexport interface LabelDefinitionJSON {\r\n displayValue: string;\r\n rawValue: LabelRawValue;\r\n typeName: string;\r\n}\r\n\r\n/** @public */\r\nexport namespace LabelDefinition {\r\n /**\r\n * Serialize given [[LabelDefinition]] to JSON\r\n * @deprecated in 3.x. Use [[LabelDefinition]].\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function toJSON(labelDefinition: LabelDefinition): LabelDefinitionJSON {\r\n return { ...labelDefinition };\r\n }\r\n\r\n /**\r\n * Deserialize [[LabelDefinition]] from JSON\r\n * @deprecated in 3.x. Use [[LabelDefinition]].\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n export function fromJSON(json: LabelDefinitionJSON | string): LabelDefinition {\r\n if (typeof json === \"string\") {\r\n return JSON.parse(json);\r\n }\r\n return { ...json };\r\n }\r\n\r\n /** @internal */\r\n export const COMPOSITE_DEFINITION_TYPENAME = \"composite\";\r\n\r\n /**\r\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\r\n * @public\r\n */\r\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\r\n return def.typeName === COMPOSITE_DEFINITION_TYPENAME;\r\n }\r\n\r\n /**\r\n * Creates [[LabelDefinition]] from string value.\r\n * @public\r\n */\r\n export function fromLabelString(label: string): LabelDefinition {\r\n return {\r\n displayValue: label,\r\n rawValue: label,\r\n typeName: \"string\",\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"LabelDefinition.js","sourceRoot":"","sources":["../../../src/presentation-common/LabelDefinition.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AA8BH,gBAAgB;AACH,QAAA,mCAAmC,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,IAAiB,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC9B;;;OAGG;IACH,SAAgB,qBAAqB,CAAC,GAAoB;QACxD,OAAO,GAAG,CAAC,QAAQ,KAAK,2CAAmC,CAAC;IAC9D,CAAC;IAFe,qCAAqB,wBAEpC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,KAAa;QAC3C,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC;IANe,+BAAe,kBAM9B,CAAA;AACH,CAAC,EApBgB,eAAe,+BAAf,eAAe,QAoB/B","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 Hierarchies\r\n */\r\n\r\n/**\r\n * Data structure that describes raw composite label value.\r\n * @public\r\n */\r\nexport interface LabelCompositeValue {\r\n separator: string;\r\n values: LabelDefinition[];\r\n}\r\n\r\n/**\r\n * Type definition of label raw value.\r\n * @public\r\n */\r\nexport type LabelRawValue = string | number | boolean | LabelCompositeValue;\r\n\r\n/**\r\n * Data structure that describes label definition.\r\n * @public\r\n */\r\nexport interface LabelDefinition {\r\n /** Display value of label */\r\n displayValue: string;\r\n /** Raw value of label */\r\n rawValue: LabelRawValue;\r\n /** Type name of raw value */\r\n typeName: string;\r\n}\r\n\r\n/** @internal */\r\nexport const COMPOSITE_LABEL_DEFINITION_TYPENAME = \"composite\";\r\n\r\n/** @public */\r\nexport namespace LabelDefinition {\r\n /**\r\n * Checks if provided [[LabelDefinition]] has raw value of type [[LabelCompositeValue]].\r\n * @public\r\n */\r\n export function isCompositeDefinition(def: LabelDefinition): def is LabelDefinition & { rawValue: LabelCompositeValue } {\r\n return def.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME;\r\n }\r\n\r\n /**\r\n * Creates [[LabelDefinition]] from string value.\r\n * @public\r\n */\r\n export function fromLabelString(label: string): LabelDefinition {\r\n return {\r\n displayValue: label,\r\n rawValue: label,\r\n typeName: \"string\",\r\n };\r\n }\r\n}\r\n"]}
@@ -1,16 +1,15 @@
1
1
  /** @packageDocumentation
2
2
  * @module Core
3
3
  */
4
- import { Content } from "./content/Content";
5
- import { Descriptor } from "./content/Descriptor";
6
- import { Item } from "./content/Item";
7
- import { DisplayValueGroup } from "./content/Value";
8
- import { ElementProperties } from "./ElementProperties";
9
- import { Node } from "./hierarchy/Node";
10
- import { NodePathElement } from "./hierarchy/NodePathElement";
11
- import { LabelDefinition } from "./LabelDefinition";
12
- /** @internal */
13
- export interface LocalizationHelperProps {
4
+ import { Content } from "./content/Content.js";
5
+ import { Descriptor } from "./content/Descriptor.js";
6
+ import { Item } from "./content/Item.js";
7
+ import { DisplayValueGroup } from "./content/Value.js";
8
+ import { ElementProperties } from "./ElementProperties.js";
9
+ import { Node } from "./hierarchy/Node.js";
10
+ import { NodePathElement } from "./hierarchy/NodePathElement.js";
11
+ import { LabelDefinition } from "./LabelDefinition.js";
12
+ interface LocalizationHelperProps {
14
13
  getLocalizedString: (key: string) => string;
15
14
  }
16
15
  /** @internal */
@@ -34,4 +33,5 @@ export declare class LocalizationHelper {
34
33
  getLocalizedNode(node: Node): Node;
35
34
  private getLocalizedDisplayValue;
36
35
  }
36
+ export {};
37
37
  //# sourceMappingURL=LocalizationHelper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAgB,iBAAiB,EAAS,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAuB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzE,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C;AAED,gBAAgB;AAChB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,mBAAmB,CAA0B;gBAEzC,KAAK,EAAE,uBAAuB;IAInC,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAI/B,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;IAIxC,2BAA2B,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe;IAQlE,6BAA6B,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB;IAO1E,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,eAAe;IAsB9E,4BAA4B,CAAC,gBAAgB,EAAE,eAAe,EAAE;IAIhE,6BAA6B,CAAC,UAAU,EAAE,UAAU;IAOpD,wBAAwB,CAAC,KAA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C,KAAK,EAAE,iBAAiB,GAAG,iBAAiB;IAO1E,2BAA2B,CAAC,eAAe,EAAE,eAAe,GAAG,eAAe;IAsB9E,4BAA4B,CAAC,gBAAgB,EAAE,eAAe,EAAE;IAIhE,6BAA6B,CAAC,UAAU,EAAE,UAAU;IAOpD,wBAAwB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;IAI/C,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAI9C,6BAA6B,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB;IAQhF,OAAO,CAAC,uBAAuB;IAO/B,OAAO,CAAC,oBAAoB;IA2B5B,OAAO,CAAC,wBAAwB;IAehC,OAAO,CAAC,+BAA+B;IAMhC,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAQzC,OAAO,CAAC,wBAAwB;CAYjC"}
@@ -8,13 +8,14 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LocalizationHelper = void 0;
11
- const Content_1 = require("./content/Content");
12
- const Descriptor_1 = require("./content/Descriptor");
13
- const Value_1 = require("./content/Value");
14
- const LabelDefinition_1 = require("./LabelDefinition");
11
+ const Content_js_1 = require("./content/Content.js");
12
+ const Descriptor_js_1 = require("./content/Descriptor.js");
13
+ const Value_js_1 = require("./content/Value.js");
14
+ const LabelDefinition_js_1 = require("./LabelDefinition.js");
15
15
  const KEY_PATTERN = /@[\w\d\-_]+:[\w\d\-\._]+?@/g;
16
16
  /** @internal */
17
17
  class LocalizationHelper {
18
+ _getLocalizedString;
18
19
  constructor(props) {
19
20
  this._getLocalizedString = props.getLocalizedString;
20
21
  }
@@ -42,7 +43,7 @@ class LocalizationHelper {
42
43
  ...compositeValue,
43
44
  values: compositeValue.values.map((value) => this.getLocalizedLabelDefinition(value)),
44
45
  });
45
- if (labelDefinition.typeName === LabelDefinition_1.LabelDefinition.COMPOSITE_DEFINITION_TYPENAME) {
46
+ if (labelDefinition.typeName === LabelDefinition_js_1.COMPOSITE_LABEL_DEFINITION_TYPENAME) {
46
47
  return {
47
48
  ...labelDefinition,
48
49
  rawValue: getLocalizedComposite(labelDefinition.rawValue),
@@ -61,7 +62,7 @@ class LocalizationHelper {
61
62
  return labelDefinitions.map((labelDefinition) => this.getLocalizedLabelDefinition(labelDefinition));
62
63
  }
63
64
  getLocalizedContentDescriptor(descriptor) {
64
- const clone = new Descriptor_1.Descriptor(descriptor);
65
+ const clone = new Descriptor_js_1.Descriptor(descriptor);
65
66
  clone.fields.forEach((field) => this.getLocalizedContentField(field));
66
67
  clone.categories.forEach((category) => this.getLocalizedCategoryDescription(category));
67
68
  return clone;
@@ -70,7 +71,7 @@ class LocalizationHelper {
70
71
  return items.map((item) => this.getLocalizedContentItem(item));
71
72
  }
72
73
  getLocalizedContent(content) {
73
- return new Content_1.Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));
74
+ return new Content_js_1.Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));
74
75
  }
75
76
  getLocalizedElementProperties(elem) {
76
77
  return {
@@ -89,23 +90,23 @@ class LocalizationHelper {
89
90
  if (typeof value === "string") {
90
91
  return this.getLocalizedString(value);
91
92
  }
92
- if (Value_1.Value.isNavigationValue(value)) {
93
+ if (Value_js_1.Value.isNavigationValue(value)) {
93
94
  return {
94
95
  ...value,
95
96
  label: this.getLocalizedLabelDefinition(value.label),
96
97
  };
97
98
  }
98
- if (Value_1.Value.isNestedContent(value)) {
99
+ if (Value_js_1.Value.isNestedContent(value)) {
99
100
  return value.map((item) => ({
100
101
  ...item,
101
102
  values: Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {}),
102
103
  displayValues: Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {}),
103
104
  }));
104
105
  }
105
- if (Value_1.Value.isArray(value)) {
106
+ if (Value_js_1.Value.isArray(value)) {
106
107
  return value.map((v) => this.getLocalizedRawValue(v));
107
108
  }
108
- if (Value_1.Value.isMap(value)) {
109
+ if (Value_js_1.Value.isMap(value)) {
109
110
  return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});
110
111
  }
111
112
  return value;
@@ -146,7 +147,7 @@ class LocalizationHelper {
146
147
  if (typeof value === "string") {
147
148
  return this.getLocalizedString(value);
148
149
  }
149
- if (Value_1.DisplayValue.isArray(value)) {
150
+ if (Value_js_1.DisplayValue.isArray(value)) {
150
151
  return value.map((v) => this.getLocalizedDisplayValue(v));
151
152
  }
152
153
  return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});
@@ -1 +1 @@
1
- {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,+CAA4C;AAC5C,qDAAkD;AAGlD,2CAAyE;AAIzE,uDAAyE;AAEzE,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAOlD,gBAAgB;AAChB,MAAa,kBAAkB;IAG7B,YAAY,KAA8B;QACxC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;IACtD,CAAC;IAEM,kBAAkB,CAAC,IAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAEM,iBAAiB,CAAC,KAAa;QACpC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAEM,2BAA2B,CAAC,GAAoB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C,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF;AA1JD,gDA0JC","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 Core\r\n */\r\n\r\nimport { CategoryDescription } from \"./content/Category\";\r\nimport { Content } from \"./content/Content\";\r\nimport { Descriptor } from \"./content/Descriptor\";\r\nimport { Field } from \"./content/Fields\";\r\nimport { Item } from \"./content/Item\";\r\nimport { DisplayValue, DisplayValueGroup, Value } from \"./content/Value\";\r\nimport { ElementProperties } from \"./ElementProperties\";\r\nimport { Node } from \"./hierarchy/Node\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement\";\r\nimport { LabelCompositeValue, LabelDefinition } from \"./LabelDefinition\";\r\n\r\nconst KEY_PATTERN = /@[\\w\\d\\-_]+:[\\w\\d\\-\\._]+?@/g;\r\n\r\n/** @internal */\r\nexport interface LocalizationHelperProps {\r\n getLocalizedString: (key: string) => string;\r\n}\r\n\r\n/** @internal */\r\nexport class LocalizationHelper {\r\n private _getLocalizedString: (key: string) => string;\r\n\r\n constructor(props: LocalizationHelperProps) {\r\n this._getLocalizedString = props.getLocalizedString;\r\n }\r\n\r\n public getLocalizedString(text: string) {\r\n return text.replace(KEY_PATTERN, (key) => this._getLocalizedString(key.replace(/^@|@$/g, \"\")));\r\n }\r\n\r\n public getLocalizedNodes(nodes: Node[]): Node[] {\r\n return nodes.map((n) => this.getLocalizedNode(n));\r\n }\r\n\r\n public getLocalizedNodePathElement(npe: NodePathElement): NodePathElement {\r\n return {\r\n ...npe,\r\n node: this.getLocalizedNode(npe.node),\r\n children: npe.children.map((c) => this.getLocalizedNodePathElement(c)),\r\n };\r\n }\r\n\r\n public getLocalizedDisplayValueGroup(group: DisplayValueGroup): DisplayValueGroup {\r\n return {\r\n ...group,\r\n displayValue: this.getLocalizedDisplayValue(group.displayValue),\r\n };\r\n }\r\n\r\n public getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition {\r\n const getLocalizedComposite = (compositeValue: LabelCompositeValue) => ({\r\n ...compositeValue,\r\n values: compositeValue.values.map((value) => this.getLocalizedLabelDefinition(value)),\r\n });\r\n\r\n if (labelDefinition.typeName === LabelDefinition.COMPOSITE_DEFINITION_TYPENAME) {\r\n return {\r\n ...labelDefinition,\r\n rawValue: getLocalizedComposite(labelDefinition.rawValue as LabelCompositeValue),\r\n };\r\n }\r\n if (labelDefinition.typeName === \"string\") {\r\n return {\r\n ...labelDefinition,\r\n rawValue: this.getLocalizedString(labelDefinition.rawValue as string),\r\n displayValue: this.getLocalizedString(labelDefinition.displayValue),\r\n };\r\n }\r\n return labelDefinition;\r\n }\r\n\r\n public getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]) {\r\n return labelDefinitions.map((labelDefinition) => this.getLocalizedLabelDefinition(labelDefinition));\r\n }\r\n\r\n public getLocalizedContentDescriptor(descriptor: Descriptor) {\r\n const clone = new Descriptor(descriptor);\r\n clone.fields.forEach((field) => this.getLocalizedContentField(field));\r\n clone.categories.forEach((category) => this.getLocalizedCategoryDescription(category));\r\n return clone;\r\n }\r\n\r\n public getLocalizedContentItems(items: Item[]): Item[] {\r\n return items.map((item) => this.getLocalizedContentItem(item));\r\n }\r\n\r\n public getLocalizedContent(content: Content): Content {\r\n return new Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));\r\n }\r\n\r\n public getLocalizedElementProperties(elem: ElementProperties): ElementProperties {\r\n return {\r\n ...elem,\r\n label: this.getLocalizedString(elem.label),\r\n };\r\n }\r\n\r\n // warning: this function mutates the item\r\n private getLocalizedContentItem(item: Item): Item {\r\n item.label = this.getLocalizedLabelDefinition(item.label);\r\n item.values = Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n item.displayValues = Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n return item;\r\n }\r\n\r\n private getLocalizedRawValue(value: Value): Value {\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (Value.isNavigationValue(value)) {\r\n return {\r\n ...value,\r\n label: this.getLocalizedLabelDefinition(value.label),\r\n };\r\n }\r\n if (Value.isNestedContent(value)) {\r\n return value.map((item) => ({\r\n ...item,\r\n values: Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {}),\r\n displayValues: Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {}),\r\n }));\r\n }\r\n if (Value.isArray(value)) {\r\n return value.map((v) => this.getLocalizedRawValue(v));\r\n }\r\n if (Value.isMap(value)) {\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n }\r\n return value;\r\n }\r\n\r\n // warning: this function mutates the field\r\n private getLocalizedContentField<TField extends Field>(field: TField) {\r\n field.label = this.getLocalizedString(field.label);\r\n if (field.isPropertiesField()) {\r\n if (field.isStructPropertiesField()) {\r\n field.memberFields = field.memberFields.map((m) => this.getLocalizedContentField(m));\r\n } else if (field.isArrayPropertiesField()) {\r\n field.itemsField = this.getLocalizedContentField(field.itemsField);\r\n }\r\n } else if (field.isNestedContentField()) {\r\n field.nestedFields = field.nestedFields.map((m) => this.getLocalizedContentField(m));\r\n }\r\n return field;\r\n }\r\n\r\n // warning: this function mutates the category\r\n private getLocalizedCategoryDescription(category: CategoryDescription) {\r\n category.label = this.getLocalizedString(category.label);\r\n category.description = this.getLocalizedString(category.description);\r\n return category;\r\n }\r\n\r\n public getLocalizedNode(node: Node): Node {\r\n return {\r\n ...node,\r\n label: this.getLocalizedLabelDefinition(node.label),\r\n ...(node.description ? { description: this.getLocalizedString(node.description) } : undefined),\r\n };\r\n }\r\n\r\n private getLocalizedDisplayValue(value: DisplayValue): DisplayValue {\r\n if (typeof value === \"undefined\") {\r\n return undefined;\r\n }\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (DisplayValue.isArray(value)) {\r\n return value.map((v) => this.getLocalizedDisplayValue(v));\r\n }\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"LocalizationHelper.js","sourceRoot":"","sources":["../../../src/presentation-common/LocalizationHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,qDAA+C;AAC/C,2DAAqD;AAGrD,iDAA4E;AAI5E,6DAAiH;AAEjH,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAMlD,gBAAgB;AAChB,MAAa,kBAAkB;IACrB,mBAAmB,CAA0B;IAErD,YAAY,KAA8B;QACxC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;IACtD,CAAC;IAEM,kBAAkB,CAAC,IAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IACj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AAC;QACnB,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,uBAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF;AA1JD,gDA0JC","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 Core\r\n */\r\n\r\nimport { CategoryDescription } from \"./content/Category.js\";\r\nimport { Content } from \"./content/Content.js\";\r\nimport { Descriptor } from \"./content/Descriptor.js\";\r\nimport { Field } from \"./content/Fields.js\";\r\nimport { Item } from \"./content/Item.js\";\r\nimport { DisplayValue, DisplayValueGroup, Value } from \"./content/Value.js\";\r\nimport { ElementProperties } from \"./ElementProperties.js\";\r\nimport { Node } from \"./hierarchy/Node.js\";\r\nimport { NodePathElement } from \"./hierarchy/NodePathElement.js\";\r\nimport { COMPOSITE_LABEL_DEFINITION_TYPENAME, LabelCompositeValue, LabelDefinition } from \"./LabelDefinition.js\";\r\n\r\nconst KEY_PATTERN = /@[\\w\\d\\-_]+:[\\w\\d\\-\\._]+?@/g;\r\n\r\ninterface LocalizationHelperProps {\r\n getLocalizedString: (key: string) => string;\r\n}\r\n\r\n/** @internal */\r\nexport class LocalizationHelper {\r\n private _getLocalizedString: (key: string) => string;\r\n\r\n constructor(props: LocalizationHelperProps) {\r\n this._getLocalizedString = props.getLocalizedString;\r\n }\r\n\r\n public getLocalizedString(text: string) {\r\n return text.replace(KEY_PATTERN, (key) => this._getLocalizedString(key.replace(/^@|@$/g, \"\")));\r\n }\r\n\r\n public getLocalizedNodes(nodes: Node[]): Node[] {\r\n return nodes.map((n) => this.getLocalizedNode(n));\r\n }\r\n\r\n public getLocalizedNodePathElement(npe: NodePathElement): NodePathElement {\r\n return {\r\n ...npe,\r\n node: this.getLocalizedNode(npe.node),\r\n children: npe.children.map((c) => this.getLocalizedNodePathElement(c)),\r\n };\r\n }\r\n\r\n public getLocalizedDisplayValueGroup(group: DisplayValueGroup): DisplayValueGroup {\r\n return {\r\n ...group,\r\n displayValue: this.getLocalizedDisplayValue(group.displayValue),\r\n };\r\n }\r\n\r\n public getLocalizedLabelDefinition(labelDefinition: LabelDefinition): LabelDefinition {\r\n const getLocalizedComposite = (compositeValue: LabelCompositeValue) => ({\r\n ...compositeValue,\r\n values: compositeValue.values.map((value) => this.getLocalizedLabelDefinition(value)),\r\n });\r\n\r\n if (labelDefinition.typeName === COMPOSITE_LABEL_DEFINITION_TYPENAME) {\r\n return {\r\n ...labelDefinition,\r\n rawValue: getLocalizedComposite(labelDefinition.rawValue as LabelCompositeValue),\r\n };\r\n }\r\n if (labelDefinition.typeName === \"string\") {\r\n return {\r\n ...labelDefinition,\r\n rawValue: this.getLocalizedString(labelDefinition.rawValue as string),\r\n displayValue: this.getLocalizedString(labelDefinition.displayValue),\r\n };\r\n }\r\n return labelDefinition;\r\n }\r\n\r\n public getLocalizedLabelDefinitions(labelDefinitions: LabelDefinition[]) {\r\n return labelDefinitions.map((labelDefinition) => this.getLocalizedLabelDefinition(labelDefinition));\r\n }\r\n\r\n public getLocalizedContentDescriptor(descriptor: Descriptor) {\r\n const clone = new Descriptor(descriptor);\r\n clone.fields.forEach((field) => this.getLocalizedContentField(field));\r\n clone.categories.forEach((category) => this.getLocalizedCategoryDescription(category));\r\n return clone;\r\n }\r\n\r\n public getLocalizedContentItems(items: Item[]): Item[] {\r\n return items.map((item) => this.getLocalizedContentItem(item));\r\n }\r\n\r\n public getLocalizedContent(content: Content): Content {\r\n return new Content(this.getLocalizedContentDescriptor(content.descriptor), this.getLocalizedContentItems(content.contentSet));\r\n }\r\n\r\n public getLocalizedElementProperties(elem: ElementProperties): ElementProperties {\r\n return {\r\n ...elem,\r\n label: this.getLocalizedString(elem.label),\r\n };\r\n }\r\n\r\n // warning: this function mutates the item\r\n private getLocalizedContentItem(item: Item): Item {\r\n item.label = this.getLocalizedLabelDefinition(item.label);\r\n item.values = Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n item.displayValues = Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n return item;\r\n }\r\n\r\n private getLocalizedRawValue(value: Value): Value {\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (Value.isNavigationValue(value)) {\r\n return {\r\n ...value,\r\n label: this.getLocalizedLabelDefinition(value.label),\r\n };\r\n }\r\n if (Value.isNestedContent(value)) {\r\n return value.map((item) => ({\r\n ...item,\r\n values: Object.entries(item.values).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {}),\r\n displayValues: Object.entries(item.displayValues).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {}),\r\n }));\r\n }\r\n if (Value.isArray(value)) {\r\n return value.map((v) => this.getLocalizedRawValue(v));\r\n }\r\n if (Value.isMap(value)) {\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedRawValue(v) }), {});\r\n }\r\n return value;\r\n }\r\n\r\n // warning: this function mutates the field\r\n private getLocalizedContentField<TField extends Field>(field: TField) {\r\n field.label = this.getLocalizedString(field.label);\r\n if (field.isPropertiesField()) {\r\n if (field.isStructPropertiesField()) {\r\n field.memberFields = field.memberFields.map((m) => this.getLocalizedContentField(m));\r\n } else if (field.isArrayPropertiesField()) {\r\n field.itemsField = this.getLocalizedContentField(field.itemsField);\r\n }\r\n } else if (field.isNestedContentField()) {\r\n field.nestedFields = field.nestedFields.map((m) => this.getLocalizedContentField(m));\r\n }\r\n return field;\r\n }\r\n\r\n // warning: this function mutates the category\r\n private getLocalizedCategoryDescription(category: CategoryDescription) {\r\n category.label = this.getLocalizedString(category.label);\r\n category.description = this.getLocalizedString(category.description);\r\n return category;\r\n }\r\n\r\n public getLocalizedNode(node: Node): Node {\r\n return {\r\n ...node,\r\n label: this.getLocalizedLabelDefinition(node.label),\r\n ...(node.description ? { description: this.getLocalizedString(node.description) } : undefined),\r\n };\r\n }\r\n\r\n private getLocalizedDisplayValue(value: DisplayValue): DisplayValue {\r\n if (typeof value === \"undefined\") {\r\n return undefined;\r\n }\r\n if (typeof value === \"string\") {\r\n return this.getLocalizedString(value);\r\n }\r\n if (DisplayValue.isArray(value)) {\r\n return value.map((v) => this.getLocalizedDisplayValue(v));\r\n }\r\n return Object.entries(value).reduce((o, [k, v]) => ({ ...o, [k]: this.getLocalizedDisplayValue(v) }), {});\r\n }\r\n}\r\n"]}
@@ -1,20 +1,17 @@
1
1
  /** @packageDocumentation
2
2
  * @module Core
3
3
  */
4
- import { RulesetVariableJSON } from "./RulesetVariables";
4
+ import { RulesetVariableJSON } from "./RulesetVariables.js";
5
5
  /** @internal */
6
6
  export declare const PRESENTATION_IPC_CHANNEL_NAME = "itwinjs-presentation/ipc-interface";
7
- /** @internal */
8
- export interface CommonIpcParams {
7
+ interface CommonIpcParams {
9
8
  clientId: string;
10
9
  }
11
- /** @internal */
12
- export interface SetRulesetVariableParams<TVariable> extends CommonIpcParams {
10
+ interface SetRulesetVariableParams<TVariable> extends CommonIpcParams {
13
11
  rulesetId: string;
14
12
  variable: TVariable;
15
13
  }
16
- /** @internal */
17
- export interface UnsetRulesetVariableParams extends CommonIpcParams {
14
+ interface UnsetRulesetVariableParams extends CommonIpcParams {
18
15
  rulesetId: string;
19
16
  variableId: string;
20
17
  }
@@ -25,4 +22,12 @@ export interface PresentationIpcInterface {
25
22
  /** Unsets ruleset variable value. */
26
23
  unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;
27
24
  }
25
+ /** @internal */
26
+ export declare enum PresentationIpcEvents {
27
+ /**
28
+ * ID of an event that's emitted when backend detects changes in presented data.
29
+ */
30
+ Update = "presentation.onUpdate"
31
+ }
32
+ export {};
28
33
  //# sourceMappingURL=PresentationIpcInterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationIpcInterface.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,uCAAuC,CAAC;AAElF,gBAAgB;AAChB,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAwB,CAAC,SAAS,CAAE,SAAQ,eAAe;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzF,qCAAqC;IACrC,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE"}
1
+ {"version":3,"file":"PresentationIpcInterface.d.ts","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,uCAAuC,CAAC;AAElF,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,wBAAwB,CAAC,SAAS,CAAE,SAAQ,eAAe;IACnE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,0BAA2B,SAAQ,eAAe;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzF,qCAAqC;IACrC,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE;AAED,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B;;OAEG;IACH,MAAM,0BAA0B;CACjC"}
@@ -7,7 +7,15 @@
7
7
  * @module Core
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.PRESENTATION_IPC_CHANNEL_NAME = void 0;
10
+ exports.PresentationIpcEvents = exports.PRESENTATION_IPC_CHANNEL_NAME = void 0;
11
11
  /** @internal */
12
12
  exports.PRESENTATION_IPC_CHANNEL_NAME = "itwinjs-presentation/ipc-interface";
13
+ /** @internal */
14
+ var PresentationIpcEvents;
15
+ (function (PresentationIpcEvents) {
16
+ /**
17
+ * ID of an event that's emitted when backend detects changes in presented data.
18
+ */
19
+ PresentationIpcEvents["Update"] = "presentation.onUpdate";
20
+ })(PresentationIpcEvents || (exports.PresentationIpcEvents = PresentationIpcEvents = {}));
13
21
  //# sourceMappingURL=PresentationIpcInterface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationIpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAIH,gBAAgB;AACH,QAAA,6BAA6B,GAAG,oCAAoC,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 Core\r\n */\r\n\r\nimport { RulesetVariableJSON } from \"./RulesetVariables\";\r\n\r\n/** @internal */\r\nexport const PRESENTATION_IPC_CHANNEL_NAME = \"itwinjs-presentation/ipc-interface\";\r\n\r\n/** @internal */\r\nexport interface CommonIpcParams {\r\n clientId: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface SetRulesetVariableParams<TVariable> extends CommonIpcParams {\r\n rulesetId: string;\r\n variable: TVariable;\r\n}\r\n\r\n/** @internal */\r\nexport interface UnsetRulesetVariableParams extends CommonIpcParams {\r\n rulesetId: string;\r\n variableId: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface PresentationIpcInterface {\r\n /** Sets ruleset variable value. */\r\n setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;\r\n\r\n /** Unsets ruleset variable value. */\r\n unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;\r\n}\r\n"]}
1
+ {"version":3,"file":"PresentationIpcInterface.js","sourceRoot":"","sources":["../../../src/presentation-common/PresentationIpcInterface.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAIH,gBAAgB;AACH,QAAA,6BAA6B,GAAG,oCAAoC,CAAC;AAyBlF,gBAAgB;AAChB,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B;;OAEG;IACH,yDAAgC,CAAA;AAClC,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC","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 Core\r\n */\r\n\r\nimport { RulesetVariableJSON } from \"./RulesetVariables.js\";\r\n\r\n/** @internal */\r\nexport const PRESENTATION_IPC_CHANNEL_NAME = \"itwinjs-presentation/ipc-interface\";\r\n\r\ninterface CommonIpcParams {\r\n clientId: string;\r\n}\r\n\r\ninterface SetRulesetVariableParams<TVariable> extends CommonIpcParams {\r\n rulesetId: string;\r\n variable: TVariable;\r\n}\r\n\r\ninterface UnsetRulesetVariableParams extends CommonIpcParams {\r\n rulesetId: string;\r\n variableId: string;\r\n}\r\n\r\n/** @internal */\r\nexport interface PresentationIpcInterface {\r\n /** Sets ruleset variable value. */\r\n setRulesetVariable(params: SetRulesetVariableParams<RulesetVariableJSON>): Promise<void>;\r\n\r\n /** Unsets ruleset variable value. */\r\n unsetRulesetVariable(params: UnsetRulesetVariableParams): Promise<void>;\r\n}\r\n\r\n/** @internal */\r\nexport enum PresentationIpcEvents {\r\n /**\r\n * ID of an event that's emitted when backend detects changes in presented data.\r\n */\r\n Update = \"presentation.onUpdate\",\r\n}\r\n"]}
@@ -3,15 +3,15 @@
3
3
  */
4
4
  import { BeEvent, Id64String } from "@itwin/core-bentley";
5
5
  import { UnitSystemKey } from "@itwin/core-quantity";
6
- import { Descriptor, SelectionInfo } from "./content/Descriptor";
7
- import { FieldDescriptor } from "./content/Fields";
8
- import { Item } from "./content/Item";
9
- import { InstanceKey } from "./EC";
10
- import { ElementProperties } from "./ElementProperties";
11
- import { InstanceFilterDefinition } from "./InstanceFilterDefinition";
12
- import { Ruleset } from "./rules/Ruleset";
13
- import { RulesetVariable } from "./RulesetVariables";
14
- import { SelectionScopeProps } from "./selection/SelectionScope";
6
+ import { Descriptor, SelectionInfo } from "./content/Descriptor.js";
7
+ import { FieldDescriptor } from "./content/Fields.js";
8
+ import { Item } from "./content/Item.js";
9
+ import { InstanceKey } from "./EC.js";
10
+ import { ElementProperties } from "./ElementProperties.js";
11
+ import { InstanceFilterDefinition } from "./InstanceFilterDefinition.js";
12
+ import { Ruleset } from "./rules/Ruleset.js";
13
+ import { RulesetVariable } from "./RulesetVariables.js";
14
+ import { SelectionScopeProps } from "./selection/SelectionScope.js";
15
15
  /**
16
16
  * A generic request options type used for both hierarchy and content requests.
17
17
  * @public
@@ -26,12 +26,6 @@ export interface RequestOptions<TIModel> {
26
26
  * unit is used if unit system is not specified.
27
27
  */
28
28
  unitSystem?: UnitSystemKey;
29
- /**
30
- * Expected form of response. This property is set automatically on newer frontends.
31
- * `unparsed-json` — deliver response from native addon without parsing it.
32
- * @internal
33
- */
34
- transport?: "unparsed-json";
35
29
  }
36
30
  /**
37
31
  * Options for requests that require presentation ruleset. Not
@@ -175,16 +169,10 @@ export interface SingleElementPropertiesRequestOptions<TIModel, TParsedContent =
175
169
  contentParser?: (descriptor: Descriptor, item: Item) => TParsedContent;
176
170
  }
177
171
  /**
178
- * Request type for multiple elements properties requests.
172
+ * Base request type for multiple elements properties requests.
179
173
  * @public
180
174
  */
181
- export interface MultiElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {
182
- /**
183
- * Classes of the elements to get properties for. If [[elementClasses]] is `undefined`, all classes
184
- * are used. Classes should be specified in one of these formats: "<schema name or alias>.<class_name>" or
185
- * "<schema name or alias>:<class_name>".
186
- */
187
- elementClasses?: string[];
175
+ export interface MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent = ElementProperties> extends RequestOptions<TIModel> {
188
176
  /**
189
177
  * Content parser that creates a result item based on given content descriptor and content item. Defaults
190
178
  * to a parser that creates [[ElementProperties]] objects.
@@ -197,6 +185,33 @@ export interface MultiElementPropertiesRequestOptions<TIModel, TParsedContent =
197
185
  */
198
186
  batchSize?: number;
199
187
  }
188
+ /**
189
+ * Request type for multiple elements properties requests, where elements are specified by class.
190
+ * @public
191
+ */
192
+ export interface MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent = ElementProperties> extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {
193
+ /**
194
+ * Classes of the elements to get properties for. If [[elementClasses]] is `undefined`, all classes
195
+ * are used. Classes should be specified in one of these formats: "<schema name or alias>.<class_name>" or
196
+ * "<schema name or alias>:<class_name>".
197
+ */
198
+ elementClasses?: string[];
199
+ }
200
+ /**
201
+ * Request type for multiple elements properties requests, where elements are specified by element id.
202
+ * @public
203
+ */
204
+ export interface MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent = ElementProperties> extends MultiElementPropertiesBaseRequestOptions<TIModel, TParsedContent> {
205
+ /**
206
+ * A list of `bis.Element` IDs to get properties for.
207
+ */
208
+ elementIds?: Id64String[];
209
+ }
210
+ /**
211
+ * Request type for multiple elements properties requests.
212
+ * @public
213
+ */
214
+ export type MultiElementPropertiesRequestOptions<TIModel, TParsedContent = ElementProperties> = MultiElementPropertiesByClassRequestOptions<TIModel, TParsedContent> | MultiElementPropertiesByIdsRequestOptions<TIModel, TParsedContent>;
200
215
  /**
201
216
  * Request type for content instance keys' requests.
202
217
  * @public
@@ -229,19 +244,19 @@ export interface DisplayLabelsRequestOptions<TIModel, TInstanceKey> extends Requ
229
244
  /**
230
245
  * Request options used for selection scope related requests
231
246
  * @public
247
+ * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
232
248
  */
233
249
  export interface SelectionScopeRequestOptions<TIModel> extends RequestOptions<TIModel> {
234
250
  }
235
251
  /**
236
252
  * Request options used for calculating selection based on given instance keys and selection scope.
237
253
  * @public
254
+ * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
238
255
  */
239
256
  export interface ComputeSelectionRequestOptions<TIModel> extends RequestOptions<TIModel> {
240
257
  elementIds: Id64String[];
241
258
  scope: SelectionScopeProps;
242
259
  }
243
- /** @internal */
244
- export declare function isComputeSelectionRequestOptions<TIModel>(options: ComputeSelectionRequestOptions<TIModel> | SelectionScopeRequestOptions<TIModel>): options is ComputeSelectionRequestOptions<TIModel>;
245
260
  /**
246
261
  * Data structure for comparing a hierarchy after ruleset or ruleset variable changes.
247
262
  * @public