@itwin/presentation-frontend 4.0.0-dev.21 → 4.0.0-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  2. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  4. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  5. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  6. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  8. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  9. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  11. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  13. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  14. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  15. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  16. package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -73
  17. package/lib/cjs/presentation-frontend/Presentation.js +160 -160
  18. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +186 -186
  20. package/lib/cjs/presentation-frontend/PresentationManager.js +436 -436
  21. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -63
  23. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  24. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  25. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  26. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  27. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  28. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
  29. package/lib/cjs/presentation-frontend/StateTracker.js +129 -129
  30. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  32. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +525 -525
  33. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  34. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +293 -293
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  38. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  39. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  40. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  42. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  43. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  44. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  45. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  46. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  48. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  49. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  50. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  51. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -40
  52. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  54. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  55. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  56. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  57. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  58. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  59. package/lib/cjs/presentation-frontend.d.ts +34 -34
  60. package/lib/cjs/presentation-frontend.js +50 -50
  61. package/lib/cjs/presentation-frontend.js.map +1 -1
  62. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  63. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  64. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  65. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  66. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  67. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  68. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  69. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  70. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  71. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  72. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
  73. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  74. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  75. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  76. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  77. package/lib/esm/presentation-frontend/Presentation.d.ts +73 -73
  78. package/lib/esm/presentation-frontend/Presentation.js +156 -156
  79. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  80. package/lib/esm/presentation-frontend/PresentationManager.d.ts +186 -186
  81. package/lib/esm/presentation-frontend/PresentationManager.js +431 -431
  82. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
  84. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  85. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  86. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  87. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  88. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  89. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
  90. package/lib/esm/presentation-frontend/StateTracker.js +125 -125
  91. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  92. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  93. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
  94. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  95. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  96. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +285 -285
  97. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  98. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  99. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  100. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  101. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  102. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  103. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  104. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  106. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  107. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  109. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  110. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  111. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
  112. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -36
  113. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  114. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  115. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  116. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  117. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  118. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  119. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  120. package/lib/esm/presentation-frontend.d.ts +34 -34
  121. package/lib/esm/presentation-frontend.js +38 -38
  122. package/lib/esm/presentation-frontend.js.map +1 -1
  123. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0E;AAC1E,oDAAoD;AAKpD;;;GAGG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,yEAAM,CAAA;AACR,CAAC,EAJW,uBAAuB,GAAvB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CAAC,cAAc,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE;QAC3B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;SAC7D,IAAI,KAAK,CAAC,oBAAoB,EAAE;QACnC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;;QAE1D,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,UAAyC,EAAE,EAAE,CAC3E,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,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 { BeEvent, IDisposable, isIDisposable } from \"@itwin/core-bentley\";\r\nimport { QueryRowFormat } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\r\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage\";\r\n\r\n/**\r\n * Scopes that favorite properties can be stored in.\r\n * @public\r\n */\r\nexport enum FavoritePropertiesScope {\r\n Global,\r\n ITwin,\r\n IModel,\r\n}\r\n\r\n/**\r\n * Format:\r\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\r\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\r\n * Primitive property - {field name}.\r\n * @public\r\n */\r\nexport type PropertyFullName = string;\r\n\r\n/**\r\n * Holds the information of favorite properties ordering.\r\n * @public\r\n */\r\nexport interface FavoritePropertiesOrderInfo {\r\n parentClassName: string | undefined;\r\n name: PropertyFullName;\r\n priority: number;\r\n orderedTimestamp: Date;\r\n}\r\n\r\n/**\r\n * Properties for initializing [[FavoritePropertiesManager]]\r\n * @public\r\n */\r\nexport interface FavoritePropertiesManagerProps {\r\n /**\r\n * Implementation of a persistence layer for storing favorite properties and their order.\r\n * @public\r\n */\r\n storage: IFavoritePropertiesStorage;\r\n}\r\n\r\n/**\r\n * The favorite property manager which lets to store favorite properties\r\n * and check if field contains favorite properties.\r\n *\r\n * @public\r\n */\r\nexport class FavoritePropertiesManager implements IDisposable {\r\n /**\r\n * Used in tests to avoid collisions between multiple runs using the same storage\r\n * @internal\r\n */\r\n public static FAVORITES_IDENTIFIER_PREFIX = \"\";\r\n\r\n /** Event raised after favorite properties have changed. */\r\n public onFavoritesChanged = new BeEvent<() => void>();\r\n\r\n private _storage: IFavoritePropertiesStorage;\r\n private _globalProperties: Set<PropertyFullName> | undefined;\r\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\r\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\r\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\r\n\r\n /** Property order is saved only in iModel scope */\r\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\r\n\r\n public constructor(props: FavoritePropertiesManagerProps) {\r\n this._storage = props.storage;\r\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\r\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\r\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\r\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\r\n }\r\n\r\n public dispose() {\r\n // istanbul ignore else\r\n if (isIDisposable(this._storage))\r\n this._storage.dispose();\r\n }\r\n\r\n /**\r\n * Initialize favorite properties for the provided IModelConnection.\r\n */\r\n public initializeConnection = async (imodel: IModelConnection) => {\r\n const imodelId = imodel.iModelId!;\r\n const iTwinId = imodel.iTwinId!;\r\n\r\n if (this._globalProperties === undefined)\r\n this._globalProperties = await this._storage.loadProperties() || new Set<PropertyFullName>();\r\n\r\n if (!this._iTwinProperties.has(iTwinId)) {\r\n const iTwinProperties = await this._storage.loadProperties(iTwinId) || new Set<PropertyFullName>();\r\n this._iTwinProperties.set(iTwinId, iTwinProperties);\r\n }\r\n\r\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\r\n const imodelProperties = await this._storage.loadProperties(iTwinId, imodelId) || new Set<PropertyFullName>();\r\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\r\n }\r\n const propertiesOrder = await this._storage.loadPropertiesOrder(iTwinId, imodelId) || [];\r\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\r\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\r\n };\r\n\r\n /**\r\n * Function that removes order information of properties that are no longer\r\n * favorited and adds missing order information for favorited properties.\r\n */\r\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\r\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\r\n\r\n const globalProperties = this._globalProperties!;\r\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\r\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\r\n // favorite property infos that need to be added to the propertiesOrder array\r\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\r\n\r\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\r\n if (infosToAdd.has(propertiesOrder[i].name))\r\n infosToAdd.delete(propertiesOrder[i].name);\r\n else\r\n propertiesOrder.splice(i, 1);\r\n }\r\n\r\n infosToAdd.forEach((info) => propertiesOrder.push({\r\n name: info,\r\n parentClassName: getPropertyClassName(info),\r\n orderedTimestamp: new Date(),\r\n priority: 0,\r\n }));\r\n\r\n let priority = propertiesOrder.length;\r\n propertiesOrder.forEach((oi) => oi.priority = priority--);\r\n };\r\n\r\n private validateInitialization(imodel: IModelConnection) {\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId)))\r\n throw Error(`Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`);\r\n }\r\n\r\n /**\r\n * Adds favorite properties into a certain scope.\r\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\r\n * @param imodel IModelConnection.\r\n * @param scope FavoritePropertiesScope to put the favorite properties into.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n let favoriteProperties: Set<PropertyFullName>;\r\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\r\n switch (scope) {\r\n case FavoritePropertiesScope.Global:\r\n favoriteProperties = this._globalProperties!;\r\n saveProperties = async (properties) => this._storage.saveProperties(properties);\r\n break;\r\n case FavoritePropertiesScope.ITwin:\r\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\r\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId);\r\n break;\r\n default:\r\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\r\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId);\r\n }\r\n\r\n const countBefore = favoriteProperties.size;\r\n const fieldInfos = getFieldInfos(field);\r\n fieldInfos.forEach((info) => favoriteProperties.add(info));\r\n if (favoriteProperties.size !== countBefore) {\r\n const saves: Array<Promise<void>> = [];\r\n saves.push(saveProperties(favoriteProperties));\r\n\r\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\r\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\r\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\r\n\r\n await Promise.all(saves);\r\n this.onFavoritesChanged.raiseEvent();\r\n }\r\n }\r\n\r\n /**\r\n * Removes favorite properties from a scope specified and all the more general scopes.\r\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\r\n * @param imodel IModelConnection.\r\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n const fieldInfos = getFieldInfos(field);\r\n const workingScopes: Array<{ properties: Set<PropertyFullName>, save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\r\n workingScopes.push({\r\n properties: this._globalProperties!,\r\n save: async (properties) => this._storage.saveProperties(properties),\r\n });\r\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\r\n workingScopes.push({\r\n properties: this._iTwinProperties.get(iTwinId)!,\r\n save: async (properties) => this._storage.saveProperties(properties, iTwinId),\r\n });\r\n }\r\n if (scope === FavoritePropertiesScope.IModel) {\r\n workingScopes.push({\r\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\r\n save: async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId),\r\n });\r\n }\r\n\r\n const saves: Array<Promise<void>> = [];\r\n let favoritesChanged = false;\r\n for (const { properties, save } of workingScopes) {\r\n const countBefore = properties.size;\r\n fieldInfos.forEach((info) => properties.delete(info));\r\n if (properties.size !== countBefore) {\r\n saves.push(save(properties));\r\n favoritesChanged = true;\r\n }\r\n }\r\n if (!favoritesChanged)\r\n return;\r\n\r\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\r\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\r\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\r\n\r\n await Promise.all(saves);\r\n this.onFavoritesChanged.raiseEvent();\r\n }\r\n\r\n /**\r\n * Removes all favorite properties from a certain scope.\r\n * @param imodel IModelConnection.\r\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n let favoriteProperties: Set<PropertyFullName>;\r\n let saveProperties: () => Promise<void>;\r\n switch (scope) {\r\n case FavoritePropertiesScope.Global:\r\n favoriteProperties = this._globalProperties!;\r\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>());\r\n break;\r\n case FavoritePropertiesScope.ITwin:\r\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\r\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\r\n break;\r\n default:\r\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\r\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\r\n }\r\n\r\n if (favoriteProperties.size === 0)\r\n return;\r\n\r\n favoriteProperties.clear();\r\n const saves: Array<Promise<void>> = [];\r\n saves.push(saveProperties());\r\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\r\n await Promise.all(saves);\r\n this.onFavoritesChanged.raiseEvent();\r\n }\r\n\r\n /**\r\n * Check if field contains at least one favorite property.\r\n * @param field Field that contains properties.\r\n * @param imodel IModelConnection.\r\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n const fieldInfos = getFieldInfos(field);\r\n return setHasAny(this._globalProperties!, fieldInfos) ||\r\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\r\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos));\r\n }\r\n\r\n /**\r\n * Sorts an array of fields with respect to favorite property order.\r\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\r\n * @param imodel IModelConnection.\r\n * @param fields Array of Field's that needs to be sorted.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n const fieldPriority = new Map<Field, number>();\r\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\r\n\r\n const sortFunction = (left: Field, right: Field): number => {\r\n const lp = fieldPriority.get(left)!;\r\n const rp = fieldPriority.get(right)!;\r\n return lp < rp ? 1 :\r\n lp > rp ? -1 :\r\n left.priority < right.priority ? 1 : // if favorite fields have equal priorities, sort by field priority\r\n left.priority > right.priority ? -1 :\r\n left.name.localeCompare(right.name);\r\n };\r\n\r\n return fields.sort(sortFunction);\r\n };\r\n\r\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\r\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\r\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\r\n if (fieldOrderInfos.length === 0)\r\n return -1;\r\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\r\n return mostRecent.priority;\r\n }\r\n\r\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\r\n let baseClasses: { [className: string]: string[] };\r\n if (this._imodelBaseClassesByClass.has(imodelInfo))\r\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\r\n else\r\n this._imodelBaseClassesByClass.set(imodelInfo, baseClasses = {});\r\n\r\n const missingClasses = new Set<string>();\r\n neededClasses.forEach((className) => {\r\n if (!baseClasses.hasOwnProperty(className))\r\n missingClasses.add(className);\r\n });\r\n if (missingClasses.size === 0)\r\n return baseClasses;\r\n\r\n const query = `\r\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\r\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\r\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\r\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\r\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\r\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\r\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\r\n for await (const row of imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\r\n if (!(row.classFullName in baseClasses))\r\n baseClasses[row.classFullName] = [];\r\n baseClasses[row.classFullName].push(row.baseClassFullName);\r\n }\r\n return baseClasses;\r\n };\r\n\r\n /** Changes field properties priorities to lower than another fields priority\r\n * @param imodel IModelConnection.\r\n * @param field Field that priority is being changed.\r\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\r\n * @param visibleFields Array of fields to move the field in.\r\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\r\n */\r\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\r\n /**\r\n * How it works:\r\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\r\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\r\n * 3. For each iterated orderInfo it checks if it is relevant:\r\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\r\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\r\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\r\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\r\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\r\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\r\n */\r\n this.validateInitialization(imodel);\r\n const iTwinId = imodel.iTwinId!;\r\n const imodelId = imodel.iModelId!;\r\n\r\n if (field === afterField)\r\n throw Error(\"`field` can not be the same as `afterField`.\");\r\n\r\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\r\n\r\n const findFieldOrderInfoData = (f: Field) => {\r\n if (!visibleFields.includes(f))\r\n throw Error(\"Field is not contained in visible fields.\");\r\n const infos = getFieldOrderInfos(f, allOrderInfos);\r\n\r\n if (infos.length === 0)\r\n throw Error(\"Field has no property order information.\");\r\n const info = getMostRecentOrderInfo(infos);\r\n const index = allOrderInfos.indexOf(info);\r\n return { infos, mostRecent: { info, index } };\r\n };\r\n\r\n const { infos: movingOrderInfos, mostRecent: { index: orderInfoIndex } } = findFieldOrderInfoData(field);\r\n\r\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\r\n let afterOrderInfoIndex;\r\n if (afterField === undefined) {\r\n afterOrderInfo = undefined;\r\n afterOrderInfoIndex = -1;\r\n } else {\r\n ({ mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex } } = findFieldOrderInfoData(afterField));\r\n }\r\n\r\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\r\n let startIndex: number;\r\n if (orderInfoIndex < afterOrderInfoIndex) {\r\n direction = Direction.Up;\r\n startIndex = afterOrderInfoIndex;\r\n } else {\r\n direction = Direction.Down;\r\n startIndex = afterOrderInfoIndex + 1;\r\n }\r\n\r\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\r\n if (oi.parentClassName)\r\n classNames.add(oi.parentClassName);\r\n return classNames;\r\n }, new Set<string>());\r\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\r\n\r\n const visibleOrderInfos = visibleFields.reduce((union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)), []);\r\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\r\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\r\n\r\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\r\n const currOrderInfo = allOrderInfos[i];\r\n\r\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\r\n if (currOrderInfo.parentClassName === undefined)\r\n continue;\r\n\r\n const visible = visibleOrderInfos.includes(currOrderInfo);\r\n if (visible) {\r\n relevantClasses.add(currOrderInfo.parentClassName);\r\n continue;\r\n }\r\n\r\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\r\n if (hasBaseClasses)\r\n continue;\r\n\r\n if (direction === Direction.Down)\r\n irrelevantOrderInfos.push(currOrderInfo);\r\n else\r\n irrelevantOrderInfos.unshift(currOrderInfo);\r\n }\r\n\r\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\r\n irrelevantOrderInfos.forEach((foi) => {\r\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\r\n allOrderInfos.splice(index, 1);\r\n });\r\n\r\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\r\n movingOrderInfos.forEach((foi) => {\r\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\r\n allOrderInfos.splice(index, 1);\r\n });\r\n movingOrderInfos.forEach((oi) => oi.orderedTimestamp = new Date());\r\n\r\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\r\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\r\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\r\n\r\n // reassign priority numbers\r\n let priority = allOrderInfos.length;\r\n allOrderInfos.forEach((oi) => oi.priority = priority--);\r\n\r\n await this._storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\r\n this.onFavoritesChanged.raiseEvent();\r\n }\r\n}\r\n\r\nenum Direction {\r\n Up = -1,\r\n Down = 1,\r\n}\r\n\r\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\r\n\r\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\r\n const nestingPrefix = getNestingPrefix(field.parent);\r\n return field.properties.map((property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`);\r\n};\r\n\r\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\r\n const nestingPrefix = getNestingPrefix(field);\r\n return `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${field.contentClassInfo.name}`;\r\n};\r\n\r\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\r\n const path: string[] = [];\r\n let curr = field;\r\n while (curr !== undefined) {\r\n curr.pathToPrimaryClass.forEach((rel) => {\r\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\r\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\r\n path.push(rel.targetClassInfo.name);\r\n });\r\n curr = curr.parent;\r\n }\r\n if (path.length === 0)\r\n return \"\";\r\n\r\n path.reverse();\r\n return `${path.join(\"-\")}-`;\r\n};\r\n\r\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\r\n const propertyNameStart = propertyName.split(\"-\")[0];\r\n const parts = propertyNameStart.split(\":\").length;\r\n if (parts === 1) // primitive\r\n return undefined;\r\n if (parts === 2) // nested property OR nested property parent class OR regular property parent class\r\n return propertyNameStart;\r\n // regular property without parent class\r\n return propertyNameStart.substr(0, propertyName.lastIndexOf(\":\"));\r\n};\r\n\r\n/** @internal */\r\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\r\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\r\n if (field.isPropertiesField())\r\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\r\n else if (field.isNestedContentField())\r\n fieldInfos.add(getNestedContentFieldPropertyName(field));\r\n else\r\n fieldInfos.add(`${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${field.name}`);\r\n return fieldInfos;\r\n};\r\n\r\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\r\n for (const key of lookup) {\r\n if (set.has(key))\r\n return true;\r\n }\r\n return false;\r\n};\r\n\r\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\r\n source.forEach((si) => {\r\n const index = dest.findIndex((di) => di.name === si.name);\r\n if (index === -1) {\r\n si.orderedTimestamp = new Date();\r\n dest.push(si);\r\n }\r\n });\r\n let priority = dest.length;\r\n dest.forEach((info) => info.priority = priority--);\r\n};\r\n\r\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\r\n toRemove.forEach((roi) => {\r\n const index = container.findIndex((oi) => oi.name === roi.name);\r\n /* istanbul ignore else */\r\n if (index >= 0)\r\n container.splice(index, 1);\r\n });\r\n};\r\n\r\n/** @internal */\r\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\r\n if (field.isNestedContentField()) {\r\n const propertyName = getNestedContentFieldPropertyName(field);\r\n return [{\r\n parentClassName: getPropertyClassName(propertyName),\r\n name: propertyName,\r\n priority: 0,\r\n orderedTimestamp: new Date(),\r\n }];\r\n }\r\n if (field.isPropertiesField()) {\r\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\r\n parentClassName: getPropertyClassName(propertyName),\r\n name: propertyName,\r\n priority: 0,\r\n orderedTimestamp: new Date(),\r\n }));\r\n }\r\n return [{\r\n parentClassName: undefined,\r\n name: field.name,\r\n priority: 0,\r\n orderedTimestamp: new Date(),\r\n }];\r\n};\r\n\r\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\r\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\r\n const tryAddOrderInfo = (name: string) => {\r\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\r\n if (fieldOrderInfo !== undefined)\r\n fieldOrderInfos.push(fieldOrderInfo);\r\n };\r\n\r\n if (field.isPropertiesField())\r\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\r\n else if (field.isNestedContentField())\r\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\r\n else\r\n tryAddOrderInfo(field.name);\r\n\r\n return fieldOrderInfos;\r\n};\r\n\r\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\r\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp) ? recent : curr);\r\n"]}
