@itwin/presentation-frontend 5.0.0-dev.61 → 5.0.0-dev.62

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.
@@ -50,11 +50,4 @@ export declare class SelectionScopesManager {
50
50
  * @public
51
51
  */
52
52
  export declare function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps;
53
- /**
54
- * Determines the scope id
55
- * @param scope Selection scope
56
- * @public
57
- * @deprecated in 3.x. This is an internal utility that should've never become public.
58
- */
59
- export declare function getScopeId(scope: SelectionScope | string | undefined): string;
60
53
  //# sourceMappingURL=SelectionScopesManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtI;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H;AAED;;;;;GAKG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE7E"}
1
+ {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtI;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H"}
@@ -9,7 +9,6 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.SelectionScopesManager = void 0;
11
11
  exports.createSelectionScopeProps = createSelectionScopeProps;
12
- exports.getScopeId = getScopeId;
13
12
  const presentation_common_1 = require("@itwin/presentation-common");
14
13
  /**
15
14
  * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)
@@ -93,14 +92,4 @@ function createSelectionScopeProps(scope) {
93
92
  }
94
93
  return scope;
95
94
  }
96
- /**
97
- * Determines the scope id
98
- * @param scope Selection scope
99
- * @public
100
- * @deprecated in 3.x. This is an internal utility that should've never become public.
101
- */
102
- // istanbul ignore next
103
- function getScopeId(scope) {
104
- return createSelectionScopeProps(scope).id;
105
- }
106
95
  //# sourceMappingURL=SelectionScopesManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"m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AAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjED,wDAiEC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,uBAAuB;AACvB,SAAgB,UAAU,CAAC,KAA0C;IACnE,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC7C,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 { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n\n/**\n * Determines the scope id\n * @param scope Selection scope\n * @public\n * @deprecated in 3.x. This is an internal utility that should've never become public.\n */\n// istanbul ignore next\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\n return createSelectionScopeProps(scope).id;\n}\n"]}
1
+ {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAiGH,8DAQC;AArGD,oEAAsI;AActI;;;;;GAKG;AACH,MAAa,sBAAsB;IACzB,mBAAmB,CAAqB;IACxC,UAAU,CAA2B;IACrC,YAAY,CAA4D;IAEhF,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IAClF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,2CAA2C;IAC3C,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW,CAAC,KAAgE;QACrF,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,MAAwB,EAAE,MAAe;QACvE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QAC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AC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC9I,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,4BAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjED,wDAiEC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n"]}
@@ -50,11 +50,4 @@ export declare class SelectionScopesManager {
50
50
  * @public
51
51
  */
52
52
  export declare function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps;
53
- /**
54
- * Determines the scope id
55
- * @param scope Selection scope
56
- * @public
57
- * @deprecated in 3.x. This is an internal utility that should've never become public.
58
- */
59
- export declare function getScopeId(scope: SelectionScope | string | undefined): string;
60
53
  //# sourceMappingURL=SelectionScopesManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtI;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H;AAED;;;;;GAKG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE7E"}
1
+ {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtI;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H"}
@@ -87,14 +87,4 @@ export function createSelectionScopeProps(scope) {
87
87
  }
88
88
  return scope;
89
89
  }
90
- /**
91
- * Determines the scope id
92
- * @param scope Selection scope
93
- * @public
94
- * @deprecated in 3.x. This is an internal utility that should've never become public.
95
- */
96
- // istanbul ignore next
97
- export function getScopeId(scope) {
98
- return createSelectionScopeProps(scope).id;
99
- }
100
90
  //# sourceMappingURL=SelectionScopesManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAA2D,MAAM,4BAA4B,CAAC;AActI;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACzB,mBAAmB,CAAqB;IACxC,UAAU,CAA2B;IACrC,YAAY,CAA4D;IAEhF,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IAClF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,2CAA2C;IAC3C,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW,CAAC,KAAgE;QACrF,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,MAAwB,EAAE,MAAe;QACvE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,gBAAgB,CAAC,MAAwB,EAAE,GAAY,EAAE,KAAoD;QACxH,MAAM,UAAU,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAEpD,6BAA6B;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C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,uBAAuB;AACvB,MAAM,UAAU,UAAU,CAAC,KAA0C;IACnE,OAAO,yBAAyB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AAC7C,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 { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n\n/**\n * Determines the scope id\n * @param scope Selection scope\n * @public\n * @deprecated in 3.x. This is an internal utility that should've never become public.\n */\n// istanbul ignore next\nexport function getScopeId(scope: SelectionScope | string | undefined): string {\n return createSelectionScopeProps(scope).id;\n}\n"]}
1
+ {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAA2D,MAAM,4BAA4B,CAAC;AActI;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACzB,mBAAmB,CAAqB;IACxC,UAAU,CAA2B;IACrC,YAAY,CAA4D;IAEhF,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IAClF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,2CAA2C;IAC3C,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW,CAAC,KAAgE;QACrF,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IA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AC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACpG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC9I,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/presentation-frontend",
3
- "version": "5.0.0-dev.61",
3
+ "version": "5.0.0-dev.62",
4
4
  "description": "Frontend of iModel.js Presentation library",
5
5
  "main": "lib/cjs/presentation-frontend.js",
6
6
  "module": "lib/esm/presentation-frontend.js",
@@ -28,12 +28,12 @@
28
28
  "rxjs-for-await": "^1.0.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@itwin/core-bentley": "5.0.0-dev.61",
32
- "@itwin/core-frontend": "5.0.0-dev.61",
33
- "@itwin/core-common": "5.0.0-dev.61",
34
- "@itwin/ecschema-metadata": "5.0.0-dev.61",
35
- "@itwin/core-quantity": "5.0.0-dev.61",
36
- "@itwin/presentation-common": "5.0.0-dev.61"
31
+ "@itwin/core-bentley": "5.0.0-dev.62",
32
+ "@itwin/core-quantity": "5.0.0-dev.62",
33
+ "@itwin/core-common": "5.0.0-dev.62",
34
+ "@itwin/core-frontend": "5.0.0-dev.62",
35
+ "@itwin/presentation-common": "5.0.0-dev.62",
36
+ "@itwin/ecschema-metadata": "5.0.0-dev.62"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@itwin/eslint-plugin": "5.0.0-dev.1",
@@ -66,14 +66,14 @@
66
66
  "source-map-support": "^0.5.6",
67
67
  "typemoq": "^2.1.0",
68
68
  "typescript": "~5.6.2",
69
- "@itwin/build-tools": "5.0.0-dev.61",
70
- "@itwin/core-bentley": "5.0.0-dev.61",
71
- "@itwin/core-common": "5.0.0-dev.61",
72
- "@itwin/core-i18n": "5.0.0-dev.61",
73
- "@itwin/core-frontend": "5.0.0-dev.61",
74
- "@itwin/core-quantity": "5.0.0-dev.61",
75
- "@itwin/ecschema-metadata": "5.0.0-dev.61",
76
- "@itwin/presentation-common": "5.0.0-dev.61"
69
+ "@itwin/core-common": "5.0.0-dev.62",
70
+ "@itwin/build-tools": "5.0.0-dev.62",
71
+ "@itwin/core-quantity": "5.0.0-dev.62",
72
+ "@itwin/core-frontend": "5.0.0-dev.62",
73
+ "@itwin/core-bentley": "5.0.0-dev.62",
74
+ "@itwin/core-i18n": "5.0.0-dev.62",
75
+ "@itwin/ecschema-metadata": "5.0.0-dev.62",
76
+ "@itwin/presentation-common": "5.0.0-dev.62"
77
77
  },
78
78
  "nyc": {
79
79
  "extends": "./node_modules/@itwin/build-tools/.nycrc"