@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
@@ -0,0 +1,105 @@
1
+ import { useTranslation as e } from "../../../i18n/I18n.js";
2
+ import { CadNodeInfoDialogContext as t } from "./CadNodeInfoDialog.context.js";
3
+ import { PRIORITY_CATEGORY as n, formatPropertyValue as r, getCdfMetadataEntries as i, getOtherCategories as a } from "./CadNodeInfoDialog.function.js";
4
+ import { useContext as o, useMemo as s } from "react";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ import { Dialog as u, DialogContent as d, DialogHeader as f, DialogTitle as p } from "@cognite/aura/components/dialog";
7
+ import { EmptyState as m, EmptyStateIcon as h, EmptyStateTitle as g } from "@cognite/aura/components/empty-state";
8
+ import { Loader as _ } from "@cognite/aura/components/loader";
9
+ import { Tabs as v, TabsLabel as y, TabsList as b, TabsPanel as x, TabsTrigger as S } from "@cognite/aura/components/tabs";
10
+ //#region libs/shared/reveal-components/src/ui/components/commandBased/treeView/DomainObjectTreeView/CadNodeInfoDialog.tsx
11
+ var C = "cdf-metadata", w = ({ open: t, onOpenChange: r, node: o, isLoading: s, isError: w }) => {
12
+ let { t: T } = e(), D = Object.keys(o?.properties ?? {}).includes(n), O = a(o), k = D ? n : C;
13
+ return /* @__PURE__ */ c(u, {
14
+ open: t,
15
+ onOpenChange: r,
16
+ children: /* @__PURE__ */ l(d, {
17
+ className: "flex h-[560px] max-w-2xl flex-col sm:max-w-2xl",
18
+ children: [/* @__PURE__ */ c(f, { children: /* @__PURE__ */ c(p, { children: T({ key: "NODE_PROPERTIES" }) }) }), s ? /* @__PURE__ */ c(_, {}) : w ? /* @__PURE__ */ c("div", {
19
+ className: "flex min-h-full flex-1 flex-col items-center justify-center",
20
+ children: /* @__PURE__ */ l(m, {
21
+ variant: "compact",
22
+ type: "error-generic",
23
+ children: [/* @__PURE__ */ c(h, {}), /* @__PURE__ */ c(g, {
24
+ as: "p",
25
+ children: T({ key: "NODE_PROPERTIES_LOAD_ERROR" })
26
+ })]
27
+ })
28
+ }) : o === void 0 ? /* @__PURE__ */ c(_, {}) : /* @__PURE__ */ l(v, {
29
+ defaultValue: k,
30
+ className: "flex min-h-0 flex-1 flex-col",
31
+ children: [/* @__PURE__ */ l(b, {
32
+ size: "small",
33
+ children: [
34
+ D && /* @__PURE__ */ c(S, {
35
+ value: "Item",
36
+ size: "small",
37
+ children: /* @__PURE__ */ c(y, { children: "Item" })
38
+ }),
39
+ /* @__PURE__ */ c(S, {
40
+ value: C,
41
+ size: "small",
42
+ children: /* @__PURE__ */ c(y, { children: T({ key: "CDF_METADATA" }) })
43
+ }),
44
+ O.map((e) => /* @__PURE__ */ c(S, {
45
+ value: e,
46
+ size: "small",
47
+ children: /* @__PURE__ */ c(y, { children: e })
48
+ }, e))
49
+ ]
50
+ }), /* @__PURE__ */ l("div", {
51
+ className: "min-h-0 flex-1 pt-2",
52
+ children: [
53
+ D && /* @__PURE__ */ c(x, {
54
+ value: "Item",
55
+ className: "h-full",
56
+ children: /* @__PURE__ */ c(E, { entries: Object.entries(o.properties?.Item ?? {}) })
57
+ }),
58
+ /* @__PURE__ */ c(x, {
59
+ value: C,
60
+ className: "h-full",
61
+ children: /* @__PURE__ */ c(E, { entries: i(o) })
62
+ }),
63
+ O.map((e) => /* @__PURE__ */ c(x, {
64
+ value: e,
65
+ className: "h-full",
66
+ children: /* @__PURE__ */ c(E, { entries: Object.entries(o.properties?.[e] ?? {}) })
67
+ }, e))
68
+ ]
69
+ })]
70
+ }, o.id)]
71
+ })
72
+ });
73
+ }, T = 64;
74
+ function E({ entries: n }) {
75
+ let { DataGrid: i } = o(t), { t: a } = e(), l = n.map(([e, t]) => ({
76
+ id: e,
77
+ key: e,
78
+ value: r(t)
79
+ })), u = s(() => [{
80
+ accessorKey: "key",
81
+ header: a({ key: "PROPERTY" }),
82
+ size: 200
83
+ }, {
84
+ accessorKey: "value",
85
+ header: a({ key: "VALUE" }),
86
+ cell: ({ row: e }) => /* @__PURE__ */ c("span", {
87
+ className: "line-clamp-3 whitespace-normal break-words",
88
+ title: e.original.value,
89
+ children: e.original.value
90
+ })
91
+ }], [a]);
92
+ return /* @__PURE__ */ c("div", {
93
+ className: "h-full",
94
+ children: /* @__PURE__ */ c(i, {
95
+ data: l,
96
+ columns: u,
97
+ rowHeight: T,
98
+ getRowId: (e) => e.id,
99
+ "aria-label": "Node properties",
100
+ className: "bg-background"
101
+ })
102
+ });
103
+ }
104
+ //#endregion
105
+ export { w as CadNodeInfoDialog };
@@ -1,19 +1,32 @@
1
1
  import { useRenderTarget as e } from "../../../RevealCanvas/ViewerContext.js";
