@cognite/reveal-components 1.0.0 → 1.0.1

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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/common/i18n/en/reveal-components.js +183 -178
  3. package/dist/data-providers/Fdm3dDataProvider.d.ts +3 -3
  4. package/dist/data-providers/cache/RevisionFdmNodeCache.d.ts +3 -2
  5. package/dist/data-providers/cache/RevisionFdmNodeCache.js +65 -39
  6. package/dist/data-providers/cache/cad/CadInstanceMappingsCache.d.ts +5 -2
  7. package/dist/data-providers/cache/cad/CadInstanceMappingsCacheImpl.js +3 -0
  8. package/dist/data-providers/cache/cad/FdmCadNodeCache.d.ts +3 -1
  9. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.d.ts +5 -0
  10. package/dist/data-providers/cache/cad/FdmCadNodeCacheImpl.js +8 -3
  11. package/dist/data-providers/core-dm-provider/CoreDm3dDataProvider.d.ts +3 -3
  12. package/dist/data-providers/core-dm-provider/getFdmConnectionsForNodes.d.ts +2 -3
  13. package/dist/data-providers/index.d.ts +2 -1
  14. package/dist/data-providers/index.js +2 -0
  15. package/dist/data-providers/legacy-fdm-provider/LegacyFdm3dDataProvider.d.ts +3 -3
  16. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.d.ts +3 -3
  17. package/dist/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.js +1 -1
  18. package/dist/domains/index.d.ts +2 -1
  19. package/dist/domains/index.js +2 -1
  20. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.d.ts +1 -0
  21. package/dist/foundation/treeNodes/cad-tree-node/cad-tree-node.js +4 -1
  22. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk.js +1 -4
  23. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.d.ts +14 -0
  24. package/dist/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js +23 -0
  25. package/dist/ui/components/commandBased/pointsOfInterest/PoiCommentSection.js +6 -6
  26. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.d.ts +16 -0
  27. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.js +6 -0
  28. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.d.ts +15 -0
  29. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.d.ts +5 -0
  30. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.js +14 -0
  31. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.js +105 -0
  32. package/dist/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.js +26 -13
  33. package/dist/ui/components/commandBased/treeView/TreeView/extraComponents/CadTreeAssetMappingDropdown.js +2 -2
  34. package/dist/ui/query/useCadNode3DInfo.d.ts +8 -0
  35. package/dist/ui/query/useCadNode3DInfo.js +24 -0
  36. package/dist/utilities/queryKeys.d.ts +2 -0
  37. package/dist/utilities/queryKeys.js +7 -0
  38. package/package.json +5 -4
@@ -1,12 +1,13 @@
1
- import { fetchAncestorNodesForTreeIndex as e, inspectNodes as t } from "./requests.js";
2
- import { max as n } from "lodash-es";
3
- import { assert as r } from "@cognite/underscore";
1
+ import { isDefined as e } from "../../utilities/isDefined.js";
2
+ import { fetchAncestorNodesForTreeIndex as t, inspectNodes as n } from "./requests.js";
3
+ import { max as r, partition as i } from "lodash-es";
4
+ import { assert as a } from "@cognite/underscore";
4
5
  //#region libs/shared/reveal-components/src/data-providers/cache/RevisionFdmNodeCache.ts
