@itwin/presentation-frontend 5.0.0-dev.90 → 5.0.0-dev.92
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/lib/cjs/package.json +1 -0
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +6 -7
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.js +6 -6
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts +3 -3
- package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.js +14 -14
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +5 -4
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.js +25 -24
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +7 -11
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +4 -2
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +4 -4
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +27 -27
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.d.ts +15 -15
- package/lib/cjs/presentation-frontend.d.ts.map +1 -1
- package/lib/cjs/presentation-frontend.js +30 -29
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +6 -7
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.js +2 -2
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts +3 -3
- package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.js +7 -7
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +5 -4
- package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.js +13 -12
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +6 -10
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +4 -2
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +4 -4
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +11 -11
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.d.ts +15 -15
- package/lib/esm/presentation-frontend.d.ts.map +1 -1
- package/lib/esm/presentation-frontend.js +12 -15
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +35 -34
|
@@ -31,7 +31,7 @@ export class FavoritePropertiesManager {
|
|
|
31
31
|
static FAVORITES_IDENTIFIER_PREFIX = "";
|
|
32
32
|
/** Event raised after favorite properties have changed. */
|
|
33
33
|
onFavoritesChanged = new BeEvent();
|
|
34
|
-
|
|
34
|
+
storage;
|
|
35
35
|
_globalProperties;
|
|
36
36
|
_iTwinProperties;
|
|
37
37
|
_imodelProperties;
|
|
@@ -40,7 +40,7 @@ export class FavoritePropertiesManager {
|
|
|
40
40
|
/** Property order is saved only in iModel scope */
|
|
41
41
|
_propertiesOrder;
|
|
42
42
|
constructor(props) {
|
|
43
|
-
this.
|
|
43
|
+
this.storage = props.storage;
|
|
44
44
|
this._iTwinProperties = new Map();
|
|
45
45
|
this._imodelProperties = new Map();
|
|
46
46
|
this._propertiesOrder = new Map();
|
|
@@ -48,16 +48,16 @@ export class FavoritePropertiesManager {
|
|
|
48
48
|
this._imodelInitializationPromises = new Map();
|
|
49
49
|
}
|
|
50
50
|
[Symbol.dispose]() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if (isDisposable(this.storage)) {
|
|
52
|
+
this.storage[Symbol.dispose]();
|
|
53
|
+
/* c8 ignore next 3 */
|
|
54
54
|
}
|
|
55
|
-
else if (isIDisposable(this.
|
|
56
|
-
this.
|
|
55
|
+
else if (isIDisposable(this.storage)) { /* eslint-disable-line @typescript-eslint/no-deprecated */
|
|
56
|
+
this.storage.dispose();
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
/** @deprecated in 5.0 Use [Symbol.dispose] instead. */
|
|
60
|
-
|
|
60
|
+
/* c8 ignore next 3 */
|
|
61
61
|
dispose() {
|
|
62
62
|
this[Symbol.dispose]();
|
|
63
63
|
}
|
|
@@ -69,17 +69,17 @@ export class FavoritePropertiesManager {
|
|
|
69
69
|
const imodelId = imodel.iModelId;
|
|
70
70
|
const iTwinId = imodel.iTwinId;
|
|
71
71
|
if (this._globalProperties === undefined) {
|
|
72
|
-
this._globalProperties = (await this.
|
|
72
|
+
this._globalProperties = (await this.storage.loadProperties()) || new Set();
|
|
73
73
|
}
|
|
74
74
|
if (!this._iTwinProperties.has(iTwinId)) {
|
|
75
|
-
const iTwinProperties = (await this.
|
|
75
|
+
const iTwinProperties = (await this.storage.loadProperties(iTwinId)) || new Set();
|
|
76
76
|
this._iTwinProperties.set(iTwinId, iTwinProperties);
|
|
77
77
|
}
|
|
78
78
|
if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {
|
|
79
|
-
const imodelProperties = (await this.
|
|
79
|
+
const imodelProperties = (await this.storage.loadProperties(iTwinId, imodelId)) || new Set();
|
|
80
80
|
this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);
|
|
81
81
|
}
|
|
82
|
-
const propertiesOrder = (await this.
|
|
82
|
+
const propertiesOrder = (await this.storage.loadPropertiesOrder(iTwinId, imodelId)) || [];
|
|
83
83
|
this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);
|
|
84
84
|
await this._adjustPropertyOrderInfos(iTwinId, imodelId);
|
|
85
85
|
};
|
|
@@ -171,15 +171,15 @@ export class FavoritePropertiesManager {
|
|
|
171
171
|
switch (scope) {
|
|
172
172
|
case FavoritePropertiesScope.Global:
|
|
173
173
|
favoriteProperties = this._globalProperties;
|
|
174
|
-
saveProperties = async (properties) => this.
|
|
174
|
+
saveProperties = async (properties) => this.storage.saveProperties(properties);
|
|
175
175
|
break;
|
|
176
176
|
case FavoritePropertiesScope.ITwin:
|
|
177
177
|
favoriteProperties = this._iTwinProperties.get(iTwinId);
|
|
178
|
-
saveProperties = async (properties) => this.
|
|
178
|
+
saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId);
|
|
179
179
|
break;
|
|
180
180
|
default:
|
|
181
181
|
favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId));
|
|
182
|
-
saveProperties = async (properties) => this.
|
|
182
|
+
saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId);
|
|
183
183
|
}
|
|
184
184
|
const countBefore = favoriteProperties.size;
|
|
185
185
|
const fieldInfos = getFieldInfos(field);
|
|
@@ -189,7 +189,7 @@ export class FavoritePropertiesManager {
|
|
|
189
189
|
saves.push(saveProperties(favoriteProperties));
|
|
190
190
|
const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId));
|
|
191
191
|
addOrderInfos(propertiesOrder, createFieldOrderInfos(field));
|
|
192
|
-
saves.push(this.
|
|
192
|
+
saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));
|
|
193
193
|
await Promise.all(saves);
|
|
194
194
|
this.onFavoritesChanged.raiseEvent();
|
|
195
195
|
}
|
|
@@ -208,18 +208,18 @@ export class FavoritePropertiesManager {
|
|
|
208
208
|
const workingScopes = [];
|
|
209
209
|
workingScopes.push({
|
|
210
210
|
properties: this._globalProperties,
|
|
211
|
-
save: async (properties) => this.
|
|
211
|
+
save: async (properties) => this.storage.saveProperties(properties),
|
|
212
212
|
});
|
|
213
213
|
if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {
|
|
214
214
|
workingScopes.push({
|
|
215
215
|
properties: this._iTwinProperties.get(iTwinId),
|
|
216
|
-
save: async (properties) => this.
|
|
216
|
+
save: async (properties) => this.storage.saveProperties(properties, iTwinId),
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
if (scope === FavoritePropertiesScope.IModel) {
|
|
220
220
|
workingScopes.push({
|
|
221
221
|
properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId)),
|
|
222
|
-
save: async (properties) => this.
|
|
222
|
+
save: async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId),
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
const saves = [];
|
|
@@ -237,7 +237,7 @@ export class FavoritePropertiesManager {
|
|
|
237
237
|
}
|
|
238
238
|
const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId));
|
|
239
239
|
removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));
|
|
240
|
-
saves.push(this.
|
|
240
|
+
saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));
|
|
241
241
|
await Promise.all(saves);
|
|
242
242
|
this.onFavoritesChanged.raiseEvent();
|
|
243
243
|
}
|
|
@@ -255,15 +255,15 @@ export class FavoritePropertiesManager {
|
|
|
255
255
|
switch (scope) {
|
|
256
256
|
case FavoritePropertiesScope.Global:
|
|
257
257
|
favoriteProperties = this._globalProperties;
|
|
258
|
-
saveProperties = async () => this.
|
|
258
|
+
saveProperties = async () => this.storage.saveProperties(new Set());
|
|
259
259
|
break;
|
|
260
260
|
case FavoritePropertiesScope.ITwin:
|
|
261
261
|
favoriteProperties = this._iTwinProperties.get(iTwinId);
|
|
262
|
-
saveProperties = async () => this.
|
|
262
|
+
saveProperties = async () => this.storage.saveProperties(new Set(), iTwinId);
|
|
263
263
|
break;
|
|
264
264
|
default:
|
|
265
265
|
favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId));
|
|
266
|
-
saveProperties = async () => this.
|
|
266
|
+
saveProperties = async () => this.storage.saveProperties(new Set(), iTwinId, imodelId);
|
|
267
267
|
}
|
|
268
268
|
if (favoriteProperties.size === 0) {
|
|
269
269
|
return;
|
|
@@ -499,7 +499,7 @@ export class FavoritePropertiesManager {
|
|
|
499
499
|
// reassign priority numbers
|
|
500
500
|
let priority = allOrderInfos.length;
|
|
501
501
|
allOrderInfos.forEach((oi) => (oi.priority = priority--));
|
|
502
|
-
await this.
|
|
502
|
+
await this.storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);
|
|
503
503
|
this.onFavoritesChanged.raiseEvent();
|
|
504
504
|
}
|
|
505
505
|
}
|
|
@@ -584,7 +584,6 @@ const addOrderInfos = (dest, source) => {
|
|
|
584
584
|
const removeOrderInfos = (container, toRemove) => {
|
|
585
585
|
toRemove.forEach((roi) => {
|
|
586
586
|
const index = container.findIndex((oi) => oi.name === roi.name);
|
|
587
|
-
/* istanbul ignore else */
|
|
588
587
|
if (index >= 0) {
|
|
589
588
|
container.splice(index, 1);
|
|
590
589
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,yEAAM,CAAA;AACR,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC;AAkCD;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IACpC;;;OAGG;IACI,MAAM,CAAC,2BAA2B,GAAG,EAAE,CAAC;IAE/C,2DAA2D;IACpD,kBAAkB,GAAG,IAAI,OAAO,EAAc,CAAC;IAE9C,QAAQ,CAA6B;IACrC,iBAAiB,CAAoC;IACrD,gBAAgB,CAAqC;IACrD,iBAAiB,CAAqC;IACtD,yBAAyB,CAAiD;IAC1E,6BAA6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AAG,CAAC,KAAY,EAAE,UAAyC,EAAiC,EAAE;IACpH,MAAM,eAAe,GAAkC,EAAE,CAAC;IAC1D,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE;QACvC,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACjE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,KAAK,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC9B,+BAA+B,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACxC,eAAe,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,UAAyC,EAAE,EAAE,CAC3E,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, isDisposable, isIDisposable } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage\";\n\n/**\n * Scopes that favorite properties can be stored in.\n * @public\n */\nexport enum FavoritePropertiesScope {\n Global,\n ITwin,\n IModel,\n}\n\n/**\n * Format:\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\n * Primitive property - {field name}.\n * @public\n */\nexport type PropertyFullName = string;\n\n/**\n * Holds the information of favorite properties ordering.\n * @public\n */\nexport interface FavoritePropertiesOrderInfo {\n parentClassName: string | undefined;\n name: PropertyFullName;\n priority: number;\n orderedTimestamp: Date;\n}\n\n/**\n * Properties for initializing [[FavoritePropertiesManager]]\n * @public\n */\nexport interface FavoritePropertiesManagerProps {\n /**\n * Implementation of a persistence layer for storing favorite properties and their order.\n * @public\n */\n storage: IFavoritePropertiesStorage;\n}\n\n/**\n * The favorite property manager which lets to store favorite properties\n * and check if field contains favorite properties.\n *\n * @public\n */\nexport class FavoritePropertiesManager implements Disposable {\n /**\n * Used in tests to avoid collisions between multiple runs using the same storage\n * @internal\n */\n public static FAVORITES_IDENTIFIER_PREFIX = \"\";\n\n /** Event raised after favorite properties have changed. */\n public onFavoritesChanged = new BeEvent<() => void>();\n\n private _storage: IFavoritePropertiesStorage;\n private _globalProperties: Set<PropertyFullName> | undefined;\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\n private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\n\n /** Property order is saved only in iModel scope */\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\n\n public constructor(props: FavoritePropertiesManagerProps) {\n this._storage = props.storage;\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\n this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n }\n\n public [Symbol.dispose]() {\n // istanbul ignore else\n if (isDisposable(this._storage)) {\n this._storage[Symbol.dispose]();\n } else if (isIDisposable(this._storage)) { /* eslint-disable-line @typescript-eslint/no-deprecated */\n this._storage.dispose();\n }\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n // istanbul ignore next\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\n */\n public initializeConnection = async (imodel: IModelConnection) => {\n const imodelId = imodel.iModelId!;\n const iTwinId = imodel.iTwinId!;\n\n if (this._globalProperties === undefined) {\n this._globalProperties = (await this._storage.loadProperties()) || new Set<PropertyFullName>();\n }\n\n if (!this._iTwinProperties.has(iTwinId)) {\n const iTwinProperties = (await this._storage.loadProperties(iTwinId)) || new Set<PropertyFullName>();\n this._iTwinProperties.set(iTwinId, iTwinProperties);\n }\n\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\n const imodelProperties = (await this._storage.loadProperties(iTwinId, imodelId)) || new Set<PropertyFullName>();\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\n }\n const propertiesOrder = (await this._storage.loadPropertiesOrder(iTwinId, imodelId)) || [];\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\n };\n\n /**\n * Function that removes order information of properties that are no longer\n * favorited and adds missing order information for favorited properties.\n */\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const globalProperties = this._globalProperties!;\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n // favorite property infos that need to be added to the propertiesOrder array\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\n\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\n if (infosToAdd.has(propertiesOrder[i].name)) {\n infosToAdd.delete(propertiesOrder[i].name);\n } else {\n propertiesOrder.splice(i, 1);\n }\n }\n\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n /**\n * Calls [[FavoritePropertiesManager.initializeConnection]] and caches the promise which should be awaited by calling [[FavoritePropertiesManager.ensureInitialized]].\n * @internal\n */\n public startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n /**\n * Performs the initialization process or finishes the one that was started by [[FavoritePropertiesManager.startConnectionInitialization]].\n * @internal\n */\n public async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\n }\n\n /**\n * Adds favorite properties into a certain scope.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to put the favorite properties into.\n */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async (properties) => this._storage.saveProperties(properties);\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId);\n }\n\n const countBefore = favoriteProperties.size;\n const fieldInfos = getFieldInfos(field);\n fieldInfos.forEach((info) => favoriteProperties.add(info));\n if (favoriteProperties.size !== countBefore) {\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties(favoriteProperties));\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n }\n\n /**\n * Removes favorite properties from a scope specified and all the more general scopes.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\n */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n const workingScopes: Array<{ properties: Set<PropertyFullName>; save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\n workingScopes.push({\n properties: this._globalProperties!,\n save: async (properties) => this._storage.saveProperties(properties),\n });\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._iTwinProperties.get(iTwinId)!,\n save: async (properties) => this._storage.saveProperties(properties, iTwinId),\n });\n }\n if (scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\n save: async (properties) => this._storage.saveProperties(properties, iTwinId, imodelId),\n });\n }\n\n const saves: Array<Promise<void>> = [];\n let favoritesChanged = false;\n for (const { properties, save } of workingScopes) {\n const countBefore = properties.size;\n fieldInfos.forEach((info) => properties.delete(info));\n if (properties.size !== countBefore) {\n saves.push(save(properties));\n favoritesChanged = true;\n }\n }\n if (!favoritesChanged) {\n return;\n }\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this._storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Removes all favorite properties from a certain scope.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\n */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: () => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>());\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async () => this._storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\n }\n\n if (favoriteProperties.size === 0) {\n return;\n }\n\n favoriteProperties.clear();\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties());\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n return (\n setHasAny(this._globalProperties!, fieldInfos) ||\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos))\n );\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\n }\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldPriority = new Map<Field, number>();\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\n\n const sortFunction = (left: Field, right: Field): number => {\n const lp = fieldPriority.get(left)!;\n const rp = fieldPriority.get(right)!;\n return lp < rp\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\n };\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\n }\n\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\n if (fieldOrderInfos.length === 0) {\n return -1;\n }\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\n return mostRecent.priority;\n }\n\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\n let baseClasses: { [className: string]: string[] };\n if (this._imodelBaseClassesByClass.has(imodelInfo)) {\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\n } else {\n this._imodelBaseClassesByClass.set(imodelInfo, (baseClasses = {}));\n }\n\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\n\n const query = `\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\n const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\n baseClasses[row.classFullName].push(row.baseClassFullName);\n }\n return baseClasses;\n };\n\n /** Changes field properties priorities to lower than another fields priority\n * @param imodel IModelConnection.\n * @param field Field that priority is being changed.\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\n * @param visibleFields Array of fields to move the field in.\n */\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\n /**\n * How it works:\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\n * 3. For each iterated orderInfo it checks if it is relevant:\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\n */\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n if (field === afterField) {\n throw Error(\"`field` can not be the same as `afterField`.\");\n }\n\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const findFieldOrderInfoData = (f: Field) => {\n if (!visibleFields.includes(f)) {\n throw Error(\"Field is not contained in visible fields.\");\n }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = findFieldOrderInfoData(afterField));\n }\n\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\n let startIndex: number;\n if (orderInfoIndex < afterOrderInfoIndex) {\n direction = Direction.Up;\n startIndex = afterOrderInfoIndex;\n } else {\n direction = Direction.Down;\n startIndex = afterOrderInfoIndex + 1;\n }\n\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\n if (oi.parentClassName) {\n classNames.add(oi.parentClassName);\n }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\n\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\n const currOrderInfo = allOrderInfos[i];\n\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\n if (currOrderInfo.parentClassName === undefined) {\n continue;\n }\n\n const visible = visibleOrderInfos.includes(currOrderInfo);\n if (visible) {\n relevantClasses.add(currOrderInfo.parentClassName);\n continue;\n }\n\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\n if (hasBaseClasses) {\n continue;\n }\n\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\n }\n\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\n irrelevantOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\n movingOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n movingOrderInfos.forEach((oi) => (oi.orderedTimestamp = new Date()));\n\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\n\n // reassign priority numbers\n let priority = allOrderInfos.length;\n allOrderInfos.forEach((oi) => (oi.priority = priority--));\n\n await this._storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\n this.onFavoritesChanged.raiseEvent();\n }\n}\n\nenum Direction {\n Up = -1,\n Down = 1,\n}\n\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\n\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\n const nestingPrefix = getNestingPrefix(field.parent);\n return field.properties.map(\n (property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`,\n );\n};\n\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\n const nestingPrefix = getNestingPrefix(field);\n return `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${field.contentClassInfo.name}`;\n};\n\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\n const path: string[] = [];\n let curr = field;\n while (curr !== undefined) {\n curr.pathToPrimaryClass.forEach((rel) => {\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\n path.push(rel.targetClassInfo.name);\n });\n curr = curr.parent;\n }\n if (path.length === 0) {\n return \"\";\n }\n\n path.reverse();\n return `${path.join(\"-\")}-`;\n};\n\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\n const propertyNameStart = propertyName.split(\"-\")[0];\n const parts = propertyNameStart.split(\":\").length;\n if (parts === 1) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(0, propertyName.lastIndexOf(\":\"));\n};\n\n/** @internal */\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\n } else if (field.isNestedContentField()) {\n fieldInfos.add(getNestedContentFieldPropertyName(field));\n } else {\n fieldInfos.add(`${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${field.name}`);\n }\n return fieldInfos;\n};\n\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\n for (const key of lookup) {\n if (set.has(key)) {\n return true;\n }\n }\n return false;\n};\n\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\n source.forEach((si) => {\n const index = dest.findIndex((di) => di.name === si.name);\n if (index === -1) {\n si.orderedTimestamp = new Date();\n dest.push(si);\n }\n });\n let priority = dest.length;\n dest.forEach((info) => (info.priority = priority--));\n};\n\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\n toRemove.forEach((roi) => {\n const index = container.findIndex((oi) => oi.name === roi.name);\n /* istanbul ignore else */\n if (index >= 0) {\n container.splice(index, 1);\n }\n });\n};\n\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n }\n if (field.isPropertiesField()) {\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }));\n }\n return [\n {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n};\n\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\n const tryAddOrderInfo = (name: string) => {\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\n if (fieldOrderInfo !== undefined) {\n fieldOrderInfos.push(fieldOrderInfo);\n }\n };\n\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\n } else if (field.isNestedContentField()) {\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\n } else {\n tryAddOrderInfo(field.name);\n }\n\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,yEAAM,CAAA;IACN,uEAAK,CAAA;IACL,yEAAM,CAAA;AACR,CAAC,EAJ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C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { BeEvent, isDisposable, isIDisposable } from \"@itwin/core-bentley\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { ClassId, Field, NestedContentField, PropertiesField } from \"@itwin/presentation-common\";\nimport { IFavoritePropertiesStorage } from \"./FavoritePropertiesStorage.js\";\n\n/**\n * Scopes that favorite properties can be stored in.\n * @public\n */\nexport enum FavoritePropertiesScope {\n Global,\n ITwin,\n IModel,\n}\n\n/**\n * Format:\n * Regular property - [{path from parent class}-]{schema name}:{class name}:{property name}.\n * Nested property - [{path from parent class}-]{content class schema name}:{content class name}.\n * Primitive property - {field name}.\n * @public\n */\nexport type PropertyFullName = string;\n\n/**\n * Holds the information of favorite properties ordering.\n * @public\n */\nexport interface FavoritePropertiesOrderInfo {\n parentClassName: string | undefined;\n name: PropertyFullName;\n priority: number;\n orderedTimestamp: Date;\n}\n\n/**\n * Properties for initializing [[FavoritePropertiesManager]]\n * @public\n */\nexport interface FavoritePropertiesManagerProps {\n /**\n * Implementation of a persistence layer for storing favorite properties and their order.\n * @public\n */\n storage: IFavoritePropertiesStorage;\n}\n\n/**\n * The favorite property manager which lets to store favorite properties\n * and check if field contains favorite properties.\n *\n * @public\n */\nexport class FavoritePropertiesManager implements Disposable {\n /**\n * Used in tests to avoid collisions between multiple runs using the same storage\n * @internal\n */\n public static FAVORITES_IDENTIFIER_PREFIX = \"\";\n\n /** Event raised after favorite properties have changed. */\n public onFavoritesChanged = new BeEvent<() => void>();\n\n public readonly storage: IFavoritePropertiesStorage;\n\n private _globalProperties: Set<PropertyFullName> | undefined;\n private _iTwinProperties: Map<string, Set<PropertyFullName>>;\n private _imodelProperties: Map<string, Set<PropertyFullName>>;\n private _imodelBaseClassesByClass: Map<string, { [className: string]: string[] }>;\n private _imodelInitializationPromises: Map<IModelConnection, Promise<void>>;\n\n /** Property order is saved only in iModel scope */\n private _propertiesOrder: Map<string, FavoritePropertiesOrderInfo[]>;\n\n public constructor(props: FavoritePropertiesManagerProps) {\n this.storage = props.storage;\n this._iTwinProperties = new Map<string, Set<PropertyFullName>>();\n this._imodelProperties = new Map<string, Set<PropertyFullName>>();\n this._propertiesOrder = new Map<string, FavoritePropertiesOrderInfo[]>();\n this._imodelBaseClassesByClass = new Map<string, { [className: string]: string[] }>();\n this._imodelInitializationPromises = new Map<IModelConnection, Promise<void>>();\n }\n\n public [Symbol.dispose]() {\n if (isDisposable(this.storage)) {\n this.storage[Symbol.dispose]();\n /* c8 ignore next 3 */\n } else if (isIDisposable(this.storage)) { /* eslint-disable-line @typescript-eslint/no-deprecated */\n this.storage.dispose();\n }\n }\n\n /** @deprecated in 5.0 Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n /**\n * Initialize favorite properties for the provided IModelConnection.\n * @deprecated in 4.5. Initialization is performed automatically by all async methods and only needed for deprecated [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]].\n */\n public initializeConnection = async (imodel: IModelConnection) => {\n const imodelId = imodel.iModelId!;\n const iTwinId = imodel.iTwinId!;\n\n if (this._globalProperties === undefined) {\n this._globalProperties = (await this.storage.loadProperties()) || new Set<PropertyFullName>();\n }\n\n if (!this._iTwinProperties.has(iTwinId)) {\n const iTwinProperties = (await this.storage.loadProperties(iTwinId)) || new Set<PropertyFullName>();\n this._iTwinProperties.set(iTwinId, iTwinProperties);\n }\n\n if (!this._imodelProperties.has(getiModelInfo(iTwinId, imodelId))) {\n const imodelProperties = (await this.storage.loadProperties(iTwinId, imodelId)) || new Set<PropertyFullName>();\n this._imodelProperties.set(getiModelInfo(iTwinId, imodelId), imodelProperties);\n }\n const propertiesOrder = (await this.storage.loadPropertiesOrder(iTwinId, imodelId)) || [];\n this._propertiesOrder.set(getiModelInfo(iTwinId, imodelId), propertiesOrder);\n await this._adjustPropertyOrderInfos(iTwinId, imodelId);\n };\n\n /**\n * Function that removes order information of properties that are no longer\n * favorited and adds missing order information for favorited properties.\n */\n private _adjustPropertyOrderInfos = async (iTwinId: string, imodelId: string) => {\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const globalProperties = this._globalProperties!;\n const iTwinProperties = this._iTwinProperties.get(iTwinId)!;\n const imodelProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n // favorite property infos that need to be added to the propertiesOrder array\n const infosToAdd = new Set<string>([...globalProperties, ...iTwinProperties, ...imodelProperties]);\n\n for (let i = propertiesOrder.length - 1; i >= 0; i--) {\n if (infosToAdd.has(propertiesOrder[i].name)) {\n infosToAdd.delete(propertiesOrder[i].name);\n } else {\n propertiesOrder.splice(i, 1);\n }\n }\n\n infosToAdd.forEach((info) =>\n propertiesOrder.push({\n name: info,\n parentClassName: getPropertyClassName(info),\n orderedTimestamp: new Date(),\n priority: 0,\n }),\n );\n\n let priority = propertiesOrder.length;\n propertiesOrder.forEach((oi) => (oi.priority = priority--));\n };\n\n private isInitialized(imodel: IModelConnection): boolean {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n return this._imodelProperties.has(getiModelInfo(iTwinId, imodelId));\n }\n\n /**\n * Checks if [[FavoritePropertiesManager.initializeConnection]] has been called for a given imodel.\n * Can be removed when [[FavoritePropertiesManager.has]] and [[FavoritePropertiesManager.sortFields]] are removed.\n */\n private validateInitialization(imodel: IModelConnection) {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n if (!this.isInitialized(imodel)) {\n throw Error(\n `Favorite properties are not initialized for iModel: '${imodelId}', in iTwin: '${iTwinId}'. Call initializeConnection() with an IModelConnection to initialize.`,\n );\n }\n }\n\n /**\n * Calls [[FavoritePropertiesManager.initializeConnection]] and caches the promise which should be awaited by calling [[FavoritePropertiesManager.ensureInitialized]].\n * @internal\n */\n public startConnectionInitialization(imodel: IModelConnection) {\n if (!this.isInitialized(imodel) && !this._imodelInitializationPromises.has(imodel)) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this._imodelInitializationPromises.set(imodel, this.initializeConnection(imodel));\n }\n }\n\n /**\n * Performs the initialization process or finishes the one that was started by [[FavoritePropertiesManager.startConnectionInitialization]].\n * @internal\n */\n public async ensureInitialized(imodel: IModelConnection) {\n if (this.isInitialized(imodel)) {\n return;\n }\n\n let promise = this._imodelInitializationPromises.get(imodel);\n if (!promise) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n promise = this.initializeConnection(imodel);\n\n // Put the promise in the map to avoid possible multiple initializations from different promises.\n this._imodelInitializationPromises.set(imodel, promise);\n }\n\n await promise;\n\n // Remove this promise from the map, because the next time this method is called, `this.isInitialized` should return true.\n this._imodelInitializationPromises.delete(imodel);\n }\n\n /**\n * Adds favorite properties into a certain scope.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to put the favorite properties into.\n */\n public async add(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: (properties: Set<PropertyFullName>) => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async (properties) => this.storage.saveProperties(properties);\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId);\n }\n\n const countBefore = favoriteProperties.size;\n const fieldInfos = getFieldInfos(field);\n fieldInfos.forEach((info) => favoriteProperties.add(info));\n if (favoriteProperties.size !== countBefore) {\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties(favoriteProperties));\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n addOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n }\n\n /**\n * Removes favorite properties from a scope specified and all the more general scopes.\n * @param field Field that contains properties. If field contains multiple properties, all of them will be un-favorited.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from. It also removes from more general scopes.\n */\n public async remove(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n const workingScopes: Array<{ properties: Set<PropertyFullName>; save: (properties: Set<PropertyFullName>) => Promise<void> }> = [];\n workingScopes.push({\n properties: this._globalProperties!,\n save: async (properties) => this.storage.saveProperties(properties),\n });\n if (scope === FavoritePropertiesScope.ITwin || scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._iTwinProperties.get(iTwinId)!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId),\n });\n }\n if (scope === FavoritePropertiesScope.IModel) {\n workingScopes.push({\n properties: this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!,\n save: async (properties) => this.storage.saveProperties(properties, iTwinId, imodelId),\n });\n }\n\n const saves: Array<Promise<void>> = [];\n let favoritesChanged = false;\n for (const { properties, save } of workingScopes) {\n const countBefore = properties.size;\n fieldInfos.forEach((info) => properties.delete(info));\n if (properties.size !== countBefore) {\n saves.push(save(properties));\n favoritesChanged = true;\n }\n }\n if (!favoritesChanged) {\n return;\n }\n\n const propertiesOrder = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n removeOrderInfos(propertiesOrder, createFieldOrderInfos(field));\n saves.push(this.storage.savePropertiesOrder(propertiesOrder, iTwinId, imodelId));\n\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Removes all favorite properties from a certain scope.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to remove the favorite properties from.\n */\n public async clear(imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<void> {\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n let favoriteProperties: Set<PropertyFullName>;\n let saveProperties: () => Promise<void>;\n switch (scope) {\n case FavoritePropertiesScope.Global:\n favoriteProperties = this._globalProperties!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>());\n break;\n case FavoritePropertiesScope.ITwin:\n favoriteProperties = this._iTwinProperties.get(iTwinId)!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId);\n break;\n default:\n favoriteProperties = this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!;\n saveProperties = async () => this.storage.saveProperties(new Set<PropertyFullName>(), iTwinId, imodelId);\n }\n\n if (favoriteProperties.size === 0) {\n return;\n }\n\n favoriteProperties.clear();\n const saves: Array<Promise<void>> = [];\n saves.push(saveProperties());\n saves.push(this._adjustPropertyOrderInfos(iTwinId, imodelId));\n await Promise.all(saves);\n this.onFavoritesChanged.raiseEvent();\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.hasAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public has(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): boolean {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldInfos = getFieldInfos(field);\n return (\n setHasAny(this._globalProperties!, fieldInfos) ||\n (scope !== FavoritePropertiesScope.Global && setHasAny(this._iTwinProperties.get(iTwinId)!, fieldInfos)) ||\n (scope === FavoritePropertiesScope.IModel && setHasAny(this._imodelProperties.get(getiModelInfo(iTwinId, imodelId))!, fieldInfos))\n );\n }\n\n /**\n * Check if field contains at least one favorite property.\n * @param field Field that contains properties.\n * @param imodel IModelConnection.\n * @param scope FavoritePropertiesScope to check for favorite properties. It also checks the more general scopes.\n */\n public async hasAsync(field: Field, imodel: IModelConnection, scope: FavoritePropertiesScope): Promise<boolean> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.has(field, imodel, scope);\n }\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n * @note `initializeConnection` must be called with the `imodel` before calling this function.\n * @deprecated in 4.5. Use [[FavoritePropertiesManager.sortFieldsAsync]] instead. This method is not async, therefore it requires early initialization by calling [[FavoritePropertiesManager.initializeConnection]].\n */\n public sortFields = (imodel: IModelConnection, fields: Field[]): Field[] => {\n this.validateInitialization(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const fieldPriority = new Map<Field, number>();\n fields.forEach((field) => fieldPriority.set(field, this.getFieldPriority(field, iTwinId, imodelId)));\n\n const sortFunction = (left: Field, right: Field): number => {\n const lp = fieldPriority.get(left)!;\n const rp = fieldPriority.get(right)!;\n return lp < rp\n ? 1\n : lp > rp\n ? -1\n : left.priority < right.priority\n ? 1 // if favorite fields have equal priorities, sort by field priority\n : left.priority > right.priority\n ? -1\n : left.name.localeCompare(right.name);\n };\n\n return fields.sort(sortFunction);\n };\n\n /**\n * Sorts an array of fields with respect to favorite property order.\n * Non-favorited fields get sorted by their default priority and always have lower priority than favorited fields.\n * @param imodel IModelConnection.\n * @param fields Array of Field's that needs to be sorted.\n */\n public async sortFieldsAsync(imodel: IModelConnection, fields: Field[]): Promise<Field[]> {\n await this.ensureInitialized(imodel);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return this.sortFields(imodel, fields);\n }\n\n private getFieldPriority(field: Field, iTwinId: string, imodelId: string): number {\n const orderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n const fieldOrderInfos = getFieldOrderInfos(field, orderInfos);\n if (fieldOrderInfos.length === 0) {\n return -1;\n }\n const mostRecent = getMostRecentOrderInfo(fieldOrderInfos);\n return mostRecent.priority;\n }\n\n private _getBaseClassesByClass = async (imodel: IModelConnection, neededClasses: Set<string>): Promise<{ [className: string]: string[] }> => {\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n const imodelInfo = getiModelInfo(iTwinId, imodelId);\n let baseClasses: { [className: string]: string[] };\n if (this._imodelBaseClassesByClass.has(imodelInfo)) {\n baseClasses = this._imodelBaseClassesByClass.get(imodelInfo)!;\n } else {\n this._imodelBaseClassesByClass.set(imodelInfo, (baseClasses = {}));\n }\n\n const missingClasses = new Set<string>();\n neededClasses.forEach((className) => {\n if (!baseClasses.hasOwnProperty(className)) {\n missingClasses.add(className);\n }\n });\n if (missingClasses.size === 0) {\n return baseClasses;\n }\n\n const query = `\n SELECT (derivedSchema.Name || ':' || derivedClass.Name) AS \"ClassFullName\", (baseSchema.Name || ':' || baseClass.Name) AS \"BaseClassFullName\"\n FROM ECDbMeta.ClassHasAllBaseClasses baseClassRels\n INNER JOIN ECDbMeta.ECClassDef derivedClass ON derivedClass.ECInstanceId = baseClassRels.SourceECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef derivedSchema ON derivedSchema.ECInstanceId = derivedClass.Schema.Id\n INNER JOIN ECDbMeta.ECClassDef baseClass ON baseClass.ECInstanceId = baseClassRels.TargetECInstanceId\n INNER JOIN ECDbMeta.ECSchemaDef baseSchema ON baseSchema.ECInstanceId = baseClass.Schema.Id\n WHERE (derivedSchema.Name || ':' || derivedClass.Name) IN (${[...missingClasses].map((className) => `'${className}'`).join(\",\")})`;\n const reader = imodel.createQueryReader(query, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames });\n while (await reader.step()) {\n const row = reader.current.toRow();\n if (!(row.classFullName in baseClasses)) {\n baseClasses[row.classFullName] = [];\n }\n baseClasses[row.classFullName].push(row.baseClassFullName);\n }\n return baseClasses;\n };\n\n /** Changes field properties priorities to lower than another fields priority\n * @param imodel IModelConnection.\n * @param field Field that priority is being changed.\n * @param afterField Field that goes before the moved field. If undefined the moving field is changed to the highest priority (to the top).\n * @param visibleFields Array of fields to move the field in.\n */\n public async changeFieldPriority(imodel: IModelConnection, field: Field, afterField: Field | undefined, visibleFields: Field[]) {\n /**\n * How it works:\n * 1. Gets the orderInfo's for `field` (`orderInfo`) and `afterField` (`afterOrderInfo`) by selecting the most recent order informations for each field\n * 2. Iterates all orderInfo's that are in between `afterOrderInfo` and `orderInfo` when sorted by priority\n * 3. For each iterated orderInfo it checks if it is relevant:\n * 3.1. If orderInfo belongs to a primitive property, orderInfo is relevant\n * 3.2. If orderInfo's field is visible, orderInfo is relevant\n * 3.3. If orderInfo's class has a base class or itself in previously labeled relevant orderInfo's, orderInfo is relevant\n * 3.4. If 3.1 - 3.3 don't pass, orderInfo is irrelevant\n * 4. Irrelevant orderInfos's get moved after `orderInfo` (depends on the direction)\n * 5. All `field` orderInfo's get moved after `afterOrderInfo`\n */\n await this.ensureInitialized(imodel);\n const iTwinId = imodel.iTwinId!;\n const imodelId = imodel.iModelId!;\n\n if (field === afterField) {\n throw Error(\"`field` can not be the same as `afterField`.\");\n }\n\n const allOrderInfos = this._propertiesOrder.get(getiModelInfo(iTwinId, imodelId))!;\n\n const findFieldOrderInfoData = (f: Field) => {\n if (!visibleFields.includes(f)) {\n throw Error(\"Field is not contained in visible fields.\");\n }\n const infos = getFieldOrderInfos(f, allOrderInfos);\n\n if (infos.length === 0) {\n throw Error(\"Field has no property order information.\");\n }\n const info = getMostRecentOrderInfo(infos);\n const index = allOrderInfos.indexOf(info);\n return { infos, mostRecent: { info, index } };\n };\n\n const {\n infos: movingOrderInfos,\n mostRecent: { index: orderInfoIndex },\n } = findFieldOrderInfoData(field);\n\n let afterOrderInfo: FavoritePropertiesOrderInfo | undefined;\n let afterOrderInfoIndex;\n if (afterField === undefined) {\n afterOrderInfo = undefined;\n afterOrderInfoIndex = -1;\n } else {\n ({\n mostRecent: { info: afterOrderInfo, index: afterOrderInfoIndex },\n } = findFieldOrderInfoData(afterField));\n }\n\n let direction: Direction; // where to go from `afterOrderInfo` to `orderInfo`\n let startIndex: number;\n if (orderInfoIndex < afterOrderInfoIndex) {\n direction = Direction.Up;\n startIndex = afterOrderInfoIndex;\n } else {\n direction = Direction.Down;\n startIndex = afterOrderInfoIndex + 1;\n }\n\n const neededClassNames: Set<string> = allOrderInfos.reduce((classNames: Set<string>, oi) => {\n if (oi.parentClassName) {\n classNames.add(oi.parentClassName);\n }\n return classNames;\n }, new Set<string>());\n const baseClassesByClass = await this._getBaseClassesByClass(imodel, neededClassNames);\n\n const visibleOrderInfos = visibleFields.reduce(\n (union: FavoritePropertiesOrderInfo[], currField) => union.concat(getFieldOrderInfos(currField, allOrderInfos)),\n [],\n );\n const irrelevantOrderInfos: FavoritePropertiesOrderInfo[] = []; // orderInfos's that won't change their logical order in respect to other properties\n const relevantClasses: Set<ClassId> = new Set<ClassId>(); // currently relevant classes\n\n for (let i = startIndex; i !== orderInfoIndex; i += direction) {\n const currOrderInfo = allOrderInfos[i];\n\n // primitive properties are always relevant, because we can't determine their relevance based on the class hierarchy\n if (currOrderInfo.parentClassName === undefined) {\n continue;\n }\n\n const visible = visibleOrderInfos.includes(currOrderInfo);\n if (visible) {\n relevantClasses.add(currOrderInfo.parentClassName);\n continue;\n }\n\n const hasBaseClasses = baseClassesByClass[currOrderInfo.parentClassName].some((classId) => relevantClasses.has(classId));\n if (hasBaseClasses) {\n continue;\n }\n\n if (direction === Direction.Down) {\n irrelevantOrderInfos.push(currOrderInfo);\n } else {\n irrelevantOrderInfos.unshift(currOrderInfo);\n }\n }\n\n // remove irrelevantOrderInfo's to add them after the `orderInfo`\n irrelevantOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n\n // remove movingOrderInfos's to add them after the `afterOrderInfo`\n movingOrderInfos.forEach((foi) => {\n const index = allOrderInfos.findIndex((oi) => oi.parentClassName === foi.parentClassName && oi.name === foi.name);\n allOrderInfos.splice(index, 1);\n });\n movingOrderInfos.forEach((oi) => (oi.orderedTimestamp = new Date()));\n\n afterOrderInfoIndex = afterOrderInfo === undefined ? -1 : allOrderInfos.indexOf(afterOrderInfo);\n allOrderInfos.splice(afterOrderInfoIndex + 1, 0, ...movingOrderInfos);\n allOrderInfos.splice(afterOrderInfoIndex + 1 + (direction === Direction.Up ? movingOrderInfos.length : 0), 0, ...irrelevantOrderInfos);\n\n // reassign priority numbers\n let priority = allOrderInfos.length;\n allOrderInfos.forEach((oi) => (oi.priority = priority--));\n\n await this.storage.savePropertiesOrder(allOrderInfos, iTwinId, imodelId);\n this.onFavoritesChanged.raiseEvent();\n }\n}\n\nenum Direction {\n Up = -1,\n Down = 1,\n}\n\nconst getiModelInfo = (iTwinId: string, imodelId: string) => `${iTwinId}/${imodelId}`;\n\nconst getPropertiesFieldPropertyNames = (field: PropertiesField) => {\n const nestingPrefix = getNestingPrefix(field.parent);\n return field.properties.map(\n (property) => `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${property.property.classInfo.name}:${property.property.name}`,\n );\n};\n\nconst getNestedContentFieldPropertyName = (field: NestedContentField) => {\n const nestingPrefix = getNestingPrefix(field);\n return `${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${nestingPrefix}${field.contentClassInfo.name}`;\n};\n\nconst getNestingPrefix = (field: NestedContentField | undefined) => {\n const path: string[] = [];\n let curr = field;\n while (curr !== undefined) {\n curr.pathToPrimaryClass.forEach((rel) => {\n // Relationship directions are reversed, because we are generating a relationship list starting from the parent\n path.push(`${rel.isForwardRelationship ? \"B\" : \"F\"}:${rel.relationshipInfo.name}`);\n path.push(rel.targetClassInfo.name);\n });\n curr = curr.parent;\n }\n if (path.length === 0) {\n return \"\";\n }\n\n path.reverse();\n return `${path.join(\"-\")}-`;\n};\n\nconst getPropertyClassName = (propertyName: PropertyFullName): string | undefined => {\n const propertyNameStart = propertyName.split(\"-\")[0];\n const parts = propertyNameStart.split(\":\").length;\n if (parts === 1) {\n // primitive\n return undefined;\n }\n if (parts === 2) {\n // nested property OR nested property parent class OR regular property parent class\n return propertyNameStart;\n }\n // regular property without parent class\n return propertyNameStart.substring(0, propertyName.lastIndexOf(\":\"));\n};\n\n/** @internal */\nexport const getFieldInfos = (field: Field): Set<PropertyFullName> => {\n const fieldInfos: Set<PropertyFullName> = new Set<PropertyFullName>();\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach((info) => fieldInfos.add(info));\n } else if (field.isNestedContentField()) {\n fieldInfos.add(getNestedContentFieldPropertyName(field));\n } else {\n fieldInfos.add(`${FavoritePropertiesManager.FAVORITES_IDENTIFIER_PREFIX}${field.name}`);\n }\n return fieldInfos;\n};\n\nconst setHasAny = (set: Set<string>, lookup: Set<string>) => {\n for (const key of lookup) {\n if (set.has(key)) {\n return true;\n }\n }\n return false;\n};\n\nconst addOrderInfos = (dest: FavoritePropertiesOrderInfo[], source: FavoritePropertiesOrderInfo[]) => {\n source.forEach((si) => {\n const index = dest.findIndex((di) => di.name === si.name);\n if (index === -1) {\n si.orderedTimestamp = new Date();\n dest.push(si);\n }\n });\n let priority = dest.length;\n dest.forEach((info) => (info.priority = priority--));\n};\n\nconst removeOrderInfos = (container: FavoritePropertiesOrderInfo[], toRemove: FavoritePropertiesOrderInfo[]) => {\n toRemove.forEach((roi) => {\n const index = container.findIndex((oi) => oi.name === roi.name);\n if (index >= 0) {\n container.splice(index, 1);\n }\n });\n};\n\n/** @internal */\nexport const createFieldOrderInfos = (field: Field): FavoritePropertiesOrderInfo[] => {\n if (field.isNestedContentField()) {\n const propertyName = getNestedContentFieldPropertyName(field);\n return [\n {\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n }\n if (field.isPropertiesField()) {\n return getPropertiesFieldPropertyNames(field).map((propertyName) => ({\n parentClassName: getPropertyClassName(propertyName),\n name: propertyName,\n priority: 0,\n orderedTimestamp: new Date(),\n }));\n }\n return [\n {\n parentClassName: undefined,\n name: field.name,\n priority: 0,\n orderedTimestamp: new Date(),\n },\n ];\n};\n\nconst getFieldOrderInfos = (field: Field, orderInfos: FavoritePropertiesOrderInfo[]): FavoritePropertiesOrderInfo[] => {\n const fieldOrderInfos: FavoritePropertiesOrderInfo[] = [];\n const tryAddOrderInfo = (name: string) => {\n const fieldOrderInfo = orderInfos.find((oi) => oi.name === name);\n if (fieldOrderInfo !== undefined) {\n fieldOrderInfos.push(fieldOrderInfo);\n }\n };\n\n if (field.isPropertiesField()) {\n getPropertiesFieldPropertyNames(field).forEach(tryAddOrderInfo);\n } else if (field.isNestedContentField()) {\n tryAddOrderInfo(getNestedContentFieldPropertyName(field));\n } else {\n tryAddOrderInfo(field.name);\n }\n\n return fieldOrderInfos;\n};\n\nconst getMostRecentOrderInfo = (orderInfos: FavoritePropertiesOrderInfo[]) =>\n orderInfos.reduce((recent, curr) => (recent && recent.orderedTimestamp >= curr.orderedTimestamp ? recent : curr));\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Core
|
|
3
3
|
*/
|
|
4
|
-
import { IConnectivityInformationProvider } from "../ConnectivityInformationProvider";
|
|
5
|
-
import { FavoritePropertiesOrderInfo, PropertyFullName } from "./FavoritePropertiesManager";
|
|
4
|
+
import { IConnectivityInformationProvider } from "../ConnectivityInformationProvider.js";
|
|
5
|
+
import { FavoritePropertiesOrderInfo, PropertyFullName } from "./FavoritePropertiesManager.js";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare const IMODELJS_PRESENTATION_SETTING_NAMESPACE = "imodeljs.presentation";
|
|
8
8
|
/** @internal */
|
package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesStorage.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAmC,gCAAgC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesStorage.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/favorite-properties/FavoritePropertiesStorage.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAmC,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC1H,OAAO,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAE/F,gBAAgB;AAChB,eAAO,MAAM,uCAAuC,0BAA0B,CAAC;AAC/E,gBAAgB;AAChB,eAAO,MAAM,uCAAuC,eAAe,CAAC;AACpE,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,uBAAuB,CAAC;AACrE,gBAAgB;AAChB,eAAO,MAAM,2CAA2C,gCAAgC,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC,CAAC;IAChG;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p } from "@itwin/core-frontend";
|
|
11
11
|
import { PresentationError, PresentationStatus } from "@itwin/presentation-common";
|
|
12
|
-
import { ConnectivityInformationProvider } from "../ConnectivityInformationProvider";
|
|
12
|
+
import { ConnectivityInformationProvider } from "../ConnectivityInformationProvider.js";
|
|
13
13
|
/** @internal */
|
|
14
14
|
export const IMODELJS_PRESENTATION_SETTING_NAMESPACE = "imodeljs.presentation";
|
|
15
15
|
/** @internal */
|
|
@@ -138,7 +138,7 @@ export class OfflineCachingFavoritePropertiesStorage {
|
|
|
138
138
|
_propertiesOrderOfflineCache = new DictionaryWithReservations(iTwinAndIModelIdsKeyComparer);
|
|
139
139
|
constructor(props) {
|
|
140
140
|
this._impl = props.impl;
|
|
141
|
-
|
|
141
|
+
/* c8 ignore next */
|
|
142
142
|
this._connectivityInfo = props.connectivityInfo ?? new ConnectivityInformationProvider();
|
|
143
143
|
this._connectivityInfo.onInternetConnectivityChanged.addListener(this.onConnectivityStatusChanged);
|
|
144
144
|
}
|
|
@@ -149,7 +149,6 @@ export class OfflineCachingFavoritePropertiesStorage {
|
|
|
149
149
|
return this._impl;
|
|
150
150
|
}
|
|
151
151
|
onConnectivityStatusChanged = (args) => {
|
|
152
|
-
// istanbul ignore else
|
|
153
152
|
if (args.status === InternetConnectivityStatus.Online) {
|
|
154
153
|
// note: we're copying the cached values to temp arrays because `saveProperties` and `savePropertiesOrder` both
|
|
155
154
|
// attempt to modify cache dictionaries
|
|
@@ -224,7 +223,6 @@ class DictionaryWithReservations {
|
|
|
224
223
|
}
|
|
225
224
|
forEach(func) {
|
|
226
225
|
this._impl.forEach((key, entry) => {
|
|
227
|
-
// istanbul ignore else
|
|
228
226
|
if (entry.value) {
|
|
229
227
|
func(key, entry.value);
|
|
230
228
|
}
|
|
@@ -251,31 +249,29 @@ class DictionaryWithReservations {
|
|
|
251
249
|
}
|
|
252
250
|
}
|
|
253
251
|
}
|
|
254
|
-
|
|
252
|
+
/* c8 ignore next 4 */
|
|
255
253
|
function iTwinAndIModelIdsKeyComparer(lhs, rhs) {
|
|
256
254
|
const iTwinIdCompare = compareStrings(lhs[0] ?? "", rhs[0] ?? "");
|
|
257
255
|
return iTwinIdCompare !== 0 ? iTwinIdCompare : compareStrings(lhs[1] ?? "", rhs[1] ?? "");
|
|
258
256
|
}
|
|
259
257
|
/** @internal */
|
|
258
|
+
/* c8 ignore start */
|
|
260
259
|
export class NoopFavoritePropertiesStorage {
|
|
261
|
-
// istanbul ignore next
|
|
262
260
|
async loadProperties(_iTwinId, _imodelId) {
|
|
263
261
|
return undefined;
|
|
264
262
|
}
|
|
265
|
-
// istanbul ignore next
|
|
266
263
|
async saveProperties(_properties, _iTwinId, _imodelId) { }
|
|
267
|
-
// istanbul ignore next
|
|
268
264
|
async loadPropertiesOrder(_iTwinId, _imodelId) {
|
|
269
265
|
return undefined;
|
|
270
266
|
}
|
|
271
|
-
// istanbul ignore next
|
|
272
267
|
async savePropertiesOrder(_orderInfos, _iTwinId, _imodelId) { }
|
|
273
268
|
}
|
|
269
|
+
/* c8 ignore end */
|
|
274
270
|
/** @internal */
|
|
275
271
|
export class BrowserLocalFavoritePropertiesStorage {
|
|
276
272
|
_localStorage;
|
|
277
273
|
constructor(props) {
|
|
278
|
-
|
|
274
|
+
/* c8 ignore next */
|
|
279
275
|
this._localStorage = props?.localStorage ?? window.localStorage;
|
|
280
276
|
}
|
|
281
277
|
createFavoritesSettingItemKey(iTwinId, imodelId) {
|