2
2
  import { IconFactory as t } from "../../Factories/IconFactory.js";
3
- import { TreeView as n } from "../TreeView/tree-view.js";
4
- import { getContextMenu as r, onSelectDomainObject as i, onToggleDomainObject as a } from "./DomainObjectTreeView.function.js";
5
- import { jsx as o } from "react/jsx-runtime";
3
+ import { CadTreeNodeViewAdapter as n } from "../../../../../foundation/treeNodes/cad-tree-node/cad-tree-node-view-adapter.js";
4
+ import { useCadNode3DInfo as r } from "../../../../query/useCadNode3DInfo.js";
5
+ import { TreeView as i } from "../TreeView/tree-view.js";
6
+ import { CadNodeInfoDialog as a } from "./CadNodeInfoDialog.js";
7
+ import { getContextMenu as o, onSelectDomainObject as s, onToggleDomainObject as c } from "./DomainObjectTreeView.function.js";
8
+ import { useState as l } from "react";
9
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
6
10
  //#region libs/shared/reveal-components/src/ui/components/commandBased/treeView/DomainObjectTreeView/DomainObjectTreeView.tsx
7
- var s = 20, c = () => {
8
- let c = e();
9
- return /* @__PURE__ */ o(n, {
10
- maxLabelLength: s,
11
- root: c.root,
12
- onSelectNode: i,
13
- onToggleNode: a,
14
- getContextMenu: r,
11
+ var p = 20, m = () => {
12
+ let m = e(), [h, g] = l(void 0), [_, v] = l(!1), y = (e) => {
13
+ e instanceof n && (g(e), v(!0));
14
+ }, { data: b, isLoading: x, isError: S } = r(m.root.sdk, h?.revisionId, h?.node.nodeId);
15
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(i, {
16
+ maxLabelLength: p,
17
+ root: m.root,
18
+ onSelectNode: s,
19
+ onToggleNode: c,
20
+ onClickInfo: y,
21
+ getContextMenu: o,
15
22
  getIconFromIconName: t.getIcon
16
- });
23
+ }), /* @__PURE__ */ d(a, {
24
+ open: _,
25
+ onOpenChange: v,
26
+ node: b,
27
+ isLoading: x,
28
+ isError: S
29
+ })] });
17
30
  };
18
31
  //#endregion
19
- export { c as DomainObjectTreeView };
32
+ export { m as DomainObjectTreeView };
@@ -39,7 +39,7 @@ function b({ cadTreeNode: p }) {
39
39
  let i = n(t(r.instance)), a = b.get(i);
40
40
  return /* @__PURE__ */ o(x, {
41
41
  name: a?.name ?? `${i}`,
42
- deleteDelegate: () => S(r)
42
+ deleteDelegate: p.canDelete ? () => S(r) : void 0
43
43
  }, e(r.instance));
44
44
  })
45
45
  })
