@itwin/presentation-frontend 4.8.0-dev.9 → 4.9.0-dev.2
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 +38 -1
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.d.ts +2 -2
- package/lib/cjs/presentation-frontend/Diagnostics.js +2 -2
- package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +3 -7
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +1 -3
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts +0 -2
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +7 -7
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +4 -0
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.d.ts +2 -2
- package/lib/esm/presentation-frontend/Diagnostics.js +2 -2
- package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +3 -7
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +1 -3
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts +0 -2
- package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +7 -7
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +4 -0
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesStorage.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAmI;AACnI,oDAAgE;AAChE,wDAAiD;AACjD,oEAAmF;AACnF,wFAAuH;AAGvH,gBAAgB;AACH,QAAA,uCAAuC,GAAG,uBAAuB,CAAC;AAC/E,gBAAgB;AACH,QAAA,uCAAuC,GAAG,YAAY,CAAC;AACpE,gBAAgB;AACH,QAAA,gCAAgC,GAAG,oBAAoB,CAAC;AACrE,gBAAgB;AACH,QAAA,2CAA2C,GAAG,6BAA6B,CAAC;AAiCzF;;;GAGG;AACH,IAAY,qCAOX;AAPD,WAAY,qCAAqC;IAC/C,qIAAqI;IACrI,iGAAI,CAAA;IACJ,wFAAwF;IACxF,+HAAmB,CAAA;IACnB,mHAAmH;IACnH,qIAAsB,CAAA;AACxB,CAAC,EAPW,qCAAqC,qDAArC,qCAAqC,QAOhD;AAED;;;GAGG;AACH,SAAgB,+BAA+B,CAAC,IAA2C;IACzF,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,qCAAqC,CAAC,IAAI;YAC7C,OAAO,IAAI,6BAA6B,EAAE,CAAC;QAC7C,KAAK,qCAAqC,CAAC,mBAAmB;YAC5D,OAAO,IAAI,qCAA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B,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;AA7CD,sFA6CC","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:\n return new NoopFavoritePropertiesStorage();\n case DefaultFavoritePropertiesStorageTypes.BrowserLocalStorage:\n return new BrowserLocalFavoritePropertiesStorage();\n case DefaultFavoritePropertiesStorageTypes.UserPreferencesStorage:\n return new OfflineCachingFavoritePropertiesStorage({ impl: new IModelAppFavoritePropertiesStorage() });\n }\n}\n\n/**\n * @internal\n */\nexport class IModelAppFavoritePropertiesStorage implements IFavoritePropertiesStorage {\n private async ensureIsSignedIn(): Promise<{ accessToken: AccessToken }> {\n const accessToken = IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : \"\";\n if (accessToken) {\n return { accessToken };\n }\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\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\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 (\n setting !== undefined &&\n setting.hasOwnProperty(\"nestedContentInfos\") &&\n setting.hasOwnProperty(\"propertyInfos\") &&\n setting.hasOwnProperty(\"baseFieldInfos\")\n ) {\n return new Set<PropertyFullName>([...setting.nestedContentInfos, ...setting.propertyInfos, ...setting.baseFieldInfos]);\n }\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\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\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\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 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\n public get impl() {\n return this._impl;\n }\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\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) {\n return this._impl.get(key)?.value;\n }\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 }\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) {\n return this._impl.set(key, { value });\n }\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 }\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 }\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> {\n return undefined;\n }\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> {\n return undefined;\n }\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\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\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
|
+
{"version":3,"file":"FavoritePropertiesStorage.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAmI;AACnI,oDAAgE;AAChE,wDAAiD;AACjD,oEAAmF;AACnF,wFAAuH;AAGvH,gBAAgB;AACH,QAAA,uCAAuC,GAAG,uBAAuB,CAAC;AAC/E,gBAAgB;AACH,QAAA,uCAAuC,GAAG,YAAY,CAAC;AACpE,gBAAgB;AACH,QAAA,gCAAgC,GAAG,oBAAoB,CAAC;AACrE,gBAAgB;AACH,QAAA,2CAA2C,GAAG,6BAA6B,CAAC;AAiCzF;;;GAGG;AACH,IAAY,qCAOX;AAPD,WAAY,qCAAqC;IAC/C,qIAAqI;IACrI,iGAAI,CAAA;IACJ,wFAAwF;IACxF,+HAAmB,CAAA;IACnB,mHAAmH;IACnH,qIAAsB,CAAA;AACxB,CAAC,EAPW,qCAAqC,qDAArC,qCAAqC,QAOhD;AAED;;;GAGG;AACH,SAAgB,+BAA+B,CAAC,IAA2C;IACzF,QA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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;AA7CD,sFA6CC","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:\r\n return new NoopFavoritePropertiesStorage();\r\n case DefaultFavoritePropertiesStorageTypes.BrowserLocalStorage:\r\n return new BrowserLocalFavoritePropertiesStorage();\r\n case DefaultFavoritePropertiesStorageTypes.UserPreferencesStorage:\r\n 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 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 }\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\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\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 (\r\n setting !== undefined &&\r\n setting.hasOwnProperty(\"nestedContentInfos\") &&\r\n setting.hasOwnProperty(\"propertyInfos\") &&\r\n setting.hasOwnProperty(\"baseFieldInfos\")\r\n ) {\r\n return new Set<PropertyFullName>([...setting.nestedContentInfos, ...setting.propertyInfos, ...setting.baseFieldInfos]);\r\n }\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\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\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\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 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\r\n public get impl() {\r\n return this._impl;\r\n }\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\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) {\r\n return this._impl.get(key)?.value;\r\n }\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 }\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) {\r\n return this._impl.set(key, { value });\r\n }\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 }\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\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> {\r\n return undefined;\r\n }\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> {\r\n return undefined;\r\n }\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\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\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HiliteSetProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;AAEH,+BAAqD;AACrD,mDAA+C;AAG/C,oEAAgK;AAChK,kDAA+C;AAC/C,yDAAiE;AACjE,0EAA+C;AAE/C,MAAM,cAAc,GAAG,0BAAwB,CAAC;AAsBhD;;;;;;GAMG;AACH,MAAa,iBAAiB;IAI5B,YAAoB,KAA6B;QAC/C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAM,CAAC,KAA6B;QAChD,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CAAC,SAA2B;QACnD,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAc,CAAC;QACzC,MAAM,cAAc,GAAG,IAAI,KAAK,EAAc,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,KAAK,EAAc,CAAC;QAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,KAAK,EAAE,MAAM,GAAG,IAA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MAAM,IAAI,GAAG,IAAI,4BAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAQ,EAAE,EAAE;YAC/B,IAAI,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,8CAA2B,EAAE,CAAC;gBAC5E,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC1B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO;YACL,YAAY;YACZ,IAAI;SACL,CAAC;IACJ,CAAC;CACF;AA9ID,8CA8IC;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC;AAElF,MAAM,mBAAmB,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,aAAa,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 UnifiedSelection\n */\n\nimport { from, Observable, shareReplay } from \"rxjs\";\nimport { eachValueFrom } from \"rxjs-for-await\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ContentFlags, DEFAULT_KEYS_BATCH_SIZE, DefaultContentDisplayTypes, DescriptorOverrides, Item, Key, KeySet, Ruleset } from \"@itwin/presentation-common\";\nimport { Presentation } from \"../Presentation\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./SelectionManager\";\nimport hiliteRuleset from \"./HiliteRules.json\";\n\nconst HILITE_RULESET = hiliteRuleset as Ruleset;\n\n/**\n * A set of model, subcategory and element ids that can be used for specifying\n * viewport hilite.\n *\n * @public\n */\nexport interface HiliteSet {\n models?: Id64String[];\n subCategories?: Id64String[];\n elements?: Id64String[];\n}\n\n/**\n * Properties for creating a `HiliteSetProvider` instance.\n * @public\n */\nexport interface HiliteSetProviderProps {\n imodel: IModelConnection;\n}\n\n/**\n * Presentation-based provider which uses presentation ruleset to determine\n * what `HiliteSet` should be hilited in the graphics viewport based on the\n * supplied `KeySet`.\n *\n * @public\n */\nexport class HiliteSetProvider {\n private _imodel: IModelConnection;\n private _cache: undefined | { keysGuid: string; observable: Observable<HiliteSet> };\n\n private constructor(props: HiliteSetProviderProps) {\n this._imodel = props.imodel;\n }\n\n /**\n * Create a hilite set provider for the specified iModel.\n */\n public static create(props: HiliteSetProviderProps) {\n return new HiliteSetProvider(props);\n }\n\n /**\n * Get hilite set for instances and/or nodes whose keys are specified in the\n * given KeySet.\n *\n * Note: The provider caches result of the last request, so subsequent requests\n * for the same input doesn't cost.\n */\n public async getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet> {\n const modelIds = new Array<Id64String>();\n const subCategoryIds = new Array<Id64String>();\n const elementIds = new Array<Id64String>();\n\n const iterator = this.getHiliteSetIterator(selection);\n for await (const set of iterator) {\n modelIds.push(...(set.models ?? []));\n subCategoryIds.push(...(set.subCategories ?? []));\n elementIds.push(...(set.elements ?? []));\n }\n\n return {\n models: modelIds.length ? modelIds : undefined,\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\n elements: elementIds.length ? elementIds : undefined,\n };\n }\n\n /**\n * Get hilite set iterator for provided keys. It loads content in batches and\n * yields hilite set created from each batch after it is loaded.\n */\n public getHiliteSetIterator(selection: Readonly<KeySet>) {\n if (!this._cache || this._cache.keysGuid !== selection.guid) {\n this._cache = {\n keysGuid: selection.guid,\n observable: from(this.createHiliteSetIterator(selection)).pipe(shareReplay({ refCount: true })),\n };\n }\n\n return eachValueFrom(this._cache.observable);\n }\n\n private async *createHiliteSetIterator(selection: Readonly<KeySet>) {\n const { keys, transientIds } = this.handleTransientKeys(selection);\n const { options, keyBatches } = this.getContentOptions(keys);\n\n if (transientIds.length !== 0) {\n yield { elements: transientIds };\n }\n\n for (const batch of keyBatches) {\n let loadedItems = 0;\n while (true) {\n const content = await Presentation.presentation.getContentIterator({\n ...options,\n paging: { start: loadedItems, size: CONTENT_SET_PAGE_SIZE },\n keys: batch,\n });\n if (!content) {\n break;\n }\n\n const items = new Array<Item>();\n for await (const item of content.items) {\n items.push(item);\n }\n const result = this.createHiliteSet(items);\n yield result;\n\n loadedItems += items.length;\n if (loadedItems >= content.total) {\n break;\n }\n }\n }\n }\n\n private createHiliteSet(records: Item[]): HiliteSet {\n const modelIds = new Array<Id64String>();\n const subCategoryIds = new Array<Id64String>();\n const elementIds = new Array<Id64String>();\n records.forEach((rec) => {\n const ids = isModelRecord(rec) ? modelIds : isSubCategoryRecord(rec) ? subCategoryIds : elementIds;\n rec.primaryKeys.forEach((pk) => ids.push(pk.id));\n });\n return {\n models: modelIds.length ? modelIds : undefined,\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\n elements: elementIds.length ? elementIds : undefined,\n };\n }\n\n private getContentOptions(keys: KeySet) {\n const descriptor: DescriptorOverrides = {\n displayType: DefaultContentDisplayTypes.Viewport,\n contentFlags: ContentFlags.KeysOnly,\n };\n const options = {\n imodel: this._imodel,\n rulesetOrId: HILITE_RULESET,\n descriptor,\n };\n const keyBatches = new Array<KeySet>();\n keys.forEachBatch(DEFAULT_KEYS_BATCH_SIZE, (batch: KeySet) => {\n keyBatches.push(batch);\n });\n return {\n options,\n keyBatches,\n };\n }\n\n private handleTransientKeys(selection: Readonly<KeySet>) {\n // need to create a new set without transients\n const transientIds = new Array<Id64String>();\n const keys = new KeySet();\n keys.add(selection, (key: Key) => {\n if (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) {\n transientIds.push(key.id);\n return false;\n }\n return true;\n });\n return {\n transientIds,\n keys,\n };\n }\n}\n\nconst CONTENT_SET_PAGE_SIZE = 1000;\n\nconst isModelRecord = (rec: Item) => rec.extendedData && rec.extendedData.isModel;\n\nconst isSubCategoryRecord = (rec: Item) => rec.extendedData && rec.extendedData.isSubCategory;\n"]}
|
|
1
|
+
{"version":3,"file":"HiliteSetProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;AAEH,+BAAqD;AACrD,mDAA+C;AAG/C,oEAAgK;AAChK,kDAA+C;AAC/C,yDAAiE;AACjE,0EAA+C;AAE/C,MAAM,cAAc,GAAG,0BAAwB,CAAC;AAsBhD;;;;;;GAMG;AACH,MAAa,iBAAiB;IAI5B,YAAoB,KAA6B;QAC/C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAM,CAAC,KAA6B;QAChD,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CAAC,SAA2B;QACnD,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAc,CAAC;QACzC,MAAM,cAAc,GAAG,IAAI,KAAK,EAAc,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,KAAK,EAAc,CAAC;QAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YACjC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;YACrC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC;YAClD,UAAU,CAAC,IAAI,CAAC,GAAG,C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AAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC1B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO;YACL,YAAY;YACZ,IAAI;SACL,CAAC;IACJ,CAAC;CACF;AA9ID,8CA8IC;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC;AAElF,MAAM,mBAAmB,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,aAAa,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { from, Observable, shareReplay } from \"rxjs\";\r\nimport { eachValueFrom } from \"rxjs-for-await\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { ContentFlags, DEFAULT_KEYS_BATCH_SIZE, DefaultContentDisplayTypes, DescriptorOverrides, Item, Key, KeySet, Ruleset } from \"@itwin/presentation-common\";\r\nimport { Presentation } from \"../Presentation\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./SelectionManager\";\r\nimport hiliteRuleset from \"./HiliteRules.json\";\r\n\r\nconst HILITE_RULESET = hiliteRuleset as Ruleset;\r\n\r\n/**\r\n * A set of model, subcategory and element ids that can be used for specifying\r\n * viewport hilite.\r\n *\r\n * @public\r\n */\r\nexport interface HiliteSet {\r\n models?: Id64String[];\r\n subCategories?: Id64String[];\r\n elements?: Id64String[];\r\n}\r\n\r\n/**\r\n * Properties for creating a `HiliteSetProvider` instance.\r\n * @public\r\n */\r\nexport interface HiliteSetProviderProps {\r\n imodel: IModelConnection;\r\n}\r\n\r\n/**\r\n * Presentation-based provider which uses presentation ruleset to determine\r\n * what `HiliteSet` should be hilited in the graphics viewport based on the\r\n * supplied `KeySet`.\r\n *\r\n * @public\r\n */\r\nexport class HiliteSetProvider {\r\n private _imodel: IModelConnection;\r\n private _cache: undefined | { keysGuid: string; observable: Observable<HiliteSet> };\r\n\r\n private constructor(props: HiliteSetProviderProps) {\r\n this._imodel = props.imodel;\r\n }\r\n\r\n /**\r\n * Create a hilite set provider for the specified iModel.\r\n */\r\n public static create(props: HiliteSetProviderProps) {\r\n return new HiliteSetProvider(props);\r\n }\r\n\r\n /**\r\n * Get hilite set for instances and/or nodes whose keys are specified in the\r\n * given KeySet.\r\n *\r\n * Note: The provider caches result of the last request, so subsequent requests\r\n * for the same input doesn't cost.\r\n */\r\n public async getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet> {\r\n const modelIds = new Array<Id64String>();\r\n const subCategoryIds = new Array<Id64String>();\r\n const elementIds = new Array<Id64String>();\r\n\r\n const iterator = this.getHiliteSetIterator(selection);\r\n for await (const set of iterator) {\r\n modelIds.push(...(set.models ?? []));\r\n subCategoryIds.push(...(set.subCategories ?? []));\r\n elementIds.push(...(set.elements ?? []));\r\n }\r\n\r\n return {\r\n models: modelIds.length ? modelIds : undefined,\r\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\r\n elements: elementIds.length ? elementIds : undefined,\r\n };\r\n }\r\n\r\n /**\r\n * Get hilite set iterator for provided keys. It loads content in batches and\r\n * yields hilite set created from each batch after it is loaded.\r\n */\r\n public getHiliteSetIterator(selection: Readonly<KeySet>) {\r\n if (!this._cache || this._cache.keysGuid !== selection.guid) {\r\n this._cache = {\r\n keysGuid: selection.guid,\r\n observable: from(this.createHiliteSetIterator(selection)).pipe(shareReplay({ refCount: true })),\r\n };\r\n }\r\n\r\n return eachValueFrom(this._cache.observable);\r\n }\r\n\r\n private async *createHiliteSetIterator(selection: Readonly<KeySet>) {\r\n const { keys, transientIds } = this.handleTransientKeys(selection);\r\n const { options, keyBatches } = this.getContentOptions(keys);\r\n\r\n if (transientIds.length !== 0) {\r\n yield { elements: transientIds };\r\n }\r\n\r\n for (const batch of keyBatches) {\r\n let loadedItems = 0;\r\n while (true) {\r\n const content = await Presentation.presentation.getContentIterator({\r\n ...options,\r\n paging: { start: loadedItems, size: CONTENT_SET_PAGE_SIZE },\r\n keys: batch,\r\n });\r\n if (!content) {\r\n break;\r\n }\r\n\r\n const items = new Array<Item>();\r\n for await (const item of content.items) {\r\n items.push(item);\r\n }\r\n const result = this.createHiliteSet(items);\r\n yield result;\r\n\r\n loadedItems += items.length;\r\n if (loadedItems >= content.total) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private createHiliteSet(records: Item[]): HiliteSet {\r\n const modelIds = new Array<Id64String>();\r\n const subCategoryIds = new Array<Id64String>();\r\n const elementIds = new Array<Id64String>();\r\n records.forEach((rec) => {\r\n const ids = isModelRecord(rec) ? modelIds : isSubCategoryRecord(rec) ? subCategoryIds : elementIds;\r\n rec.primaryKeys.forEach((pk) => ids.push(pk.id));\r\n });\r\n return {\r\n models: modelIds.length ? modelIds : undefined,\r\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\r\n elements: elementIds.length ? elementIds : undefined,\r\n };\r\n }\r\n\r\n private getContentOptions(keys: KeySet) {\r\n const descriptor: DescriptorOverrides = {\r\n displayType: DefaultContentDisplayTypes.Viewport,\r\n contentFlags: ContentFlags.KeysOnly,\r\n };\r\n const options = {\r\n imodel: this._imodel,\r\n rulesetOrId: HILITE_RULESET,\r\n descriptor,\r\n };\r\n const keyBatches = new Array<KeySet>();\r\n keys.forEachBatch(DEFAULT_KEYS_BATCH_SIZE, (batch: KeySet) => {\r\n keyBatches.push(batch);\r\n });\r\n return {\r\n options,\r\n keyBatches,\r\n };\r\n }\r\n\r\n private handleTransientKeys(selection: Readonly<KeySet>) {\r\n // need to create a new set without transients\r\n const transientIds = new Array<Id64String>();\r\n const keys = new KeySet();\r\n keys.add(selection, (key: Key) => {\r\n if (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) {\r\n transientIds.push(key.id);\r\n return false;\r\n }\r\n return true;\r\n });\r\n return {\r\n transientIds,\r\n keys,\r\n };\r\n }\r\n}\r\n\r\nconst CONTENT_SET_PAGE_SIZE = 1000;\r\n\r\nconst isModelRecord = (rec: Item) => rec.extendedData && rec.extendedData.isModel;\r\n\r\nconst isSubCategoryRecord = (rec: Item) => rec.extendedData && rec.extendedData.isSubCategory;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISelectionProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/ISelectionProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { SelectionChangeEvent } from \"./SelectionChangeEvent\";\n\n/**\n * Selection provider interface which provides main selection and sub-selection.\n * @public\n */\nexport interface ISelectionProvider {\n /** An event that's fired when selection changes */\n selectionChange: SelectionChangeEvent;\n\n /** Get the selection stored in the provider.\n * @param imodel iModel connection which the selection is associated with.\n * @param level Level of the selection (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n */\n getSelection(imodel: IModelConnection, level: number): Readonly<KeySet>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ISelectionProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/ISelectionProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { KeySet } from \"@itwin/presentation-common\";\r\nimport { SelectionChangeEvent } from \"./SelectionChangeEvent\";\r\n\r\n/**\r\n * Selection provider interface which provides main selection and sub-selection.\r\n * @public\r\n */\r\nexport interface ISelectionProvider {\r\n /** An event that's fired when selection changes */\r\n selectionChange: SelectionChangeEvent;\r\n\r\n /** Get the selection stored in the provider.\r\n * @param imodel iModel connection which the selection is associated with.\r\n * @param level Level of the selection (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n */\r\n getSelection(imodel: IModelConnection, level: number): Readonly<KeySet>;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA8C;AAW9C;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,sBAAiC;CAAG;AAA9E,oDAA8E;AAE9E;;;GAGG;AACH,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,2DAAG,CAAA;IAEH,8BAA8B;IAC9B,iEAAM,CAAA;IAEN,8BAA8B;IAC9B,mEAAO,CAAA;IAEP,6BAA6B;IAC7B,+DAAK,CAAA;AACP,CAAC,EAZW,mBAAmB,mCAAnB,mBAAmB,QAY9B","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 UnifiedSelection\n */\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\n\n/**\n * An interface for selection change listeners.\n * @public\n */\nexport declare type SelectionChangesListener = (args: SelectionChangeEventArgs, provider: ISelectionProvider) => void;\n\n/**\n * An event broadcasted on selection changes\n * @public\n */\nexport class SelectionChangeEvent extends BeEvent<SelectionChangesListener> {}\n\n/**\n * The type of selection change\n * @public\n */\nexport enum SelectionChangeType {\n /** Added to selection. */\n Add,\n\n /** Removed from selection. */\n Remove,\n\n /** Selection was replaced. */\n Replace,\n\n /** Selection was cleared. */\n Clear,\n}\n\n/**\n * The event object that's sent when the selection changes.\n * @public\n */\nexport interface SelectionChangeEventArgs {\n /** The name of the selection source which caused the selection change. */\n source: string;\n\n /** Level of the selection. See [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels). */\n level: number;\n\n /** The selection change type. */\n changeType: SelectionChangeType;\n\n /** Set of keys affected by this selection change event. */\n keys: Readonly<KeySet>;\n\n /** iModel connection with which the selection is associated with. */\n imodel: IModelConnection;\n\n /** The timestamp of when the selection change happened */\n timestamp: Date;\n\n /** Id of the ruleset associated with the selection change. */\n rulesetId?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA8C;AAW9C;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,sBAAiC;CAAG;AAA9E,oDAA8E;AAE9E;;;GAGG;AACH,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,2DAAG,CAAA;IAEH,8BAA8B;IAC9B,iEAAM,CAAA;IAEN,8BAA8B;IAC9B,mEAAO,CAAA;IAEP,6BAA6B;IAC7B,+DAAK,CAAA;AACP,CAAC,EAZW,mBAAmB,mCAAnB,mBAAmB,QAY9B","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 UnifiedSelection\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { KeySet } from \"@itwin/presentation-common\";\r\nimport { ISelectionProvider } from \"./ISelectionProvider\";\r\n\r\n/**\r\n * An interface for selection change listeners.\r\n * @public\r\n */\r\nexport declare type SelectionChangesListener = (args: SelectionChangeEventArgs, provider: ISelectionProvider) => void;\r\n\r\n/**\r\n * An event broadcasted on selection changes\r\n * @public\r\n */\r\nexport class SelectionChangeEvent extends BeEvent<SelectionChangesListener> {}\r\n\r\n/**\r\n * The type of selection change\r\n * @public\r\n */\r\nexport enum SelectionChangeType {\r\n /** Added to selection. */\r\n Add,\r\n\r\n /** Removed from selection. */\r\n Remove,\r\n\r\n /** Selection was replaced. */\r\n Replace,\r\n\r\n /** Selection was cleared. */\r\n Clear,\r\n}\r\n\r\n/**\r\n * The event object that's sent when the selection changes.\r\n * @public\r\n */\r\nexport interface SelectionChangeEventArgs {\r\n /** The name of the selection source which caused the selection change. */\r\n source: string;\r\n\r\n /** Level of the selection. See [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels). */\r\n level: number;\r\n\r\n /** The selection change type. */\r\n changeType: SelectionChangeType;\r\n\r\n /** Set of keys affected by this selection change event. */\r\n keys: Readonly<KeySet>;\r\n\r\n /** iModel connection with which the selection is associated with. */\r\n imodel: IModelConnection;\r\n\r\n /** The timestamp of when the selection change happened */\r\n timestamp: Date;\r\n\r\n /** Id of the ruleset associated with the selection change. */\r\n rulesetId?: string;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionHandler.js","sourceRoot":"","s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I,cAAc,CAAC,QAAgB,CAAC;QACrC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;CACF;AA9HD,4CA8HC","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 UnifiedSelection\n */\n\nimport { DisposableList, IDisposable } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { Keys, KeySet } from \"@itwin/presentation-common\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\nimport { SelectionChangeEventArgs, SelectionChangesListener } from \"./SelectionChangeEvent\";\nimport { SelectionManager } from \"./SelectionManager\";\n\n/**\n * Properties for creating a `SelectionHandler` instance.\n * @public\n */\nexport interface SelectionHandlerProps {\n /** SelectionManager used to store overall selection. */\n manager: SelectionManager;\n /** iModel connection the selection changes will be associated with. */\n imodel: IModelConnection;\n /**\n * Name of the selection handler. This is an identifier of what caused the\n * selection to change, set as `SelectionChangeEventArgs.source` when firing\n * selection change events. `SelectionHandler.shouldHandle` uses `name` to filter\n * events that it doesn't need to handle.\n */\n name: string;\n /**\n * ID of presentation ruleset used by the component using this handler. The ID is set as\n * `SelectionChangeEventArgs.rulesetId` when making selection changes and event\n * listeners can use or ignore this information.\n */\n rulesetId?: string;\n /** Callback function called when selection changes. */\n onSelect?: SelectionChangesListener;\n}\n\n/**\n * A class that handles selection changes and helps to change\n * internal the selection state.\n *\n * @public\n */\nexport class SelectionHandler implements IDisposable {\n private _inSelect: boolean;\n private _disposables: DisposableList;\n\n /** Selection manager used by this handler to manage selection */\n public readonly manager: SelectionManager;\n /** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */\n public name: string;\n /** iModel whose selection is being handled */\n public imodel: IModelConnection;\n /**\n * Id of a ruleset selection changes will be associated with.\n * @see `SelectionHandlerProps.rulesetId`\n */\n public rulesetId?: string;\n /** Callback function called when selection changes */\n public onSelect?: SelectionChangesListener;\n\n /**\n * Constructor.\n */\n constructor(props: SelectionHandlerProps) {\n this._inSelect = false;\n this.manager = props.manager;\n this._disposables = new DisposableList();\n this.name = props.name;\n this.rulesetId = props.rulesetId;\n this.imodel = props.imodel;\n this.onSelect = props.onSelect;\n this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));\n }\n\n /**\n * Destructor. Must be called before disposing this object to make sure it cleans\n * up correctly.\n */\n public dispose(): void {\n this._disposables.dispose();\n }\n\n /**\n * Called when the selection changes. Handles this callback by first checking whether\n * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected onSelectionChanged = (evt: SelectionChangeEventArgs, provider: ISelectionProvider): void => {\n if (!this.onSelect || !this.shouldHandle(evt)) {\n return;\n }\n\n this._inSelect = true;\n this.onSelect(evt, provider);\n this._inSelect = false;\n };\n\n /** Called to check whether the event should be handled by this handler */\n protected shouldHandle(evt: SelectionChangeEventArgs): boolean {\n if (this.name === evt.source) {\n return false;\n }\n return true;\n }\n\n /** Get selection levels for the imodel managed by this handler */\n public getSelectionLevels(): number[] {\n return this.manager.getSelectionLevels(this.imodel);\n }\n\n /**\n * Get selection for the imodel managed by this handler.\n * @param level Level of the selection to get. Defaults to 0.\n */\n public getSelection(level?: number): Readonly<KeySet> {\n return this.manager.getSelection(this.imodel, level);\n }\n\n /**\n * Add to selection.\n * @param keys The keys to add to selection.\n * @param level Level of the selection.\n */\n public addToSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect) {\n return;\n }\n\n return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Remove from selection.\n * @param keys The keys to remove from selection.\n * @param level Level of the selection.\n */\n public removeFromSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect) {\n return;\n }\n\n return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Change selection.\n * @param keys The keys indicating the new selection.\n * @param level Level of the selection.\n */\n public replaceSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect) {\n return;\n }\n\n return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Clear selection.\n * @param level Level of the selection.\n */\n public clearSelection(level: number = 0): void {\n if (this._inSelect) {\n return;\n }\n\n return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionHandler.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAAkE;AAiClE;;;;;GAKG;AACH,MAAa,gBAAgB;IAkB3B;;OAEG;IACH,YAAY,KAA4B;QAmBxC;;;WAGG;QACH,gEAAgE;QACtD,uBAAkB,GAAG,CAAC,GAA6B,EAAE,QAA4B,EAAQ,EAAE;YACnG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9C,OAAO;YACT,CAAC;YAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC,CAAC;QA/BA,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,6BAAc,EAAE,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,KAA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AAC;YACnB,OAAO;QACT,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,IAAU,EAAE,QAAgB,CAAC;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5F,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB,CAAC;QACrC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;CACF;AA9HD,4CA8HC","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 UnifiedSelection\r\n */\r\n\r\nimport { DisposableList, IDisposable } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { Keys, KeySet } from \"@itwin/presentation-common\";\r\nimport { ISelectionProvider } from \"./ISelectionProvider\";\r\nimport { SelectionChangeEventArgs, SelectionChangesListener } from \"./SelectionChangeEvent\";\r\nimport { SelectionManager } from \"./SelectionManager\";\r\n\r\n/**\r\n * Properties for creating a `SelectionHandler` instance.\r\n * @public\r\n */\r\nexport interface SelectionHandlerProps {\r\n /** SelectionManager used to store overall selection. */\r\n manager: SelectionManager;\r\n /** iModel connection the selection changes will be associated with. */\r\n imodel: IModelConnection;\r\n /**\r\n * Name of the selection handler. This is an identifier of what caused the\r\n * selection to change, set as `SelectionChangeEventArgs.source` when firing\r\n * selection change events. `SelectionHandler.shouldHandle` uses `name` to filter\r\n * events that it doesn't need to handle.\r\n */\r\n name: string;\r\n /**\r\n * ID of presentation ruleset used by the component using this handler. The ID is set as\r\n * `SelectionChangeEventArgs.rulesetId` when making selection changes and event\r\n * listeners can use or ignore this information.\r\n */\r\n rulesetId?: string;\r\n /** Callback function called when selection changes. */\r\n onSelect?: SelectionChangesListener;\r\n}\r\n\r\n/**\r\n * A class that handles selection changes and helps to change\r\n * internal the selection state.\r\n *\r\n * @public\r\n */\r\nexport class SelectionHandler implements IDisposable {\r\n private _inSelect: boolean;\r\n private _disposables: DisposableList;\r\n\r\n /** Selection manager used by this handler to manage selection */\r\n public readonly manager: SelectionManager;\r\n /** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */\r\n public name: string;\r\n /** iModel whose selection is being handled */\r\n public imodel: IModelConnection;\r\n /**\r\n * Id of a ruleset selection changes will be associated with.\r\n * @see `SelectionHandlerProps.rulesetId`\r\n */\r\n public rulesetId?: string;\r\n /** Callback function called when selection changes */\r\n public onSelect?: SelectionChangesListener;\r\n\r\n /**\r\n * Constructor.\r\n */\r\n constructor(props: SelectionHandlerProps) {\r\n this._inSelect = false;\r\n this.manager = props.manager;\r\n this._disposables = new DisposableList();\r\n this.name = props.name;\r\n this.rulesetId = props.rulesetId;\r\n this.imodel = props.imodel;\r\n this.onSelect = props.onSelect;\r\n this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));\r\n }\r\n\r\n /**\r\n * Destructor. Must be called before disposing this object to make sure it cleans\r\n * up correctly.\r\n */\r\n public dispose(): void {\r\n this._disposables.dispose();\r\n }\r\n\r\n /**\r\n * Called when the selection changes. Handles this callback by first checking whether\r\n * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected onSelectionChanged = (evt: SelectionChangeEventArgs, provider: ISelectionProvider): void => {\r\n if (!this.onSelect || !this.shouldHandle(evt)) {\r\n return;\r\n }\r\n\r\n this._inSelect = true;\r\n this.onSelect(evt, provider);\r\n this._inSelect = false;\r\n };\r\n\r\n /** Called to check whether the event should be handled by this handler */\r\n protected shouldHandle(evt: SelectionChangeEventArgs): boolean {\r\n if (this.name === evt.source) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Get selection levels for the imodel managed by this handler */\r\n public getSelectionLevels(): number[] {\r\n return this.manager.getSelectionLevels(this.imodel);\r\n }\r\n\r\n /**\r\n * Get selection for the imodel managed by this handler.\r\n * @param level Level of the selection to get. Defaults to 0.\r\n */\r\n public getSelection(level?: number): Readonly<KeySet> {\r\n return this.manager.getSelection(this.imodel, level);\r\n }\r\n\r\n /**\r\n * Add to selection.\r\n * @param keys The keys to add to selection.\r\n * @param level Level of the selection.\r\n */\r\n public addToSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect) {\r\n return;\r\n }\r\n\r\n return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Remove from selection.\r\n * @param keys The keys to remove from selection.\r\n * @param level Level of the selection.\r\n */\r\n public removeFromSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect) {\r\n return;\r\n }\r\n\r\n return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Change selection.\r\n * @param keys The keys indicating the new selection.\r\n * @param level Level of the selection.\r\n */\r\n public replaceSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect) {\r\n return;\r\n }\r\n\r\n return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Clear selection.\r\n * @param level Level of the selection.\r\n */\r\n public clearSelection(level: number = 0): void {\r\n if (this._inSelect) {\r\n return;\r\n }\r\n\r\n return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionHelper.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,oEAAgE;AAEhE;;;GAGG;AACH,MAAa,eAAe;IAC1B,uBAAuB;IACvB,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAoB;QACpD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAO,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;YACxB,IAAI,yBAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,IAAI,6BAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;oBACpC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxBD,0CAwBC","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 UnifiedSelection\n */\n\nimport { Key, Keys, NodeKey } from \"@itwin/presentation-common\";\n\n/**\n * Helper class for working with selection.\n * @public\n */\nexport class SelectionHelper {\n // istanbul ignore next\n private constructor() {}\n\n /**\n * Re-map the given keyset for selection. This means all instance node keys get converted\n * to instance keys, because in that case we want to select instances instead of nodes. All\n * other types of keys ar left as is.\n */\n public static getKeysForSelection(keys: Readonly<Keys>): Key[] {\n const result = new Array<Key>();\n keys.forEach((key: Key) => {\n if (Key.isNodeKey(key)) {\n if (NodeKey.isInstancesNodeKey(key)) {\n result.push(...key.instanceKeys);\n } else {\n result.push(key);\n }\n } else {\n result.push(key);\n }\n });\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionHelper.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,oEAAgE;AAEhE;;;GAGG;AACH,MAAa,eAAe;IAC1B,uBAAuB;IACvB,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAoB;QACpD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAO,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;YACxB,IAAI,yBAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,IAAI,6BAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;oBACpC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxBD,0CAwBC","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 UnifiedSelection\r\n */\r\n\r\nimport { Key, Keys, NodeKey } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Helper class for working with selection.\r\n * @public\r\n */\r\nexport class SelectionHelper {\r\n // istanbul ignore next\r\n private constructor() {}\r\n\r\n /**\r\n * Re-map the given keyset for selection. This means all instance node keys get converted\r\n * to instance keys, because in that case we want to select instances instead of nodes. All\r\n * other types of keys ar left as is.\r\n */\r\n public static getKeysForSelection(keys: Readonly<Keys>): Key[] {\r\n const result = new Array<Key>();\r\n keys.forEach((key: Key) => {\r\n if (Key.isNodeKey(key)) {\r\n if (NodeKey.isInstancesNodeKey(key)) {\r\n result.push(...key.instanceKeys);\r\n } else {\r\n result.push(key);\r\n }\r\n } else {\r\n result.push(key);\r\n }\r\n });\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -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,EAA4C,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAoD,IAAI,EAAE,MAAM,EAAW,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC1J,OAAO,EAKL,gBAAgB,EAGjB,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,CAAC;IAC/B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,kBAAkB;IACzD,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,gCAAgC,CAA+F;IACvI,OAAO,CAAC,mBAAmB,CAAkD;IAC7E,OAAO,CAAC,YAAY,CAAU;IAE9B,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,iBAAiB,CAAkD;IAC3E,OAAO,CAAC,4BAA4B,CAAe;IACnD,OAAO,CAAC,UAAU,CAAyB;IAE3C,2DAA2D;IAC3D,SAAgB,eAAe,EAAE,oBAAoB,CAAC;IAEtD,kGAAkG;IAClG,SAAgB,MAAM,EAAE,sBAAsB,CAAC;IAE/C;;OAEG;gBACS,KAAK,EAAE,qBAAqB;IAmBjC,OAAO;IAKd,OAAO,CAAC,iBAAiB;IAUzB,gBAAgB;IAET,2BAA2B,CAAC,MAAM,EAAE,gBAAgB;IAI3D;;OAEG;IACI,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,UAAO;IAqB3E;;;OAGG;IACI,8BAA8B,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW;IAW5E,yFAAyF;IAClF,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE;IAI7D;;;;;;OAMG;IACI,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,GAAE,MAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IAIlF,OAAO,CAAC,WAAW;
|
|
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,O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M,EAAE,MAAM,EACd,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,EACpD,KAAK,GAAE,MAAU,EACjB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAKhB;;;;;;;;OAQG;IACU,yBAAyB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,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;AAED,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,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;IAGD,OAAO,CAAC,sBAAsB,CA4D5B;CACH"}
|
|
@@ -117,6 +117,9 @@ class SelectionManager {
|
|
|
117
117
|
return this._currentSelection.getSelection(imodel.key, level);
|
|
118
118
|
}
|
|
119
119
|
handleEvent(evt) {
|
|
120
|
+
if (!this._knownIModels.has(evt.imodel.key)) {
|
|
121
|
+
this._knownIModels.set(evt.imodel.key, evt.imodel);
|
|
122
|
+
}
|
|
120
123
|
switch (evt.changeType) {
|
|
121
124
|
case SelectionChangeEvent_1.SelectionChangeType.Add:
|
|
122
125
|
this._selectionStorage.addToSelection({
|
|
@@ -293,6 +296,7 @@ class SelectionManager {
|
|
|
293
296
|
const currentSelectables = this._selectionStorage.getSelection({ iModelKey: args.iModelKey, level: args.level });
|
|
294
297
|
return this._currentSelection.computeSelection(args.iModelKey, args.level, currentSelectables, args.selectables).pipe((0, rxjs_1.mergeMap)(({ level, changedSelection }) => {
|
|
295
298
|
const imodel = this._knownIModels.get(args.iModelKey);
|
|
299
|
+
// istanbul ignore if
|
|
296
300
|
if (!imodel) {
|
|
297
301
|
return rxjs_1.EMPTY;
|
|
298
302
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAqG;AACrG,sDAAmF;AACnF,wDAAkG;AAClG,oEAA0J;AAC1J,gEAQkC;AAClC,kDAA+C;AAC/C,2DAAmE;AAEnE,iEAA6G;AAC7G,qEAA6F;AAgB7F;;;GAGG;AACH,MAAa,gBAAgB;IAkB3B;;OAEG;IACH,YAAY,KAA4B;QAnBhC,qCAAgC,GAAG,IAAI,GAAG,EAAoF,CAAC;QAC/H,wBAAmB,GAAG,IAAI,GAAG,EAAuC,CAAC;QAGrE,kBAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;QACpD,sBAAiB,GAAG,IAAI,uBAAuB,EAAE,CAAC;QAClD,sBAAiB,GAAG,IAAI,cAAO,EAAmC,CAAC;QAEnE,eAAU,GAAsB,EAAE,CAAC;QAYzC,IAAI,CAAC,eAAe,GAAG,IAAI,2CAAoB,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,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ACvC,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,2BAAY,CAAC,YAAY,CAAC,sBAAsB,CAAC;QACrE,MAAM;QACN,IAAI,EAAE,IAAI,4BAAM,CAAC,CAAC,OAAO,CAAC,CAAC;QAC3B,WAAW,EAAE;YACX,EAAE,EAAE,mBAAmB;YACvB,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,SAAS;oBACnB,cAAc,EAAE;wBACd;4BACE,QAAQ,EAAE,uBAAuB;yBAClC;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,MAAM,GAAG,GAAG,IAAmB,CAAC;IAChC,OAAO,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAgC;IACrD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,0CAAmB,CAAC,GAAG,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,0CAAmB,CAAC,MAAM,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,0CAAmB,CAAC,OAAO,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,0CAAmB,CAAC,KAAK,CAAC;IACrC,CAAC;AACH,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 UnifiedSelection\n */\n\nimport { defer, EMPTY, mergeMap, Observable, of, Subject, Subscription, takeUntil, tap } from \"rxjs\";\nimport { Id64, Id64Arg, Id64Array, IDisposable, using } from \"@itwin/core-bentley\";\nimport { IModelConnection, SelectionSetEvent, SelectionSetEventType } from \"@itwin/core-frontend\";\nimport { AsyncTasksTracker, BaseNodeKey, InstanceKey, Key, Keys, KeySet, NodeKey, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\nimport {\n createStorage,\n CustomSelectable,\n Selectable,\n Selectables,\n SelectionStorage,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangeType,\n} from \"@itwin/unified-selection\";\nimport { Presentation } from \"../Presentation\";\nimport { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\nimport { SelectionChangeEvent, SelectionChangeEventArgs, SelectionChangeType } from \"./SelectionChangeEvent\";\nimport { createSelectionScopeProps, SelectionScopesManager } from \"./SelectionScopesManager\";\n\n/**\n * Properties for creating [[SelectionManager]].\n * @public\n */\nexport interface SelectionManagerProps {\n /** A manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n scopes: SelectionScopesManager;\n /**\n * Custom unified selection storage to be used by [[SelectionManager]]. If not provided [[SelectionManager]] creates\n * and maintains storage.\n */\n selectionStorage?: SelectionStorage;\n}\n\n/**\n * The selection manager which stores the overall selection.\n * @public\n */\nexport class SelectionManager implements ISelectionProvider {\n private _selectionStorage: SelectionStorage;\n private _imodelToolSelectionSyncHandlers = new Map<IModelConnection, { requestorsCount: number; handler: ToolSelectionSyncHandler }>();\n private _hiliteSetProviders = new Map<IModelConnection, HiliteSetProvider>();\n private _ownsStorage: boolean;\n\n private _knownIModels = new Map<string, IModelConnection>();\n private _currentSelection = new CurrentSelectionStorage();\n private _selectionChanges = new Subject<StorageSelectionChangeEventArgs>();\n private _selectionEventsSubscription: Subscription;\n private _listeners: Array<() => void> = [];\n\n /** An event which gets broadcasted on selection changes */\n public readonly selectionChange: SelectionChangeEvent;\n\n /** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n public readonly scopes: SelectionScopesManager;\n\n /**\n * Creates an instance of SelectionManager.\n */\n constructor(props: SelectionManagerProps) {\n this.selectionChange = new SelectionChangeEvent();\n this.scopes = props.scopes;\n this._selectionStorage = props.selectionStorage ?? createStorage();\n this._ownsStorage = props.selectionStorage === undefined;\n this._selectionStorage.selectionChangeEvent.addListener((args) => this._selectionChanges.next(args));\n this._selectionEventsSubscription = this.streamSelectionEvents();\n this._listeners.push(\n IModelConnection.onOpen.addListener((imodel) => {\n this._knownIModels.set(imodel.key, imodel);\n }),\n );\n this._listeners.push(\n IModelConnection.onClose.addListener((imodel: IModelConnection) => {\n this.onConnectionClose(imodel);\n }),\n );\n }\n\n public dispose() {\n this._selectionEventsSubscription.unsubscribe();\n this._listeners.forEach((dispose) => dispose());\n }\n\n private onConnectionClose(imodel: IModelConnection): void {\n this._hiliteSetProviders.delete(imodel);\n this._knownIModels.delete(imodel.key);\n this._currentSelection.clear(imodel.key);\n if (this._ownsStorage) {\n this.clearSelection(\"Connection Close Event\", imodel);\n this._selectionStorage.clearStorage({ iModelKey: imodel.key });\n }\n }\n\n /** @internal */\n // istanbul ignore next\n public getToolSelectionSyncHandler(imodel: IModelConnection) {\n return this._imodelToolSelectionSyncHandlers.get(imodel)?.handler;\n }\n\n /**\n * Request the manager to sync with imodel's tool selection (see `IModelConnection.selectionSet`).\n */\n public setSyncWithIModelToolSelection(imodel: IModelConnection, sync = true) {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (sync) {\n if (!registration || registration.requestorsCount === 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { requestorsCount: 1, handler: new ToolSelectionSyncHandler(imodel, this) });\n } else {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount: registration.requestorsCount + 1 });\n }\n } else {\n if (registration && registration.requestorsCount > 0) {\n const requestorsCount = registration.requestorsCount - 1;\n if (requestorsCount > 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount });\n } else {\n this._imodelToolSelectionSyncHandlers.delete(imodel);\n registration.handler.dispose();\n }\n }\n }\n }\n\n /**\n * Temporarily suspends tool selection synchronization until the returned `IDisposable`\n * is disposed.\n */\n public suspendIModelToolSelectionSync(imodel: IModelConnection): IDisposable {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (!registration) {\n return { dispose: () => {} };\n }\n\n const wasSuspended = registration.handler.isSuspended;\n registration.handler.isSuspended = true;\n return { dispose: () => (registration.handler.isSuspended = wasSuspended) };\n }\n\n /** Get the selection levels currently stored in this manager for the specified imodel */\n public getSelectionLevels(imodel: IModelConnection): number[] {\n return this._selectionStorage.getSelectionLevels({ iModelKey: imodel.key });\n }\n\n /**\n * Get the selection currently stored in this manager\n *\n * @note Calling immediately after `add*`|`replace*`|`remove*`|`clear*` method call does not guarantee\n * that returned `KeySet` will include latest changes. Listen for `selectionChange` event to get the\n * latest selection after changes.\n */\n public getSelection(imodel: IModelConnection, level: number = 0): Readonly<KeySet> {\n return this._currentSelection.getSelection(imodel.key, level);\n }\n\n private handleEvent(evt: SelectionChangeEventArgs): void {\n switch (evt.changeType) {\n case SelectionChangeType.Add:\n this._selectionStorage.addToSelection({\n iModelKey: evt.imodel.key,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Remove:\n this._selectionStorage.removeFromSelection({\n iModelKey: evt.imodel.key,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Replace:\n this._selectionStorage.replaceSelection({\n iModelKey: evt.imodel.key,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Clear:\n this._selectionStorage.clearSelection({ iModelKey: evt.imodel.key, source: evt.source, level: evt.level });\n break;\n }\n }\n\n /**\n * Add keys to the selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public addToSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Add,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Remove keys from current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to remove\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public removeFromSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Remove,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Replace current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public replaceSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Replace,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Clear current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public clearSelection(source: string, imodel: IModelConnection, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Clear,\n keys: new KeySet(),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Add keys to selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to add\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async addToSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.addToSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Remove keys from current selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to remove\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async removeFromSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.removeFromSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Replace current selection with keys after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to replace with\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async replaceSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.replaceSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Get the current hilite set for the specified imodel\n * @public\n */\n public async getHiliteSet(imodel: IModelConnection): Promise<HiliteSet> {\n return this.getHiliteSetProvider(imodel).getHiliteSet(this.getSelection(imodel));\n }\n\n /**\n * Get the current hilite set iterator for the specified imodel.\n * @public\n */\n public getHiliteSetIterator(imodel: IModelConnection) {\n return this.getHiliteSetProvider(imodel).getHiliteSetIterator(this.getSelection(imodel));\n }\n\n private getHiliteSetProvider(imodel: IModelConnection) {\n let provider = this._hiliteSetProviders.get(imodel);\n if (!provider) {\n provider = HiliteSetProvider.create({ imodel });\n this._hiliteSetProviders.set(imodel, provider);\n }\n return provider;\n }\n\n private streamSelectionEvents() {\n return this._selectionChanges\n .pipe(\n mergeMap((args) => {\n const currentSelectables = this._selectionStorage.getSelection({ iModelKey: args.iModelKey, level: args.level });\n return this._currentSelection.computeSelection(args.iModelKey, args.level, currentSelectables, args.selectables).pipe(\n mergeMap(({ level, changedSelection }): Observable<SelectionChangeEventArgs> => {\n const imodel = this._knownIModels.get(args.iModelKey);\n if (!imodel) {\n return EMPTY;\n }\n return of({\n imodel,\n keys: changedSelection,\n level,\n source: args.source,\n timestamp: args.timestamp,\n changeType: getChangeType(args.changeType),\n });\n }),\n );\n }),\n )\n .subscribe({\n next: (args) => {\n this.selectionChange.raiseEvent(args, this);\n },\n });\n }\n}\n\n/** @internal */\nexport const TRANSIENT_ELEMENT_CLASSNAME = \"/TRANSIENT\";\n\n/** @internal */\nexport class ToolSelectionSyncHandler implements IDisposable {\n private _selectionSourceName = \"Tool\";\n private _logicalSelection: SelectionManager;\n private _imodel: IModelConnection;\n private _imodelToolSelectionListenerDisposeFunc: () => void;\n private _asyncsTracker = new AsyncTasksTracker();\n public isSuspended?: boolean;\n\n public constructor(imodel: IModelConnection, logicalSelection: SelectionManager) {\n this._imodel = imodel;\n this._logicalSelection = logicalSelection;\n this._imodelToolSelectionListenerDisposeFunc = imodel.selectionSet.onChanged.addListener(this.onToolSelectionChanged);\n }\n\n public dispose() {\n this._imodelToolSelectionListenerDisposeFunc();\n }\n\n /** note: used only it tests */\n public get pendingAsyncs() {\n return this._asyncsTracker.pendingAsyncs;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onToolSelectionChanged = async (ev: SelectionSetEvent): Promise<void> => {\n // ignore selection change event if the handler is suspended\n if (this.isSuspended) {\n return;\n }\n\n // this component only cares about its own imodel\n const imodel = ev.set.iModel;\n if (imodel !== this._imodel) {\n return;\n }\n\n // determine the level of selection changes\n // wip: may want to allow selecting at different levels?\n const selectionLevel = 0;\n\n let ids: Id64Arg;\n switch (ev.type) {\n case SelectionSetEventType.Add:\n ids = ev.added;\n break;\n case SelectionSetEventType.Replace:\n ids = ev.set.elements;\n break;\n default:\n ids = ev.removed;\n break;\n }\n\n // we're always using scoped selection changer even if the scope is set to \"element\" - that\n // makes sure we're adding to selection keys with concrete classes and not \"BisCore:Element\", which\n // we can't because otherwise our keys compare fails (presentation components load data with\n // concrete classes)\n const changer = new ScopedSelectionChanger(\n this._selectionSourceName,\n this._imodel,\n this._logicalSelection,\n createSelectionScopeProps(this._logicalSelection.scopes.activeScope),\n );\n\n // we know what to do immediately on `clear` events\n if (SelectionSetEventType.Clear === ev.type) {\n await changer.clear(selectionLevel);\n return;\n }\n\n const parsedIds = parseIds(ids);\n await using(this._asyncsTracker.trackAsyncTask(), async (_r) => {\n switch (ev.type) {\n case SelectionSetEventType.Add:\n await changer.add(parsedIds.transient, parsedIds.persistent, selectionLevel);\n break;\n case SelectionSetEventType.Replace:\n await changer.replace(parsedIds.transient, parsedIds.persistent, selectionLevel);\n break;\n case SelectionSetEventType.Remove:\n await changer.remove(parsedIds.transient, parsedIds.persistent, selectionLevel);\n break;\n }\n });\n };\n}\n\nconst parseIds = (ids: Id64Arg): { persistent: Id64Arg; transient: Id64Arg } => {\n let allPersistent = true;\n let allTransient = true;\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n allPersistent = false;\n } else {\n allTransient = false;\n }\n\n if (!allPersistent && !allTransient) {\n break;\n }\n }\n\n // avoid making a copy if ids are only persistent or only transient\n if (allPersistent) {\n return { persistent: ids, transient: [] };\n } else if (allTransient) {\n return { persistent: [], transient: ids };\n }\n\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\n // a Set for performance\n const persistentElementIds: Id64Array = [];\n const transientElementIds: Id64Array = [];\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n transientElementIds.push(id);\n } else {\n persistentElementIds.push(id);\n }\n }\n\n return { persistent: persistentElementIds, transient: transientElementIds };\n};\n\nfunction addTransientKeys(transientIds: Id64Arg, keys: KeySet): void {\n for (const id of Id64.iterable(transientIds)) {\n keys.add({ className: TRANSIENT_ELEMENT_CLASSNAME, id });\n }\n}\n\n/** @internal */\nclass ScopedSelectionChanger {\n public readonly name: string;\n public readonly imodel: IModelConnection;\n public readonly manager: SelectionManager;\n public readonly scope: SelectionScopeProps | SelectionScope | string;\n public constructor(name: string, imodel: IModelConnection, manager: SelectionManager, scope: SelectionScopeProps | SelectionScope | string) {\n this.name = name;\n this.imodel = imodel;\n this.manager = manager;\n this.scope = scope;\n }\n public async clear(level: number): Promise<void> {\n this.manager.clearSelection(this.name, this.imodel, level);\n }\n public async add(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\n addTransientKeys(transientIds, keys);\n this.manager.addToSelection(this.name, this.imodel, keys, level);\n }\n public async remove(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\n addTransientKeys(transientIds, keys);\n this.manager.removeFromSelection(this.name, this.imodel, keys, level);\n }\n public async replace(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\n addTransientKeys(transientIds, keys);\n this.manager.replaceSelection(this.name, this.imodel, keys, level);\n }\n}\n\n/** Stores current selection in `KeySet` format per iModel. */\nclass CurrentSelectionStorage {\n private _currentSelection = new Map<string, IModelSelectionStorage>();\n\n private getCurrentSelectionStorage(imodelKey: string) {\n let storage = this._currentSelection.get(imodelKey);\n if (!storage) {\n storage = new IModelSelectionStorage();\n this._currentSelection.set(imodelKey, storage);\n }\n return storage;\n }\n\n public getSelection(imodelKey: string, level: number) {\n return this.getCurrentSelectionStorage(imodelKey).getSelection(level);\n }\n\n public clear(imodelKey: string) {\n this._currentSelection.delete(imodelKey);\n }\n\n public computeSelection(imodelKey: string, level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n return this.getCurrentSelectionStorage(imodelKey).computeSelection(level, currSelectables, changedSelectables);\n }\n}\n\ninterface StorageEntry {\n value: KeySet;\n ongoingComputationDisposers: Set<Subject<void>>;\n}\n\n/**\n * Computes and stores current selection in `KeySet` format.\n * It always stores result of latest resolved call to `computeSelection`.\n */\nclass IModelSelectionStorage {\n private _currentSelection = new Map<number, StorageEntry>();\n\n public getSelection(level: number): KeySet {\n let entry = this._currentSelection.get(level);\n if (!entry) {\n entry = { value: new KeySet(), ongoingComputationDisposers: new Set() };\n this._currentSelection.set(level, entry);\n }\n return entry.value;\n }\n\n private clearSelections(level: number) {\n const clearedLevels = [];\n for (const [storedLevel] of this._currentSelection.entries()) {\n if (storedLevel > level) {\n clearedLevels.push(storedLevel);\n }\n }\n clearedLevels.forEach((storedLevel) => {\n const entry = this._currentSelection.get(storedLevel);\n // istanbul ignore if\n if (!entry) {\n return;\n }\n\n for (const disposer of entry.ongoingComputationDisposers) {\n disposer.next();\n }\n this._currentSelection.delete(storedLevel);\n });\n }\n\n private addDisposer(level: number, disposer: Subject<void>) {\n const entry = this._currentSelection.get(level);\n if (!entry) {\n this._currentSelection.set(level, { value: new KeySet(), ongoingComputationDisposers: new Set([disposer]) });\n return;\n }\n entry.ongoingComputationDisposers.add(disposer);\n }\n\n private setSelection(level: number, keys: KeySet, disposer: Subject<void>) {\n const currEntry = this._currentSelection.get(level);\n // istanbul ignore else\n if (currEntry) {\n currEntry.ongoingComputationDisposers.delete(disposer);\n }\n this._currentSelection.set(level, {\n value: keys,\n ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* istanbul ignore next */ new Set(),\n });\n }\n\n public computeSelection(level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n this.clearSelections(level);\n\n const prevComputationsDisposers = [...(this._currentSelection.get(level)?.ongoingComputationDisposers ?? [])];\n const currDisposer = new Subject<void>();\n this.addDisposer(level, currDisposer);\n\n return defer(async () => {\n const convertedSelectables: SelectableKeys[] = [];\n const [current, changed] = await Promise.all([\n selectablesToKeys(currSelectables, convertedSelectables),\n selectablesToKeys(changedSelectables, convertedSelectables),\n ]);\n\n const currentSelection = new KeySet([...current.keys, ...current.selectableKeys.flatMap((selectable) => selectable.keys)]);\n const changedSelection = new KeySet([...changed.keys, ...changed.selectableKeys.flatMap((selectable) => selectable.keys)]);\n\n return {\n level,\n currentSelection,\n changedSelection,\n };\n }).pipe(\n takeUntil(currDisposer),\n tap({\n next: (val) => {\n prevComputationsDisposers.forEach((disposer) => disposer.next());\n this.setSelection(val.level, val.currentSelection, currDisposer);\n },\n }),\n );\n }\n}\n\nfunction keysToSelectable(imodel: IModelConnection, keys: Readonly<KeySet>) {\n const selectables: Selectable[] = [];\n keys.forEach((key) => {\n if (\"id\" in key) {\n selectables.push(key);\n return;\n }\n\n const customSelectable: CustomSelectable = {\n identifier: key.pathFromRoot.join(\"/\"),\n data: key,\n loadInstanceKeys: () => createInstanceKeysIterator(imodel, key),\n };\n selectables.push(customSelectable);\n });\n return selectables;\n}\n\ninterface SelectableKeys {\n identifier: string;\n keys: Key[];\n}\n\nasync function selectablesToKeys(selectables: Selectables, convertedList: SelectableKeys[]) {\n const keys: Key[] = [];\n const selectableKeys: SelectableKeys[] = [];\n\n for (const [className, ids] of selectables.instanceKeys) {\n for (const id of ids) {\n keys.push({ id, className });\n }\n }\n\n for (const [_, selectable] of selectables.custom) {\n if (isNodeKey(selectable.data)) {\n selectableKeys.push({ identifier: selectable.identifier, keys: [selectable.data] });\n continue;\n }\n const converted = convertedList.find((con) => con.identifier === selectable.identifier);\n if (converted) {\n selectableKeys.push(converted);\n continue;\n }\n\n const newConverted: SelectableKeys = { identifier: selectable.identifier, keys: [] };\n convertedList.push(newConverted);\n for await (const instanceKey of selectable.loadInstanceKeys()) {\n newConverted.keys.push(instanceKey);\n }\n selectableKeys.push(newConverted);\n }\n\n return { keys, selectableKeys };\n}\n\nasync function* createInstanceKeysIterator(imodel: IModelConnection, nodeKey: NodeKey): AsyncIterableIterator<InstanceKey> {\n if (NodeKey.isInstancesNodeKey(nodeKey)) {\n for (const key of nodeKey.instanceKeys) {\n yield key;\n }\n return;\n }\n\n const content = await Presentation.presentation.getContentInstanceKeys({\n imodel,\n keys: new KeySet([nodeKey]),\n rulesetOrId: {\n id: \"grouped-instances\",\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n });\n\n for await (const key of content.items()) {\n yield key;\n }\n}\n\nfunction isNodeKey(data: unknown): data is NodeKey {\n const key = data as BaseNodeKey;\n return key.pathFromRoot !== undefined && key.type !== undefined;\n}\n\nfunction getChangeType(type: StorageSelectionChangeType): SelectionChangeType {\n switch (type) {\n case \"add\":\n return SelectionChangeType.Add;\n case \"remove\":\n return SelectionChangeType.Remove;\n case \"replace\":\n return SelectionChangeType.Replace;\n case \"clear\":\n return SelectionChangeType.Clear;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;A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AAG,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,MAAM,GAAG,GAAG,IAAmB,CAAC;IAChC,OAAO,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAgC;IACrD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,0CAAmB,CAAC,GAAG,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,0CAAmB,CAAC,MAAM,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,0CAAmB,CAAC,OAAO,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,0CAAmB,CAAC,KAAK,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { defer, EMPTY, mergeMap, Observable, of, Subject, Subscription, takeUntil, tap } from \"rxjs\";\r\nimport { Id64, Id64Arg, Id64Array, IDisposable, using } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, SelectionSetEvent, SelectionSetEventType } from \"@itwin/core-frontend\";\r\nimport { AsyncTasksTracker, BaseNodeKey, InstanceKey, Key, Keys, KeySet, NodeKey, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\r\nimport {\r\n createStorage,\r\n CustomSelectable,\r\n Selectable,\r\n Selectables,\r\n SelectionStorage,\r\n StorageSelectionChangeEventArgs,\r\n StorageSelectionChangeType,\r\n} from \"@itwin/unified-selection\";\r\nimport { Presentation } from \"../Presentation\";\r\nimport { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider\";\r\nimport { ISelectionProvider } from \"./ISelectionProvider\";\r\nimport { SelectionChangeEvent, SelectionChangeEventArgs, SelectionChangeType } from \"./SelectionChangeEvent\";\r\nimport { createSelectionScopeProps, SelectionScopesManager } from \"./SelectionScopesManager\";\r\n\r\n/**\r\n * Properties for creating [[SelectionManager]].\r\n * @public\r\n */\r\nexport interface SelectionManagerProps {\r\n /** A manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\r\n scopes: SelectionScopesManager;\r\n /**\r\n * Custom unified selection storage to be used by [[SelectionManager]]. If not provided [[SelectionManager]] creates\r\n * and maintains storage.\r\n */\r\n selectionStorage?: SelectionStorage;\r\n}\r\n\r\n/**\r\n * The selection manager which stores the overall selection.\r\n * @public\r\n */\r\nexport class SelectionManager implements ISelectionProvider {\r\n private _selectionStorage: SelectionStorage;\r\n private _imodelToolSelectionSyncHandlers = new Map<IModelConnection, { requestorsCount: number; handler: ToolSelectionSyncHandler }>();\r\n private _hiliteSetProviders = new Map<IModelConnection, HiliteSetProvider>();\r\n private _ownsStorage: boolean;\r\n\r\n private _knownIModels = new Map<string, IModelConnection>();\r\n private _currentSelection = new CurrentSelectionStorage();\r\n private _selectionChanges = new Subject<StorageSelectionChangeEventArgs>();\r\n private _selectionEventsSubscription: Subscription;\r\n private _listeners: Array<() => void> = [];\r\n\r\n /** An event which gets broadcasted on selection changes */\r\n public readonly selectionChange: SelectionChangeEvent;\r\n\r\n /** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\r\n public readonly scopes: SelectionScopesManager;\r\n\r\n /**\r\n * Creates an instance of SelectionManager.\r\n */\r\n constructor(props: SelectionManagerProps) {\r\n this.selectionChange = new SelectionChangeEvent();\r\n this.scopes = props.scopes;\r\n this._selectionStorage = props.selectionStorage ?? createStorage();\r\n this._ownsStorage = props.selectionStorage === undefined;\r\n this._selectionStorage.selectionChangeEvent.addListener((args) => this._selectionChanges.next(args));\r\n this._selectionEventsSubscription = this.streamSelectionEvents();\r\n this._listeners.push(\r\n IModelConnection.onOpen.addListener((imodel) => {\r\n this._knownIModels.set(imodel.key, imodel);\r\n }),\r\n );\r\n this._listeners.push(\r\n IModelConnection.onClose.addListener((imodel: IModelConnection) => {\r\n this.onConnectionClose(imodel);\r\n }),\r\n );\r\n }\r\n\r\n public dispose() {\r\n this._selectionEventsSubscription.unsubscribe();\r\n this._listeners.forEach((dispose) => dispose());\r\n }\r\n\r\n private onConnectionClose(imodel: IModelConnection): void {\r\n this._hiliteSetProviders.delete(imodel);\r\n this._knownIModels.delete(imodel.key);\r\n this._currentSelection.clear(imodel.key);\r\n if (this._ownsStorage) {\r\n this.clearSelection(\"Connection Close Event\", imodel);\r\n this._selectionStorage.clearStorage({ iModelKey: imodel.key });\r\n }\r\n }\r\n\r\n /** @internal */\r\n // istanbul ignore next\r\n public getToolSelectionSyncHandler(imodel: IModelConnection) {\r\n return this._imodelToolSelectionSyncHandlers.get(imodel)?.handler;\r\n }\r\n\r\n /**\r\n * Request the manager to sync with imodel's tool selection (see `IModelConnection.selectionSet`).\r\n */\r\n public setSyncWithIModelToolSelection(imodel: IModelConnection, sync = true) {\r\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\r\n if (sync) {\r\n if (!registration || registration.requestorsCount === 0) {\r\n this._imodelToolSelectionSyncHandlers.set(imodel, { requestorsCount: 1, handler: new ToolSelectionSyncHandler(imodel, this) });\r\n } else {\r\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount: registration.requestorsCount + 1 });\r\n }\r\n } else {\r\n if (registration && registration.requestorsCount > 0) {\r\n const requestorsCount = registration.requestorsCount - 1;\r\n if (requestorsCount > 0) {\r\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount });\r\n } else {\r\n this._imodelToolSelectionSyncHandlers.delete(imodel);\r\n registration.handler.dispose();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Temporarily suspends tool selection synchronization until the returned `IDisposable`\r\n * is disposed.\r\n */\r\n public suspendIModelToolSelectionSync(imodel: IModelConnection): IDisposable {\r\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\r\n if (!registration) {\r\n return { dispose: () => {} };\r\n }\r\n\r\n const wasSuspended = registration.handler.isSuspended;\r\n registration.handler.isSuspended = true;\r\n return { dispose: () => (registration.handler.isSuspended = wasSuspended) };\r\n }\r\n\r\n /** Get the selection levels currently stored in this manager for the specified imodel */\r\n public getSelectionLevels(imodel: IModelConnection): number[] {\r\n return this._selectionStorage.getSelectionLevels({ iModelKey: imodel.key });\r\n }\r\n\r\n /**\r\n * Get the selection currently stored in this manager\r\n *\r\n * @note Calling immediately after `add*`|`replace*`|`remove*`|`clear*` method call does not guarantee\r\n * that returned `KeySet` will include latest changes. Listen for `selectionChange` event to get the\r\n * latest selection after changes.\r\n */\r\n public getSelection(imodel: IModelConnection, level: number = 0): Readonly<KeySet> {\r\n return this._currentSelection.getSelection(imodel.key, level);\r\n }\r\n\r\n private handleEvent(evt: SelectionChangeEventArgs): void {\r\n if (!this._knownIModels.has(evt.imodel.key)) {\r\n this._knownIModels.set(evt.imodel.key, evt.imodel);\r\n }\r\n\r\n switch (evt.changeType) {\r\n case SelectionChangeType.Add:\r\n this._selectionStorage.addToSelection({\r\n iModelKey: evt.imodel.key,\r\n source: evt.source,\r\n level: evt.level,\r\n selectables: keysToSelectable(evt.imodel, evt.keys),\r\n });\r\n break;\r\n case SelectionChangeType.Remove:\r\n this._selectionStorage.removeFromSelection({\r\n iModelKey: evt.imodel.key,\r\n source: evt.source,\r\n level: evt.level,\r\n selectables: keysToSelectable(evt.imodel, evt.keys),\r\n });\r\n break;\r\n case SelectionChangeType.Replace:\r\n this._selectionStorage.replaceSelection({\r\n iModelKey: evt.imodel.key,\r\n source: evt.source,\r\n level: evt.level,\r\n selectables: keysToSelectable(evt.imodel, evt.keys),\r\n });\r\n break;\r\n case SelectionChangeType.Clear:\r\n this._selectionStorage.clearSelection({ iModelKey: evt.imodel.key, source: evt.source, level: evt.level });\r\n break;\r\n }\r\n }\r\n\r\n /**\r\n * Add keys to the selection\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param keys Keys to add\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public addToSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\r\n const evt: SelectionChangeEventArgs = {\r\n source,\r\n level,\r\n imodel,\r\n changeType: SelectionChangeType.Add,\r\n keys: new KeySet(keys),\r\n timestamp: new Date(),\r\n rulesetId,\r\n };\r\n this.handleEvent(evt);\r\n }\r\n\r\n /**\r\n * Remove keys from current selection\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param keys Keys to remove\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public removeFromSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\r\n const evt: SelectionChangeEventArgs = {\r\n source,\r\n level,\r\n imodel,\r\n changeType: SelectionChangeType.Remove,\r\n keys: new KeySet(keys),\r\n timestamp: new Date(),\r\n rulesetId,\r\n };\r\n this.handleEvent(evt);\r\n }\r\n\r\n /**\r\n * Replace current selection\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param keys Keys to add\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public replaceSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\r\n const evt: SelectionChangeEventArgs = {\r\n source,\r\n level,\r\n imodel,\r\n changeType: SelectionChangeType.Replace,\r\n keys: new KeySet(keys),\r\n timestamp: new Date(),\r\n rulesetId,\r\n };\r\n this.handleEvent(evt);\r\n }\r\n\r\n /**\r\n * Clear current selection\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public clearSelection(source: string, imodel: IModelConnection, level: number = 0, rulesetId?: string): void {\r\n const evt: SelectionChangeEventArgs = {\r\n source,\r\n level,\r\n imodel,\r\n changeType: SelectionChangeType.Clear,\r\n keys: new KeySet(),\r\n timestamp: new Date(),\r\n rulesetId,\r\n };\r\n this.handleEvent(evt);\r\n }\r\n\r\n /**\r\n * Add keys to selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param ids Element IDs to add\r\n * @param scope Selection scope to apply\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public async addToSelectionWithScope(\r\n source: string,\r\n imodel: IModelConnection,\r\n ids: Id64Arg,\r\n scope: SelectionScopeProps | SelectionScope | string,\r\n level: number = 0,\r\n rulesetId?: string,\r\n ): Promise<void> {\r\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\r\n this.addToSelection(source, imodel, scopedKeys, level, rulesetId);\r\n }\r\n\r\n /**\r\n * Remove keys from current selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param ids Element IDs to remove\r\n * @param scope Selection scope to apply\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public async removeFromSelectionWithScope(\r\n source: string,\r\n imodel: IModelConnection,\r\n ids: Id64Arg,\r\n scope: SelectionScopeProps | SelectionScope | string,\r\n level: number = 0,\r\n rulesetId?: string,\r\n ): Promise<void> {\r\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\r\n this.removeFromSelection(source, imodel, scopedKeys, level, rulesetId);\r\n }\r\n\r\n /**\r\n * Replace current selection with keys after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\r\n * @param source Name of the selection source\r\n * @param imodel iModel associated with the selection\r\n * @param ids Element IDs to replace with\r\n * @param scope Selection scope to apply\r\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\r\n */\r\n public async replaceSelectionWithScope(\r\n source: string,\r\n imodel: IModelConnection,\r\n ids: Id64Arg,\r\n scope: SelectionScopeProps | SelectionScope | string,\r\n level: number = 0,\r\n rulesetId?: string,\r\n ): Promise<void> {\r\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\r\n this.replaceSelection(source, imodel, scopedKeys, level, rulesetId);\r\n }\r\n\r\n /**\r\n * Get the current hilite set for the specified imodel\r\n * @public\r\n */\r\n public async getHiliteSet(imodel: IModelConnection): Promise<HiliteSet> {\r\n return this.getHiliteSetProvider(imodel).getHiliteSet(this.getSelection(imodel));\r\n }\r\n\r\n /**\r\n * Get the current hilite set iterator for the specified imodel.\r\n * @public\r\n */\r\n public getHiliteSetIterator(imodel: IModelConnection) {\r\n return this.getHiliteSetProvider(imodel).getHiliteSetIterator(this.getSelection(imodel));\r\n }\r\n\r\n private getHiliteSetProvider(imodel: IModelConnection) {\r\n let provider = this._hiliteSetProviders.get(imodel);\r\n if (!provider) {\r\n provider = HiliteSetProvider.create({ imodel });\r\n this._hiliteSetProviders.set(imodel, provider);\r\n }\r\n return provider;\r\n }\r\n\r\n private streamSelectionEvents() {\r\n return this._selectionChanges\r\n .pipe(\r\n mergeMap((args) => {\r\n const currentSelectables = this._selectionStorage.getSelection({ iModelKey: args.iModelKey, level: args.level });\r\n return this._currentSelection.computeSelection(args.iModelKey, args.level, currentSelectables, args.selectables).pipe(\r\n mergeMap(({ level, changedSelection }): Observable<SelectionChangeEventArgs> => {\r\n const imodel = this._knownIModels.get(args.iModelKey);\r\n // istanbul ignore if\r\n if (!imodel) {\r\n return EMPTY;\r\n }\r\n return of({\r\n imodel,\r\n keys: changedSelection,\r\n level,\r\n source: args.source,\r\n timestamp: args.timestamp,\r\n changeType: getChangeType(args.changeType),\r\n });\r\n }),\r\n );\r\n }),\r\n )\r\n .subscribe({\r\n next: (args) => {\r\n this.selectionChange.raiseEvent(args, this);\r\n },\r\n });\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport const TRANSIENT_ELEMENT_CLASSNAME = \"/TRANSIENT\";\r\n\r\n/** @internal */\r\nexport class ToolSelectionSyncHandler implements IDisposable {\r\n private _selectionSourceName = \"Tool\";\r\n private _logicalSelection: SelectionManager;\r\n private _imodel: IModelConnection;\r\n private _imodelToolSelectionListenerDisposeFunc: () => void;\r\n private _asyncsTracker = new AsyncTasksTracker();\r\n public isSuspended?: boolean;\r\n\r\n public constructor(imodel: IModelConnection, logicalSelection: SelectionManager) {\r\n this._imodel = imodel;\r\n this._logicalSelection = logicalSelection;\r\n this._imodelToolSelectionListenerDisposeFunc = imodel.selectionSet.onChanged.addListener(this.onToolSelectionChanged);\r\n }\r\n\r\n public dispose() {\r\n this._imodelToolSelectionListenerDisposeFunc();\r\n }\r\n\r\n /** note: used only it tests */\r\n public get pendingAsyncs() {\r\n return this._asyncsTracker.pendingAsyncs;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private onToolSelectionChanged = async (ev: SelectionSetEvent): Promise<void> => {\r\n // ignore selection change event if the handler is suspended\r\n if (this.isSuspended) {\r\n return;\r\n }\r\n\r\n // this component only cares about its own imodel\r\n const imodel = ev.set.iModel;\r\n if (imodel !== this._imodel) {\r\n return;\r\n }\r\n\r\n // determine the level of selection changes\r\n // wip: may want to allow selecting at different levels?\r\n const selectionLevel = 0;\r\n\r\n let ids: Id64Arg;\r\n switch (ev.type) {\r\n case SelectionSetEventType.Add:\r\n ids = ev.added;\r\n break;\r\n case SelectionSetEventType.Replace:\r\n ids = ev.set.elements;\r\n break;\r\n default:\r\n ids = ev.removed;\r\n break;\r\n }\r\n\r\n // we're always using scoped selection changer even if the scope is set to \"element\" - that\r\n // makes sure we're adding to selection keys with concrete classes and not \"BisCore:Element\", which\r\n // we can't because otherwise our keys compare fails (presentation components load data with\r\n // concrete classes)\r\n const changer = new ScopedSelectionChanger(\r\n this._selectionSourceName,\r\n this._imodel,\r\n this._logicalSelection,\r\n createSelectionScopeProps(this._logicalSelection.scopes.activeScope),\r\n );\r\n\r\n // we know what to do immediately on `clear` events\r\n if (SelectionSetEventType.Clear === ev.type) {\r\n await changer.clear(selectionLevel);\r\n return;\r\n }\r\n\r\n const parsedIds = parseIds(ids);\r\n await using(this._asyncsTracker.trackAsyncTask(), async (_r) => {\r\n switch (ev.type) {\r\n case SelectionSetEventType.Add:\r\n await changer.add(parsedIds.transient, parsedIds.persistent, selectionLevel);\r\n break;\r\n case SelectionSetEventType.Replace:\r\n await changer.replace(parsedIds.transient, parsedIds.persistent, selectionLevel);\r\n break;\r\n case SelectionSetEventType.Remove:\r\n await changer.remove(parsedIds.transient, parsedIds.persistent, selectionLevel);\r\n break;\r\n }\r\n });\r\n };\r\n}\r\n\r\nconst parseIds = (ids: Id64Arg): { persistent: Id64Arg; transient: Id64Arg } => {\r\n let allPersistent = true;\r\n let allTransient = true;\r\n for (const id of Id64.iterable(ids)) {\r\n if (Id64.isTransient(id)) {\r\n allPersistent = false;\r\n } else {\r\n allTransient = false;\r\n }\r\n\r\n if (!allPersistent && !allTransient) {\r\n break;\r\n }\r\n }\r\n\r\n // avoid making a copy if ids are only persistent or only transient\r\n if (allPersistent) {\r\n return { persistent: ids, transient: [] };\r\n } else if (allTransient) {\r\n return { persistent: [], transient: ids };\r\n }\r\n\r\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\r\n // a Set for performance\r\n const persistentElementIds: Id64Array = [];\r\n const transientElementIds: Id64Array = [];\r\n for (const id of Id64.iterable(ids)) {\r\n if (Id64.isTransient(id)) {\r\n transientElementIds.push(id);\r\n } else {\r\n persistentElementIds.push(id);\r\n }\r\n }\r\n\r\n return { persistent: persistentElementIds, transient: transientElementIds };\r\n};\r\n\r\nfunction addTransientKeys(transientIds: Id64Arg, keys: KeySet): void {\r\n for (const id of Id64.iterable(transientIds)) {\r\n keys.add({ className: TRANSIENT_ELEMENT_CLASSNAME, id });\r\n }\r\n}\r\n\r\n/** @internal */\r\nclass ScopedSelectionChanger {\r\n public readonly name: string;\r\n public readonly imodel: IModelConnection;\r\n public readonly manager: SelectionManager;\r\n public readonly scope: SelectionScopeProps | SelectionScope | string;\r\n public constructor(name: string, imodel: IModelConnection, manager: SelectionManager, scope: SelectionScopeProps | SelectionScope | string) {\r\n this.name = name;\r\n this.imodel = imodel;\r\n this.manager = manager;\r\n this.scope = scope;\r\n }\r\n public async clear(level: number): Promise<void> {\r\n this.manager.clearSelection(this.name, this.imodel, level);\r\n }\r\n public async add(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\r\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\r\n addTransientKeys(transientIds, keys);\r\n this.manager.addToSelection(this.name, this.imodel, keys, level);\r\n }\r\n public async remove(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\r\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\r\n addTransientKeys(transientIds, keys);\r\n this.manager.removeFromSelection(this.name, this.imodel, keys, level);\r\n }\r\n public async replace(transientIds: Id64Arg, persistentIds: Id64Arg, level: number): Promise<void> {\r\n const keys = await this.manager.scopes.computeSelection(this.imodel, persistentIds, this.scope);\r\n addTransientKeys(transientIds, keys);\r\n this.manager.replaceSelection(this.name, this.imodel, keys, level);\r\n }\r\n}\r\n\r\n/** Stores current selection in `KeySet` format per iModel. */\r\nclass CurrentSelectionStorage {\r\n private _currentSelection = new Map<string, IModelSelectionStorage>();\r\n\r\n private getCurrentSelectionStorage(imodelKey: string) {\r\n let storage = this._currentSelection.get(imodelKey);\r\n if (!storage) {\r\n storage = new IModelSelectionStorage();\r\n this._currentSelection.set(imodelKey, storage);\r\n }\r\n return storage;\r\n }\r\n\r\n public getSelection(imodelKey: string, level: number) {\r\n return this.getCurrentSelectionStorage(imodelKey).getSelection(level);\r\n }\r\n\r\n public clear(imodelKey: string) {\r\n this._currentSelection.delete(imodelKey);\r\n }\r\n\r\n public computeSelection(imodelKey: string, level: number, currSelectables: Selectables, changedSelectables: Selectables) {\r\n return this.getCurrentSelectionStorage(imodelKey).computeSelection(level, currSelectables, changedSelectables);\r\n }\r\n}\r\n\r\ninterface StorageEntry {\r\n value: KeySet;\r\n ongoingComputationDisposers: Set<Subject<void>>;\r\n}\r\n\r\n/**\r\n * Computes and stores current selection in `KeySet` format.\r\n * It always stores result of latest resolved call to `computeSelection`.\r\n */\r\nclass IModelSelectionStorage {\r\n private _currentSelection = new Map<number, StorageEntry>();\r\n\r\n public getSelection(level: number): KeySet {\r\n let entry = this._currentSelection.get(level);\r\n if (!entry) {\r\n entry = { value: new KeySet(), ongoingComputationDisposers: new Set() };\r\n this._currentSelection.set(level, entry);\r\n }\r\n return entry.value;\r\n }\r\n\r\n private clearSelections(level: number) {\r\n const clearedLevels = [];\r\n for (const [storedLevel] of this._currentSelection.entries()) {\r\n if (storedLevel > level) {\r\n clearedLevels.push(storedLevel);\r\n }\r\n }\r\n clearedLevels.forEach((storedLevel) => {\r\n const entry = this._currentSelection.get(storedLevel);\r\n // istanbul ignore if\r\n if (!entry) {\r\n return;\r\n }\r\n\r\n for (const disposer of entry.ongoingComputationDisposers) {\r\n disposer.next();\r\n }\r\n this._currentSelection.delete(storedLevel);\r\n });\r\n }\r\n\r\n private addDisposer(level: number, disposer: Subject<void>) {\r\n const entry = this._currentSelection.get(level);\r\n if (!entry) {\r\n this._currentSelection.set(level, { value: new KeySet(), ongoingComputationDisposers: new Set([disposer]) });\r\n return;\r\n }\r\n entry.ongoingComputationDisposers.add(disposer);\r\n }\r\n\r\n private setSelection(level: number, keys: KeySet, disposer: Subject<void>) {\r\n const currEntry = this._currentSelection.get(level);\r\n // istanbul ignore else\r\n if (currEntry) {\r\n currEntry.ongoingComputationDisposers.delete(disposer);\r\n }\r\n this._currentSelection.set(level, {\r\n value: keys,\r\n ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* istanbul ignore next */ new Set(),\r\n });\r\n }\r\n\r\n public computeSelection(level: number, currSelectables: Selectables, changedSelectables: Selectables) {\r\n this.clearSelections(level);\r\n\r\n const prevComputationsDisposers = [...(this._currentSelection.get(level)?.ongoingComputationDisposers ?? [])];\r\n const currDisposer = new Subject<void>();\r\n this.addDisposer(level, currDisposer);\r\n\r\n return defer(async () => {\r\n const convertedSelectables: SelectableKeys[] = [];\r\n const [current, changed] = await Promise.all([\r\n selectablesToKeys(currSelectables, convertedSelectables),\r\n selectablesToKeys(changedSelectables, convertedSelectables),\r\n ]);\r\n\r\n const currentSelection = new KeySet([...current.keys, ...current.selectableKeys.flatMap((selectable) => selectable.keys)]);\r\n const changedSelection = new KeySet([...changed.keys, ...changed.selectableKeys.flatMap((selectable) => selectable.keys)]);\r\n\r\n return {\r\n level,\r\n currentSelection,\r\n changedSelection,\r\n };\r\n }).pipe(\r\n takeUntil(currDisposer),\r\n tap({\r\n next: (val) => {\r\n prevComputationsDisposers.forEach((disposer) => disposer.next());\r\n this.setSelection(val.level, val.currentSelection, currDisposer);\r\n },\r\n }),\r\n );\r\n }\r\n}\r\n\r\nfunction keysToSelectable(imodel: IModelConnection, keys: Readonly<KeySet>) {\r\n const selectables: Selectable[] = [];\r\n keys.forEach((key) => {\r\n if (\"id\" in key) {\r\n selectables.push(key);\r\n return;\r\n }\r\n\r\n const customSelectable: CustomSelectable = {\r\n identifier: key.pathFromRoot.join(\"/\"),\r\n data: key,\r\n loadInstanceKeys: () => createInstanceKeysIterator(imodel, key),\r\n };\r\n selectables.push(customSelectable);\r\n });\r\n return selectables;\r\n}\r\n\r\ninterface SelectableKeys {\r\n identifier: string;\r\n keys: Key[];\r\n}\r\n\r\nasync function selectablesToKeys(selectables: Selectables, convertedList: SelectableKeys[]) {\r\n const keys: Key[] = [];\r\n const selectableKeys: SelectableKeys[] = [];\r\n\r\n for (const [className, ids] of selectables.instanceKeys) {\r\n for (const id of ids) {\r\n keys.push({ id, className });\r\n }\r\n }\r\n\r\n for (const [_, selectable] of selectables.custom) {\r\n if (isNodeKey(selectable.data)) {\r\n selectableKeys.push({ identifier: selectable.identifier, keys: [selectable.data] });\r\n continue;\r\n }\r\n const converted = convertedList.find((con) => con.identifier === selectable.identifier);\r\n if (converted) {\r\n selectableKeys.push(converted);\r\n continue;\r\n }\r\n\r\n const newConverted: SelectableKeys = { identifier: selectable.identifier, keys: [] };\r\n convertedList.push(newConverted);\r\n for await (const instanceKey of selectable.loadInstanceKeys()) {\r\n newConverted.keys.push(instanceKey);\r\n }\r\n selectableKeys.push(newConverted);\r\n }\r\n\r\n return { keys, selectableKeys };\r\n}\r\n\r\nasync function* createInstanceKeysIterator(imodel: IModelConnection, nodeKey: NodeKey): AsyncIterableIterator<InstanceKey> {\r\n if (NodeKey.isInstancesNodeKey(nodeKey)) {\r\n for (const key of nodeKey.instanceKeys) {\r\n yield key;\r\n }\r\n return;\r\n }\r\n\r\n const content = await Presentation.presentation.getContentInstanceKeys({\r\n imodel,\r\n keys: new KeySet([nodeKey]),\r\n rulesetOrId: {\r\n id: \"grouped-instances\",\r\n rules: [\r\n {\r\n ruleType: \"Content\",\r\n specifications: [\r\n {\r\n specType: \"SelectedNodeInstances\",\r\n },\r\n ],\r\n },\r\n ],\r\n },\r\n });\r\n\r\n for await (const key of content.items()) {\r\n yield key;\r\n }\r\n}\r\n\r\nfunction isNodeKey(data: unknown): data is NodeKey {\r\n const key = data as BaseNodeKey;\r\n return key.pathFromRoot !== undefined && key.type !== undefined;\r\n}\r\n\r\nfunction getChangeType(type: StorageSelectionChangeType): SelectionChangeType {\r\n switch (type) {\r\n case \"add\":\r\n return SelectionChangeType.Add;\r\n case \"remove\":\r\n return SelectionChangeType.Remove;\r\n case \"replace\":\r\n return SelectionChangeType.Replace;\r\n case \"clear\":\r\n return SelectionChangeType.Clear;\r\n }\r\n}\r\n"]}
|