@itwin/unified-selection 1.8.3 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/lib/{cjs/unified-selection → unified-selection}/CachingHiliteSetProvider.d.ts +3 -3
- package/lib/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -0
- package/lib/unified-selection/CachingHiliteSetProvider.js.map +1 -0
- package/lib/unified-selection/DisposePolyfill.d.ts.map +1 -0
- package/lib/unified-selection/DisposePolyfill.js.map +1 -0
- package/lib/{cjs/unified-selection → unified-selection}/EnableUnifiedSelectionSyncWithIModel.d.ts +7 -7
- package/lib/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/EnableUnifiedSelectionSyncWithIModel.js +1 -1
- package/lib/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -0
- package/lib/{cjs/unified-selection → unified-selection}/HiliteSetProvider.d.ts +3 -3
- package/lib/unified-selection/HiliteSetProvider.d.ts.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/HiliteSetProvider.js +2 -2
- package/lib/unified-selection/HiliteSetProvider.js.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/IModelHiliteSetProvider.d.ts +4 -3
- package/lib/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -0
- package/lib/unified-selection/IModelHiliteSetProvider.js.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/Selectable.d.ts +1 -1
- package/lib/unified-selection/Selectable.d.ts.map +1 -0
- package/lib/unified-selection/Selectable.js.map +1 -0
- package/lib/{cjs/unified-selection → unified-selection}/SelectionChangeEvent.d.ts +2 -2
- package/lib/unified-selection/SelectionChangeEvent.d.ts.map +1 -0
- package/lib/unified-selection/SelectionChangeEvent.js.map +1 -0
- package/lib/{cjs/unified-selection → unified-selection}/SelectionScope.d.ts +3 -3
- package/lib/unified-selection/SelectionScope.d.ts.map +1 -0
- package/lib/unified-selection/SelectionScope.js.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/SelectionStorage.d.ts +4 -3
- package/lib/unified-selection/SelectionStorage.d.ts.map +1 -0
- package/lib/unified-selection/SelectionStorage.js.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/Utils.d.ts +3 -3
- package/lib/unified-selection/Utils.d.ts.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/Utils.js +1 -1
- package/lib/unified-selection/Utils.js.map +1 -0
- package/lib/{esm/unified-selection → unified-selection}/types/IModel.d.ts +2 -2
- package/lib/unified-selection/types/IModel.d.ts.map +1 -0
- package/lib/unified-selection/types/IModel.js.map +1 -0
- package/lib/unified-selection.d.ts +16 -0
- package/lib/unified-selection.d.ts.map +1 -0
- package/lib/{esm/unified-selection.js → unified-selection.js} +2 -3
- package/lib/unified-selection.js.map +1 -0
- package/package.json +13 -15
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +0 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js +0 -27
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +0 -1
- package/lib/cjs/unified-selection/DisposePolyfill.d.ts +0 -1
- package/lib/cjs/unified-selection/DisposePolyfill.d.ts.map +0 -1
- package/lib/cjs/unified-selection/DisposePolyfill.js +0 -11
- package/lib/cjs/unified-selection/DisposePolyfill.js.map +0 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +0 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +0 -392
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +0 -1
- package/lib/cjs/unified-selection/HiliteSetProvider.d.ts.map +0 -1
- package/lib/cjs/unified-selection/HiliteSetProvider.js +0 -382
- package/lib/cjs/unified-selection/HiliteSetProvider.js.map +0 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts +0 -51
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts.map +0 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.js +0 -66
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.js.map +0 -1
- package/lib/cjs/unified-selection/Selectable.d.ts +0 -150
- package/lib/cjs/unified-selection/Selectable.d.ts.map +0 -1
- package/lib/cjs/unified-selection/Selectable.js +0 -238
- package/lib/cjs/unified-selection/Selectable.js.map +0 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts.map +0 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.js +0 -7
- package/lib/cjs/unified-selection/SelectionChangeEvent.js.map +0 -1
- package/lib/cjs/unified-selection/SelectionScope.d.ts.map +0 -1
- package/lib/cjs/unified-selection/SelectionScope.js +0 -252
- package/lib/cjs/unified-selection/SelectionScope.js.map +0 -1
- package/lib/cjs/unified-selection/SelectionStorage.d.ts +0 -105
- package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +0 -1
- package/lib/cjs/unified-selection/SelectionStorage.js +0 -153
- package/lib/cjs/unified-selection/SelectionStorage.js.map +0 -1
- package/lib/cjs/unified-selection/Utils.d.ts +0 -39
- package/lib/cjs/unified-selection/Utils.d.ts.map +0 -1
- package/lib/cjs/unified-selection/Utils.js +0 -82
- package/lib/cjs/unified-selection/Utils.js.map +0 -1
- package/lib/cjs/unified-selection/types/IModel.d.ts +0 -133
- package/lib/cjs/unified-selection/types/IModel.d.ts.map +0 -1
- package/lib/cjs/unified-selection/types/IModel.js +0 -24
- package/lib/cjs/unified-selection/types/IModel.js.map +0 -1
- package/lib/cjs/unified-selection.d.ts +0 -10
- package/lib/cjs/unified-selection.d.ts.map +0 -1
- package/lib/cjs/unified-selection.js +0 -27
- package/lib/cjs/unified-selection.js.map +0 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts +0 -56
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +0 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +0 -1
- package/lib/esm/unified-selection/DisposePolyfill.d.ts.map +0 -1
- package/lib/esm/unified-selection/DisposePolyfill.js.map +0 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +0 -119
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +0 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +0 -1
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts +0 -48
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts.map +0 -1
- package/lib/esm/unified-selection/HiliteSetProvider.js.map +0 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts.map +0 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.js.map +0 -1
- package/lib/esm/unified-selection/Selectable.d.ts.map +0 -1
- package/lib/esm/unified-selection/Selectable.js.map +0 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.d.ts +0 -60
- package/lib/esm/unified-selection/SelectionChangeEvent.d.ts.map +0 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.js.map +0 -1
- package/lib/esm/unified-selection/SelectionScope.d.ts +0 -54
- package/lib/esm/unified-selection/SelectionScope.d.ts.map +0 -1
- package/lib/esm/unified-selection/SelectionScope.js.map +0 -1
- package/lib/esm/unified-selection/SelectionStorage.d.ts.map +0 -1
- package/lib/esm/unified-selection/SelectionStorage.js.map +0 -1
- package/lib/esm/unified-selection/Utils.d.ts.map +0 -1
- package/lib/esm/unified-selection/Utils.js.map +0 -1
- package/lib/esm/unified-selection/types/IModel.d.ts.map +0 -1
- package/lib/esm/unified-selection/types/IModel.js.map +0 -1
- package/lib/esm/unified-selection.d.ts +0 -10
- package/lib/esm/unified-selection.d.ts.map +0 -1
- package/lib/esm/unified-selection.js.map +0 -1
- /package/lib/{esm/unified-selection → unified-selection}/CachingHiliteSetProvider.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/DisposePolyfill.d.ts +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/DisposePolyfill.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/IModelHiliteSetProvider.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/Selectable.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/SelectionChangeEvent.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/SelectionScope.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/SelectionStorage.js +0 -0
- /package/lib/{esm/unified-selection → unified-selection}/types/IModel.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/unified-selection/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,0CAA0C,EAAE,MAAM,4BAA4B,CAAC;AAYxF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,GAAwB,EAAE,QAAwB;IACjG,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7E,OAAO,mBAAmB,QAAQ,GAAG,CAAC;IACxC,CAAC;IAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,cAAc,IAAI,GAAG,CAAC;QACxB,CAAC;QACD,cAAc,IAAI,GAAG,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,QAAQ,QAAQ,cAAc,GAAG,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,mBAAmB,CAAI,EAC5C,aAAa,EACb,aAAa,EACb,KAAK,EACL,MAAM,GAMP;IACC,MAAM,iBAAiB,GAAG,0CAA0C,EAAE,CAAC;IACvE,MAAM,MAAM,GAAG,aAAa,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC/B,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;QACzB,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAI,YAAoB;IACnE,OAAO,CAAC,GAAkB,EAAiB,EAAE;QAC3C,OAAO,GAAG,CAAC,IAAI,CACb,WAAW,CAAC,YAAY,CAAC,EACzB,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACpB,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,CAAC;gBAC1C,OAAO,GAAG,CAAC;YACb,CAAC;YACD,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC,CAAC,EACF,SAAS,EAAE,CACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./DisposePolyfill.js\";\n\nimport { bufferCount, concatAll, concatMap, delay, of } from \"rxjs\";\nimport { Id64 } from \"@itwin/core-bentley\";\nimport { createMainThreadReleaseOnTimePassedHandler } from \"@itwin/presentation-shared\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Array, Id64Set } from \"@itwin/core-bentley\";\nimport type {\n ECSqlBinding,\n ECSqlQueryDef,\n ECSqlQueryExecutor,\n ECSqlQueryReaderOptions,\n ECSqlQueryRow,\n} from \"@itwin/presentation-shared\";\n\n/**\n * Forms ECSql bindings from given ID's.\n * @internal\n */\nexport function formIdBindings(property: string, ids: Id64Array | Id64Set, bindings: ECSqlBinding[]): string {\n const count = Id64.sizeOf(ids);\n if (count > 1000) {\n bindings.push({ type: \"idset\", value: ids instanceof Set ? [...ids] : ids });\n return `InVirtualSet(?, ${property})`;\n }\n\n if (count === 0) {\n return `FALSE`;\n }\n\n let bindingsClause = \"\";\n ids.forEach((id) => {\n bindings.push({ type: \"id\", value: id });\n if (bindingsClause.length > 0) {\n bindingsClause += \",\";\n }\n bindingsClause += \"?\";\n });\n return `${property} IN (${bindingsClause})`;\n}\n\n/**\n * Executes given ECSql query and extracts data from rows. Additionally handles main thread releasing.\n * @internal\n */\nexport async function* genericExecuteQuery<T>({\n queryExecutor,\n parseQueryRow,\n query,\n config,\n}: {\n queryExecutor: ECSqlQueryExecutor;\n query: ECSqlQueryDef;\n parseQueryRow: (row: ECSqlQueryRow) => T;\n config?: ECSqlQueryReaderOptions;\n}): AsyncIterableIterator<T> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const reader = queryExecutor.createQueryReader(query, config);\n for await (const row of reader) {\n yield parseQueryRow(row);\n await releaseMainThread();\n }\n}\n\n/**\n * Emits a certain amount of values, then releases the main thread for other timers to use.\n * @internal\n */\nexport function releaseMainThreadOnItemsCount<T>(elementCount: number) {\n return (obs: Observable<T>): Observable<T> => {\n return obs.pipe(\n bufferCount(elementCount),\n concatMap((buff, i) => {\n const out = of(buff);\n if (i === 0 && buff.length < elementCount) {\n return out;\n }\n return out.pipe(delay(0));\n }),\n concatAll(),\n );\n };\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Id64Arg, Id64Set } from "@itwin/core-bentley";
|
|
2
|
-
import { Event } from "@itwin/presentation-shared";
|
|
1
|
+
import type { Id64Arg, Id64Set } from "@itwin/core-bentley";
|
|
2
|
+
import type { Event } from "@itwin/presentation-shared";
|
|
3
3
|
/**
|
|
4
4
|
* A collection of geometric element, model and subcategory ids that can be added to
|
|
5
5
|
* a [[SelectionSet]] or [[HiliteSet]].
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,oBAAY,yBAAyB;IACnC,2CAA2C;IAC3C,GAAG,IAAA;IACH,+CAA+C;IAC/C,MAAM,IAAA;IACN,6EAA6E;IAC7E,OAAO,IAAA;IACP,yDAAyD;IACzD,KAAK,IAAA;CACN;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,6CAA6C;IAC7C,GAAG,EAAE,sBAAsB,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,kFAAkF;IAClF,SAAS,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,2BAA2B,KAAK,IAAI,CAAC,CAAC;IAC5D,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,mCAAmC;IACnC,QAAQ,IAAI,IAAI,CAAC;CAClB,GAAG,CACA;IACE,wDAAwD;IACxD,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,6DAA6D;IAC7D,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CAChC,GACD;IACE;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE;SAAG,CAAC,IAAI,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO;KAAE,CAAC;IAE/D;;;;;OAKG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC;IAEnD;;;;;OAKG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC;CACvD,CACJ,CAAC;AAEF;;;;GAIG;AACH,UAAU,SAAS;IACjB,wCAAwC;IACxC,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,gHAAgH;IAChH,wBAAwB,EAAE,OAAO,CAAC;IAClC,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAoBhG;;;;GAIG;AACH,MAAM,CAAN,IAAY,yBASX;AATD,WAAY,yBAAyB;IACnC,2CAA2C;IAC3C,uEAAG,CAAA;IACH,+CAA+C;IAC/C,6EAAM,CAAA;IACN,6EAA6E;IAC7E,+EAAO,CAAA;IACP,yDAAyD;IACzD,2EAAK,CAAA;AACP,CAAC,EATW,yBAAyB,KAAzB,yBAAyB,QASpC","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\nimport type { Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport type { Event } from \"@itwin/presentation-shared\";\n\n/**\n * A collection of geometric element, model and subcategory ids that can be added to\n * a [[SelectionSet]] or [[HiliteSet]].\n *\n * **Warning:** This type was added to `@itwin/core-frontend` in 5.0.\n *\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectableids/\n * @public\n */\nexport interface CoreSelectableIds {\n elements?: Id64Arg;\n models?: Id64Arg;\n subcategories?: Id64Arg;\n}\n\n/**\n * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/\n * @internal\n */\nexport enum CoreSelectionSetEventType {\n /** Elements have been added to the set. */\n Add,\n /** Elements have been removed from the set. */\n Remove,\n /** Some elements have been added to the set and others have been removed. */\n Replace,\n /** All elements are about to be removed from the set. */\n Clear,\n}\n\n/**\n * Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/\n * @public\n */\nexport interface CoreSelectionSetEventUnsafe {\n /**\n * The type of operation that produced this event.\n *\n * Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with\n * different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)\n * doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.\n */\n type: number;\n /** The element Ids added to the set. */\n added?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been removed from selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n additions?: CoreSelectableIds;\n /** The element Ids removed from the set. */\n removed?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been added to selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n removals?: CoreSelectableIds;\n /** The affected `CoreIModelSelectionSet`. */\n set: CoreIModelSelectionSet;\n}\n\n/**\n * A set of *currently selected* elements in an iModel.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/\n * @public\n */\nexport type CoreIModelSelectionSet = {\n /** Event called whenever elements are added or removed from this SelectionSet. */\n onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;\n /** The IDs of the selected elements. */\n readonly elements: Set<string>;\n /** Clear current selection set. */\n emptyAll(): void;\n} & (\n | {\n /** Add one or more Ids to the current selection set. */\n add(elem: Id64Arg): boolean;\n /** Remove one or more Ids from the current selection set. */\n remove(elem: Id64Arg): boolean;\n }\n | {\n /**\n * Get the active selection as a collection of geometric element, model and subcategory ids.\n */\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n }\n);\n\n/**\n * A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.\n * @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/\n * @public\n */\ninterface Uint32Set {\n /** Add any number of Ids to the set. */\n addIds(ids: Id64Arg): void;\n /** Remove any number of Ids from the set. */\n deleteIds(ids: Id64Arg): void;\n}\n\n/**\n * A set of *hilited* elements in an iModel, by element id.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/\n * @public\n */\nexport interface CoreIModelHiliteSet {\n /** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/\n wantSyncWithSelectionSet: boolean;\n /** The set of hilited elements. */\n readonly elements: Uint32Set;\n /** The set of hilited subcategories. */\n readonly subcategories: Uint32Set;\n /** The set of hilited models. */\n readonly models: Uint32Set;\n /** Remove all elements from the hilited set. */\n clear(): void;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type { CustomSelectable, SelectableIdentifier, SelectableInstanceKey } from "./unified-selection/Selectable.js";
|
|
2
|
+
export { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables } from "./unified-selection/Selectable.js";
|
|
3
|
+
export type { SelectionStorage } from "./unified-selection/SelectionStorage.js";
|
|
4
|
+
export { createStorage } from "./unified-selection/SelectionStorage.js";
|
|
5
|
+
export type { HiliteSet, HiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
|
|
6
|
+
export { createHiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
|
|
7
|
+
export type { CachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider.js";
|
|
8
|
+
export { createCachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider.js";
|
|
9
|
+
export type { IModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
|
|
10
|
+
export { createIModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
|
|
11
|
+
export type { SelectionScope } from "./unified-selection/SelectionScope.js";
|
|
12
|
+
export { computeSelection } from "./unified-selection/SelectionScope.js";
|
|
13
|
+
export { enableUnifiedSelectionSyncWithIModel } from "./unified-selection/EnableUnifiedSelectionSyncWithIModel.js";
|
|
14
|
+
export type { StorageSelectionChangeType, StorageSelectionChangeEventArgs, StorageSelectionChangesListener, } from "./unified-selection/SelectionChangeEvent.js";
|
|
15
|
+
export { CLEAR_SELECTION_STORAGE_SOURCE } from "./unified-selection/SelectionStorage.js";
|
|
16
|
+
//# sourceMappingURL=unified-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-selection.d.ts","sourceRoot":"","sources":["../src/unified-selection.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACvH,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACzG,YAAY,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,YAAY,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AACjG,YAAY,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,YAAY,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,6DAA6D,CAAC;AACnH,YAAY,EACV,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
export { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables
|
|
5
|
+
export { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables } from "./unified-selection/Selectable.js";
|
|
6
6
|
export { createStorage } from "./unified-selection/SelectionStorage.js";
|
|
7
7
|
export { createHiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
|
|
8
|
-
export {
|
|
9
8
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
10
|
-
createCachingHiliteSetProvider
|
|
9
|
+
export { createCachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider.js";
|
|
11
10
|
export { createIModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
|
|
12
11
|
export { computeSelection } from "./unified-selection/SelectionScope.js";
|
|
13
12
|
export { enableUnifiedSelectionSyncWithIModel } from "./unified-selection/EnableUnifiedSelectionSyncWithIModel.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-selection.js","sourceRoot":"","sources":["../src/unified-selection.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAGnF,4DAA4D;AAC5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAEjG,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,6DAA6D,CAAC;AAMnH,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,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\nexport type { CustomSelectable, SelectableIdentifier, SelectableInstanceKey } from \"./unified-selection/Selectable.js\";\nexport { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables } from \"./unified-selection/Selectable.js\";\nexport type { SelectionStorage } from \"./unified-selection/SelectionStorage.js\";\nexport { createStorage } from \"./unified-selection/SelectionStorage.js\";\nexport type { HiliteSet, HiliteSetProvider } from \"./unified-selection/HiliteSetProvider.js\";\nexport { createHiliteSetProvider } from \"./unified-selection/HiliteSetProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type { CachingHiliteSetProvider } from \"./unified-selection/CachingHiliteSetProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport { createCachingHiliteSetProvider } from \"./unified-selection/CachingHiliteSetProvider.js\";\nexport type { IModelHiliteSetProvider } from \"./unified-selection/IModelHiliteSetProvider.js\";\nexport { createIModelHiliteSetProvider } from \"./unified-selection/IModelHiliteSetProvider.js\";\nexport type { SelectionScope } from \"./unified-selection/SelectionScope.js\";\nexport { computeSelection } from \"./unified-selection/SelectionScope.js\";\nexport { enableUnifiedSelectionSyncWithIModel } from \"./unified-selection/EnableUnifiedSelectionSyncWithIModel.js\";\nexport type {\n StorageSelectionChangeType,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n} from \"./unified-selection/SelectionChangeEvent.js\";\nexport { CLEAR_SELECTION_STORAGE_SOURCE } from \"./unified-selection/SelectionStorage.js\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/unified-selection",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"description": "Package for managing unified selection in iTwin.js applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -25,45 +25,43 @@
|
|
|
25
25
|
"url": "http://www.bentley.com"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"module": "lib/esm/unified-selection.js",
|
|
28
|
+
"types": "lib/unified-selection",
|
|
29
|
+
"module": "lib/unified-selection.js",
|
|
31
30
|
"exports": {
|
|
32
31
|
".": {
|
|
33
|
-
"import": "./lib/
|
|
34
|
-
"require": "./lib/cjs/unified-selection.js"
|
|
32
|
+
"import": "./lib/unified-selection.js"
|
|
35
33
|
},
|
|
36
34
|
"./package.json": "./package.json"
|
|
37
35
|
},
|
|
38
36
|
"dependencies": {
|
|
39
|
-
"@itwin/core-bentley": "^5.11.
|
|
37
|
+
"@itwin/core-bentley": "^5.11.3",
|
|
40
38
|
"rxjs": "^7.8.2",
|
|
41
39
|
"rxjs-for-await": "^1.0.0",
|
|
42
|
-
"@itwin/presentation-shared": "
|
|
40
|
+
"@itwin/presentation-shared": "2.0.0-alpha.12"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@itwin/build-tools": "^5.11.
|
|
43
|
+
"@itwin/build-tools": "^5.11.3",
|
|
46
44
|
"@itwin/eslint-plugin": "^6.1.0",
|
|
47
45
|
"@types/node": "^24.13.3",
|
|
48
46
|
"@vitest/coverage-v8": "^4.1.10",
|
|
49
47
|
"cpx2": "^7.0.2",
|
|
50
48
|
"eslint": "^9.39.5",
|
|
51
49
|
"rimraf": "^6.1.3",
|
|
52
|
-
"typescript": "
|
|
50
|
+
"@typescript/native": "npm:typescript@~7.0.2",
|
|
51
|
+
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
53
52
|
"vitest": "^4.1.10",
|
|
54
|
-
"presentation-test-utilities": "
|
|
53
|
+
"presentation-test-utilities": "0.0.1"
|
|
55
54
|
},
|
|
56
55
|
"scripts": {
|
|
57
|
-
"build": "npm run -s typecheck && npm run -s build:
|
|
58
|
-
"build:
|
|
59
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
56
|
+
"build": "npm run -s typecheck && npm run -s build:lib",
|
|
57
|
+
"build:lib": "tsc -p tsconfig.lib.json",
|
|
60
58
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
61
59
|
"clean": "rimraf lib build",
|
|
62
60
|
"cover": "vitest run --coverage",
|
|
63
61
|
"lint": "eslint \"./src/**/*.ts\"",
|
|
64
62
|
"test": "vitest run",
|
|
65
63
|
"test:watch": "vitest",
|
|
66
|
-
"extract-api": "betools extract-api --entry=lib/
|
|
64
|
+
"extract-api": "betools extract-api --entry=lib/unified-selection --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api --includeUnexportedApis",
|
|
67
65
|
"check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/unified-selection.api.md",
|
|
68
66
|
"update-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md,./learning",
|
|
69
67
|
"check-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md,./learning --check",
|
package/lib/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,iEAAiE;IACjE,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,GAAG,kBAAkB,CAAC;IAEtF,yHAAyH;IACzH,uBAAuB,CAAC,EAAE,OAAO,uBAAuB,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAClB,mCAAmC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAErC;;;;;OAKG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC;IAE9B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,6BAA6B,GACnC,wBAAwB,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAO7D"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.createCachingHiliteSetProvider = createCachingHiliteSetProvider;
|
|
9
|
-
require("./DisposePolyfill.js");
|
|
10
|
-
const IModelHiliteSetProvider_js_1 = require("./IModelHiliteSetProvider.js");
|
|
11
|
-
/**
|
|
12
|
-
* Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent
|
|
13
|
-
* hilite set requests for the same iModel don't cost until selection in given selection storage changes.
|
|
14
|
-
* @public
|
|
15
|
-
* @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.
|
|
16
|
-
*/
|
|
17
|
-
/* v8 ignore start */
|
|
18
|
-
function createCachingHiliteSetProvider(props) {
|
|
19
|
-
const provider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)(props);
|
|
20
|
-
return {
|
|
21
|
-
getHiliteSet: (hiliteSetProps) => provider.getCurrentHiliteSet(hiliteSetProps),
|
|
22
|
-
[Symbol.dispose]: () => provider[Symbol.dispose](),
|
|
23
|
-
dispose: () => provider[Symbol.dispose](),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/* v8 ignore stop */
|
|
27
|
-
//# sourceMappingURL=CachingHiliteSetProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;;AAgErD,wEASC;AAvED,gCAA8B;AAI9B,6EAA6E;AAmD7E;;;;;GAKG;AACH,qBAAqB;AACrB,SAAgB,8BAA8B,CAC5C,KAAoC;IAEpC,MAAM,QAAQ,GAAG,IAAA,0DAA6B,EAAC,KAAK,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,CAAC,cAAqC,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC;QACrG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAClD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC;AACD,oBAAoB","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/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport \"./DisposePolyfill.js\";\n\nimport { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport { createHiliteSetProvider, HiliteSet } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * Props for creating a `CachingHiliteSetProvider` instance.\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProviderProps` instead.\n */\nexport interface CachingHiliteSetProviderProps {\n /** Selection storage to use for retrieving the hilite set. */\n selectionStorage: SelectionStorage;\n\n /** A callback that should return iModel access by iModel key. */\n imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;\n\n /** An optional hilite set provider factory. If not provided, defaults to `createHiliteSetProvider` from this package. */\n createHiliteSetProvider?: typeof createHiliteSetProvider;\n}\n\n/**\n * Defines return value of `createCachingHiliteSetProvider`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createCachingHiliteSetProvider`\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProvider` instead.\n */\nexport interface CachingHiliteSetProvider {\n /** Get the current hilite set iterator for the specified imodel */\n getHiliteSet(props: {\n /** iModel to get hilite set for */\n imodelKey: string;\n }): AsyncIterableIterator<HiliteSet>;\n\n /**\n * Disposes the cache.\n *\n * Optional to avoid breaking the API. Will be made required when the deprecated\n * `dispose` is removed.\n */\n [Symbol.dispose]?: () => void;\n\n /**\n * Disposes the cache.\n * @deprecated in 1.2. Use `[Symbol.dispose]` instead.\n */\n dispose(): void;\n}\n\n/**\n * Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent\n * hilite set requests for the same iModel don't cost until selection in given selection storage changes.\n * @public\n * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.\n */\n/* v8 ignore start */\nexport function createCachingHiliteSetProvider(\n props: CachingHiliteSetProviderProps,\n): CachingHiliteSetProvider & { [Symbol.dispose]: () => void } {\n const provider = createIModelHiliteSetProvider(props);\n return {\n getHiliteSet: (hiliteSetProps: { imodelKey: string }) => provider.getCurrentHiliteSet(hiliteSetProps),\n [Symbol.dispose]: () => provider[Symbol.dispose](),\n dispose: () => provider[Symbol.dispose](),\n };\n}\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=DisposePolyfill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisposePolyfill.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/DisposePolyfill.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/**
|
|
7
|
-
* Polyfill for upcoming resource management feature: https://github.com/tc39/proposal-explicit-resource-management
|
|
8
|
-
*/
|
|
9
|
-
Symbol.dispose ??= Symbol("Symbol.dispose");
|
|
10
|
-
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
11
|
-
//# sourceMappingURL=DisposePolyfill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisposePolyfill.js","sourceRoot":"","sources":["../../../src/unified-selection/DisposePolyfill.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG;;GAEG;AACF,MAAc,CAAC,OAAO,KAAK,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACpD,MAAc,CAAC,YAAY,KAAK,MAAM,CAAC,qBAAqB,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\n/**\n * Polyfill for upcoming resource management feature: https://github.com/tc39/proposal-explicit-resource-management\n */\n(Symbol as any).dispose ??= Symbol(\"Symbol.dispose\");\n(Symbol as any).asyncDispose ??= Symbol(\"Symbol.asyncDispose\");\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAI9B,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAsC,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAiC,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGtG,OAAO,EAAoB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAIvB,MAAM,mBAAmB,CAAC;AAG3B;;;GAGG;AACH,MAAM,WAAW,yCAAyC;IACxD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,EAAE,kBAAkB,GAC9B,yBAAyB,GAAG;QAC1B,sEAAsE;QACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,mFAAmF;QACnF,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;QACxC,yFAAyF;QACzF,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;KAC/C,CAAC;IAEJ;;;OAGG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,uCAAuC;IACvC,mBAAmB,EAAE,MAAM,cAAc,CAAC;IAE1C;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAElD;;;;;;;;;;;;;;OAcG;IACH,wBAAwB,CAAC,EAErB,wBAAwB,GAExB,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,GAAG;QAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAC;CACpF;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,yCAAyC,GAAG,MAAM,IAAI,CAGjH;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;;IACjC,OAAO,CAAC,oBAAoB,CAAU;IAEtC,OAAO,CAAC,aAAa,CAA4D;IACjF,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,wBAAwB,CAAoF;IACpH,OAAO,CAAC,oBAAoB,CAAuB;IAEnD,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,8BAA8B,CAAK;IAC3C,OAAO,CAAC,qBAAqB,CAAuB;IACpD,OAAO,CAAC,mCAAmC,CAAa;IACxD,OAAO,CAAC,qCAAqC,CAAa;IAC1D,OAAO,CAAC,iCAAiC,CAAa;gBAInC,KAAK,EAAE,yCAAyC,GAAG;QAAE,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;KAAE;IAoDxG,CAAC,MAAM,CAAC,OAAO,CAAC;IAOvB,4GAA4G;IACrG,8BAA8B;;;IAUrC,OAAO,CAAC,aAAa;IAmDrB,OAAO,CAAC,yBAAyB,CAa/B;IAEF,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,wBAAwB,CAwD9B;CACH"}
|
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
7
|
-
if (value !== null && value !== void 0) {
|
|
8
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
9
|
-
var dispose, inner;
|
|
10
|
-
if (async) {
|
|
11
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
12
|
-
dispose = value[Symbol.asyncDispose];
|
|
13
|
-
}
|
|
14
|
-
if (dispose === void 0) {
|
|
15
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
16
|
-
dispose = value[Symbol.dispose];
|
|
17
|
-
if (async) inner = dispose;
|
|
18
|
-
}
|
|
19
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
20
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
21
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
22
|
-
}
|
|
23
|
-
else if (async) {
|
|
24
|
-
env.stack.push({ async: true });
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
};
|
|
28
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
29
|
-
return function (env) {
|
|
30
|
-
function fail(e) {
|
|
31
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
32
|
-
env.hasError = true;
|
|
33
|
-
}
|
|
34
|
-
var r, s = 0;
|
|
35
|
-
function next() {
|
|
36
|
-
while (r = env.stack.pop()) {
|
|
37
|
-
try {
|
|
38
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
39
|
-
if (r.dispose) {
|
|
40
|
-
var result = r.dispose.call(r.value);
|
|
41
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
42
|
-
}
|
|
43
|
-
else s |= 1;
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
fail(e);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
50
|
-
if (env.hasError) throw env.error;
|
|
51
|
-
}
|
|
52
|
-
return next();
|
|
53
|
-
};
|
|
54
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
55
|
-
var e = new Error(message);
|
|
56
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.IModelSelectionHandler = void 0;
|
|
60
|
-
exports.enableUnifiedSelectionSyncWithIModel = enableUnifiedSelectionSyncWithIModel;
|
|
61
|
-
require("./DisposePolyfill.js");
|
|
62
|
-
const rxjs_1 = require("rxjs");
|
|
63
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
64
|
-
const HiliteSetProvider_js_1 = require("./HiliteSetProvider.js");
|
|
65
|
-
const IModelHiliteSetProvider_js_1 = require("./IModelHiliteSetProvider.js");
|
|
66
|
-
const Selectable_js_1 = require("./Selectable.js");
|
|
67
|
-
const SelectionScope_js_1 = require("./SelectionScope.js");
|
|
68
|
-
const IModel_js_1 = require("./types/IModel.js");
|
|
69
|
-
const Utils_js_1 = require("./Utils.js");
|
|
70
|
-
/**
|
|
71
|
-
* Enables synchronization between iModel selection and unified selection.
|
|
72
|
-
* @returns function for disposing the synchronization.
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
function enableUnifiedSelectionSyncWithIModel(props) {
|
|
76
|
-
const selectionHandler = new IModelSelectionHandler(props);
|
|
77
|
-
return () => selectionHandler[Symbol.dispose]();
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* A handler that syncs selection between unified selection storage (`SelectionStorage`) and
|
|
81
|
-
* an iModel (`iModel.selectionSet`, `iModel.hilited`).
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
class IModelSelectionHandler {
|
|
86
|
-
_selectionSourceName = "Tool";
|
|
87
|
-
_imodelAccess;
|
|
88
|
-
_selectionStorage;
|
|
89
|
-
_imodelHiliteSetProvider;
|
|
90
|
-
_activeScopeProvider;
|
|
91
|
-
_isSuspended;
|
|
92
|
-
_selectionStorageChangeTracker = 0;
|
|
93
|
-
_cancelOngoingChanges = new rxjs_1.Subject();
|
|
94
|
-
_unregisterUnifiedSelectionListener;
|
|
95
|
-
_unregisterIModelSelectionSetListener;
|
|
96
|
-
_disposeInternalHiliteSetProvider;
|
|
97
|
-
#componentId;
|
|
98
|
-
constructor(props) {
|
|
99
|
-
this.#componentId = core_bentley_1.Guid.createValue();
|
|
100
|
-
this._imodelAccess = props.imodelAccess;
|
|
101
|
-
this._selectionStorage = props.selectionStorage;
|
|
102
|
-
this._activeScopeProvider = props.activeScopeProvider;
|
|
103
|
-
this._isSuspended = false;
|
|
104
|
-
[this._imodelHiliteSetProvider, this._disposeInternalHiliteSetProvider] = (() => {
|
|
105
|
-
if (props.imodelHiliteSetProvider) {
|
|
106
|
-
return [props.imodelHiliteSetProvider, () => { }];
|
|
107
|
-
}
|
|
108
|
-
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
109
|
-
/* v8 ignore else -- @preserve */
|
|
110
|
-
if (props.cachingHiliteSetProvider) {
|
|
111
|
-
return [
|
|
112
|
-
createIModelHiliteSetProviderFromCachingProvider(props.cachingHiliteSetProvider, props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess })),
|
|
113
|
-
// don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed
|
|
114
|
-
// by whoever owns it
|
|
115
|
-
() => { },
|
|
116
|
-
];
|
|
117
|
-
}
|
|
118
|
-
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
119
|
-
/* v8 ignore start */
|
|
120
|
-
const internalProvider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)({
|
|
121
|
-
selectionStorage: this._selectionStorage,
|
|
122
|
-
imodelProvider: () => this._imodelAccess,
|
|
123
|
-
createHiliteSetProvider: () => props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess }),
|
|
124
|
-
});
|
|
125
|
-
return [internalProvider, () => (0, Utils_js_1.safeDispose)(internalProvider)];
|
|
126
|
-
/* v8 ignore stop */
|
|
127
|
-
})();
|
|
128
|
-
this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);
|
|
129
|
-
this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);
|
|
130
|
-
if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {
|
|
131
|
-
// itwinjs-core@4: stop imodel from syncing tool selection with hilited list - we want to manage that sync ourselves
|
|
132
|
-
this._imodelAccess.hiliteSet.wantSyncWithSelectionSet = false;
|
|
133
|
-
}
|
|
134
|
-
this.applyCurrentHiliteSet({ activeSelectionAction: "clearAll" });
|
|
135
|
-
}
|
|
136
|
-
[Symbol.dispose]() {
|
|
137
|
-
this._cancelOngoingChanges.next();
|
|
138
|
-
this._unregisterIModelSelectionSetListener();
|
|
139
|
-
this._unregisterUnifiedSelectionListener();
|
|
140
|
-
this._disposeInternalHiliteSetProvider();
|
|
141
|
-
}
|
|
142
|
-
/** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */
|
|
143
|
-
suspendIModelToolSelectionSync() {
|
|
144
|
-
const wasSuspended = this._isSuspended;
|
|
145
|
-
this._isSuspended = true;
|
|
146
|
-
return {
|
|
147
|
-
[Symbol.dispose]: () => {
|
|
148
|
-
this._isSuspended = wasSuspended;
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
syncHiliteSet(props) {
|
|
153
|
-
const { changeType, selectables, source } = props;
|
|
154
|
-
switch (changeType) {
|
|
155
|
-
case "clear":
|
|
156
|
-
return this.applyCurrentHiliteSet({ activeSelectionAction: "clearAll" });
|
|
157
|
-
case "replace":
|
|
158
|
-
return this.applyCurrentHiliteSet({
|
|
159
|
-
activeSelectionAction: source === this._selectionSourceName
|
|
160
|
-
? is5xSelectionSet(this._imodelAccess.selectionSet)
|
|
161
|
-
? // with 5x core we don't need to clear anything when event is triggered by a Tool (hilite and selection sets are in sync already)
|
|
162
|
-
"keep"
|
|
163
|
-
: // with 4x core we need to clear hilite set, because it's not synced with selection set
|
|
164
|
-
"clearHilited"
|
|
165
|
-
: // when event is triggered not by a Tool, we need to clear everything
|
|
166
|
-
"clearAll",
|
|
167
|
-
});
|
|
168
|
-
case "add":
|
|
169
|
-
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
170
|
-
.getHiliteSetProvider({ imodelKey: this._imodelAccess.key })
|
|
171
|
-
.getHiliteSet({ selectables }))
|
|
172
|
-
.pipe((0, rxjs_1.takeUntil)(this._cancelOngoingChanges))
|
|
173
|
-
.subscribe({
|
|
174
|
-
next: (set) => {
|
|
175
|
-
this.addHiliteSet(set);
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
case "remove":
|
|
179
|
-
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
180
|
-
.getHiliteSetProvider({ imodelKey: this._imodelAccess.key })
|
|
181
|
-
.getHiliteSet({ selectables }))
|
|
182
|
-
.pipe((0, rxjs_1.takeUntil)(this._cancelOngoingChanges))
|
|
183
|
-
.subscribe({
|
|
184
|
-
next: (set) => {
|
|
185
|
-
this.removeHiliteSet(set);
|
|
186
|
-
},
|
|
187
|
-
complete: () => {
|
|
188
|
-
this.applyCurrentHiliteSet({ activeSelectionAction: "keep" });
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
onUnifiedSelectionChanged = (args) => {
|
|
194
|
-
// iModels are only interested in top-level selection changes
|
|
195
|
-
if (args.imodelKey !== this._imodelAccess.key || args.level !== 0) {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
// update the selection storage change tracker so we know the selection storage changed
|
|
199
|
-
this._selectionStorageChangeTracker = (this._selectionStorageChangeTracker + 1) % Number.MAX_SAFE_INTEGER;
|
|
200
|
-
if (args.changeType === "replace" || args.changeType === "clear") {
|
|
201
|
-
this._cancelOngoingChanges.next();
|
|
202
|
-
}
|
|
203
|
-
this.syncHiliteSet(args);
|
|
204
|
-
};
|
|
205
|
-
applyCurrentHiliteSet({ activeSelectionAction, }) {
|
|
206
|
-
if (activeSelectionAction !== "keep") {
|
|
207
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
208
|
-
try {
|
|
209
|
-
const _dispose = __addDisposableResource(env_1, this.suspendIModelToolSelectionSync(), false);
|
|
210
|
-
if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {
|
|
211
|
-
this._imodelAccess.hiliteSet.clear();
|
|
212
|
-
}
|
|
213
|
-
if (activeSelectionAction === "clearAll") {
|
|
214
|
-
this._imodelAccess.selectionSet.emptyAll();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
catch (e_1) {
|
|
218
|
-
env_1.error = e_1;
|
|
219
|
-
env_1.hasError = true;
|
|
220
|
-
}
|
|
221
|
-
finally {
|
|
222
|
-
__disposeResources(env_1);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
(0, rxjs_1.from)(this._imodelHiliteSetProvider.getCurrentHiliteSet({ imodelKey: this._imodelAccess.key }))
|
|
226
|
-
.pipe((0, rxjs_1.takeUntil)(this._cancelOngoingChanges))
|
|
227
|
-
.subscribe({
|
|
228
|
-
next: (ids) => {
|
|
229
|
-
this.addHiliteSet(ids);
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
addHiliteSet(set) {
|
|
234
|
-
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
235
|
-
try {
|
|
236
|
-
const _dispose = __addDisposableResource(env_2, this.suspendIModelToolSelectionSync(), false);
|
|
237
|
-
if (is5xSelectionSet(this._imodelAccess.selectionSet)) {
|
|
238
|
-
// with 5.x core we can simply add the set as a whole
|
|
239
|
-
this._imodelAccess.selectionSet.add({
|
|
240
|
-
models: set.models,
|
|
241
|
-
subcategories: set.subCategories,
|
|
242
|
-
elements: set.elements,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
// pre-5.0 core requires adding models and subcategories to hilite set separately
|
|
247
|
-
/* v8 ignore else -- @preserve */
|
|
248
|
-
if (set.models.length) {
|
|
249
|
-
this._imodelAccess.hiliteSet.models.addIds(set.models);
|
|
250
|
-
}
|
|
251
|
-
/* v8 ignore else -- @preserve */
|
|
252
|
-
if (set.subCategories.length) {
|
|
253
|
-
this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);
|
|
254
|
-
}
|
|
255
|
-
/* v8 ignore else -- @preserve */
|
|
256
|
-
if (set.elements.length) {
|
|
257
|
-
this._imodelAccess.hiliteSet.elements.addIds(set.elements);
|
|
258
|
-
this._imodelAccess.selectionSet.add(set.elements);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
catch (e_2) {
|
|
263
|
-
env_2.error = e_2;
|
|
264
|
-
env_2.hasError = true;
|
|
265
|
-
}
|
|
266
|
-
finally {
|
|
267
|
-
__disposeResources(env_2);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
removeHiliteSet(set) {
|
|
271
|
-
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
272
|
-
try {
|
|
273
|
-
const _dispose = __addDisposableResource(env_3, this.suspendIModelToolSelectionSync(), false);
|
|
274
|
-
if (is5xSelectionSet(this._imodelAccess.selectionSet)) {
|
|
275
|
-
// with 5.x core we can simply remove the set as a whole
|
|
276
|
-
this._imodelAccess.selectionSet.remove({
|
|
277
|
-
models: set.models,
|
|
278
|
-
subcategories: set.subCategories,
|
|
279
|
-
elements: set.elements,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
/* v8 ignore else -- @preserve */
|
|
284
|
-
if (set.models.length) {
|
|
285
|
-
this._imodelAccess.hiliteSet.models.deleteIds(set.models);
|
|
286
|
-
}
|
|
287
|
-
/* v8 ignore else -- @preserve */
|
|
288
|
-
if (set.subCategories.length) {
|
|
289
|
-
this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);
|
|
290
|
-
}
|
|
291
|
-
/* v8 ignore else -- @preserve */
|
|
292
|
-
if (set.elements.length) {
|
|
293
|
-
this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);
|
|
294
|
-
this._imodelAccess.selectionSet.remove(set.elements);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
catch (e_3) {
|
|
299
|
-
env_3.error = e_3;
|
|
300
|
-
env_3.hasError = true;
|
|
301
|
-
}
|
|
302
|
-
finally {
|
|
303
|
-
__disposeResources(env_3);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
onIModelSelectionChanged = async (event) => {
|
|
307
|
-
if (this._isSuspended) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
if (IModel_js_1.CoreSelectionSetEventType.Clear === event.type) {
|
|
311
|
-
this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const ids = getSelectionSetChangeIds(event);
|
|
315
|
-
const scopedSelection = (0, rxjs_1.merge)(ids.elements
|
|
316
|
-
? (0, rxjs_1.from)((0, SelectionScope_js_1.computeSelection)({
|
|
317
|
-
queryExecutor: this._imodelAccess,
|
|
318
|
-
elementIds: ids.elements,
|
|
319
|
-
scope: this._activeScopeProvider(),
|
|
320
|
-
componentId: this.#componentId,
|
|
321
|
-
}))
|
|
322
|
-
: /* v8 ignore next */ rxjs_1.EMPTY, ids.models
|
|
323
|
-
? (0, rxjs_1.from)(ids.models).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.Model", id })))
|
|
324
|
-
: /* v8 ignore next */ rxjs_1.EMPTY, ids.subcategories
|
|
325
|
-
? (0, rxjs_1.from)(ids.subcategories).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.SubCategory", id })))
|
|
326
|
-
: /* v8 ignore next */ rxjs_1.EMPTY);
|
|
327
|
-
const selectionStorageVersion = this._selectionStorageChangeTracker;
|
|
328
|
-
const changeSelectionStorageProps = {
|
|
329
|
-
imodelKey: this._imodelAccess.key,
|
|
330
|
-
source: this._selectionSourceName,
|
|
331
|
-
selectables: await (0, rxjs_1.firstValueFrom)(scopedSelection.pipe((0, rxjs_1.toArray)())),
|
|
332
|
-
};
|
|
333
|
-
try {
|
|
334
|
-
switch (event.type) {
|
|
335
|
-
case IModel_js_1.CoreSelectionSetEventType.Add:
|
|
336
|
-
return this._selectionStorage.addToSelection(changeSelectionStorageProps);
|
|
337
|
-
case IModel_js_1.CoreSelectionSetEventType.Remove:
|
|
338
|
-
return this._selectionStorage.removeFromSelection(changeSelectionStorageProps);
|
|
339
|
-
case IModel_js_1.CoreSelectionSetEventType.Replace:
|
|
340
|
-
return this._selectionStorage.replaceSelection(changeSelectionStorageProps);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
finally {
|
|
344
|
-
if (this._selectionStorageChangeTracker === selectionStorageVersion) {
|
|
345
|
-
// if the storage wasn't changed while we were processing the selection change, we have to re-sync the
|
|
346
|
-
// hilite set (otherwise it's done by the selection storage change handler)
|
|
347
|
-
this.syncHiliteSet({
|
|
348
|
-
...changeSelectionStorageProps,
|
|
349
|
-
selectables: Selectable_js_1.Selectables.create(changeSelectionStorageProps.selectables),
|
|
350
|
-
changeType: getUnifiedSelectionChangeType(event.type),
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
exports.IModelSelectionHandler = IModelSelectionHandler;
|
|
357
|
-
function getSelectionSetChangeIds(event) {
|
|
358
|
-
switch (event.type) {
|
|
359
|
-
case IModel_js_1.CoreSelectionSetEventType.Add:
|
|
360
|
-
return event.additions ?? (event.added ? { elements: event.added } : /* v8 ignore next */ {});
|
|
361
|
-
case IModel_js_1.CoreSelectionSetEventType.Remove:
|
|
362
|
-
return event.removals ?? (event.removed ? { elements: event.removed } : /* v8 ignore next */ {});
|
|
363
|
-
case IModel_js_1.CoreSelectionSetEventType.Replace:
|
|
364
|
-
return "active" in event.set ? event.set.active : { elements: event.set.elements };
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
function getUnifiedSelectionChangeType(coreChangeType) {
|
|
368
|
-
switch (coreChangeType) {
|
|
369
|
-
case IModel_js_1.CoreSelectionSetEventType.Add:
|
|
370
|
-
return "add";
|
|
371
|
-
case IModel_js_1.CoreSelectionSetEventType.Remove:
|
|
372
|
-
return "remove";
|
|
373
|
-
case IModel_js_1.CoreSelectionSetEventType.Replace:
|
|
374
|
-
return "replace";
|
|
375
|
-
/* v8 ignore next -- @preserve */
|
|
376
|
-
case IModel_js_1.CoreSelectionSetEventType.Clear:
|
|
377
|
-
return "clear";
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
function is5xSelectionSet(selectionSet) {
|
|
381
|
-
return "active" in selectionSet;
|
|
382
|
-
}
|
|
383
|
-
/* v8 ignore start */
|
|
384
|
-
function createIModelHiliteSetProviderFromCachingProvider(cachingHiliteSetProvider, hiliteSetProvider) {
|
|
385
|
-
return {
|
|
386
|
-
getHiliteSetProvider: () => hiliteSetProvider,
|
|
387
|
-
getCurrentHiliteSet: (props) => cachingHiliteSetProvider.getHiliteSet(props),
|
|
388
|
-
[Symbol.dispose]: () => { },
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
/* v8 ignore stop */
|
|
392
|
-
//# sourceMappingURL=EnableUnifiedSelectionSyncWithIModel.js.map
|