1
+ {"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/Fav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AE,CAAC;IAC1D,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;QACvC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACjE,IAAI,cAAc,KAAK,SAAS;YAC9B,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE;QAC3B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;SAC7D,IAAI,KAAK,CAAC,oBAAoB,EAAE;QACnC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;;QAE1D,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,UAAyC,EAAE,EAAE,CAC3E,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, IDisposable, isIDisposable } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage\";\n\n/**\n * Scopes that favorite properties can be stored in.\n * @public\n */\nexport enum FavoritePropertiesScope {\n Global,\n ITwin,\n IModel,\n}\n\n/**\n * Format:\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\n * Primitive property - {field name}.\n * @public\n */\nexport type PropertyFullName = string;\n\n/**\n * Holds the information of favorite properties ordering.\n * @public\n */\nexport interface FavoritePropertiesOrderInfo {\n parentClassName: string | undefined;\n name: PropertyFullName;\n priority: number;\n orderedTimestamp: Date;\n}\n\n/**\n * Properties for initializing [[FavoritePropertiesManager]]\n * @public\n */\nexport interface FavoritePropertiesManagerProps {\n /**\n * Implementation of a persistence layer for storing favorite properties and their order.\n * @public\n */\n storage: IFavoritePropertiesStorage;\n}\n\n/**\n * The favorite property manager which lets to store favorite properties\n * and check if field contains favorite properties.\n *\n * @public\n */\nexport class FavoritePropertiesManager implements IDisposable {\n /**\n * Used in tests to avoid collisions between multiple runs using the same storage\n * @internal\n */\n public static FAVORITES_IDENTIFIER_PREFIX = \"\";\n\n /** Event raised after favorite properties have changed. */\n public onFavoritesChanged = new BeEvent<() => void>();\n\n private _storage: IFavoritePropertiesStorage;\n private _globalProperties: Set<PropertyFullName> | undefined;\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\n\n /** Property order is saved only in iModel scope */\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\n\n public constructor(props: FavoritePropertiesManagerProps) {\n this._storage = props.storage;\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\n }\n\n public dispose() {\n // istanbul ignore else\n if (isIDisposable(this._storage))\n this._storage.dispose();\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n */\n public initializeConnection = async (imodel: IModelConnection) => {\n const imodelId = imodel.iModelId!;\n const iTwinId = imodel.iTwinId!;\n\n if (this._globalProperties === undefined)\n this._globalProperties = await this._storage.loadProperties() || new Set<PropertyFullName>();\n\n if (!this._iTwinProperties.has(iTwinId)) {\n const iTwinProperties = await this._storage.loadProperties(iTwinId) || new Set<PropertyFullName>();\n this._iTwinProperties.set(iTwinId, iTwinProperties);\n }\n\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\n const imodelProperties = await this._storage.loadProperties(iTwinId, imodelId) || new Set<PropertyFullName>();\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\n }\n const propertiesOrder = await this._storage.loadPropertiesOrder(iTwinId, imodelId) || [];\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\n };\n\n /**\n * Function that removes order information of properties that are no longer\n * favorited and adds missing order information for favorited properties.\n */\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const globalProperties = this._globalProperties!;\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n // favorite property infos that need to be added to the propertiesOrder array\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\n\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\n if (infosToAdd.has(propertiesOrder[i].name))\n infosToAdd.delete(propertiesOrder[i].name);\n else\n propertiesOrder.splice(i, 1);\n }\n\n infosToAdd.forEach((info) => propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }));\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => oi.priority = priority--);\n };\n\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId)))\n throw Error(`Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`);\n }\n\n /**\n * Adds favorite properties into a certain scope.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to put the favorite properties into.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async (properties) => this._storage.saveProperties(properties);\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId);\n }\n\n const countBefore = favoriteProperties.size;\n const fieldInfos = getFieldInfos(field);\n fieldInfos.forEach((info) => favoriteProperties.add(info));\n if (favoriteProperties.size !== countBefore) {\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties(favoriteProperties));\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n }\n\n /**\n * Removes favorite properties from a scope specified and all the more general scopes.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n const workingScopes: Array<{ properties: Set<PropertyFullName>, save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\n workingScopes.push({\n properties: this._globalProperties!,\n save: async (properties) => this._storage.saveProperties(properties),\n });\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._iTwinProperties.get(iTwinId)!,\n save: async (properties) => this._storage.saveProperties(properties, iTwinId),\n });\n }\n if (scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\n save: async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId),\n });\n }\n\n const saves: Array<Promise<void>> = [];\n let favoritesChanged = false;\n for (const { properties, save } of workingScopes) {\n const countBefore = properties.size;\n fieldInfos.forEach((info) => properties.delete(info));\n if (properties.size !== countBefore) {\n saves.push(save(properties));\n favoritesChanged = true;\n }\n }\n if (!favoritesChanged)\n return;\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Removes all favorite properties from a certain scope.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: () => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>());\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\n }\n\n if (favoriteProperties.size === 0)\n return;\n\n favoriteProperties.clear();\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties());\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n return setHasAny(this._globalProperties!, fieldInfos) ||\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos));\n }\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldPriority = new Map<Field, number>();\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\n\n const sortFunction = (left: Field, right: Field): number => {\n const lp = fieldPriority.get(left)!;\n const rp = fieldPriority.get(right)!;\n return lp < rp ? 1 :\n lp > rp ? -1 :\n left.priority < right.priority ? 1 : // if favorite fields have equal priorities, sort by field priority\n left.priority > right.priority ? -1 :\n left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\n };\n\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\n if (fieldOrderInfos.length === 0)\n return -1;\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\n return mostRecent.priority;\n }\n\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\n let baseClasses: { [className: string]: string[] };\n if (this._imodelBaseClassesByClass.has(imodelInfo))\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\n else\n this._imodelBaseClassesByClass.set(imodelInfo, baseClasses = {});\n\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className))\n missingClasses.add(className);\n });\n if (missingClasses.size === 0)\n return baseClasses;\n\n const query = `\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\n for await (const row of imodel.query(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames })) {\n if (!(row.classFullName in baseClasses))\n baseClasses[row.classFullName] = [];\n baseClasses[row.classFullName].push(row.baseClassFullName);\n }\n return baseClasses;\n };\n\n /** Changes field properties priorities to lower than another fields priority\n * @param imodel IModelConnection.\n * @param field Field that priority is being changed.\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\n * @param visibleFields Array of fields to move the field in.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n */\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\n /**\n * How it works:\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\n * 3. For each iterated orderInfo it checks if it is relevant:\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\n */\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n if (field === afterField)\n throw Error(\"`field` can not be the same as `afterField`.\");\n\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const findFieldOrderInfoData = (f: Field) => {\n if (!visibleFields.includes(f))\n throw Error(\"Field is not contained in visible fields.\");\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0)\n throw Error(\"Field has no property order information.\");\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const { infos: movingOrderInfos, mostRecent: { index: orderInfoIndex } } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({ mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex } } = findFieldOrderInfoData(afterField));\n }\n\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\n let startIndex: number;\n if (orderInfoIndex < afterOrderInfoIndex) {\n direction = Direction.Up;\n startIndex = afterOrderInfoIndex;\n } else {\n direction = Direction.Down;\n startIndex = afterOrderInfoIndex + 1;\n }\n\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\n if (oi.parentClassName)\n classNames.add(oi.parentClassName);\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce((union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)), []);\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\n\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\n const currOrderInfo = allOrderInfos[i];\n\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\n if (currOrderInfo.parentClassName === undefined)\n continue;\n\n const visible = visibleOrderInfos.includes(currOrderInfo);\n if (visible) {\n relevantClasses.add(currOrderInfo.parentClassName);\n continue;\n }\n\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\n if (hasBaseClasses)\n continue;\n\n if (direction === Direction.Down)\n irrelevantOrderInfos.push(currOrderInfo);\n else\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\n\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\n irrelevantOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\n movingOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n movingOrderInfos.forEach((oi) => oi.orderedTimestamp = new Date());\n\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\n\n // reassign priority numbers\n let priority = allOrderInfos.length;\n allOrderInfos.forEach((oi) => oi.priority = priority--);\n\n await this._storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\n this.onFavoritesChanged.raiseEvent();\n }\n}\n\nenum Direction {\n Up = -1,\n Down = 1,\n}\n\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\n\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\n const nestingPrefix = getNestingPrefix(field.parent);\n return field.properties.map((property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`);\n};\n\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\n const nestingPrefix = getNestingPrefix(field);\n return `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${field.contentClassInfo.name}`;\n};\n\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\n const path: string[] = [];\n let curr = field;\n while (curr !== undefined) {\n curr.pathToPrimaryClass.forEach((rel) => {\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\n path.push(rel.targetClassInfo.name);\n });\n curr = curr.parent;\n }\n if (path.length === 0)\n return \"\";\n\n path.reverse();\n return `${path.join(\"-\")}-`;\n};\n\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\n const propertyNameStart = propertyName.split(\"-\")[0];\n const parts = propertyNameStart.split(\":\").length;\n if (parts === 1) // primitive\n return undefined;\n if (parts === 2) // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n // regular property without parent class\n return propertyNameStart.substr(0, propertyName.lastIndexOf(\":\"));\n};\n\n/** @internal */\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\n if (field.isPropertiesField())\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\n else if (field.isNestedContentField())\n fieldInfos.add(getNestedContentFieldPropertyName(field));\n else\n fieldInfos.add(`${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${field.name}`);\n return fieldInfos;\n};\n\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\n for (const key of lookup) {\n if (set.has(key))\n return true;\n }\n return false;\n};\n\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\n source.forEach((si) => {\n const index = dest.findIndex((di) => di.name === si.name);\n if (index === -1) {\n si.orderedTimestamp = new Date();\n dest.push(si);\n }\n });\n let priority = dest.length;\n dest.forEach((info) => info.priority = priority--);\n};\n\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\n toRemove.forEach((roi) => {\n const index = container.findIndex((oi) => oi.name === roi.name);\n /* istanbul ignore else */\n if (index >= 0)\n container.splice(index, 1);\n });\n};\n\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [{\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }];\n }\n if (field.isPropertiesField()) {\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }));\n }\n return [{\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n }];\n};\n\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\n const tryAddOrderInfo = (name: string) => {\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\n if (fieldOrderInfo !== undefined)\n fieldOrderInfos.push(fieldOrderInfo);\n };\n\n if (field.isPropertiesField())\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\n else if (field.isNestedContentField())\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\n else\n tryAddOrderInfo(field.name);\n\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp) ? recent : curr);\n"]}
@@ -1,112 +1,112 @@
1
- /** @packageDocumentation
2
- * @module Core
3
- */
4
- import { IDisposable } from "@itwin/core-bentley";
5
- import { IConnectivityInformationProvider } from "../ConnectivityInformationProvider";
6
- import { FavoritePropertiesOrderInfo, PropertyFullName } from "./FavoritePropertiesManager";
7
- /** @internal */
8
- export declare const IMODELJS_PRESENTATION_SETTING_NAMESPACE = "imodeljs.presentation";
9
- /** @internal */
10
- export declare const DEPRECATED_PROPERTIES_SETTING_NAMESPACE = "Properties";
11
- /** @internal */
12
- export declare const FAVORITE_PROPERTIES_SETTING_NAME = "FavoriteProperties";
13
- /** @internal */
14
- export declare const FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME = "FavoritePropertiesOrderInfo";
15
- /**
16
- * Stores user preferences for favorite properties.
17
- * @public
18
- */
19
- export interface IFavoritePropertiesStorage {
20
- /** Load Favorite properties from user-specific settings.
21
- * @param iTwinId ITwin Id, if the settings is specific to a iTwin, otherwise undefined.
22
- * @param imodelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.
23
- */
24
- loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
25
- /** Saves Favorite properties to user-specific settings.
26
- * @param properties Favorite properties to save.
27
- * @param iTwinId iTwin Id, if the settings is specific to a iTwin, otherwise undefined.
28
- * @param iModelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.
29
- */
30
- saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
31
- /** Load array of FavoritePropertiesOrderInfo from user-specific settings.
32
- * Setting is specific to an iModel.
33
- * @param iTwinId iTwin Id.
34
- * @param imodelId iModel Id.
35
- */
36
- loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
37
- /** Saves FavoritePropertiesOrderInfo array to user-specific settings.
38
- * Setting is specific to an iModel.
39
- * @param orderInfo Array of FavoritePropertiesOrderInfo to save.
40
- * @param iTwinId iTwin Id.
41
- * @param imodelId iModel Id.
42
- */
43
- savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
44
- }
45
- /**
46
- * Available implementations of [[IFavoritePropertiesStorage]].
47
- * @public
48
- */
49
- export declare enum DefaultFavoritePropertiesStorageTypes {
50
- /** A no-op storage that doesn't store or return anything. Used for cases when favorite properties aren't used by the application. */
51
- Noop = 0,
52
- /** A storage that stores favorite properties information in a browser local storage. */
53
- BrowserLocalStorage = 1,
54
- /** A storage that stores favorite properties in a user preferences storage (see [[IModelApp.userPreferences]]). */
55
- UserPreferencesStorage = 2
56
- }
57
- /**
58
- * A factory method to create one of the available [[IFavoritePropertiesStorage]] implementations.
59
- * @public
60
- */
61
- export declare function createFavoritePropertiesStorage(type: DefaultFavoritePropertiesStorageTypes): IFavoritePropertiesStorage;
62
- /**
63
- * @internal
64
- */
65
- export declare class IModelAppFavoritePropertiesStorage implements IFavoritePropertiesStorage {
66
- private ensureIsSignedIn;
67
- loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
68
- saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
69
- loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
70
- savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
71
- }
72
- /** @internal */
73
- export interface OfflineCachingFavoritePropertiesStorageProps {
74
- impl: IFavoritePropertiesStorage;
75
- connectivityInfo?: IConnectivityInformationProvider;
76
- }
77
- /** @internal */
78
- export declare class OfflineCachingFavoritePropertiesStorage implements IFavoritePropertiesStorage, IDisposable {
79
- private _connectivityInfo;
80
- private _impl;
81
- private _propertiesOfflineCache;
82
- private _propertiesOrderOfflineCache;
83
- constructor(props: OfflineCachingFavoritePropertiesStorageProps);
84
- dispose(): void;
85
- get impl(): IFavoritePropertiesStorage;
86
- private onConnectivityStatusChanged;
87
- loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<string> | undefined>;
88
- saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
89
- loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
90
- savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
91
- }
92
- /** @internal */
93
- export declare class NoopFavoritePropertiesStorage implements IFavoritePropertiesStorage {
94
- loadProperties(_iTwinId?: string, _imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
95
- saveProperties(_properties: Set<PropertyFullName>, _iTwinId?: string, _imodelId?: string): Promise<void>;
96
- loadPropertiesOrder(_iTwinId: string | undefined, _imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
97
- savePropertiesOrder(_orderInfos: FavoritePropertiesOrderInfo[], _iTwinId: string | undefined, _imodelId: string): Promise<void>;
98
- }
99
- /** @internal */
100
- export declare class BrowserLocalFavoritePropertiesStorage implements IFavoritePropertiesStorage {
101
- private _localStorage;
102
- constructor(props?: {
103
- localStorage?: Storage;
104
- });
105
- createFavoritesSettingItemKey(iTwinId?: string, imodelId?: string): string;
106
- createOrderSettingItemKey(iTwinId?: string, imodelId?: string): string;
107
- loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
108
- saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
109
- loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
110
- savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
111
- }
1
+ /** @packageDocumentation
2
+ * @module Core
3
+ */
4
+ import { IDisposable } from "@itwin/core-bentley";
5
+ import { IConnectivityInformationProvider } from "../ConnectivityInformationProvider";
6
+ import { FavoritePropertiesOrderInfo, PropertyFullName } from "./FavoritePropertiesManager";
7
+ /** @internal */
8
+ export declare const IMODELJS_PRESENTATION_SETTING_NAMESPACE = "imodeljs.presentation";
9
+ /** @internal */
10
+ export declare const DEPRECATED_PROPERTIES_SETTING_NAMESPACE = "Properties";
11
+ /** @internal */
12
+ export declare const FAVORITE_PROPERTIES_SETTING_NAME = "FavoriteProperties";
13
+ /** @internal */
14
+ export declare const FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME = "FavoritePropertiesOrderInfo";
15
+ /**
16
+ * Stores user preferences for favorite properties.
17
+ * @public
18
+ */
19
+ export interface IFavoritePropertiesStorage {
20
+ /** Load Favorite properties from user-specific settings.
21
+ * @param iTwinId ITwin Id, if the settings is specific to a iTwin, otherwise undefined.
22
+ * @param imodelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.
23
+ */
24
+ loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
25
+ /** Saves Favorite properties to user-specific settings.
26
+ * @param properties Favorite properties to save.
27
+ * @param iTwinId iTwin Id, if the settings is specific to a iTwin, otherwise undefined.
28
+ * @param iModelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.
29
+ */
30
+ saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
31
+ /** Load array of FavoritePropertiesOrderInfo from user-specific settings.
32
+ * Setting is specific to an iModel.
33
+ * @param iTwinId iTwin Id.
34
+ * @param imodelId iModel Id.
35
+ */
36
+ loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
37
+ /** Saves FavoritePropertiesOrderInfo array to user-specific settings.
38
+ * Setting is specific to an iModel.
39
+ * @param orderInfo Array of FavoritePropertiesOrderInfo to save.
40
+ * @param iTwinId iTwin Id.
41
+ * @param imodelId iModel Id.
42
+ */
43
+ savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
44
+ }
45
+ /**
46
+ * Available implementations of [[IFavoritePropertiesStorage]].
47
+ * @public
48
+ */
49
+ export declare enum DefaultFavoritePropertiesStorageTypes {
50
+ /** A no-op storage that doesn't store or return anything. Used for cases when favorite properties aren't used by the application. */
51
+ Noop = 0,
52
+ /** A storage that stores favorite properties information in a browser local storage. */
53
+ BrowserLocalStorage = 1,
54
+ /** A storage that stores favorite properties in a user preferences storage (see [[IModelApp.userPreferences]]). */
55
+ UserPreferencesStorage = 2
56
+ }
57
+ /**
58
+ * A factory method to create one of the available [[IFavoritePropertiesStorage]] implementations.
59
+ * @public
60
+ */
61
+ export declare function createFavoritePropertiesStorage(type: DefaultFavoritePropertiesStorageTypes): IFavoritePropertiesStorage;
62
+ /**
63
+ * @internal
64
+ */
65
+ export declare class IModelAppFavoritePropertiesStorage implements IFavoritePropertiesStorage {
66
+ private ensureIsSignedIn;
67
+ loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
68
+ saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
69
+ loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
70
+ savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
71
+ }
72
+ /** @internal */
73
+ export interface OfflineCachingFavoritePropertiesStorageProps {
74
+ impl: IFavoritePropertiesStorage;
75
+ connectivityInfo?: IConnectivityInformationProvider;
76
+ }
77
+ /** @internal */
78
+ export declare class OfflineCachingFavoritePropertiesStorage implements IFavoritePropertiesStorage, IDisposable {
79
+ private _connectivityInfo;
80
+ private _impl;
81
+ private _propertiesOfflineCache;
82
+ private _propertiesOrderOfflineCache;
83
+ constructor(props: OfflineCachingFavoritePropertiesStorageProps);
84
+ dispose(): void;
85
+ get impl(): IFavoritePropertiesStorage;
86
+ private onConnectivityStatusChanged;
87
+ loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<string> | undefined>;
88
+ saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
89
+ loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
90
+ savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
91
+ }
92
+ /** @internal */
93
+ export declare class NoopFavoritePropertiesStorage implements IFavoritePropertiesStorage {
94
+ loadProperties(_iTwinId?: string, _imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
95
+ saveProperties(_properties: Set<PropertyFullName>, _iTwinId?: string, _imodelId?: string): Promise<void>;
96
+ loadPropertiesOrder(_iTwinId: string | undefined, _imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
97
+ savePropertiesOrder(_orderInfos: FavoritePropertiesOrderInfo[], _iTwinId: string | undefined, _imodelId: string): Promise<void>;
98
+ }
99
+ /** @internal */
100
+ export declare class BrowserLocalFavoritePropertiesStorage implements IFavoritePropertiesStorage {
101
+ private _localStorage;
102
+ constructor(props?: {
103
+ localStorage?: Storage;
104
+ });
105
+ createFavoritesSettingItemKey(iTwinId?: string, imodelId?: string): string;
106
+ createOrderSettingItemKey(iTwinId?: string, imodelId?: string): string;
107
+ loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;
108
+ saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;
109
+ loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;
110
+ savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;
111
+ }
112
112
  //# sourceMappingURL=FavoritePropertiesStorage.d.ts.map