@@ -56,7 +56,7 @@ function x({ name: e, deleteDelegate: t }) {
56
56
  children: [/* @__PURE__ */ o(u, { children: /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ o(d, { render: /* @__PURE__ */ o(m, {
57
57
  className: "p-0",
58
58
  children: n
59
- }) }), /* @__PURE__ */ o(l, { children: e })] }) }), /* @__PURE__ */ o("div", {
59
+ }) }), /* @__PURE__ */ o(l, { children: e })] }) }), t !== void 0 && /* @__PURE__ */ o("div", {
60
60
  role: "button",
61
61
  tabIndex: 0,
62
62
  className: v("inline-flex size-5 shrink-0 items-center justify-center rounded-sm", "text-destructive-foreground-on-critical", "hover:bg-destructive-background-hover", "cursor-pointer transition-all"),
@@ -0,0 +1,8 @@
1
+ import { CogniteClient, Node3D } from '@cognite/sdk';
2
+ import { RevisionId } from '../../foundation/treeNodes/cad-tree-node/cad-types';
3
+ export type UseCadNode3DInfoResult = {
4
+ data: Node3D | undefined;
5
+ isLoading: boolean;
6
+ isError: boolean;
7
+ };
8
+ export declare function useCadNode3DInfo(sdk: CogniteClient, revisionId: RevisionId | undefined, nodeId: number | undefined): UseCadNode3DInfoResult;
@@ -0,0 +1,24 @@
1
+ import { queryKeys as e } from "../../utilities/queryKeys.js";
2
+ import { useQuery as t } from "@tanstack/react-query";
3
+ //#region libs/shared/reveal-components/src/ui/query/useCadNode3DInfo.ts
4
+ var n = {
5
+ modelId: -1,
6
+ revisionId: -1
7
+ };
8
+ function r(r, i, a) {
9
+ let o = t({
10
+ queryKey: e.cadNode3DInfo(i ?? n, a),
11
+ queryFn: async () => {
12
+ if (i !== void 0 && a !== void 0) return (await r.revisions3D.retrieve3DNodes(i.modelId, i.revisionId, [{ id: a }]))[0];
13
+ },
14
+ staleTime: Infinity,
15
+ enabled: i !== void 0 && a !== void 0
16
+ });
17
+ return {
18
+ data: o.data,
19
+ isLoading: i !== void 0 && o.isLoading,
20
+ isError: i === void 0 || o.isError
21
+ };
22
+ }
23
+ //#endregion
24
+ export { r as useCadNode3DInfo };
@@ -2,6 +2,7 @@ import { QueryKey } from '@tanstack/react-query';
2
2
  import { IdEither } from '@cognite/sdk';
3
3
  import { DmsUniqueIdentifier } from '../data-providers/FdmSDK';
4
4
  import { AllAssetFilterProps } from '../data-providers/network/common/filters';
5
+ import { RevisionId } from '../foundation/treeNodes/cad-tree-node/cad-types';
5
6
  import { InstanceReference } from './instanceIds';
6
7
  import { CadModelOptions } from './modelIds/types';
7
8
  export declare const queryKeys: {
@@ -24,6 +25,7 @@ export declare const queryKeys: {
24
25
  readonly pointCloudDMModelIdRevisionIds: (modelKeys: string[]) => QueryKey;
25
26
  readonly pointCloudDMVolumeAssetMappingsWithViews: (assetRefKeys: string[]) => QueryKey;
26
27
  readonly modelRevisionId: (revisionKeys: string[]) => QueryKey;
28
+ readonly cadNode3DInfo: (revisionId: RevisionId, nodeId: number | undefined) => QueryKey;
27
29
  readonly timeseriesFromRelationship: () => QueryKey;
28
30
  readonly modelsForAssetPerInstanceReference: (instance: InstanceReference | undefined) => QueryKey;
29
31
  readonly hybridDmAssetMappingsForInstances: (modelKeys: string[], instances: DmsUniqueIdentifier[]) => QueryKey;
@@ -71,6 +71,13 @@ var r = {
71
71
  "model-revision-id",
72
72
  e
73
73
  ],
74
+ cadNode3DInfo: (e, t) => [
75
+ ...u,
76
+ "cad-node-3d-info",
77
+ e.modelId,
78
+ e.revisionId,
79
+ t
80
+ ],
74
81
  timeseriesFromRelationship: () => [...c, "timeseries-relationship"],
75
82
  modelsForAssetPerInstanceReference: (e) => [
76
83
  "react-components",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal-components",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React components, hooks, and data providers for building 3D applications on top of Cognite Reveal.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -80,6 +80,7 @@
80
80
  "@floating-ui/react": "^0.24.8",
81
81
  "@tabler/icons-react": "^3.35.0",
82
82
  "@tanstack/react-query": "^4.43.0",
83
+ "@tanstack/react-table": "^8.7.4",
83
84
  "dayjs": "^1.11.13",
84
85
  "lodash-es": "^4.18.1",
85
86
  "ml-matrix": "^6.12.1",
@@ -87,9 +88,9 @@
87
88
  "react": "^18.3.1",
88
89
  "react-dom": "^18.3.1",
89
90
  "three": "0.184.0",
90
- "@cognite/underscore": "1.0.0",
91
- "@cognite/signal-utils": "1.0.0",
92
- "@cognite/aura": "0.3.5"
91
+ "@cognite/aura": "0.3.5",
92
+ "@cognite/signal-utils": "1.0.1",
93
+ "@cognite/underscore": "1.0.1"
93
94
  },
94
95
  "devDependencies": {
95
96
  "@azure/msal-browser": "^2.31.0",