5
- var i = {
6
+ var o = {
6
7
  connections: [],
7
8
  ancestorsWithSameMapping: [],
8
9
  firstMappedAncestorTreeIndex: -1
9
- }, a = class {
10
+ }, s = class {
10
11
  _cogniteClient;
11
12
  _fdmClient;
12
13
  _fdm3dDataProvider;
@@ -31,7 +32,7 @@ var i = {
31
32
  };
32
33
  }
33
34
  async assertOrFetchViewsForNodeData(e, t) {
34
- if (c(t)) return t.map((e) => e.views);
35
+ if (d(t)) return t.map((e) => e.views);
35
36
  let n = t[0].cadNode, r = {
36
37
  cadNode: n,
37
38
  connections: t.map((e) => e.connection)
@@ -50,17 +51,17 @@ var i = {
50
51
  }
51
52
  async getViewsPromiseFromDataPromises(e, t) {
52
53
  let n = await e, { ancestorsWithSameMapping: r } = await t, i = r.map((e) => e.treeIndex), a = i.filter((e) => this._treeIndexToFdmConnections.has(e)).sort((e, t) => t - e), o = a.length === 0 ? void 0 : this._treeIndexToFdmConnections.get(a[0]);
53
- return c(o) ? (this.setCacheDataForTreeIndices(i, o), o.map((e) => e.views)) : await this.getAndCacheViewsPromiseForNodeData(n, i);
54
+ return d(o) ? (this.setCacheDataForTreeIndices(i, o), o.map((e) => e.views)) : await this.getAndCacheViewsPromiseForNodeData(n, i);
54
55
  }
55
56
  async getCadAndConnectionsPromiseForAncestorData(e) {
56
- let { connections: t, ancestorsWithSameMapping: n, firstMappedAncestorTreeIndex: i } = await e;
57
+ let { connections: t, ancestorsWithSameMapping: n, firstMappedAncestorTreeIndex: r } = await e;
57
58
  if (t.length === 0) {
58
59
  this.setCacheDataForTreeIndices(n.map((e) => e.treeIndex), []);
59
60
  return;
60
61
  }
61
- let a = n.find((e) => e.treeIndex === i);
62
- return r(a !== void 0), {
63
- cadNode: a,
62
+ let i = n.find((e) => e.treeIndex === r);
63
+ return a(i !== void 0), {
64
+ cadNode: i,
64
65
  connections: t
65
66
  };
66
67
  }
@@ -69,50 +70,47 @@ var i = {
69
70
  this._treeIndexToFdmConnections.set(e, t);
70
71
  });
71
72
  }
72
- async getAndCacheViewsPromiseForNodeData(e, n) {
73
+ async getAndCacheViewsPromiseForNodeData(e, t) {
73
74
  if (e === void 0) {
74
- this.setCacheDataForTreeIndices(n, []);
75
+ this.setCacheDataForTreeIndices(t, []);
75
76
  return;
76
77
  }
77
- let r = (await t(this._fdmClient, e.connections.map((e) => e.instance))).items.map((e) => e.inspectionResults.involvedViews), i = e.connections.map((t, n) => ({
78
+ let r = (await n(this._fdmClient, e.connections.map((e) => e.instance))).items.map((e) => e.inspectionResults.involvedViews), i = e.connections.map((t, n) => ({
78
79
  connection: t,
79
80
  cadNode: e.cadNode,
80
81
  view: r[n]
81
82
  }));
82
- return this.setCacheDataForTreeIndices(n, i), r;
83
+ return this.setCacheDataForTreeIndices(t, i), r;
83
84
  }
84
- async getClosestParentMapping(t) {
85
- let n = await e(this._modelId, this._revisionId, t, this._cogniteClient), r = await this.getMappingConnectionsForAncestors(n);
86
- if (r.length === 0) return i;
87
- let a = this.combineConnectionsWithTreeIndex(r, n), c = o(a);
88
- return c === void 0 ? i : s(c, a, n);
89
- }
90
- combineConnectionsWithTreeIndex(e, t) {
91
- return e.reduce((e, n) => {
92
- let r = t.find((e) => e.treeIndex === n.treeIndex);
93
- return r !== void 0 && e.push({
94
- connection: n,
95
- treeIndex: r.treeIndex
96
- }), e;
97
- }, []);
85
+ async getClosestParentMapping(e) {
86
+ let n = await t(this._modelId, this._revisionId, e, this._cogniteClient), r = await this.getMappingConnectionsForAncestors(n);
87
+ if (r.length === 0) return o;
88
+ let i = r.map((e) => ({
89
+ connection: e,
90
+ treeIndex: e.treeIndex
91
+ })), a = l(i);
92
+ return a === void 0 ? o : u(a, i, n);
98
93
  }
99
94
  async getMappingConnectionsForAncestors(e) {
100
95
  let t = e.filter((e) => this._treeIndexToFdmConnections.has(e.treeIndex)).sort((e, t) => t.treeIndex - e.treeIndex)[0];
101
96
  if (t !== void 0) {
102
97
  let e = this._treeIndexToFdmConnections.get(t.treeIndex);
103
- return r(e !== void 0), e.map((e) => e.connection);
98
+ return a(e !== void 0), e.map((e) => e.connection);
104
99
  }
105
100
  let n = await this._modelInstances;
106
- return n === void 0 || n.length === 0 ? [] : await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, e);
101
+ return n === void 0 || n.length === 0 ? [] : await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, e.map((e) => ({
102
+ ...e,
103
+ nodeId: e.id
104
+ })));
107
105
  }
108
106
  async fetchViewsForAllConnections() {
109
107
  let e = this.getAllConnections().filter((e) => e.views === void 0 || e.views.length === 0);
110
108
  if (e.length === 0) return;
111
- let n = await t(this._fdmClient, e.map((e) => e.connection.instance));
112
- e.forEach((e, t) => {
109
+ let t = await n(this._fdmClient, e.map((e) => e.connection.instance));
110
+ e.forEach((e, n) => {
113
111
  let r = {
114
112
  ...e,
115
- views: [n.items[t].inspectionResults.involvedViews[0]]
113
+ views: [t.items[n].inspectionResults.involvedViews[0]]
116
114
  };
117
115
  this.insertTreeIndexMappings(r.cadNode.treeIndex, r);
118
116
  });
@@ -129,14 +127,42 @@ var i = {
129
127
  n.push(t);
130
128
  }
131
129
  }
130
+ async getConnectionsForNodes(t) {
131
+ let n = await this._modelInstances;
132
+ if (n === void 0 || n.length === 0) return [];
133
+ let [r, a] = i(t, (e) => this._treeIndexToFdmConnections.has(e.treeIndex)), o = r.map((e) => this._treeIndexToFdmConnections.get(e.treeIndex)).filter(e).flat(), s = await this._fdm3dDataProvider.getFdmConnectionsForNodes(n, this._revisionId, a);
134
+ return s.forEach((e) => {
135
+ if (e.nodeId === void 0 || e.treeIndex === void 0 || e.subtreeSize === void 0) return;
136
+ let t = {
137
+ id: e.nodeId,
138
+ treeIndex: e.treeIndex,
139
+ subtreeSize: e.subtreeSize
140
+ };
141
+ this.insertTreeIndexMappings(e.treeIndex, {
142
+ connection: e,
143
+ cadNode: t
144
+ });
145
+ }), c(t, [...s, ...o.map((e) => e.connection)]);
146
+ }
132
147
  getAllConnections() {
133
148
  return [...this._treeIndexToFdmConnections.values()].flat();
134
149
  }
135
150
  };
136
- function o(e) {
137
- return n(e.map((e) => e.treeIndex));
151
+ function c(t, n) {
152
+ let r = new Map(t.map((e) => [e.treeIndex, e]));
153
+ return n.map((e) => {
154
+ let t = r.get(e.treeIndex);
155
+ if (t !== void 0) return {
156
+ sourceType: "cdm",
157
+ node: t,
158
+ instance: e.instance
159
+ };
160
+ }).filter(e);
161
+ }
162
+ function l(e) {
163
+ return r(e.map((e) => e.treeIndex));
138
164
  }
139
- function s(e, t, n) {
165
+ function u(e, t, n) {
140
166
  let r = t.filter((t) => t.treeIndex === e), i = n.filter((t) => t.treeIndex >= e);
141
167
  return {
142
168
  connections: r.map((e) => e.connection),
@@ -144,8 +170,8 @@ function s(e, t, n) {
144
170
  firstMappedAncestorTreeIndex: e
145
171
  };
146
172
  }
147
- function c(e) {
173
+ function d(e) {
148
174
  return e !== void 0 && e?.every((e) => e.views !== void 0 && e.views.length > 0);
149
175
  }
150
176
  //#endregion
151
- export { a as RevisionFdmNodeCache, c as checkDefinedViews };
177
+ export { s as RevisionFdmNodeCache, d as checkDefinedViews };
@@ -4,11 +4,13 @@ import { SlimCadNodeWithBounds } from '../../utils/cadNodeConnectionFields';
4
4
  import { ModelRevisionKey, ModelRevisionId, CadNodeIdData } from '../types';
5
5
  export type CadModelMappingsWithNodes = Map<ModelRevisionKey, Map<InstanceKey, SlimCadNodeWithBounds[]>>;
6
6
  export type CadModelMappings = Map<ModelRevisionKey, Map<InstanceKey, CadNodeIdData[]>>;
7
- export type CadNodeMapping = {
7
+ export type CadNodeMapping = CdmCadNodeMapping | HybridCadNodeMapping;
8
+ export type CdmCadNodeMapping = {
8
9
  sourceType: 'cdm';
9
10
  node: CadNodeIdData;
10
11
  instance: DmsUniqueIdentifier;
11
- } | {
12
+ };
13
+ export type HybridCadNodeMapping = {
12
14
  sourceType: 'assetMapping';
13
15
  node: CadNodeIdData;
14
16
  instance: InstanceId;
@@ -17,4 +19,5 @@ export type CadInstanceMappingsCache = {
17
19
  getMappingsForModelsAndInstances: (instances: InstanceId[], models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappingsWithNodes>;
18
20
  getAllModelMappings: (models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappings>;
19
21
  getAllModelMappingsWithViews: (models: ModelRevisionId[], signal?: AbortSignal) => Promise<CadModelMappings>;
22
+ getMappingsForNodes: (model: ModelRevisionId, nodes: CadNodeIdData[], signal?: AbortSignal) => Promise<CadNodeMapping[]>;
20
23
  };
@@ -36,6 +36,9 @@ var l = class {
36
36
  async getAllModelMappingsWithViews(e, t) {
37
37
  return await this.getAllModelMappingsInternal(e, !0, t);
38
38
  }
39
+ async getMappingsForNodes(e, t, n) {
40
+ return u(n), await this._dmCache?.getMappingsForNodes(e, t) ?? [];
41
+ }
39
42
  async getAllModelMappingsInternal(e, c, l) {
40
43
  u(l);
41
44
  let d = r(e.map((e) => async () => {
@@ -1,8 +1,10 @@
1
1
  import { DmsUniqueIdentifier } from '../../FdmSDK';
2
- import { FdmNodeDataPromises, ModelRevisionId, ModelRevisionToConnectionMap } from '../types';
2
+ import { CadNodeIdData, FdmNodeDataPromises, ModelRevisionId, ModelRevisionToConnectionMap } from '../types';
3
+ import { CadNodeMapping } from './CadInstanceMappingsCache';
3
4
  import { ThreeDModelFdmMappings } from './types';
4
5
  export type FdmCadNodeCache = {
5
6
  getMappingsForFdmInstances: (instances: DmsUniqueIdentifier[], modelRevisionIds: ModelRevisionId[]) => Promise<ThreeDModelFdmMappings[]>;
6
7
  getAllMappingExternalIds: (modelRevisionIds: ModelRevisionId[], fetchViews: boolean) => Promise<ModelRevisionToConnectionMap>;
8
+ getMappingsForNodes: (modelRevisionId: ModelRevisionId, nodes: CadNodeIdData[]) => Promise<CadNodeMapping[]>;
7
9
  getClosestParentDataPromises: (modelId: number, revisionId: number, treeIndex: number) => FdmNodeDataPromises;
8
10
  };
@@ -1,11 +1,16 @@
1
1
  import { CogniteClient } from '@cognite/sdk';
2
2
  import { Fdm3dDataProvider } from '../../Fdm3dDataProvider';
3
+ import { FdmSDK } from '../../FdmSDK';
3
4
  import { fetchNodesForNodeIds, inspectNodes, treeIndexesToNodeIds } from '../requests';
5
+ import { RevisionFdmNodeCache } from '../RevisionFdmNodeCache';
6
+ import { ModelId, RevisionId } from '../types';
4
7
  import { FdmCadNodeCache } from './FdmCadNodeCache';
5
8
  export type FdmCadNodeCacheDeps = {
6
9
  treeIndexesToNodeIds: typeof treeIndexesToNodeIds;
7
10
  fetchNodesForNodeIds: typeof fetchNodesForNodeIds;
8
11
  inspectNodes: typeof inspectNodes;
12
+ createRevisionCache: (sdk: CogniteClient, fdmSdk: FdmSDK, fdmDataProvider: Fdm3dDataProvider, modelId: ModelId, revisionId: RevisionId) => RevisionFdmNodeCache;
13
+ createFdmClient: (sdk: CogniteClient) => FdmSDK;
9
14
  };
10
15
  export declare const defaultFdmCadNodeCacheDeps: FdmCadNodeCacheDeps;
11
16
  export declare function createFdmCadNodeCache(cdfClient: CogniteClient, fdm3dDataProvider: Fdm3dDataProvider, deps?: FdmCadNodeCacheDeps): FdmCadNodeCache;
@@ -12,7 +12,9 @@ import { assert as h } from "@cognite/underscore";
12
12
  var g = {
13
13
  treeIndexesToNodeIds: l,
14
14
  fetchNodesForNodeIds: s,
15
- inspectNodes: c
15
+ inspectNodes: c,
16
+ createRevisionCache: (e, t, n, r, i) => new f(e, t, n, r, i),
17
+ createFdmClient: (e) => new i(e)
16
18
  };
17
19
  function _(e, t, n = g) {
18
20
  return new v(e, t, n);
@@ -25,7 +27,7 @@ var v = class {
25
27
  _deps;
26
28
  _completeRevisions = /* @__PURE__ */ new Set();
27
29
  constructor(e, t, n = g) {
28
- this._cdfClient = e, this._fdmClient = new i(e), this._fdm3dDataProvider = t, this._deps = n;
30
+ this._cdfClient = e, this._fdmClient = n.createFdmClient(e), this._fdm3dDataProvider = t, this._deps = n;
29
31
  }
30
32
  async getMappingsForFdmInstances(e, n) {
31
33
  let [r, i] = m(n, (e) => {
@@ -34,6 +36,9 @@ var v = class {
34
36
  }), a = await this.getNonCachedModelMappings(e, i), o = [...this.getCachedModelMappings(r, e), ...a];
35
37
  return p(o, this._cdfClient);
36
38
  }
39
+ getMappingsForNodes(e, t) {
40
+ return this.getOrCreateRevisionCache(e.modelId, e.revisionId).getConnectionsForNodes(t);
41
+ }
37
42
  getCachedModelMappings(t, n) {
38
43
  let r = new Set(n.map(e));
39
44
  return t.map((e) => this.getCachedModelMappingForRevision(e, r));
@@ -141,7 +146,7 @@ var v = class {
141
146
  getOrCreateRevisionCache(e, n) {
142
147
  let r = t(e, n), i = this._revisionNodeCaches.get(r);
143
148
  if (i !== void 0) return i;
144
- let a = new f(this._cdfClient, this._fdmClient, this._fdm3dDataProvider, e, n);
149
+ let a = this._deps.createRevisionCache(this._cdfClient, this._fdmClient, this._fdm3dDataProvider, e, n);
145
150
  return this._revisionNodeCaches.set(r, a), a;
146
151
  }
147
152
  };
@@ -1,6 +1,6 @@
1
- import { ViewDefinition, Node3D } from '@cognite/sdk';
1
+ import { ViewDefinition } from '@cognite/sdk';
2
2
  import { InstancesWithView, InstancesWithViewDefinition } from '../../ui/query/useSearchMappedEquipmentFDM';
3
- import { FdmCadConnection } from '../cache/types';
3
+ import { CadNodeIdData, FdmCadConnection } from '../cache/types';
4
4
  import { Fdm3dDataProvider } from '../Fdm3dDataProvider';
5
5
  import { DmsUniqueIdentifier, FdmSDK, InstanceFilter, NodeItem, Source } from '../FdmSDK';
6
6
  import { Classic3DResourceIdentifier, ThreeDResourceIdentifier } from '../types/resources';
@@ -22,7 +22,7 @@ export declare class CoreDm3dFdm3dDataProvider implements Fdm3dDataProvider {
22
22
  private getDMSRevisionsForRevisionIdsAndModelRefs;
23
23
  private getRevisionRefsByType;
24
24
  getEdgeConnected3dInstances(instance: DmsUniqueIdentifier): Promise<DmsUniqueIdentifier[]>;
25
- getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes: Node3D[]): Promise<FdmCadConnection[]>;
25
+ getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes: CadNodeIdData[]): Promise<FdmCadConnection[]>;
26
26
  listMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: ViewDefinition[], instanceFilter: InstanceFilter | undefined, limit: number): Promise<NodeItem[]>;
27
27
  listAllMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: Source[], instanceFilter: InstanceFilter | undefined): Promise<NodeItem[]>;
28
28
  filterNodesByMappedTo3d(nodes: InstancesWithViewDefinition[], models: ThreeDResourceIdentifier[], includeIndirectRelations: boolean): Promise<InstancesWithView[]>;
@@ -1,5 +1,4 @@
1
- import { Node3D } from '@cognite/sdk';
2
1
  import { createDmsQueryDataAccumulator } from '../../utilities/dms-cursoring/dmsAccumulator';
3
- import { FdmCadConnection } from '../cache/types';
2
+ import { CadNodeIdData, FdmCadConnection } from '../cache/types';
4
3
  import { DmsUniqueIdentifier, FdmSDK } from '../FdmSDK';
5
- export declare function getFdmConnectionsForNodes(model: DmsUniqueIdentifier, revisionRef: DmsUniqueIdentifier, revisionId: number, nodes: Node3D[], fdmSdk: FdmSDK, accumulate?: typeof createDmsQueryDataAccumulator): Promise<FdmCadConnection[]>;
4
+ export declare function getFdmConnectionsForNodes(model: DmsUniqueIdentifier, revisionRef: DmsUniqueIdentifier, revisionId: number, nodes: CadNodeIdData[], fdmSdk: FdmSDK, accumulate?: typeof createDmsQueryDataAccumulator): Promise<FdmCadConnection[]>;
@@ -2,5 +2,6 @@ export type { AssetIdsAndTimeseriesData, ExtendedRelationship, AssetAndTimeserie
2
2
  export type { InstanceBounds } from './network/bounds/getBoundsForInstance';
3
3
  export type { AssetProperties } from './core-dm-provider/utils/filters';
4
4
  export type { FdmNode, Source, DmsUniqueIdentifier, ExternalId, SearchOperator, SimpleSource, Space, NodeItem, } from './FdmSDK';
5
- export type { CadNodeMapping } from './cache/cad/CadInstanceMappingsCache';
5
+ export type { CadNodeMapping, CadInstanceMappingsCache, } from './cache/cad/CadInstanceMappingsCache';
6
+ export { instanceIdToInstanceReference } from './cache/idAndKeyTranslation';
6
7
  export type { CadNodeIdData } from './cache/types';
@@ -0,0 +1,2 @@
1
+ import { instanceIdToInstanceReference as e } from "./cache/idAndKeyTranslation.js";
2
+ export { e as instanceIdToInstanceReference };
@@ -1,7 +1,7 @@
1
- import { ViewDefinition, CogniteClient, Node3D } from '@cognite/sdk';
1
+ import { ViewDefinition, CogniteClient } from '@cognite/sdk';
2
2
  import { TrackingDelegate } from '../../foundation/utilities/types';
3
3
  import { InstancesWithView, InstancesWithViewDefinition } from '../../ui/query/useSearchMappedEquipmentFDM';
4
- import { FdmCadConnection } from '../cache/types';
4
+ import { CadNodeIdData, FdmCadConnection } from '../cache/types';
5
5
  import { Fdm3dDataProvider } from '../Fdm3dDataProvider';
6
6
  import { DmsUniqueIdentifier, FdmSDK, InstanceFilter, NodeItem, Source } from '../FdmSDK';
7
7
  import { Classic3DResourceIdentifier, ThreeDResourceIdentifier } from '../types/resources';
@@ -15,7 +15,7 @@ export declare class LegacyFdm3dDataProvider implements Fdm3dDataProvider {
15
15
  is3dView(view: ViewDefinition): boolean;
16
16
  getDMSModels(modelId: number): Promise<DmsUniqueIdentifier[]>;
17
17
  getEdgeConnected3dInstances(instance: DmsUniqueIdentifier): Promise<DmsUniqueIdentifier[]>;
18
- getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes: Node3D[]): Promise<FdmCadConnection[]>;
18
+ getFdmConnectionsForNodes(models: DmsUniqueIdentifier[], revisionId: number, nodes: CadNodeIdData[]): Promise<FdmCadConnection[]>;
19
19
  listMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: ViewDefinition[], instanceFilter: InstanceFilter | undefined, limit: number): Promise<NodeItem[]>;
20
20
  listAllMappedFdmNodes(models: ThreeDResourceIdentifier[], sourcesToSearch: Source[]): Promise<NodeItem[]>;
21
21
  filterNodesByMappedTo3d(nodes: InstancesWithViewDefinition[], models: ThreeDResourceIdentifier[], includeIndirectRelations: boolean): Promise<InstancesWithView[]>;
@@ -1,4 +1,4 @@
1
- import { CogniteClient, Node3D } from '@cognite/sdk';
2
- import { FdmCadConnection } from '../cache/types';
1
+ import { CogniteClient } from '@cognite/sdk';
2
+ import { CadNodeIdData, FdmCadConnection } from '../cache/types';
3
3
  import { DmsUniqueIdentifier, FdmSDK } from '../FdmSDK';
4
- export declare function getFdmConnectionsForNodes(fdmClient: FdmSDK, cogniteClient: CogniteClient, models: DmsUniqueIdentifier[], revisionId: number, nodes: Node3D[]): Promise<FdmCadConnection[]>;
4
+ export declare function getFdmConnectionsForNodes(fdmClient: FdmSDK, cogniteClient: CogniteClient, models: DmsUniqueIdentifier[], revisionId: number, nodes: CadNodeIdData[]): Promise<FdmCadConnection[]>;
@@ -2,7 +2,7 @@ import { SYSTEM_3D_EDGE_SOURCE as e } from "./dataModels.js";
2
2
  import { fdmEdgesToCadConnections as t } from "./fdmEdgesToCadConnections.js";
3
3
  //#region libs/shared/reveal-components/src/data-providers/legacy-fdm-provider/getFdmConnectionsForNodeIds.ts
4
4
  async function n(n, r, i, a, o) {
5
- let s = o.map((e) => e.id), c = { and: [
5
+ let s = o.map((e) => e.nodeId), c = { and: [
6
6
  { in: {
7
7
  property: ["edge", "endNode"],
8
8
  values: i.map((e) => ({
@@ -101,8 +101,9 @@ export type { AnnotationIdentifier } from './annotation360/types';
101
101
  export type { AssetIdentifier } from './annotation360/types';
102
102
  export type { AnnotationStatus } from './annotation360/types';
103
103
  export type { ILazyLoader } from '../foundation/treeNodes/tree-node-type/i-lazy-loader';
104
- export type { INodesAndInstanceMappingsSdk } from '../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/i-nodes-and-instance-mappings-sdk';
104
+ export type { INodesAndInstanceMappingsSdk, IInstanceMappingsSdk, } from '../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/i-nodes-and-instance-mappings-sdk';
105
105
  export { NodesAndInstanceMappingsSdk } from '../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/nodes-and-instance-mappings-sdk';
106
+ export { CoreDmInstanceMappingsSdk, type CoreDmInstanceMappingDeleteDelegate, } from '../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk';
106
107
  export { ClassicInstanceMappingsSdk } from '../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/classic-instance-mappings-sdk';
107
108
  export { CadLazyLoader } from '../foundation/treeNodes/cad-tree-node/cad-lazy-loader';
108
109
  export type { CadLazyLoaderOptions } from '../foundation/treeNodes/cad-tree-node/cad-lazy-loader';
@@ -98,6 +98,7 @@ import { Image360AnnotationFolder as Ge } from "./annotation360/Image360Annotati
98
98
  import { Image360AnnotationSelectTool as Ke } from "./annotation360/Image360AnnotationSelectTool.js";
99
99
  import { Image360AnnotationCreateTool as qe } from "./annotation360/Image360AnnotationCreateTool.js";
100
100
  import { DeleteSelectedImage360AnnotationCommand as Je } from "./annotation360/DeleteSelectedImage360AnnotationCommand.js";
101
+ import { CoreDmInstanceMappingsSdk as Ye } from "../foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.js";
101
102
  he(), Te();
102
103
  //#endregion
103
- export { I as Annotation, L as AnnotationChangedDescription, R as AnnotationUtils, xe as AnnotationsCreateTool, z as AnnotationsDomainObject, j as AnnotationsRenderStyle, be as AnnotationsSelectTool, Ie as BaseBannerCommand, e as BaseCommand, ve as BaseCreator, N as BaseDragger, ye as BaseEditTool, r as BaseFilterCommand, i as BaseFilterItemCommand, n as BaseOptionCommand, ie as BaseRevealConfig, De as BaseSettingsCommand, Ee as BaseSliderCommand, ne as BaseTool, u as BaseView, me as CadDomainObject, de as CadLazyLoader, ue as CadTreeNode, g as ChangedDescription, a as Changes, fe as ClassicInstanceMappingsSdk, _ as ColorType, Q as CommandChanges, X as CommandsController, k as CommonRenderStyle, f as CopyToClipboardCommand, h as CycleLengthUnitsCommand, H as DEFAULT_POLYGON_OFFSET, ae as DefaultRevealConfig, m as DeleteDomainObjectCommand, Je as DeleteSelectedImage360AnnotationCommand, C as DomainObject, v as DomainObjectChange, p as DomainObjectCommand, D as DomainObjectTransaction, ke as FitViewCommand, o as FocusType, Se as FolderDomainObject, Le as GeneralBannerCommand, Oe as GroupCommand, B as GroupThreeView, qe as Image360AnnotationCreateTool, We as Image360AnnotationDomainObject, Ge as Image360AnnotationFolder, Ke as Image360AnnotationSelectTool, G as Image360CollectionDomainObject, He as Index2, _e as InstanceCommand, Ae as KeyboardSpeedCommand, re as NavigationTool, pe as NodesAndInstanceMappingsSdk, M as PanelInfo, K as PointCloudDomainObject, je as PointCloudFilterCommand, se as PointsOfInterestDomainObject, ce as PointsOfInterestView, y as PopupStyle, T as PrimitiveType, c as Quantity, P as Range1, F as Range3, O as RenderStyle, t as RenderTargetCommand, W as RevealDomainObject, oe as RevealRenderTarget, q as RevealSettingsController, J as RootDomainObject, Ve as SceneDomainObject, Be as SetAxisVisibleCommand, Me as SetPointColorTypeCommand, Ne as SetPointShapeCommand, Pe as SetPointSizeCommand, Fe as SetQualityCommand, Re as SetQualitySliderCommand, ze as SettingsCommand, we as ShowAllDomainObjectsCommand, Ce as ShowDomainObjectsOnTopCommand, A as Status, d as ThreeView, E as Transaction, le as TreeNode, V as TrianglesBuffers, ge as UndoCommand, te as UndoManager, l as UnitSystem, b as Views, s as VisibleState, w as VisualDomainObject, Ue as getGlobalMatrix, x as getNextColor, S as getNextColorByIndex, Y as getResizeCursor, $ as isCustomObjectIntersection, ee as isDomainObjectIntersection, Z as isPointsOfInterestIntersection, U as updatePolygonOffset };
104
+ export { I as Annotation, L as AnnotationChangedDescription, R as AnnotationUtils, xe as AnnotationsCreateTool, z as AnnotationsDomainObject, j as AnnotationsRenderStyle, be as AnnotationsSelectTool, Ie as BaseBannerCommand, e as BaseCommand, ve as BaseCreator, N as BaseDragger, ye as BaseEditTool, r as BaseFilterCommand, i as BaseFilterItemCommand, n as BaseOptionCommand, ie as BaseRevealConfig, De as BaseSettingsCommand, Ee as BaseSliderCommand, ne as BaseTool, u as BaseView, me as CadDomainObject, de as CadLazyLoader, ue as CadTreeNode, g as ChangedDescription, a as Changes, fe as ClassicInstanceMappingsSdk, _ as ColorType, Q as CommandChanges, X as CommandsController, k as CommonRenderStyle, f as CopyToClipboardCommand, Ye as CoreDmInstanceMappingsSdk, h as CycleLengthUnitsCommand, H as DEFAULT_POLYGON_OFFSET, ae as DefaultRevealConfig, m as DeleteDomainObjectCommand, Je as DeleteSelectedImage360AnnotationCommand, C as DomainObject, v as DomainObjectChange, p as DomainObjectCommand, D as DomainObjectTransaction, ke as FitViewCommand, o as FocusType, Se as FolderDomainObject, Le as GeneralBannerCommand, Oe as GroupCommand, B as GroupThreeView, qe as Image360AnnotationCreateTool, We as Image360AnnotationDomainObject, Ge as Image360AnnotationFolder, Ke as Image360AnnotationSelectTool, G as Image360CollectionDomainObject, He as Index2, _e as InstanceCommand, Ae as KeyboardSpeedCommand, re as NavigationTool, pe as NodesAndInstanceMappingsSdk, M as PanelInfo, K as PointCloudDomainObject, je as PointCloudFilterCommand, se as PointsOfInterestDomainObject, ce as PointsOfInterestView, y as PopupStyle, T as PrimitiveType, c as Quantity, P as Range1, F as Range3, O as RenderStyle, t as RenderTargetCommand, W as RevealDomainObject, oe as RevealRenderTarget, q as RevealSettingsController, J as RootDomainObject, Ve as SceneDomainObject, Be as SetAxisVisibleCommand, Me as SetPointColorTypeCommand, Ne as SetPointShapeCommand, Pe as SetPointSizeCommand, Fe as SetQualityCommand, Re as SetQualitySliderCommand, ze as SettingsCommand, we as ShowAllDomainObjectsCommand, Ce as ShowDomainObjectsOnTopCommand, A as Status, d as ThreeView, E as Transaction, le as TreeNode, V as TrianglesBuffers, ge as UndoCommand, te as UndoManager, l as UnitSystem, b as Views, s as VisibleState, w as VisualDomainObject, Ue as getGlobalMatrix, x as getNextColor, S as getNextColorByIndex, Y as getResizeCursor, $ as isCustomObjectIntersection, ee as isDomainObjectIntersection, Z as isPointsOfInterestIntersection, U as updatePolygonOffset };
@@ -32,6 +32,7 @@ export declare class CadTreeNode extends TreeNode {
32
32
  getRoot(): CadTreeNode;
33
33
  getInstanceMappings(): readonly Readonly<CadNodeMapping>[];
34
34
  addInstanceMapping(assetMapping: CadNodeMapping): void;
35
+ get canDelete(): boolean;
35
36
  deleteInstanceMapping(instanceMapping: CadNodeMapping): Promise<void>;
36
37
  /**
37
38
  * This function ensure same conversion of treeIndex to UniqueId
@@ -55,8 +55,11 @@ var n = class n extends t {
55
55
  addInstanceMapping(e) {
56
56
  this._instanceMappings = [...this._instanceMappings ?? [], e], this.update();
57
57
  }
58
+ get canDelete() {
59
+ return this._deleteInstanceMappingCallback !== void 0;
60
+ }
58
61
  async deleteInstanceMapping(t) {
59
- if (this._instanceMappings === void 0) return;
62
+ if (this._instanceMappings === void 0 || !this.canDelete) return;
60
63
  let n = e(t.instance), r = this._instanceMappings.find((r) => n === e(r.instance) && r.node.nodeId === t.node.nodeId);
61
64
  r !== void 0 && (this._instanceMappings = this._instanceMappings.filter((e) => e !== r), await this._deleteInstanceMappingCallback?.(t), this.update());
62
65
  }
@@ -26,10 +26,7 @@ var n = class {
26
26
  }).filter(t) };
27
27
  }
28
28
  async deleteInstanceMapping(t, n, r) {
29
- let i = e(r.instance) ? { assetId: r.instance } : {
30
- assetId: 0,
31
- assetInstanceId: r.instance
32
- };
29
+ let i = e(r.instance) ? { assetId: r.instance } : { assetInstanceId: r.instance };
33
30
  await this._sdk.assetMappings3D.delete(t, n, [{
34
31
  nodeId: r.node.nodeId,
35
32
  ...i
@@ -0,0 +1,14 @@
1
+ import { CadNodeMapping } from '../../../../data-providers';
2
+ import { CadInstanceMappingsCache, CdmCadNodeMapping } from '../../../../data-providers/cache/cad/CadInstanceMappingsCache';
3
+ import { SubsetOfNode3D } from '../cad-types';
4
+ import { IInstanceMappingsSdk } from './i-nodes-and-instance-mappings-sdk';
5
+ export type CoreDmInstanceMappingDeleteDelegate = (modelId: number, revisionId: number, mapping: CdmCadNodeMapping) => Promise<void>;
6
+ export declare class CoreDmInstanceMappingsSdk implements IInstanceMappingsSdk {
7
+ private _cadMappingsCache;
8
+ private _deleteAssetMapping;
9
+ constructor(_cadMappingsCache: CadInstanceMappingsCache, _deleteAssetMapping: CoreDmInstanceMappingDeleteDelegate);
10
+ filterInstanceMappings(modelId: number, revisionId: number, nodes: SubsetOfNode3D[]): Promise<{
11
+ items: CadNodeMapping[];
12
+ }>;
13
+ deleteInstanceMapping(modelId: number, revisionId: number, instanceMapping: CadNodeMapping): Promise<void>;
14
+ }
@@ -0,0 +1,23 @@
1
+ //#region libs/shared/reveal-components/src/foundation/treeNodes/cad-tree-node/nodes-and-instance-mappings-sdk/core-dm-instance-mappings-sdk.ts
2
+ var e = class {
3
+ _cadMappingsCache;
4
+ _deleteAssetMapping;
5
+ constructor(e, t) {
6
+ this._cadMappingsCache = e, this._deleteAssetMapping = t;
7
+ }
8
+ async filterInstanceMappings(e, t, n) {
9
+ return { items: await this._cadMappingsCache.getMappingsForNodes({
10
+ modelId: e,
11
+ revisionId: t
12
+ }, n.map((e) => ({
13
+ ...e,
14
+ nodeId: e.id
15
+ }))) };
16
+ }
17
+ deleteInstanceMapping(e, t, n) {
18
+ if (n.sourceType !== "cdm") throw Error("Incompatible instance mapping type in CDM SDK: " + n.sourceType);
19
+ return this._deleteAssetMapping(e, t, n);
20
+ }
21
+ };
22
+ //#endregion
23
+ export { e as CoreDmInstanceMappingsSdk };
@@ -9,8 +9,8 @@ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
9
  import { IconLoader2 as u, IconSend as d } from "@tabler/icons-react";
10
10
  import { Separator as f } from "@cognite/aura/components/separator";
11
11
  import { Label as p } from "@cognite/aura/components/label";
12
- import { Avatar as m, AvatarFallback as h } from "@cognite/aura/components/avatar";
13
- import { EmptyState as g, EmptyStateIcon as _, EmptyStateTitle as v } from "@cognite/aura/components/empty-state";
12
+ import { EmptyState as m, EmptyStateIcon as h, EmptyStateTitle as g } from "@cognite/aura/components/empty-state";
13
+ import { Avatar as _, AvatarFallback as v } from "@cognite/aura/components/avatar";
14
14
  import { InputGroup as y, InputGroupAddon as b, InputGroupButton as x, InputGroupTextarea as S } from "@cognite/aura/components/input-group";
15
15
  //#region libs/shared/reveal-components/src/ui/components/commandBased/pointsOfInterest/PoiCommentSection.tsx
16
16
  var C = () => {
@@ -51,10 +51,10 @@ var C = () => {
51
51
  })]
52
52
  }) : /* @__PURE__ */ c("div", {
53
53
  className: "flex min-h-full flex-col items-center justify-center px-2 py-3",
54
- children: /* @__PURE__ */ l(g, {
54
+ children: /* @__PURE__ */ l(m, {
55
55
  variant: "compact",
56
56
  type: "new-chat",
57
- children: [/* @__PURE__ */ c(_, {}), /* @__PURE__ */ c(v, {
57
+ children: [/* @__PURE__ */ c(h, {}), /* @__PURE__ */ c(g, {
58
58
  as: "p",
59
59
  children: n({ key: "POINT_OF_INTEREST_NO_COMMENTS_YET" })
60
60
  })]
@@ -67,9 +67,9 @@ var C = () => {
67
67
  let { currentLanguage: o } = e();
68
68
  return /* @__PURE__ */ l("div", {
69
69
  className: "flex flex-row gap-2 items-start",
70
- children: [/* @__PURE__ */ c(m, {
70
+ children: [/* @__PURE__ */ c(_, {
71
71
  variant: i(a.ownerId),
72
- children: /* @__PURE__ */ c(h, { children: r(a.ownerId) })
72
+ children: /* @__PURE__ */ c(v, { children: r(a.ownerId) })
73
73
  }), /* @__PURE__ */ l("div", {
74
74
  className: "flex min-w-0 flex-1 flex-col gap-1",
75
75
  children: [/* @__PURE__ */ c("div", {
@@ -0,0 +1,16 @@
1
+ import { Context, ReactElement } from 'react';
2
+ import { ColumnDef } from '@tanstack/react-table';
3
+ import { PropertyRow } from './CadNodeInfoDialog';
4
+ export type PropertyDataGridProps = {
5
+ data: PropertyRow[];
6
+ columns: ColumnDef<PropertyRow>[];
7
+ rowHeight: number;
8
+ getRowId: (row: PropertyRow) => string;
9
+ 'aria-label': string;
10
+ className?: string;
11
+ };
12
+ export type CadNodeInfoDialogDependencies = {
13
+ DataGrid: (props: PropertyDataGridProps) => ReactElement;
14
+ };
15
+ export declare const defaultCadNodeInfoDialogDependencies: CadNodeInfoDialogDependencies;
16
+ export declare const CadNodeInfoDialogContext: Context<CadNodeInfoDialogDependencies>;
@@ -0,0 +1,6 @@
1
+ import { createContext as e } from "react";
2
+ import { DataGrid as t } from "@cognite/aura/data-grid";
3
+ //#region libs/shared/reveal-components/src/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.context.ts
4
+ var n = { DataGrid: t }, r = e(n);
5
+ //#endregion
6
+ export { r as CadNodeInfoDialogContext, n as defaultCadNodeInfoDialogDependencies };
@@ -0,0 +1,15 @@
1
+ import { ReactElement } from 'react';
2
+ import { Node3D } from '@cognite/sdk';
3
+ export type CadNodeInfoDialogProps = {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ node: Node3D | undefined;
7
+ isLoading: boolean;
8
+ isError: boolean;
9
+ };
10
+ export declare const CadNodeInfoDialog: ({ open, onOpenChange, node, isLoading, isError, }: CadNodeInfoDialogProps) => ReactElement;
11
+ export type PropertyRow = {
12
+ id: string;
13
+ key: string;
14
+ value: string;
15
+ };
@@ -0,0 +1,5 @@
1
+ import { Node3D } from '@cognite/sdk';
2
+ export declare const PRIORITY_CATEGORY = "Item";
3
+ export declare function getOtherCategories(node: Node3D | undefined): string[];
4
+ export declare function getCdfMetadataEntries(node: Node3D): Array<[string, unknown]>;
5
+ export declare function formatPropertyValue(value: unknown): string;
@@ -0,0 +1,14 @@
1
+ //#region libs/shared/reveal-components/src/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.function.tsx
2
+ var e = "Item";
3
+ function t(t) {
4
+ return Object.keys(t?.properties ?? {}).filter((t) => t !== e).sort();
5
+ }
6
+ function n(e) {
7
+ let { properties: t, ...n } = e;
8
+ return Object.entries(n);
9
+ }
10
+ function r(e) {
11
+ return typeof e == "object" && e ? JSON.stringify(e, null, 2) : String(e ?? "");
12
+ }
13
+ //#endregion
14
+ export { e as PRIORITY_CATEGORY, r as formatPropertyValue, n as getCdfMetadataEntries, t as getOtherCategories };