@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":"FavoritePropertiesStorage.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAe,cAAc,EAAE,UAAU,EAAE,IAAI,EAAe,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AACnI,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,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AG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC5F,IAAI,CAAC,KAAK;YACR,OAAO,SAAS,CAAC;QAEnB,MAAM,UAAU,GAAkC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,CAAC;YACtF,GAAG,IAAI;YACP,gBAAgB,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;SAClD,CAAC,CAAC,CAAC;QACJ,OAAO,UAAU,CAAC;IACpB,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,UAAyC,EAAE,OAA2B,EAAE,QAAgB;QACvH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5G,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { AccessToken, compareStrings, Dictionary, Guid, IDisposable, isIDisposable, OrderedComparator } from \"@itwin/core-bentley\";\r\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"@itwin/core-frontend\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\nimport { ConnectivityInformationProvider, IConnectivityInformationProvider } from \"../ConnectivityInformationProvider\";\r\nimport { FavoritePropertiesOrderInfo, PropertyFullName } from \"./FavoritePropertiesManager\";\r\n\r\n/** @internal */\r\nexport const IMODELJS_PRESENTATION_SETTING_NAMESPACE = \"imodeljs.presentation\";\r\n/** @internal */\r\nexport const DEPRECATED_PROPERTIES_SETTING_NAMESPACE = \"Properties\";\r\n/** @internal */\r\nexport const FAVORITE_PROPERTIES_SETTING_NAME = \"FavoriteProperties\";\r\n/** @internal */\r\nexport const FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME = \"FavoritePropertiesOrderInfo\";\r\n\r\n/**\r\n * Stores user preferences for favorite properties.\r\n * @public\r\n */\r\nexport interface IFavoritePropertiesStorage {\r\n /** Load Favorite properties from user-specific settings.\r\n * @param iTwinId ITwin Id, if the settings is specific to a iTwin, otherwise undefined.\r\n * @param imodelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.\r\n */\r\n loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;\r\n /** Saves Favorite properties to user-specific settings.\r\n * @param properties Favorite properties to save.\r\n * @param iTwinId iTwin Id, if the settings is specific to a iTwin, otherwise undefined.\r\n * @param iModelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.\r\n */\r\n saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;\r\n /** Load array of FavoritePropertiesOrderInfo from user-specific settings.\r\n * Setting is specific to an iModel.\r\n * @param iTwinId iTwin Id.\r\n * @param imodelId iModel Id.\r\n */\r\n loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;\r\n /** Saves FavoritePropertiesOrderInfo array to user-specific settings.\r\n * Setting is specific to an iModel.\r\n * @param orderInfo Array of FavoritePropertiesOrderInfo to save.\r\n * @param iTwinId iTwin Id.\r\n * @param imodelId iModel Id.\r\n */\r\n savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;\r\n}\r\n\r\n/**\r\n * Available implementations of [[IFavoritePropertiesStorage]].\r\n * @public\r\n */\r\nexport enum DefaultFavoritePropertiesStorageTypes {\r\n /** A no-op storage that doesn't store or return anything. Used for cases when favorite properties aren't used by the application. */\r\n Noop,\r\n /** A storage that stores favorite properties information in a browser local storage. */\r\n BrowserLocalStorage,\r\n /** A storage that stores favorite properties in a user preferences storage (see [[IModelApp.userPreferences]]). */\r\n UserPreferencesStorage,\r\n}\r\n\r\n/**\r\n * A factory method to create one of the available [[IFavoritePropertiesStorage]] implementations.\r\n * @public\r\n */\r\nexport function createFavoritePropertiesStorage(type: DefaultFavoritePropertiesStorageTypes): IFavoritePropertiesStorage {\r\n switch (type) {\r\n case DefaultFavoritePropertiesStorageTypes.Noop: return new NoopFavoritePropertiesStorage();\r\n case DefaultFavoritePropertiesStorageTypes.BrowserLocalStorage: return new BrowserLocalFavoritePropertiesStorage();\r\n case DefaultFavoritePropertiesStorageTypes.UserPreferencesStorage: return new OfflineCachingFavoritePropertiesStorage({ impl: new IModelAppFavoritePropertiesStorage() });\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class IModelAppFavoritePropertiesStorage implements IFavoritePropertiesStorage {\r\n\r\n private async ensureIsSignedIn(): Promise<{ accessToken: AccessToken }> {\r\n const accessToken = IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : \"\";\r\n if (accessToken)\r\n return { accessToken };\r\n throw new PresentationError(PresentationStatus.Error, \"Current user is not authorized to use the settings service\");\r\n }\r\n\r\n public async loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined> {\r\n if (!IModelApp.userPreferences)\r\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\r\n\r\n const { accessToken } = await this.ensureIsSignedIn();\r\n let setting = await IModelApp.userPreferences.get({\r\n accessToken,\r\n iTwinId,\r\n iModelId: imodelId,\r\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\r\n key: FAVORITE_PROPERTIES_SETTING_NAME,\r\n });\r\n\r\n if (setting !== undefined)\r\n return new Set<PropertyFullName>(setting);\r\n\r\n // try to check the old namespace\r\n setting = await IModelApp.userPreferences.get({\r\n accessToken,\r\n iTwinId,\r\n iModelId: imodelId,\r\n namespace: DEPRECATED_PROPERTIES_SETTING_NAMESPACE,\r\n key: FAVORITE_PROPERTIES_SETTING_NAME,\r\n });\r\n\r\n if (setting !== undefined && setting.hasOwnProperty(\"nestedContentInfos\") && setting.hasOwnProperty(\"propertyInfos\") && setting.hasOwnProperty(\"baseFieldInfos\"))\r\n return new Set<PropertyFullName>([...setting.nestedContentInfos, ...setting.propertyInfos, ...setting.baseFieldInfos]);\r\n\r\n return undefined;\r\n }\r\n\r\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void> {\r\n if (!IModelApp.userPreferences)\r\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\r\n\r\n const { accessToken } = await this.ensureIsSignedIn();\r\n await IModelApp.userPreferences.save({\r\n accessToken,\r\n iTwinId,\r\n iModelId: imodelId,\r\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\r\n key: FAVORITE_PROPERTIES_SETTING_NAME,\r\n content: Array.from(properties),\r\n });\r\n }\r\n\r\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> {\r\n if (!IModelApp.userPreferences)\r\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\r\n\r\n const { accessToken } = await this.ensureIsSignedIn();\r\n const setting = await IModelApp.userPreferences.get({\r\n accessToken,\r\n iTwinId,\r\n iModelId: imodelId,\r\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\r\n key: FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME,\r\n });\r\n return setting as FavoritePropertiesOrderInfo[];\r\n }\r\n\r\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string) {\r\n if (!IModelApp.userPreferences)\r\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\r\n\r\n const { accessToken } = await this.ensureIsSignedIn();\r\n await IModelApp.userPreferences.save({\r\n accessToken,\r\n iTwinId,\r\n iModelId: imodelId,\r\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\r\n key: FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME,\r\n content: orderInfos,\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface OfflineCachingFavoritePropertiesStorageProps {\r\n impl: IFavoritePropertiesStorage;\r\n connectivityInfo?: IConnectivityInformationProvider;\r\n}\r\n/** @internal */\r\nexport class OfflineCachingFavoritePropertiesStorage implements IFavoritePropertiesStorage, IDisposable {\r\n\r\n private _connectivityInfo: IConnectivityInformationProvider;\r\n private _impl: IFavoritePropertiesStorage;\r\n private _propertiesOfflineCache = new DictionaryWithReservations<ITwinAndIModelIdsKey, Set<PropertyFullName>>(iTwinAndIModelIdsKeyComparer);\r\n private _propertiesOrderOfflineCache = new DictionaryWithReservations<ITwinAndIModelIdsKey, FavoritePropertiesOrderInfo[]>(iTwinAndIModelIdsKeyComparer);\r\n\r\n public constructor(props: OfflineCachingFavoritePropertiesStorageProps) {\r\n this._impl = props.impl;\r\n // istanbul ignore next\r\n this._connectivityInfo = props.connectivityInfo ?? new ConnectivityInformationProvider();\r\n this._connectivityInfo.onInternetConnectivityChanged.addListener(this.onConnectivityStatusChanged);\r\n }\r\n\r\n public dispose() {\r\n if (isIDisposable(this._connectivityInfo))\r\n this._connectivityInfo.dispose();\r\n }\r\n\r\n public get impl() { return this._impl; }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onConnectivityStatusChanged = (args: { status: InternetConnectivityStatus }) => {\r\n // istanbul ignore else\r\n if (args.status === InternetConnectivityStatus.Online) {\r\n // note: we're copying the cached values to temp arrays because `saveProperties` and `savePropertiesOrder` both\r\n // attempt to modify cache dictionaries\r\n\r\n const propertiesCache = new Array<{ properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string }>();\r\n this._propertiesOfflineCache.forEach((key, value) => propertiesCache.push({ properties: value, iTwinId: key[0], imodelId: key[1] }));\r\n propertiesCache.forEach(async (cached) => this.saveProperties(cached.properties, cached.iTwinId, cached.imodelId));\r\n\r\n const ordersCache = new Array<{ order: FavoritePropertiesOrderInfo[], iTwinId?: string, imodelId: string }>();\r\n this._propertiesOrderOfflineCache.forEach((key, value) => ordersCache.push({ order: value, iTwinId: key[0], imodelId: key[1]! }));\r\n ordersCache.forEach(async (cached) => this.savePropertiesOrder(cached.order, cached.iTwinId, cached.imodelId));\r\n }\r\n };\r\n\r\n public async loadProperties(iTwinId?: string, imodelId?: string) {\r\n if (this._connectivityInfo.status === InternetConnectivityStatus.Online) {\r\n try {\r\n return await this._impl.loadProperties(iTwinId, imodelId);\r\n } catch {\r\n // return from offline cache if the above fails\r\n }\r\n }\r\n return this._propertiesOfflineCache.get([iTwinId, imodelId]);\r\n }\r\n\r\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string) {\r\n const key: ITwinAndIModelIdsKey = [iTwinId, imodelId];\r\n if (this._connectivityInfo.status === InternetConnectivityStatus.Offline) {\r\n this._propertiesOfflineCache.set(key, properties);\r\n return;\r\n }\r\n const reservationId = this._propertiesOfflineCache.reserve(key);\r\n try {\r\n await this._impl.saveProperties(properties, iTwinId, imodelId);\r\n this._propertiesOfflineCache.reservedDelete(key, reservationId);\r\n } catch {\r\n this._propertiesOfflineCache.reservedSet(key, properties, reservationId);\r\n }\r\n }\r\n\r\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string) {\r\n if (this._connectivityInfo.status === InternetConnectivityStatus.Online) {\r\n try {\r\n return await this._impl.loadPropertiesOrder(iTwinId, imodelId);\r\n } catch {\r\n // return from offline cache if the above fails\r\n }\r\n }\r\n return this._propertiesOrderOfflineCache.get([iTwinId, imodelId]);\r\n }\r\n\r\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string) {\r\n const key: ITwinAndIModelIdsKey = [iTwinId, imodelId];\r\n if (this._connectivityInfo.status === InternetConnectivityStatus.Offline) {\r\n this._propertiesOrderOfflineCache.set(key, orderInfos);\r\n return;\r\n }\r\n const reservationId = this._propertiesOrderOfflineCache.reserve(key);\r\n try {\r\n await this._impl.savePropertiesOrder(orderInfos, iTwinId, imodelId);\r\n this._propertiesOrderOfflineCache.reservedDelete(key, reservationId);\r\n } catch {\r\n this._propertiesOrderOfflineCache.reservedSet(key, orderInfos, reservationId);\r\n }\r\n }\r\n\r\n}\r\n\r\nclass DictionaryWithReservations<TKey, TValue> {\r\n private _impl: Dictionary<TKey, { value?: TValue, lastReservationId?: string }>;\r\n public constructor(compareKeys: OrderedComparator<TKey>) {\r\n this._impl = new Dictionary(compareKeys);\r\n }\r\n public get(key: TKey) { return this._impl.get(key)?.value; }\r\n public forEach(func: (key: TKey, value: TValue) => void): void {\r\n this._impl.forEach((key, entry) => {\r\n // istanbul ignore else\r\n if (entry.value)\r\n func(key, entry.value);\r\n });\r\n }\r\n public reserve(key: TKey) {\r\n const reservationId = Guid.createValue();\r\n this._impl.set(key, { lastReservationId: reservationId });\r\n return reservationId;\r\n }\r\n public set(key: TKey, value: TValue) { return this._impl.set(key, { value }); }\r\n public reservedSet(key: TKey, value: TValue, reservationId: string) {\r\n const entry = this._impl.get(key);\r\n if (entry && entry.lastReservationId === reservationId)\r\n this._impl.set(key, { value });\r\n }\r\n public reservedDelete(key: TKey, reservationId: string) {\r\n const entry = this._impl.get(key);\r\n if (entry && entry.lastReservationId === reservationId)\r\n this._impl.delete(key);\r\n }\r\n}\r\ntype ITwinAndIModelIdsKey = [string | undefined, string | undefined];\r\n\r\n// istanbul ignore next\r\nfunction iTwinAndIModelIdsKeyComparer(lhs: ITwinAndIModelIdsKey, rhs: ITwinAndIModelIdsKey) {\r\n const iTwinIdCompare = compareStrings(lhs[0] ?? \"\", rhs[0] ?? \"\");\r\n return (iTwinIdCompare !== 0) ? iTwinIdCompare : compareStrings(lhs[1] ?? \"\", rhs[1] ?? \"\");\r\n}\r\n\r\n/** @internal */\r\nexport class NoopFavoritePropertiesStorage implements IFavoritePropertiesStorage {\r\n // istanbul ignore next\r\n public async loadProperties(_iTwinId?: string, _imodelId?: string): Promise<Set<PropertyFullName> | undefined> { return undefined; }\r\n // istanbul ignore next\r\n public async saveProperties(_properties: Set<PropertyFullName>, _iTwinId?: string, _imodelId?: string) { }\r\n // istanbul ignore next\r\n public async loadPropertiesOrder(_iTwinId: string | undefined, _imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> { return undefined; }\r\n // istanbul ignore next\r\n public async savePropertiesOrder(_orderInfos: FavoritePropertiesOrderInfo[], _iTwinId: string | undefined, _imodelId: string): Promise<void> { }\r\n}\r\n\r\n/** @internal */\r\nexport class BrowserLocalFavoritePropertiesStorage implements IFavoritePropertiesStorage {\r\n private _localStorage: Storage;\r\n\r\n public constructor(props?: { localStorage?: Storage }) {\r\n // istanbul ignore next\r\n this._localStorage = props?.localStorage ?? window.localStorage;\r\n }\r\n\r\n public createFavoritesSettingItemKey(iTwinId?: string, imodelId?: string): string {\r\n return `${IMODELJS_PRESENTATION_SETTING_NAMESPACE}${FAVORITE_PROPERTIES_SETTING_NAME}?iTwinId=${iTwinId}&imodelId=${imodelId}`;\r\n }\r\n public createOrderSettingItemKey(iTwinId?: string, imodelId?: string): string {\r\n return `${IMODELJS_PRESENTATION_SETTING_NAMESPACE}${FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME}?iTwinId=${iTwinId}&imodelId=${imodelId}`;\r\n }\r\n\r\n public async loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined> {\r\n const value = this._localStorage.getItem(this.createFavoritesSettingItemKey(iTwinId, imodelId));\r\n if (!value)\r\n return undefined;\r\n\r\n const properties: PropertyFullName[] = JSON.parse(value);\r\n return new Set(properties);\r\n }\r\n\r\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string) {\r\n this._localStorage.setItem(this.createFavoritesSettingItemKey(iTwinId, imodelId), JSON.stringify([...properties]));\r\n }\r\n\r\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> {\r\n const value = this._localStorage.getItem(this.createOrderSettingItemKey(iTwinId, imodelId));\r\n if (!value)\r\n return undefined;\r\n\r\n const orderInfos: FavoritePropertiesOrderInfo[] = JSON.parse(value).map((json: any) => ({\r\n ...json,\r\n orderedTimestamp: new Date(json.orderedTimestamp),\r\n }));\r\n return orderInfos;\r\n }\r\n\r\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void> {\r\n this._localStorage.setItem(this.createOrderSettingItemKey(iTwinId, imodelId), JSON.stringify(orderInfos));\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"FavoritePropertiesStorage.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAe,cAAc,EAAE,UAAU,EAAE,IAAI,EAAe,aAAa,EAAqB,MAAM,qBAAqB,CAAC;AACnI,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAoC,MAAM,oCAAoC,CAAC;AAGvH,gBAAgB;AAChB,MAAM,CAAC,MAAM,uCAAuC,GAAG,uBAAuB,CAAC;AAC/E,gBAAgB;AAChB,MAAM,CAAC,MAAM,uCAAuC,GAAG,YAAY,CAAC;AACpE,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AACrE,gBAAgB;AAChB,MAAM,CAAC,MAAM,2CAA2C,GAAG,6BAA6B,CAAC;AAiCzF;;;GAGG;AACH,MAA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CAAC,UAAyC,EAAE,OAA2B,EAAE,QAAgB;QACvH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5G,CAAC;CACF","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 { AccessToken, compareStrings, Dictionary, Guid, IDisposable, isIDisposable, OrderedComparator } from \"@itwin/core-bentley\";\nimport { InternetConnectivityStatus } from \"@itwin/core-common\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\nimport { ConnectivityInformationProvider, IConnectivityInformationProvider } from \"../ConnectivityInformationProvider\";\nimport { FavoritePropertiesOrderInfo, PropertyFullName } from \"./FavoritePropertiesManager\";\n\n/** @internal */\nexport const IMODELJS_PRESENTATION_SETTING_NAMESPACE = \"imodeljs.presentation\";\n/** @internal */\nexport const DEPRECATED_PROPERTIES_SETTING_NAMESPACE = \"Properties\";\n/** @internal */\nexport const FAVORITE_PROPERTIES_SETTING_NAME = \"FavoriteProperties\";\n/** @internal */\nexport const FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME = \"FavoritePropertiesOrderInfo\";\n\n/**\n * Stores user preferences for favorite properties.\n * @public\n */\nexport interface IFavoritePropertiesStorage {\n /** Load Favorite properties from user-specific settings.\n * @param iTwinId ITwin Id, if the settings is specific to a iTwin, otherwise undefined.\n * @param imodelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.\n */\n loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined>;\n /** Saves Favorite properties to user-specific settings.\n * @param properties Favorite properties to save.\n * @param iTwinId iTwin Id, if the settings is specific to a iTwin, otherwise undefined.\n * @param iModelId iModel Id, if the setting is specific to an iModel, otherwise undefined. The iTwinId must be specified if iModelId is specified.\n */\n saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void>;\n /** Load array of FavoritePropertiesOrderInfo from user-specific settings.\n * Setting is specific to an iModel.\n * @param iTwinId iTwin Id.\n * @param imodelId iModel Id.\n */\n loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined>;\n /** Saves FavoritePropertiesOrderInfo array to user-specific settings.\n * Setting is specific to an iModel.\n * @param orderInfo Array of FavoritePropertiesOrderInfo to save.\n * @param iTwinId iTwin Id.\n * @param imodelId iModel Id.\n */\n savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void>;\n}\n\n/**\n * Available implementations of [[IFavoritePropertiesStorage]].\n * @public\n */\nexport enum DefaultFavoritePropertiesStorageTypes {\n /** A no-op storage that doesn't store or return anything. Used for cases when favorite properties aren't used by the application. */\n Noop,\n /** A storage that stores favorite properties information in a browser local storage. */\n BrowserLocalStorage,\n /** A storage that stores favorite properties in a user preferences storage (see [[IModelApp.userPreferences]]). */\n UserPreferencesStorage,\n}\n\n/**\n * A factory method to create one of the available [[IFavoritePropertiesStorage]] implementations.\n * @public\n */\nexport function createFavoritePropertiesStorage(type: DefaultFavoritePropertiesStorageTypes): IFavoritePropertiesStorage {\n switch (type) {\n case DefaultFavoritePropertiesStorageTypes.Noop: return new NoopFavoritePropertiesStorage();\n case DefaultFavoritePropertiesStorageTypes.BrowserLocalStorage: return new BrowserLocalFavoritePropertiesStorage();\n case DefaultFavoritePropertiesStorageTypes.UserPreferencesStorage: return new OfflineCachingFavoritePropertiesStorage({ impl: new IModelAppFavoritePropertiesStorage() });\n }\n}\n\n/**\n * @internal\n */\nexport class IModelAppFavoritePropertiesStorage implements IFavoritePropertiesStorage {\n\n private async ensureIsSignedIn(): Promise<{ accessToken: AccessToken }> {\n const accessToken = IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : \"\";\n if (accessToken)\n return { accessToken };\n throw new PresentationError(PresentationStatus.Error, \"Current user is not authorized to use the settings service\");\n }\n\n public async loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined> {\n if (!IModelApp.userPreferences)\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\n\n const { accessToken } = await this.ensureIsSignedIn();\n let setting = await IModelApp.userPreferences.get({\n accessToken,\n iTwinId,\n iModelId: imodelId,\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\n key: FAVORITE_PROPERTIES_SETTING_NAME,\n });\n\n if (setting !== undefined)\n return new Set<PropertyFullName>(setting);\n\n // try to check the old namespace\n setting = await IModelApp.userPreferences.get({\n accessToken,\n iTwinId,\n iModelId: imodelId,\n namespace: DEPRECATED_PROPERTIES_SETTING_NAMESPACE,\n key: FAVORITE_PROPERTIES_SETTING_NAME,\n });\n\n if (setting !== undefined && setting.hasOwnProperty(\"nestedContentInfos\") && setting.hasOwnProperty(\"propertyInfos\") && setting.hasOwnProperty(\"baseFieldInfos\"))\n return new Set<PropertyFullName>([...setting.nestedContentInfos, ...setting.propertyInfos, ...setting.baseFieldInfos]);\n\n return undefined;\n }\n\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string): Promise<void> {\n if (!IModelApp.userPreferences)\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\n\n const { accessToken } = await this.ensureIsSignedIn();\n await IModelApp.userPreferences.save({\n accessToken,\n iTwinId,\n iModelId: imodelId,\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\n key: FAVORITE_PROPERTIES_SETTING_NAME,\n content: Array.from(properties),\n });\n }\n\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> {\n if (!IModelApp.userPreferences)\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\n\n const { accessToken } = await this.ensureIsSignedIn();\n const setting = await IModelApp.userPreferences.get({\n accessToken,\n iTwinId,\n iModelId: imodelId,\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\n key: FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME,\n });\n return setting as FavoritePropertiesOrderInfo[];\n }\n\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string) {\n if (!IModelApp.userPreferences)\n throw new PresentationError(PresentationStatus.Error, \"User preferences service is not set up\");\n\n const { accessToken } = await this.ensureIsSignedIn();\n await IModelApp.userPreferences.save({\n accessToken,\n iTwinId,\n iModelId: imodelId,\n namespace: IMODELJS_PRESENTATION_SETTING_NAMESPACE,\n key: FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME,\n content: orderInfos,\n });\n }\n}\n\n/** @internal */\nexport interface OfflineCachingFavoritePropertiesStorageProps {\n impl: IFavoritePropertiesStorage;\n connectivityInfo?: IConnectivityInformationProvider;\n}\n/** @internal */\nexport class OfflineCachingFavoritePropertiesStorage implements IFavoritePropertiesStorage, IDisposable {\n\n private _connectivityInfo: IConnectivityInformationProvider;\n private _impl: IFavoritePropertiesStorage;\n private _propertiesOfflineCache = new DictionaryWithReservations<ITwinAndIModelIdsKey, Set<PropertyFullName>>(iTwinAndIModelIdsKeyComparer);\n private _propertiesOrderOfflineCache = new DictionaryWithReservations<ITwinAndIModelIdsKey, FavoritePropertiesOrderInfo[]>(iTwinAndIModelIdsKeyComparer);\n\n public constructor(props: OfflineCachingFavoritePropertiesStorageProps) {\n this._impl = props.impl;\n // istanbul ignore next\n this._connectivityInfo = props.connectivityInfo ?? new ConnectivityInformationProvider();\n this._connectivityInfo.onInternetConnectivityChanged.addListener(this.onConnectivityStatusChanged);\n }\n\n public dispose() {\n if (isIDisposable(this._connectivityInfo))\n this._connectivityInfo.dispose();\n }\n\n public get impl() { return this._impl; }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onConnectivityStatusChanged = (args: { status: InternetConnectivityStatus }) => {\n // istanbul ignore else\n if (args.status === InternetConnectivityStatus.Online) {\n // note: we're copying the cached values to temp arrays because `saveProperties` and `savePropertiesOrder` both\n // attempt to modify cache dictionaries\n\n const propertiesCache = new Array<{ properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string }>();\n this._propertiesOfflineCache.forEach((key, value) => propertiesCache.push({ properties: value, iTwinId: key[0], imodelId: key[1] }));\n propertiesCache.forEach(async (cached) => this.saveProperties(cached.properties, cached.iTwinId, cached.imodelId));\n\n const ordersCache = new Array<{ order: FavoritePropertiesOrderInfo[], iTwinId?: string, imodelId: string }>();\n this._propertiesOrderOfflineCache.forEach((key, value) => ordersCache.push({ order: value, iTwinId: key[0], imodelId: key[1]! }));\n ordersCache.forEach(async (cached) => this.savePropertiesOrder(cached.order, cached.iTwinId, cached.imodelId));\n }\n };\n\n public async loadProperties(iTwinId?: string, imodelId?: string) {\n if (this._connectivityInfo.status === InternetConnectivityStatus.Online) {\n try {\n return await this._impl.loadProperties(iTwinId, imodelId);\n } catch {\n // return from offline cache if the above fails\n }\n }\n return this._propertiesOfflineCache.get([iTwinId, imodelId]);\n }\n\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string) {\n const key: ITwinAndIModelIdsKey = [iTwinId, imodelId];\n if (this._connectivityInfo.status === InternetConnectivityStatus.Offline) {\n this._propertiesOfflineCache.set(key, properties);\n return;\n }\n const reservationId = this._propertiesOfflineCache.reserve(key);\n try {\n await this._impl.saveProperties(properties, iTwinId, imodelId);\n this._propertiesOfflineCache.reservedDelete(key, reservationId);\n } catch {\n this._propertiesOfflineCache.reservedSet(key, properties, reservationId);\n }\n }\n\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string) {\n if (this._connectivityInfo.status === InternetConnectivityStatus.Online) {\n try {\n return await this._impl.loadPropertiesOrder(iTwinId, imodelId);\n } catch {\n // return from offline cache if the above fails\n }\n }\n return this._propertiesOrderOfflineCache.get([iTwinId, imodelId]);\n }\n\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string) {\n const key: ITwinAndIModelIdsKey = [iTwinId, imodelId];\n if (this._connectivityInfo.status === InternetConnectivityStatus.Offline) {\n this._propertiesOrderOfflineCache.set(key, orderInfos);\n return;\n }\n const reservationId = this._propertiesOrderOfflineCache.reserve(key);\n try {\n await this._impl.savePropertiesOrder(orderInfos, iTwinId, imodelId);\n this._propertiesOrderOfflineCache.reservedDelete(key, reservationId);\n } catch {\n this._propertiesOrderOfflineCache.reservedSet(key, orderInfos, reservationId);\n }\n }\n\n}\n\nclass DictionaryWithReservations<TKey, TValue> {\n private _impl: Dictionary<TKey, { value?: TValue, lastReservationId?: string }>;\n public constructor(compareKeys: OrderedComparator<TKey>) {\n this._impl = new Dictionary(compareKeys);\n }\n public get(key: TKey) { return this._impl.get(key)?.value; }\n public forEach(func: (key: TKey, value: TValue) => void): void {\n this._impl.forEach((key, entry) => {\n // istanbul ignore else\n if (entry.value)\n func(key, entry.value);\n });\n }\n public reserve(key: TKey) {\n const reservationId = Guid.createValue();\n this._impl.set(key, { lastReservationId: reservationId });\n return reservationId;\n }\n public set(key: TKey, value: TValue) { return this._impl.set(key, { value }); }\n public reservedSet(key: TKey, value: TValue, reservationId: string) {\n const entry = this._impl.get(key);\n if (entry && entry.lastReservationId === reservationId)\n this._impl.set(key, { value });\n }\n public reservedDelete(key: TKey, reservationId: string) {\n const entry = this._impl.get(key);\n if (entry && entry.lastReservationId === reservationId)\n this._impl.delete(key);\n }\n}\ntype ITwinAndIModelIdsKey = [string | undefined, string | undefined];\n\n// istanbul ignore next\nfunction iTwinAndIModelIdsKeyComparer(lhs: ITwinAndIModelIdsKey, rhs: ITwinAndIModelIdsKey) {\n const iTwinIdCompare = compareStrings(lhs[0] ?? \"\", rhs[0] ?? \"\");\n return (iTwinIdCompare !== 0) ? iTwinIdCompare : compareStrings(lhs[1] ?? \"\", rhs[1] ?? \"\");\n}\n\n/** @internal */\nexport class NoopFavoritePropertiesStorage implements IFavoritePropertiesStorage {\n // istanbul ignore next\n public async loadProperties(_iTwinId?: string, _imodelId?: string): Promise<Set<PropertyFullName> | undefined> { return undefined; }\n // istanbul ignore next\n public async saveProperties(_properties: Set<PropertyFullName>, _iTwinId?: string, _imodelId?: string) { }\n // istanbul ignore next\n public async loadPropertiesOrder(_iTwinId: string | undefined, _imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> { return undefined; }\n // istanbul ignore next\n public async savePropertiesOrder(_orderInfos: FavoritePropertiesOrderInfo[], _iTwinId: string | undefined, _imodelId: string): Promise<void> { }\n}\n\n/** @internal */\nexport class BrowserLocalFavoritePropertiesStorage implements IFavoritePropertiesStorage {\n private _localStorage: Storage;\n\n public constructor(props?: { localStorage?: Storage }) {\n // istanbul ignore next\n this._localStorage = props?.localStorage ?? window.localStorage;\n }\n\n public createFavoritesSettingItemKey(iTwinId?: string, imodelId?: string): string {\n return `${IMODELJS_PRESENTATION_SETTING_NAMESPACE}${FAVORITE_PROPERTIES_SETTING_NAME}?iTwinId=${iTwinId}&imodelId=${imodelId}`;\n }\n public createOrderSettingItemKey(iTwinId?: string, imodelId?: string): string {\n return `${IMODELJS_PRESENTATION_SETTING_NAMESPACE}${FAVORITE_PROPERTIES_ORDER_INFO_SETTING_NAME}?iTwinId=${iTwinId}&imodelId=${imodelId}`;\n }\n\n public async loadProperties(iTwinId?: string, imodelId?: string): Promise<Set<PropertyFullName> | undefined> {\n const value = this._localStorage.getItem(this.createFavoritesSettingItemKey(iTwinId, imodelId));\n if (!value)\n return undefined;\n\n const properties: PropertyFullName[] = JSON.parse(value);\n return new Set(properties);\n }\n\n public async saveProperties(properties: Set<PropertyFullName>, iTwinId?: string, imodelId?: string) {\n this._localStorage.setItem(this.createFavoritesSettingItemKey(iTwinId, imodelId), JSON.stringify([...properties]));\n }\n\n public async loadPropertiesOrder(iTwinId: string | undefined, imodelId: string): Promise<FavoritePropertiesOrderInfo[] | undefined> {\n const value = this._localStorage.getItem(this.createOrderSettingItemKey(iTwinId, imodelId));\n if (!value)\n return undefined;\n\n const orderInfos: FavoritePropertiesOrderInfo[] = JSON.parse(value).map((json: any) => ({\n ...json,\n orderedTimestamp: new Date(json.orderedTimestamp),\n }));\n return orderInfos;\n }\n\n public async savePropertiesOrder(orderInfos: FavoritePropertiesOrderInfo[], iTwinId: string | undefined, imodelId: string): Promise<void> {\n this._localStorage.setItem(this.createOrderSettingItemKey(iTwinId, imodelId), JSON.stringify(orderInfos));\n }\n}\n"]}
@@ -1,172 +1,172 @@
1
- {
2
- "$schema": "../../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
- "id": "presentation-frontend/HiliteRules",
4
- "rules": [
5
- {
6
- "ruleType": "Content",
7
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Subject\", \"BisCore\")",
8
- "onlyIfNotHandled": true,
9
- "specifications": [
10
- {
11
- "specType": "ContentRelatedInstances",
12
- "relationshipPaths": [
13
- [
14
- {
15
- "relationship": {
16
- "schemaName": "BisCore",
17
- "className": "ElementOwnsChildElements"
18
- },
19
- "direction": "Forward",
20
- "targetClass": {
21
- "schemaName": "BisCore",
22
- "className": "Subject"
23
- },
24
- "count": "*"
25
- },
26
- {
27
- "relationship": {
28
- "schemaName": "BisCore",
29
- "className": "ElementOwnsChildElements"
30
- },
31
- "direction": "Forward",
32
- "targetClass": {
33
- "schemaName": "BisCore",
34
- "className": "PhysicalPartition"
35
- }
36
- }
37
- ]
38
- ]
39
- }
40
- ]
41
- },
42
- {
43
- "ruleType": "Content",
44
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Model\", \"BisCore\")",
45
- "onlyIfNotHandled": true,
46
- "specifications": [
47
- {
48
- "specType": "SelectedNodeInstances"
49
- }
50
- ]
51
- },
52
- {
53
- "ruleType": "ExtendedData",
54
- "condition": "ThisNode.IsOfClass(\"Model\", \"BisCore\") ORELSE ThisNode.IsOfClass(\"PhysicalPartition\", \"BisCore\")",
55
- "items": {
56
- "isModel": "true"
57
- }
58
- },
59
- {
60
- "ruleType": "Content",
61
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Category\", \"BisCore\")",
62
- "onlyIfNotHandled": true,
63
- "specifications": [
64
- {
65
- "specType": "ContentRelatedInstances",
66
- "relationshipPaths": [
67
- {
68
- "relationship": {
69
- "schemaName": "BisCore",
70
- "className": "CategoryOwnsSubCategories"
71
- },
72
- "direction": "Forward"
73
- }
74
- ]
75
- }
76
- ]
77
- },
78
- {
79
- "ruleType": "Content",
80
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"SubCategory\", \"BisCore\")",
81
- "onlyIfNotHandled": true,
82
- "specifications": [
83
- {
84
- "specType": "SelectedNodeInstances"
85
- }
86
- ]
87
- },
88
- {
89
- "ruleType": "ExtendedData",
90
- "condition": "ThisNode.IsOfClass(\"SubCategory\", \"BisCore\")",
91
- "items": {
92
- "isSubCategory": "true"
93
- }
94
- },
95
- {
96
- "ruleType": "Content",
97
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
98
- "onlyIfNotHandled": true,
99
- "specifications": [
100
- {
101
- "specType": "ContentRelatedInstances",
102
- "relationshipPaths": [
103
- [
104
- {
105
- "relationship": {
106
- "schemaName": "BisCore",
107
- "className": "ElementGroupsMembers"
108
- },
109
- "direction": "Forward"
110
- },
111
- {
112
- "relationship": {
113
- "schemaName": "BisCore",
114
- "className": "ElementOwnsChildElements"
115
- },
116
- "direction": "Forward",
117
- "count": "*"
118
- }
119
- ]
120
- ],
121
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
122
- }
123
- ]
124
- },
125
- {
126
- "ruleType": "Content",
127
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GeometricElement\", \"BisCore\")",
128
- "onlyIfNotHandled": true,
129
- "specifications": [
130
- {
131
- "specType": "ContentRelatedInstances",
132
- "relationshipPaths": [
133
- {
134
- "relationship": {
135
- "schemaName": "BisCore",
136
- "className": "ElementOwnsChildElements"
137
- },
138
- "direction": "Forward",
139
- "count": "*"
140
- }
141
- ],
142
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
143
- },
144
- {
145
- "specType": "SelectedNodeInstances"
146
- }
147
- ]
148
- },
149
- {
150
- "ruleType": "Content",
151
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Element\", \"BisCore\")",
152
- "priority": 0,
153
- "onlyIfNotHandled": true,
154
- "specifications": [
155
- {
156
- "specType": "ContentRelatedInstances",
157
- "relationshipPaths": [
158
- {
159
- "relationship": {
160
- "schemaName": "BisCore",
161
- "className": "ElementOwnsChildElements"
162
- },
163
- "direction": "Forward",
164
- "count": "*"
165
- }
166
- ],
167
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
168
- }
169
- ]
170
- }
171
- ]
172
- }
1
+ {
2
+ "$schema": "../../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
+ "id": "presentation-frontend/HiliteRules",
4
+ "rules": [
5
+ {
6
+ "ruleType": "Content",
7
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Subject\", \"BisCore\")",
8
+ "onlyIfNotHandled": true,
9
+ "specifications": [
10
+ {
11
+ "specType": "ContentRelatedInstances",
12
+ "relationshipPaths": [
13
+ [
14
+ {
15
+ "relationship": {
16
+ "schemaName": "BisCore",
17
+ "className": "ElementOwnsChildElements"
18
+ },
19
+ "direction": "Forward",
20
+ "targetClass": {
21
+ "schemaName": "BisCore",
22
+ "className": "Subject"
23
+ },
24
+ "count": "*"
25
+ },
26
+ {
27
+ "relationship": {
28
+ "schemaName": "BisCore",
29
+ "className": "ElementOwnsChildElements"
30
+ },
31
+ "direction": "Forward",
32
+ "targetClass": {
33
+ "schemaName": "BisCore",
34
+ "className": "PhysicalPartition"
35
+ }
36
+ }
37
+ ]
38
+ ]
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "ruleType": "Content",
44
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Model\", \"BisCore\")",
45
+ "onlyIfNotHandled": true,
46
+ "specifications": [
47
+ {
48
+ "specType": "SelectedNodeInstances"
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "ruleType": "ExtendedData",
54
+ "condition": "ThisNode.IsOfClass(\"Model\", \"BisCore\") ORELSE ThisNode.IsOfClass(\"PhysicalPartition\", \"BisCore\")",
55
+ "items": {
56
+ "isModel": "true"
57
+ }
58
+ },
59
+ {
60
+ "ruleType": "Content",
61
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Category\", \"BisCore\")",
62
+ "onlyIfNotHandled": true,
63
+ "specifications": [
64
+ {
65
+ "specType": "ContentRelatedInstances",
66
+ "relationshipPaths": [
67
+ {
68
+ "relationship": {
69
+ "schemaName": "BisCore",
70
+ "className": "CategoryOwnsSubCategories"
71
+ },
72
+ "direction": "Forward"
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "ruleType": "Content",
80
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"SubCategory\", \"BisCore\")",
81
+ "onlyIfNotHandled": true,
82
+ "specifications": [
83
+ {
84
+ "specType": "SelectedNodeInstances"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "ruleType": "ExtendedData",
90
+ "condition": "ThisNode.IsOfClass(\"SubCategory\", \"BisCore\")",
91
+ "items": {
92
+ "isSubCategory": "true"
93
+ }
94
+ },
95
+ {
96
+ "ruleType": "Content",
97
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
98
+ "onlyIfNotHandled": true,
99
+ "specifications": [
100
+ {
101
+ "specType": "ContentRelatedInstances",
102
+ "relationshipPaths": [
103
+ [
104
+ {
105
+ "relationship": {
106
+ "schemaName": "BisCore",
107
+ "className": "ElementGroupsMembers"
108
+ },
109
+ "direction": "Forward"
110
+ },
111
+ {
112
+ "relationship": {
113
+ "schemaName": "BisCore",
114
+ "className": "ElementOwnsChildElements"
115
+ },
116
+ "direction": "Forward",
117
+ "count": "*"
118
+ }
119
+ ]
120
+ ],
121
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "ruleType": "Content",
127
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GeometricElement\", \"BisCore\")",
128
+ "onlyIfNotHandled": true,
129
+ "specifications": [
130
+ {
131
+ "specType": "ContentRelatedInstances",
132
+ "relationshipPaths": [
133
+ {
134
+ "relationship": {
135
+ "schemaName": "BisCore",
136
+ "className": "ElementOwnsChildElements"
137
+ },
138
+ "direction": "Forward",
139
+ "count": "*"
140
+ }
141
+ ],
142
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
143
+ },
144
+ {
145
+ "specType": "SelectedNodeInstances"
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "ruleType": "Content",
151
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Element\", \"BisCore\")",
152
+ "priority": 0,
153
+ "onlyIfNotHandled": true,
154
+ "specifications": [
155
+ {
156
+ "specType": "ContentRelatedInstances",
157
+ "relationshipPaths": [
158
+ {
159
+ "relationship": {
160
+ "schemaName": "BisCore",
161
+ "className": "ElementOwnsChildElements"
162
+ },
163
+ "direction": "Forward",
164
+ "count": "*"
165
+ }
166
+ ],
167
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
168
+ }
169
+ ]
170
+ }
171
+ ]
172
+ }
@@ -1,53 +1,53 @@
1
- /** @packageDocumentation
2
- * @module UnifiedSelection
3
- */
4
- import { Id64String } from "@itwin/core-bentley";
5
- import { IModelConnection } from "@itwin/core-frontend";
6
- import { KeySet, Ruleset } from "@itwin/presentation-common";
7
- /** @internal */
8
- export declare const HILITE_RULESET: Ruleset;
9
- /**
10
- * A set of model, subcategory and element ids that can be used for specifying
11
- * viewport hilite.
12
- *
13
- * @public
14
- */
15
- export interface HiliteSet {
16
- models?: Id64String[];
17
- subCategories?: Id64String[];
18
- elements?: Id64String[];
19
- }
20
- /**
21
- * Properties for creating a `HiliteSetProvider` instance.
22
- * @public
23
- */
24
- export interface HiliteSetProviderProps {
25
- imodel: IModelConnection;
26
- }
27
- /**
28
- * Presentation-based provider which uses presentation ruleset to determine
29
- * what `HiliteSet` should be hilited in the graphics viewport based on the
30
- * supplied `KeySet`.
31
- *
32
- * @public
33
- */
34
- export declare class HiliteSetProvider {
35
- private _imodel;
36
- private _cached;
37
- private constructor();
38
- /**
39
- * Create a hilite set provider for the specified iModel.
40
- */
41
- static create(props: HiliteSetProviderProps): HiliteSetProvider;
42
- private getRecords;
43
- private createHiliteSet;
44
- /**
45
- * Get hilite set for instances and/or nodes whose keys are specified in the
46
- * given KeySet.
47
- *
48
- * Note: The provider caches result of the last request, so subsequent requests
49
- * for the same input doesn't cost.
50
- */
51
- getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet>;
52
- }
1
+ /** @packageDocumentation
2
+ * @module UnifiedSelection
3
+ */
4
+ import { Id64String } from "@itwin/core-bentley";
5
+ import { IModelConnection } from "@itwin/core-frontend";
6
+ import { KeySet, Ruleset } from "@itwin/presentation-common";
7
+ /** @internal */
8
+ export declare const HILITE_RULESET: Ruleset;
9
+ /**
10
+ * A set of model, subcategory and element ids that can be used for specifying
11
+ * viewport hilite.
12
+ *
13
+ * @public
14
+ */
15
+ export interface HiliteSet {
16
+ models?: Id64String[];
17
+ subCategories?: Id64String[];
18
+ elements?: Id64String[];
19
+ }
20
+ /**
21
+ * Properties for creating a `HiliteSetProvider` instance.
22
+ * @public
23
+ */
24
+ export interface HiliteSetProviderProps {
25
+ imodel: IModelConnection;
26
+ }
27
+ /**
28
+ * Presentation-based provider which uses presentation ruleset to determine
29
+ * what `HiliteSet` should be hilited in the graphics viewport based on the
30
+ * supplied `KeySet`.
31
+ *
32
+ * @public
33
+ */
34
+ export declare class HiliteSetProvider {
35
+ private _imodel;
36
+ private _cached;
37
+ private constructor();
38
+ /**
39
+ * Create a hilite set provider for the specified iModel.
40
+ */
41
+ static create(props: HiliteSetProviderProps): HiliteSetProvider;
42
+ private getRecords;
43
+ private createHiliteSet;
44
+ /**
45
+ * Get hilite set for instances and/or nodes whose keys are specified in the
46
+ * given KeySet.
47
+ *
48
+ * Note: The provider caches result of the last request, so subsequent requests
49
+ * for the same input doesn't cost.
50
+ */
51
+ getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet>;
52
+ }
53
53
  //# sourceMappingURL=HiliteSetProvider.d.ts.map