@itwin/presentation-frontend 5.0.0-dev.4 → 5.0.0-dev.40
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.
- package/CHANGELOG.md +28 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +5 -5
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +14 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +66 -47
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +5 -5
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +14 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +66 -47
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Change Log - @itwin/presentation-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 13 Jan 2025 14:09:29 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.10.4
|
|
6
|
+
Mon, 13 Jan 2025 14:06:43 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.10.3
|
|
11
|
+
Mon, 06 Jan 2025 14:00:13 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 4.10.2
|
|
16
|
+
Thu, 21 Nov 2024 15:22:20 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 4.10.1
|
|
21
|
+
Thu, 14 Nov 2024 18:11:00 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 4.10.0
|
|
26
|
+
Wed, 13 Nov 2024 15:23:39 GMT
|
|
27
|
+
|
|
28
|
+
### Updates
|
|
29
|
+
|
|
30
|
+
- Bumped `@itwin/unified-selection` version.
|
|
4
31
|
|
|
5
32
|
## 4.9.7
|
|
6
33
|
Wed, 06 Nov 2024 19:23:04 GMT
|
|
@@ -27,6 +27,11 @@ var FavoritePropertiesScope;
|
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
29
|
class FavoritePropertiesManager {
|
|
30
|
+
/**
|
|
31
|
+
* Used in tests to avoid collisions between multiple runs using the same storage
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
static { this.FAVORITES_IDENTIFIER_PREFIX = ""; }
|
|
30
35
|
constructor(props) {
|
|
31
36
|
/** Event raised after favorite properties have changed. */
|
|
32
37
|
this.onFavoritesChanged = new core_bentley_1.BeEvent();
|
|
@@ -486,11 +491,6 @@ class FavoritePropertiesManager {
|
|
|
486
491
|
}
|
|
487
492
|
}
|
|
488
493
|
exports.FavoritePropertiesManager = FavoritePropertiesManager;
|
|
489
|
-
/**
|
|
490
|
-
* Used in tests to avoid collisions between multiple runs using the same storage
|
|
491
|
-
* @internal
|
|
492
|
-
*/
|
|
493
|
-
FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX = "";
|
|
494
494
|
var Direction;
|
|
495
495
|
(function (Direction) {
|
|
496
496
|
Direction[Direction["Up"] = -1] = "Up";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA0E;AAC1E,oDAAoD;AAKpD;;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IAAI,IAAI,EAAE;SAC7B;KACF,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,qBAAqB,yBA4BhC;AAEF,MAAM,kBAAkB,GAAG,CAAC,KAAY,EAAE,UAAyC,EAAiC,EAAE;IACpH,MAAM,eAAe,GAAkC,EAAE,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,EAAE,CAAC;YACjC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACxC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,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,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,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 private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\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 this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n }\n\n public dispose() {\n // istanbul ignore else\n if (isIDisposable(this._storage)) {\n this._storage.dispose();\n }\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\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\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\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n /**\n * Calls [[FavoritePropertiesManager.initializeConnection]] and caches the promise which should be awaited by calling [[FavoritePropertiesManager.ensureInitialized]].\n * @internal\n */\n public startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n /**\n * Performs the initialization process or finishes the one that was started by [[FavoritePropertiesManager.startConnectionInitialization]].\n * @internal\n */\n public async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\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 */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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 */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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\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 */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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\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 * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\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 (\n 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 /**\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 */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\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 * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\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\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\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 */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\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 }\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\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\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 const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\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 */\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 await this.ensureInitialized(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\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 }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = 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 }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\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\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\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\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(\n (property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`,\n );\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\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) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(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 }\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 }\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\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\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 {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\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\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\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;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,uCAAvB,uBAAuB,QAIlC;AAkCD;;;;;GAKG;AACH,MAAa,yBAAyB;IACpC;;;OAGG;aACW,gCAA2B,GAAG,EAAE,AAAL,CAAM;IAe/C,YAAmB,KAAqC;QAbxD,2DAA2D;QAC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AAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACjE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACxC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,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,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,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 private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\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 this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n }\n\n public dispose() {\n // istanbul ignore else\n if (isIDisposable(this._storage)) {\n this._storage.dispose();\n }\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\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\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\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n /**\n * Calls [[FavoritePropertiesManager.initializeConnection]] and caches the promise which should be awaited by calling [[FavoritePropertiesManager.ensureInitialized]].\n * @internal\n */\n public startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n /**\n * Performs the initialization process or finishes the one that was started by [[FavoritePropertiesManager.startConnectionInitialization]].\n * @internal\n */\n public async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\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 */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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 */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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\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 */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(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\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 * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\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 (\n 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 /**\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 */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\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 * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\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\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\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 */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\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 }\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\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\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 const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\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 */\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 await this.ensureInitialized(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\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 }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = 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 }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\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\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\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\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(\n (property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`,\n );\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\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) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(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 }\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 }\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\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\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 {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\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\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\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|
|
@@ -21,13 +21,21 @@ export interface SelectionManagerProps {
|
|
|
21
21
|
* and maintains storage.
|
|
22
22
|
*/
|
|
23
23
|
selectionStorage?: SelectionStorage;
|
|
24
|
+
/**
|
|
25
|
+
* An optional function that returns a key for the given iModel. The key is what "glues" iModel selection
|
|
26
|
+
* changes made in `selectionStorage`, where iModels are identified by key, and `SelectionManager`, where
|
|
27
|
+
* iModels are specified as `IModelConnection`.
|
|
28
|
+
*
|
|
29
|
+
* If not provided, [IModelConnection.key]($core-frontend) or [IModelConnection.name]($core-frontend) is used.
|
|
30
|
+
*/
|
|
31
|
+
imodelKeyFactory?: (imodel: IModelConnection) => string;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* The selection manager which stores the overall selection.
|
|
27
35
|
* @public
|
|
28
36
|
*/
|
|
29
37
|
export declare class SelectionManager implements ISelectionProvider {
|
|
30
|
-
private
|
|
38
|
+
private _imodelKeyFactory;
|
|
31
39
|
private _imodelToolSelectionSyncHandlers;
|
|
32
40
|
private _hiliteSetProviders;
|
|
33
41
|
private _ownsStorage;
|
|
@@ -36,6 +44,11 @@ export declare class SelectionManager implements ISelectionProvider {
|
|
|
36
44
|
private _selectionChanges;
|
|
37
45
|
private _selectionEventsSubscription;
|
|
38
46
|
private _listeners;
|
|
47
|
+
/**
|
|
48
|
+
* Underlying selection storage used by this selection manager. Ideally, consumers should use
|
|
49
|
+
* the storage directly instead of using this manager to manipulate selection.
|
|
50
|
+
*/
|
|
51
|
+
readonly selectionStorage: SelectionStorage;
|
|
39
52
|
/** An event which gets broadcasted on selection changes */
|
|
40
53
|
readonly selectionChange: SelectionChangeEvent;
|
|
41
54
|
/** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAQ,OAAO,EAAa,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SelectionManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAQ,OAAO,EAAa,WAAW,EAAS,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAA2D,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAoD,IAAI,EAAE,MAAM,EAAW,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC1J,OAAO,EAKL,gBAAgB,EAIjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAiD,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAA6B,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,oGAAoG;IACpG,MAAM,EAAE,sBAAsB,CA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G,MAAM,EACpD,KAAK,GAAE,MAAU,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAKhB;;;OAGG;IACU,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAIvE;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,gBAAgB;IAIpD,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,qBAAqB;CA8B9B;AAWD,gBAAgB;AAChB,qBAAa,wBAAyB,YAAW,WAAW;IAC1D,OAAO,CAAC,oBAAoB,CAAU;IACtC,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,uCAAuC,CAAa;IAC5D,OAAO,CAAC,cAAc,CAA2B;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAC;gBAEV,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB;IAMxE,OAAO;IAId,+BAA+B;IAC/B,IAAW,aAAa,gBAEvB;IAED,OAAO,CAAC,sBAAsB,CAwD5B;CACH"}
|
|
@@ -28,18 +28,19 @@ class SelectionManager {
|
|
|
28
28
|
constructor(props) {
|
|
29
29
|
this._imodelToolSelectionSyncHandlers = new Map();
|
|
30
30
|
this._hiliteSetProviders = new Map();
|
|
31
|
-
this._knownIModels = new
|
|
31
|
+
this._knownIModels = new Set();
|
|
32
32
|
this._currentSelection = new CurrentSelectionStorage();
|
|
33
33
|
this._selectionChanges = new rxjs_1.Subject();
|
|
34
34
|
this._listeners = [];
|
|
35
35
|
this.selectionChange = new SelectionChangeEvent_1.SelectionChangeEvent();
|
|
36
36
|
this.scopes = props.scopes;
|
|
37
|
-
this.
|
|
37
|
+
this.selectionStorage = props.selectionStorage ?? (0, unified_selection_1.createStorage)();
|
|
38
|
+
this._imodelKeyFactory = props.imodelKeyFactory ?? ((imodel) => (imodel.key.length ? imodel.key : imodel.name));
|
|
38
39
|
this._ownsStorage = props.selectionStorage === undefined;
|
|
39
|
-
this.
|
|
40
|
+
this.selectionStorage.selectionChangeEvent.addListener((args) => this._selectionChanges.next(args));
|
|
40
41
|
this._selectionEventsSubscription = this.streamSelectionEvents();
|
|
41
42
|
this._listeners.push(core_frontend_1.IModelConnection.onOpen.addListener((imodel) => {
|
|
42
|
-
this._knownIModels.
|
|
43
|
+
this._knownIModels.add(imodel);
|
|
43
44
|
}));
|
|
44
45
|
this._listeners.push(core_frontend_1.IModelConnection.onClose.addListener((imodel) => {
|
|
45
46
|
this.onConnectionClose(imodel);
|
|
@@ -50,12 +51,13 @@ class SelectionManager {
|
|
|
50
51
|
this._listeners.forEach((dispose) => dispose());
|
|
51
52
|
}
|
|
52
53
|
onConnectionClose(imodel) {
|
|
54
|
+
const imodelKey = this._imodelKeyFactory(imodel);
|
|
53
55
|
this._hiliteSetProviders.delete(imodel);
|
|
54
|
-
this._knownIModels.delete(imodel
|
|
55
|
-
this._currentSelection.clear(
|
|
56
|
+
this._knownIModels.delete(imodel);
|
|
57
|
+
this._currentSelection.clear(imodelKey);
|
|
56
58
|
if (this._ownsStorage) {
|
|
57
59
|
this.clearSelection("Connection Close Event", imodel);
|
|
58
|
-
this.
|
|
60
|
+
this.selectionStorage.clearStorage({ imodelKey });
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
/** @internal */
|
|
@@ -104,7 +106,8 @@ class SelectionManager {
|
|
|
104
106
|
}
|
|
105
107
|
/** Get the selection levels currently stored in this manager for the specified imodel */
|
|
106
108
|
getSelectionLevels(imodel) {
|
|
107
|
-
|
|
109
|
+
const imodelKey = this._imodelKeyFactory(imodel);
|
|
110
|
+
return this.selectionStorage.getSelectionLevels({ imodelKey });
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
113
|
* Get the selection currently stored in this manager
|
|
@@ -114,39 +117,39 @@ class SelectionManager {
|
|
|
114
117
|
* latest selection after changes.
|
|
115
118
|
*/
|
|
116
119
|
getSelection(imodel, level = 0) {
|
|
117
|
-
|
|
120
|
+
const imodelKey = this._imodelKeyFactory(imodel);
|
|
121
|
+
return this._currentSelection.getSelection(imodelKey, level);
|
|
118
122
|
}
|
|
119
123
|
handleEvent(evt) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
124
|
+
const imodelKey = this._imodelKeyFactory(evt.imodel);
|
|
125
|
+
this._knownIModels.add(evt.imodel);
|
|
123
126
|
switch (evt.changeType) {
|
|
124
127
|
case SelectionChangeEvent_1.SelectionChangeType.Add:
|
|
125
|
-
this.
|
|
126
|
-
|
|
128
|
+
this.selectionStorage.addToSelection({
|
|
129
|
+
imodelKey,
|
|
127
130
|
source: evt.source,
|
|
128
131
|
level: evt.level,
|
|
129
132
|
selectables: keysToSelectable(evt.imodel, evt.keys),
|
|
130
133
|
});
|
|
131
134
|
break;
|
|
132
135
|
case SelectionChangeEvent_1.SelectionChangeType.Remove:
|
|
133
|
-
this.
|
|
134
|
-
|
|
136
|
+
this.selectionStorage.removeFromSelection({
|
|
137
|
+
imodelKey,
|
|
135
138
|
source: evt.source,
|
|
136
139
|
level: evt.level,
|
|
137
140
|
selectables: keysToSelectable(evt.imodel, evt.keys),
|
|
138
141
|
});
|
|
139
142
|
break;
|
|
140
143
|
case SelectionChangeEvent_1.SelectionChangeType.Replace:
|
|
141
|
-
this.
|
|
142
|
-
|
|
144
|
+
this.selectionStorage.replaceSelection({
|
|
145
|
+
imodelKey,
|
|
143
146
|
source: evt.source,
|
|
144
147
|
level: evt.level,
|
|
145
148
|
selectables: keysToSelectable(evt.imodel, evt.keys),
|
|
146
149
|
});
|
|
147
150
|
break;
|
|
148
151
|
case SelectionChangeEvent_1.SelectionChangeType.Clear:
|
|
149
|
-
this.
|
|
152
|
+
this.selectionStorage.clearSelection({ imodelKey, source: evt.source, level: evt.level });
|
|
150
153
|
break;
|
|
151
154
|
}
|
|
152
155
|
}
|
|
@@ -293,9 +296,9 @@ class SelectionManager {
|
|
|
293
296
|
streamSelectionEvents() {
|
|
294
297
|
return this._selectionChanges
|
|
295
298
|
.pipe((0, rxjs_1.mergeMap)((args) => {
|
|
296
|
-
const currentSelectables = this.
|
|
299
|
+
const currentSelectables = this.selectionStorage.getSelection({ imodelKey: args.imodelKey, level: args.level });
|
|
297
300
|
return this._currentSelection.computeSelection(args.imodelKey, args.level, currentSelectables, args.selectables).pipe((0, rxjs_1.mergeMap)(({ level, changedSelection }) => {
|
|
298
|
-
const imodel = this._knownIModels.
|
|
301
|
+
const imodel = findIModel(this._knownIModels, this._imodelKeyFactory, args.imodelKey);
|
|
299
302
|
// istanbul ignore if
|
|
300
303
|
if (!imodel) {
|
|
301
304
|
return rxjs_1.EMPTY;
|
|
@@ -318,6 +321,14 @@ class SelectionManager {
|
|
|
318
321
|
}
|
|
319
322
|
}
|
|
320
323
|
exports.SelectionManager = SelectionManager;
|
|
324
|
+
function findIModel(set, imodelKeyFactory, key) {
|
|
325
|
+
for (const imodel of set) {
|
|
326
|
+
if (imodelKeyFactory(imodel) === key) {
|
|
327
|
+
return imodel;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return undefined;
|
|
331
|
+
}
|
|
321
332
|
/** @internal */
|
|
322
333
|
class ToolSelectionSyncHandler {
|
|
323
334
|
constructor(imodel, logicalSelection) {
|
|
@@ -339,13 +350,13 @@ class ToolSelectionSyncHandler {
|
|
|
339
350
|
let ids;
|
|
340
351
|
switch (ev.type) {
|
|
341
352
|
case core_frontend_1.SelectionSetEventType.Add:
|
|
342
|
-
ids = ev.
|
|
353
|
+
ids = ev.additions;
|
|
343
354
|
break;
|
|
344
355
|
case core_frontend_1.SelectionSetEventType.Replace:
|
|
345
|
-
ids = ev.set.
|
|
356
|
+
ids = ev.set.active;
|
|
346
357
|
break;
|
|
347
358
|
default:
|
|
348
|
-
ids = ev.
|
|
359
|
+
ids = ev.removals;
|
|
349
360
|
break;
|
|
350
361
|
}
|
|
351
362
|
// we're always using scoped selection changer even if the scope is set to "element" - that
|
|
@@ -353,22 +364,19 @@ class ToolSelectionSyncHandler {
|
|
|
353
364
|
// we can't because otherwise our keys compare fails (presentation components load data with
|
|
354
365
|
// concrete classes)
|
|
355
366
|
const changer = new ScopedSelectionChanger(this._selectionSourceName, this._imodel, this._logicalSelection, (0, SelectionScopesManager_1.createSelectionScopeProps)(this._logicalSelection.scopes.activeScope));
|
|
356
|
-
// we know what to do immediately on `clear` events
|
|
357
|
-
if (core_frontend_1.SelectionSetEventType.Clear === ev.type) {
|
|
358
|
-
await changer.clear(selectionLevel);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
const parsedIds = parseIds(ids);
|
|
362
367
|
await (0, core_bentley_1.using)(this._asyncsTracker.trackAsyncTask(), async (_r) => {
|
|
363
368
|
switch (ev.type) {
|
|
364
369
|
case core_frontend_1.SelectionSetEventType.Add:
|
|
365
|
-
await changer.add(
|
|
370
|
+
await changer.add(ids, selectionLevel);
|
|
366
371
|
break;
|
|
367
372
|
case core_frontend_1.SelectionSetEventType.Replace:
|
|
368
|
-
await changer.replace(
|
|
373
|
+
await changer.replace(ids, selectionLevel);
|
|
369
374
|
break;
|
|
370
375
|
case core_frontend_1.SelectionSetEventType.Remove:
|
|
371
|
-
await changer.remove(
|
|
376
|
+
await changer.remove(ids, selectionLevel);
|
|
377
|
+
break;
|
|
378
|
+
case core_frontend_1.SelectionSetEventType.Clear:
|
|
379
|
+
await changer.clear(selectionLevel);
|
|
372
380
|
break;
|
|
373
381
|
}
|
|
374
382
|
});
|
|
@@ -386,7 +394,7 @@ class ToolSelectionSyncHandler {
|
|
|
386
394
|
}
|
|
387
395
|
}
|
|
388
396
|
exports.ToolSelectionSyncHandler = ToolSelectionSyncHandler;
|
|
389
|
-
const
|
|
397
|
+
const parseElementIds = (ids) => {
|
|
390
398
|
let allPersistent = true;
|
|
391
399
|
let allTransient = true;
|
|
392
400
|
for (const id of core_bentley_1.Id64.iterable(ids)) {
|
|
@@ -421,12 +429,11 @@ const parseIds = (ids) => {
|
|
|
421
429
|
}
|
|
422
430
|
return { persistent: persistentElementIds, transient: transientElementIds };
|
|
423
431
|
};
|
|
424
|
-
function
|
|
425
|
-
for (const id of core_bentley_1.Id64.iterable(
|
|
426
|
-
|
|
432
|
+
function addKeys(target, className, ids) {
|
|
433
|
+
for (const id of core_bentley_1.Id64.iterable(ids)) {
|
|
434
|
+
target.add({ className, id });
|
|
427
435
|
}
|
|
428
436
|
}
|
|
429
|
-
/** @internal */
|
|
430
437
|
class ScopedSelectionChanger {
|
|
431
438
|
constructor(name, imodel, manager, scope) {
|
|
432
439
|
this.name = name;
|
|
@@ -437,21 +444,33 @@ class ScopedSelectionChanger {
|
|
|
437
444
|
async clear(level) {
|
|
438
445
|
this.manager.clearSelection(this.name, this.imodel, level);
|
|
439
446
|
}
|
|
440
|
-
async add(
|
|
441
|
-
const keys = await this
|
|
442
|
-
addTransientKeys(transientIds, keys);
|
|
447
|
+
async add(ids, level) {
|
|
448
|
+
const keys = await this.#computeSelection(ids);
|
|
443
449
|
this.manager.addToSelection(this.name, this.imodel, keys, level);
|
|
444
450
|
}
|
|
445
|
-
async remove(
|
|
446
|
-
const keys = await this
|
|
447
|
-
addTransientKeys(transientIds, keys);
|
|
451
|
+
async remove(ids, level) {
|
|
452
|
+
const keys = await this.#computeSelection(ids);
|
|
448
453
|
this.manager.removeFromSelection(this.name, this.imodel, keys, level);
|
|
449
454
|
}
|
|
450
|
-
async replace(
|
|
451
|
-
const keys = await this
|
|
452
|
-
addTransientKeys(transientIds, keys);
|
|
455
|
+
async replace(ids, level) {
|
|
456
|
+
const keys = await this.#computeSelection(ids);
|
|
453
457
|
this.manager.replaceSelection(this.name, this.imodel, keys, level);
|
|
454
458
|
}
|
|
459
|
+
async #computeSelection(ids) {
|
|
460
|
+
let keys = new presentation_common_1.KeySet();
|
|
461
|
+
if (ids.elements) {
|
|
462
|
+
const { persistent, transient } = parseElementIds(ids.elements);
|
|
463
|
+
keys = await this.manager.scopes.computeSelection(this.imodel, persistent, this.scope);
|
|
464
|
+
addKeys(keys, unified_selection_1.TRANSIENT_ELEMENT_CLASSNAME, transient);
|
|
465
|
+
}
|
|
466
|
+
if (ids.models) {
|
|
467
|
+
addKeys(keys, "BisCore.Model", ids.models);
|
|
468
|
+
}
|
|
469
|
+
if (ids.subcategories) {
|
|
470
|
+
addKeys(keys, "BisCore.SubCategory", ids.subcategories);
|
|
471
|
+
}
|
|
472
|
+
return keys;
|
|
473
|
+
}
|
|
455
474
|
}
|
|
456
475
|
/** Stores current selection in `KeySet` format per iModel. */
|
|
457
476
|
class CurrentSelectionStorage {
|