@collabdt/core 0.4.5 → 0.4.8
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/dist/core/components/Toolbar.js +1 -1
- package/dist/core/components/Toolbar.js.map +1 -1
- package/dist/core/components/ui/CollapsibleSection.d.ts +5 -1
- package/dist/core/components/ui/CollapsibleSection.d.ts.map +1 -1
- package/dist/core/components/ui/CollapsibleSection.js +10 -2
- package/dist/core/components/ui/CollapsibleSection.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/Shell.d.ts.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/Shell.js +0 -3
- package/dist/core/components/ui/ViewerSidebar/Shell.js.map +1 -1
- package/dist/core/components/ui/ViewerSidebar/index.js +1 -1
- package/dist/core/components/ui/ViewerSidebar/index.js.map +1 -1
- package/dist/core/components/viewers/bim/BimToolbar.d.ts +1 -3
- package/dist/core/components/viewers/bim/BimToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimToolbar.js +2 -2
- package/dist/core/components/viewers/bim/BimToolbar.js.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/BimViewer.js +42 -0
- package/dist/core/components/viewers/bim/BimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.js +5 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/FileTab/src/ModelsSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/index.d.ts +11 -8
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/index.js +125 -57
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceProvider.d.ts +32 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceProvider.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceProvider.js +53 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceProvider.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceSwatch.d.ts +19 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceSwatch.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceSwatch.js +131 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/AppearanceSwatch.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/BimTreeView.d.ts +19 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/BimTreeView.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/BimTreeView.js +101 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/BimTreeView.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/ElevationsSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/ElevationsSection.js +24 -35
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/ElevationsSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js +4 -9
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/FloorplanSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/IfcClassesSection.d.ts +16 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/IfcClassesSection.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/IfcClassesSection.js +94 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/IfcClassesSection.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerGroupSection.d.ts +28 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerGroupSection.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerGroupSection.js +55 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerGroupSection.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.d.ts +18 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.js +16 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.js.map +1 -0
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.d.ts +6 -12
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.js +78 -401
- package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.js.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.d.ts +1 -2
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js +2 -7
- package/dist/core/components/viewers/bim/src/BimSidebar/src/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts +115 -0
- package/dist/core/components/viewers/bim/src/ElementAppearance.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/ElementAppearance.js +254 -0
- package/dist/core/components/viewers/bim/src/ElementAppearance.js.map +1 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts +8 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js +54 -2
- package/dist/core/components/viewers/bim/src/FloorplanTool/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js +15 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/StoreyProjector.js.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts +4 -0
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/FloorplanTool/src/types.js.map +1 -1
- package/dist/core/components/viewers/bim/src/Highlighter/index.d.ts +31 -4
- package/dist/core/components/viewers/bim/src/Highlighter/index.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/Highlighter/index.js +122 -69
- package/dist/core/components/viewers/bim/src/Highlighter/index.js.map +1 -1
- package/dist/core/components/viewers/bim/src/IfcClasses.d.ts +93 -0
- package/dist/core/components/viewers/bim/src/IfcClasses.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/IfcClasses.js +196 -0
- package/dist/core/components/viewers/bim/src/IfcClasses.js.map +1 -0
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js +2 -0
- package/dist/core/components/viewers/bim/src/SimpleBimViewer.js.map +1 -1
- package/dist/core/components/viewers/bim/src/SpatialStructure.d.ts +37 -31
- package/dist/core/components/viewers/bim/src/SpatialStructure.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/SpatialStructure.js +141 -234
- package/dist/core/components/viewers/bim/src/SpatialStructure.js.map +1 -1
- package/dist/core/components/viewers/bim/src/VisibilityState.d.ts +21 -0
- package/dist/core/components/viewers/bim/src/VisibilityState.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/VisibilityState.js +18 -0
- package/dist/core/components/viewers/bim/src/VisibilityState.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/ViewModeCoordinator.d.ts +12 -0
- package/dist/core/components/viewers/bim/src/lib/ViewModeCoordinator.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/ViewModeCoordinator.js +15 -1
- package/dist/core/components/viewers/bim/src/lib/ViewModeCoordinator.js.map +1 -1
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts +75 -0
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js +121 -0
- package/dist/core/components/viewers/bim/src/lib/appearanceOverrides.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.d.ts +22 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.js +106 -0
- package/dist/core/components/viewers/bim/src/lib/bimItemActions.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimTree.d.ts +58 -0
- package/dist/core/components/viewers/bim/src/lib/bimTree.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/bimTree.js +133 -0
- package/dist/core/components/viewers/bim/src/lib/bimTree.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts +64 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js +244 -0
- package/dist/core/components/viewers/bim/src/lib/spaceOverlay.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spatialTree.d.ts +30 -0
- package/dist/core/components/viewers/bim/src/lib/spatialTree.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/spatialTree.js +73 -0
- package/dist/core/components/viewers/bim/src/lib/spatialTree.js.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/useBimTreeControls.d.ts +36 -0
- package/dist/core/components/viewers/bim/src/lib/useBimTreeControls.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/lib/useBimTreeControls.js +138 -0
- package/dist/core/components/viewers/bim/src/lib/useBimTreeControls.js.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingPlanes.d.ts +74 -0
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingPlanes.d.ts.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingPlanes.js +261 -0
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingPlanes.js.map +1 -0
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js +82 -110
- package/dist/core/components/viewers/bim/src/tools/ClippingTool/ClippingTool.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.d.ts +1 -3
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js +2 -4
- package/dist/core/components/viewers/bim/src/tools/bimToolbar.js.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/selectionBimTool.d.ts.map +1 -1
- package/dist/core/components/viewers/bim/src/tools/selectionBimTool.js +39 -12
- package/dist/core/components/viewers/bim/src/tools/selectionBimTool.js.map +1 -1
- package/dist/core/hooks/useUndoRedoShortcuts.d.ts +33 -0
- package/dist/core/hooks/useUndoRedoShortcuts.d.ts.map +1 -0
- package/dist/core/hooks/useUndoRedoShortcuts.js +40 -0
- package/dist/core/hooks/useUndoRedoShortcuts.js.map +1 -0
- package/dist/core/i18n/messages/en.json +29 -1
- package/dist/core/i18n/messages/es.json +29 -1
- package/dist/core/i18n/messages/fr.json +30 -2
- package/dist/core/utils/undoHistory.d.ts +72 -0
- package/dist/core/utils/undoHistory.d.ts.map +1 -0
- package/dist/core/utils/undoHistory.js +93 -0
- package/dist/core/utils/undoHistory.js.map +1 -0
- package/package.json +1 -1
- package/dist/core/components/viewers/bim/src/ClippingPlane.d.ts +0 -19
- package/dist/core/components/viewers/bim/src/ClippingPlane.d.ts.map +0 -1
- package/dist/core/components/viewers/bim/src/ClippingPlane.js +0 -86
- package/dist/core/components/viewers/bim/src/ClippingPlane.js.map +0 -1
package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayerViewPanel.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,UAAU,KAAK;IACb,oEAAoE;IACpE,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,qBAgBjE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function LayerViewPanel({ actions, count, children }) {
|
|
4
|
+
const hasToolbar = actions !== void 0 || count !== void 0;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
6
|
+
hasToolbar && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 pb-1 flex-shrink-0", children: [
|
|
7
|
+
count !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground tabular-nums", children: count }),
|
|
8
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 ml-auto", children: actions })
|
|
9
|
+
] }),
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto pr-1", children })
|
|
11
|
+
] });
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
LayerViewPanel
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=LayerViewPanel.js.map
|
package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/LayerViewPanel.tsx"],"sourcesContent":["'use client'\r\n\r\n// SPDX-License-Identifier: AGPL-3.0-or-later\r\n// Copyright (C) 2025 Collab Digital Twins\r\n\r\nimport * as React from 'react'\r\n\r\ninterface Props {\r\n /** Buttons for this view, shown right-aligned above the content. */\r\n actions?: React.ReactNode\r\n /** Item count shown at the left of the action row. */\r\n count?: number\r\n children: React.ReactNode\r\n}\r\n\r\n/**\r\n * The body of one view inside a `LayerGroupSection`.\r\n *\r\n * Views no longer own a collapsible header of their own — the group provides\r\n * it — so their per-view controls live in a compact toolbar above the scrolling\r\n * content instead.\r\n */\r\nexport function LayerViewPanel({ actions, count, children }: Props) {\r\n const hasToolbar = actions !== undefined || count !== undefined\r\n\r\n return (\r\n <div className=\"flex flex-col h-full min-h-0\">\r\n {hasToolbar && (\r\n <div className=\"flex items-center gap-1 pb-1 flex-shrink-0\">\r\n {count !== undefined && (\r\n <span className=\"text-xs text-muted-foreground tabular-nums\">{count}</span>\r\n )}\r\n <div className=\"flex items-center gap-1 ml-auto\">{actions}</div>\r\n </div>\r\n )}\r\n <div className=\"flex-1 min-h-0 overflow-y-auto pr-1\">{children}</div>\r\n </div>\r\n )\r\n}\r\n"],"mappings":";AA4BQ,SAEI,KAFJ;AAND,SAAS,eAAe,EAAE,SAAS,OAAO,SAAS,GAAU;AAClE,QAAM,aAAa,YAAY,UAAa,UAAU;AAEtD,SACE,qBAAC,SAAI,WAAU,gCACZ;AAAA,kBACC,qBAAC,SAAI,WAAU,8CACZ;AAAA,gBAAU,UACT,oBAAC,UAAK,WAAU,8CAA8C,iBAAM;AAAA,MAEtE,oBAAC,SAAI,WAAU,mCAAmC,mBAAQ;AAAA,OAC5D;AAAA,IAEF,oBAAC,SAAI,WAAU,uCAAuC,UAAS;AAAA,KACjE;AAEJ;","names":[]}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface Props {
|
|
3
|
-
/** Filter query
|
|
4
|
-
* LayersTab — applied to both the tree itself and to auto-expanding
|
|
5
|
-
* any branch that contains a match. */
|
|
3
|
+
/** Filter query from the shared search bar at the top of the LayersTab. */
|
|
6
4
|
searchQuery: string;
|
|
7
|
-
/** Currently active fragment model id. When omitted, the section
|
|
8
|
-
* resolves the first model in `FragmentsManager.list`. */
|
|
9
|
-
modelId: string | null;
|
|
10
5
|
}
|
|
11
6
|
/**
|
|
12
|
-
* Sidebar section
|
|
13
|
-
*
|
|
14
|
-
* to highlight them in the 3D view.
|
|
7
|
+
* Sidebar section for the IFC spatial structure (Building > Storey > Space >
|
|
8
|
+
* Element) of every loaded model, with select / hide / isolate per node.
|
|
15
9
|
*
|
|
16
|
-
*
|
|
17
|
-
* the shared
|
|
10
|
+
* The tree itself is built by the `SpatialStructure` component and rendered by
|
|
11
|
+
* the shared `BimTreeView`; this file only wires the two together.
|
|
18
12
|
*/
|
|
19
|
-
export declare function SpatialStructureSection({ searchQuery
|
|
13
|
+
export declare function SpatialStructureSection({ searchQuery }: Props): React.JSX.Element;
|
|
20
14
|
export {};
|
|
21
15
|
//# sourceMappingURL=SpatialStructureSection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialStructureSection.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpatialStructureSection.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAa9B,UAAU,KAAK;IACb,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,WAAW,EAAE,EAAE,KAAK,qBAsH7D"}
|
package/dist/core/components/viewers/bim/src/BimSidebar/src/LayersTab/src/SpatialStructureSection.js
CHANGED
|
@@ -1,435 +1,112 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
3
|
import * as OBC from "@thatopen/components";
|
|
20
|
-
import * as OBF from "@thatopen/components-front";
|
|
21
4
|
import * as LR from "lucide-react";
|
|
22
5
|
import { useTranslations } from "next-intl";
|
|
23
6
|
import * as React from "react";
|
|
24
7
|
import { BimContext } from "../../../../../../../../store";
|
|
25
|
-
import { cn } from "../../../../../../../../utils/utils";
|
|
26
8
|
import { Button } from "../../../../../../../ui/Button";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
} from "
|
|
32
|
-
function SpatialStructureSection({ searchQuery
|
|
9
|
+
import { useBimTreeControls } from "../../../../lib/useBimTreeControls";
|
|
10
|
+
import { SpatialStructure } from "../../../../SpatialStructure";
|
|
11
|
+
import { useAppearance } from "./AppearanceProvider";
|
|
12
|
+
import { BimTreeView } from "./BimTreeView";
|
|
13
|
+
import { LayerViewPanel } from "./LayerViewPanel";
|
|
14
|
+
function SpatialStructureSection({ searchQuery }) {
|
|
33
15
|
const t = useTranslations("LayersTab");
|
|
34
16
|
const { state: bimState } = React.useContext(BimContext);
|
|
35
17
|
const { bimComponents } = bimState.bim;
|
|
36
|
-
const
|
|
18
|
+
const { clearSource, hasOverrides } = useAppearance();
|
|
19
|
+
const [trees, setTrees] = React.useState([]);
|
|
37
20
|
const [isLoading, setIsLoading] = React.useState(false);
|
|
38
|
-
const [expandedItems, setExpandedItems] = React.useState(
|
|
39
|
-
/* @__PURE__ */ new Set()
|
|
40
|
-
);
|
|
41
|
-
const [visibilityByNodeId, setVisibilityByNodeId] = React.useState({});
|
|
42
|
-
const [isTreeExpanded, setIsTreeExpanded] = React.useState(true);
|
|
43
|
-
const highlighterRef = React.useRef(null);
|
|
44
|
-
const spatialStructureRef = React.useRef(null);
|
|
45
|
-
const currentModelIdRef = React.useRef(null);
|
|
46
|
-
const activeModelIdRef = React.useRef(null);
|
|
47
|
-
const appliedVisibilityByLocalIdRef = React.useRef(/* @__PURE__ */ new Map());
|
|
48
|
-
const getItemId = React.useCallback(
|
|
49
|
-
(item, path = "") => {
|
|
50
|
-
const currentPath = path ? `${path}/${item.name}` : item.name;
|
|
51
|
-
return item.localId ? `${item.localId}` : currentPath;
|
|
52
|
-
},
|
|
53
|
-
[]
|
|
54
|
-
);
|
|
55
21
|
React.useEffect(() => {
|
|
56
22
|
if (!bimComponents) return;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} catch (e) {
|
|
60
|
-
spatialStructureRef.current = new SpatialStructure(bimComponents);
|
|
61
|
-
}
|
|
62
|
-
const spatialStructure = spatialStructureRef.current;
|
|
63
|
-
setTree(spatialStructure.tree);
|
|
23
|
+
const spatialStructure = bimComponents.get(SpatialStructure);
|
|
24
|
+
setTrees(spatialStructure.trees);
|
|
64
25
|
setIsLoading(spatialStructure.isLoading);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setIsLoading(data.isLoading);
|
|
70
|
-
};
|
|
71
|
-
spatialStructure.onSpatialStructureCreated.add(handleTreeCreated);
|
|
72
|
-
spatialStructure.onLoadingStateChanged.add(handleLoadingChanged);
|
|
73
|
-
try {
|
|
74
|
-
highlighterRef.current = bimComponents.get(OBF.Highlighter);
|
|
75
|
-
} catch (e) {
|
|
76
|
-
}
|
|
26
|
+
const onTrees = (data) => setTrees(data.trees);
|
|
27
|
+
const onLoading = (data) => setIsLoading(data.isLoading);
|
|
28
|
+
spatialStructure.onSpatialStructureCreated.add(onTrees);
|
|
29
|
+
spatialStructure.onLoadingStateChanged.add(onLoading);
|
|
77
30
|
try {
|
|
78
31
|
const fragments = bimComponents.get(OBC.FragmentsManager);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
currentModelIdRef.current = modelId;
|
|
83
|
-
} else if (fragmentsList.size > 0) {
|
|
84
|
-
currentModelIdRef.current = Array.from(fragmentsList.keys())[0];
|
|
32
|
+
for (const modelId of fragments.list.keys()) {
|
|
33
|
+
if (!spatialStructure.hasTree(modelId)) {
|
|
34
|
+
void spatialStructure.getSpatialStructure(modelId);
|
|
85
35
|
}
|
|
86
36
|
}
|
|
87
37
|
} catch (e) {
|
|
88
38
|
}
|
|
89
|
-
if (activeModelIdRef.current !== currentModelIdRef.current) {
|
|
90
|
-
activeModelIdRef.current = currentModelIdRef.current;
|
|
91
|
-
appliedVisibilityByLocalIdRef.current = /* @__PURE__ */ new Map();
|
|
92
|
-
setVisibilityByNodeId({});
|
|
93
|
-
}
|
|
94
|
-
if (currentModelIdRef.current && !spatialStructure.tree && !spatialStructure.isLoading) {
|
|
95
|
-
void spatialStructure.getSpatialStructure(currentModelIdRef.current);
|
|
96
|
-
}
|
|
97
39
|
return () => {
|
|
98
|
-
spatialStructure.onSpatialStructureCreated.remove(
|
|
99
|
-
spatialStructure.onLoadingStateChanged.remove(
|
|
40
|
+
spatialStructure.onSpatialStructureCreated.remove(onTrees);
|
|
41
|
+
spatialStructure.onLoadingStateChanged.remove(onLoading);
|
|
100
42
|
};
|
|
101
|
-
}, [bimComponents
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
appliedVisibilityByLocalIdRef.current.set(appliedKey, effectiveVisible);
|
|
118
|
-
if (effectiveVisible) {
|
|
119
|
-
showIds.push(item.localId);
|
|
120
|
-
} else {
|
|
121
|
-
hideIds.push(item.localId);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
for (const child of item.children) {
|
|
126
|
-
visit(child, `${parentPath}/${item.name}`, effectiveVisible);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
for (const child of tree.children) {
|
|
130
|
-
visit(child);
|
|
131
|
-
}
|
|
132
|
-
if (hideIds.length === 0 && showIds.length === 0) return;
|
|
133
|
-
void (async () => {
|
|
134
|
-
try {
|
|
135
|
-
if (hideIds.length > 0) {
|
|
136
|
-
await model.setVisible(hideIds, false);
|
|
137
|
-
}
|
|
138
|
-
if (showIds.length > 0) {
|
|
139
|
-
await model.setVisible(showIds, true);
|
|
140
|
-
}
|
|
141
|
-
void fragments.core.update(true);
|
|
142
|
-
} catch (error) {
|
|
143
|
-
console.warn("Failed to sync spatial visibility:", error);
|
|
144
|
-
}
|
|
145
|
-
})();
|
|
146
|
-
}, [bimComponents, tree, getItemId, visibilityByNodeId]);
|
|
147
|
-
React.useEffect(() => {
|
|
148
|
-
if (!tree || !searchQuery.trim()) return;
|
|
149
|
-
const next = new Set(expandedItems);
|
|
150
|
-
const expandParents = (items, parentPath = "", parentId) => {
|
|
151
|
-
for (const item of items) {
|
|
152
|
-
const itemId = getItemId(item, parentPath);
|
|
153
|
-
const matches = item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
154
|
-
if (matches && parentId) next.add(parentId);
|
|
155
|
-
if (item.children.length > 0) {
|
|
156
|
-
expandParents(item.children, `${parentPath}/${item.name}`, itemId);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
expandParents(tree.children);
|
|
161
|
-
setExpandedItems(next);
|
|
162
|
-
}, [searchQuery, tree, getItemId]);
|
|
163
|
-
const handleNodeClick = React.useCallback((item) => {
|
|
164
|
-
if (!highlighterRef.current || !currentModelIdRef.current || item.localId === void 0) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
void highlighterRef.current.clear("select");
|
|
169
|
-
const selection = {
|
|
170
|
-
[currentModelIdRef.current]: /* @__PURE__ */ new Set([item.localId])
|
|
171
|
-
};
|
|
172
|
-
void highlighterRef.current.highlightByID("select", selection);
|
|
173
|
-
} catch (error) {
|
|
174
|
-
console.warn("Highlighting failed:", error);
|
|
175
|
-
}
|
|
176
|
-
}, []);
|
|
177
|
-
const handleNodeHover = React.useCallback(
|
|
178
|
-
(item, isHovering) => {
|
|
179
|
-
if (!highlighterRef.current || !currentModelIdRef.current || item.localId === void 0) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
if (isHovering) {
|
|
184
|
-
const selection = {
|
|
185
|
-
[currentModelIdRef.current]: /* @__PURE__ */ new Set([item.localId])
|
|
186
|
-
};
|
|
187
|
-
void highlighterRef.current.highlightByID("hover", selection);
|
|
188
|
-
} else {
|
|
189
|
-
void highlighterRef.current.clear("hover");
|
|
190
|
-
}
|
|
191
|
-
} catch (error) {
|
|
192
|
-
console.warn("Hover highlighting failed:", error);
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
[]
|
|
196
|
-
);
|
|
197
|
-
const syncVisibilityToModel = React.useCallback(async (nextVisibilityByNodeId) => {
|
|
198
|
-
var _a;
|
|
199
|
-
if (!bimComponents || !currentModelIdRef.current) return;
|
|
200
|
-
const fragments = bimComponents.get(OBC.FragmentsManager);
|
|
201
|
-
const model = fragments.core.models.list.get(currentModelIdRef.current);
|
|
202
|
-
if (!(model == null ? void 0 : model.setVisible)) return;
|
|
203
|
-
const hideIds = [];
|
|
204
|
-
const showIds = [];
|
|
205
|
-
const visit = (node, parentPath = "", parentVisible = true) => {
|
|
206
|
-
var _a2;
|
|
207
|
-
const itemId = getItemId(node, parentPath);
|
|
208
|
-
const nodeVisible = (_a2 = nextVisibilityByNodeId[itemId]) != null ? _a2 : true;
|
|
209
|
-
const effectiveVisible = parentVisible && nodeVisible;
|
|
210
|
-
if (node.localId !== void 0) {
|
|
211
|
-
const appliedKey = `${currentModelIdRef.current}:${node.localId}`;
|
|
212
|
-
const lastAppliedVisible = appliedVisibilityByLocalIdRef.current.get(appliedKey);
|
|
213
|
-
if (lastAppliedVisible !== effectiveVisible) {
|
|
214
|
-
appliedVisibilityByLocalIdRef.current.set(appliedKey, effectiveVisible);
|
|
215
|
-
if (effectiveVisible) {
|
|
216
|
-
showIds.push(node.localId);
|
|
217
|
-
} else {
|
|
218
|
-
hideIds.push(node.localId);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
for (const child of node.children) {
|
|
223
|
-
visit(child, `${parentPath}/${node.name}`, effectiveVisible);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
for (const child of (_a = tree == null ? void 0 : tree.children) != null ? _a : []) {
|
|
227
|
-
visit(child);
|
|
228
|
-
}
|
|
229
|
-
if (hideIds.length === 0 && showIds.length === 0) return;
|
|
230
|
-
try {
|
|
231
|
-
if (hideIds.length > 0) {
|
|
232
|
-
await model.setVisible(hideIds, false);
|
|
233
|
-
}
|
|
234
|
-
if (showIds.length > 0) {
|
|
235
|
-
await model.setVisible(showIds, true);
|
|
236
|
-
}
|
|
237
|
-
void fragments.core.update(true);
|
|
238
|
-
} catch (error) {
|
|
239
|
-
console.warn("Failed to sync spatial visibility:", error);
|
|
240
|
-
}
|
|
241
|
-
}, [bimComponents, getItemId, tree]);
|
|
242
|
-
const applyNodeVisibility = React.useCallback(async (item, visible) => {
|
|
243
|
-
const nextVisibility = __spreadValues({}, visibilityByNodeId);
|
|
244
|
-
const setNodeAndChildren = (node, parentPath = "") => {
|
|
245
|
-
const itemId = getItemId(node, parentPath);
|
|
246
|
-
nextVisibility[itemId] = visible;
|
|
247
|
-
for (const child of node.children) {
|
|
248
|
-
setNodeAndChildren(child, `${parentPath}/${node.name}`);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
setNodeAndChildren(item);
|
|
252
|
-
setVisibilityByNodeId(nextVisibility);
|
|
253
|
-
await syncVisibilityToModel(nextVisibility);
|
|
254
|
-
}, [getItemId, syncVisibilityToModel, visibilityByNodeId]);
|
|
255
|
-
const handleNodeVisibilityChange = React.useCallback((item, nextVisible) => {
|
|
256
|
-
void applyNodeVisibility(item, nextVisible);
|
|
257
|
-
}, [applyNodeVisibility]);
|
|
258
|
-
const toggleExpanded = (id) => {
|
|
259
|
-
const next = new Set(expandedItems);
|
|
260
|
-
if (next.has(id)) next.delete(id);
|
|
261
|
-
else next.add(id);
|
|
262
|
-
setExpandedItems(next);
|
|
263
|
-
};
|
|
264
|
-
const toggleTreeExpansion = React.useCallback(() => {
|
|
265
|
-
if (!tree) return;
|
|
266
|
-
const newIsExpanded = !isTreeExpanded;
|
|
267
|
-
setIsTreeExpanded(newIsExpanded);
|
|
268
|
-
if (newIsExpanded) {
|
|
269
|
-
const expandAll = (item, expanded, path = "") => {
|
|
270
|
-
const itemId = getItemId(item, path);
|
|
271
|
-
expanded.add(itemId);
|
|
272
|
-
for (const child of item.children) {
|
|
273
|
-
expandAll(child, expanded, `${path}/${item.name}`);
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const next = /* @__PURE__ */ new Set();
|
|
277
|
-
for (const child of tree.children) expandAll(child, next);
|
|
278
|
-
setExpandedItems(next);
|
|
279
|
-
} else {
|
|
280
|
-
setExpandedItems(/* @__PURE__ */ new Set());
|
|
281
|
-
}
|
|
282
|
-
}, [isTreeExpanded, tree, getItemId]);
|
|
283
|
-
const treeBody = isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
284
|
-
/* @__PURE__ */ jsx(LR.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
285
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("loadingText") })
|
|
286
|
-
] }) : tree ? /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
287
|
-
tree.children.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-1", children: tree.children.map((item) => {
|
|
288
|
-
const itemId = getItemId(item);
|
|
289
|
-
return /* @__PURE__ */ jsx(
|
|
290
|
-
SpatialTreeNode,
|
|
291
|
-
{
|
|
292
|
-
item,
|
|
293
|
-
getItemId,
|
|
294
|
-
expandedItems,
|
|
295
|
-
onToggleExpanded: toggleExpanded,
|
|
296
|
-
onNodeClick: handleNodeClick,
|
|
297
|
-
onNodeHover: handleNodeHover,
|
|
298
|
-
onNodeVisibilityChange: handleNodeVisibilityChange,
|
|
299
|
-
visibilityByNodeId,
|
|
300
|
-
searchQuery,
|
|
301
|
-
path: ""
|
|
302
|
-
},
|
|
303
|
-
itemId
|
|
304
|
-
);
|
|
305
|
-
}) }),
|
|
306
|
-
searchQuery.trim() && !tree.children.some(
|
|
307
|
-
(child) => child.name.toLowerCase().includes(searchQuery.toLowerCase()) || hasMatchingDescendants(child, searchQuery)
|
|
308
|
-
) && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
43
|
+
}, [bimComponents]);
|
|
44
|
+
const controls = useBimTreeControls({
|
|
45
|
+
components: bimComponents,
|
|
46
|
+
nodes: trees,
|
|
47
|
+
searchQuery
|
|
48
|
+
});
|
|
49
|
+
let body;
|
|
50
|
+
if (isLoading && trees.length === 0) {
|
|
51
|
+
body = /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-8", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(LR.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
53
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("loadingText") })
|
|
54
|
+
] });
|
|
55
|
+
} else if (trees.length === 0) {
|
|
56
|
+
body = /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("noneAvailable") }) });
|
|
57
|
+
} else if (controls.nodes.length === 0) {
|
|
58
|
+
body = /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
309
59
|
t("noResults"),
|
|
310
60
|
" \u201C",
|
|
311
61
|
searchQuery,
|
|
312
62
|
"\u201D"
|
|
313
|
-
] }) })
|
|
314
|
-
|
|
63
|
+
] }) });
|
|
64
|
+
} else {
|
|
65
|
+
body = /* @__PURE__ */ jsx(BimTreeView, { nodes: controls.nodes, controls, source: "spatial" });
|
|
66
|
+
}
|
|
315
67
|
return /* @__PURE__ */ jsx(
|
|
316
|
-
|
|
68
|
+
LayerViewPanel,
|
|
317
69
|
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
70
|
+
actions: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Button,
|
|
73
|
+
{
|
|
74
|
+
variant: "ghost",
|
|
75
|
+
size: "icon",
|
|
76
|
+
className: "h-6 w-6 p-0",
|
|
77
|
+
onClick: () => clearSource("spatial"),
|
|
78
|
+
disabled: !hasOverrides("spatial"),
|
|
79
|
+
title: t("resetColorsTitle"),
|
|
80
|
+
children: /* @__PURE__ */ jsx(LR.Paintbrush, { className: "h-4 w-4" })
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
variant: "ghost",
|
|
87
|
+
size: "icon",
|
|
88
|
+
className: "h-6 w-6 p-0",
|
|
89
|
+
onClick: controls.showAll,
|
|
90
|
+
title: t("showAllTitle"),
|
|
91
|
+
children: /* @__PURE__ */ jsx(LR.Eye, { className: "h-4 w-4" })
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Button,
|
|
96
|
+
{
|
|
97
|
+
variant: "ghost",
|
|
98
|
+
size: "icon",
|
|
99
|
+
className: "h-6 w-6 p-0",
|
|
100
|
+
onClick: controls.toggleExpandAll,
|
|
101
|
+
title: controls.isFullyExpanded ? t("collapseTitle") : t("expandTitle"),
|
|
102
|
+
children: controls.isFullyExpanded ? /* @__PURE__ */ jsx(LR.ListCollapse, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(LR.ListFilterPlus, { className: "h-4 w-4" })
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
] }),
|
|
106
|
+
children: body
|
|
333
107
|
}
|
|
334
108
|
);
|
|
335
109
|
}
|
|
336
|
-
function SpatialTreeNode({
|
|
337
|
-
item,
|
|
338
|
-
getItemId,
|
|
339
|
-
expandedItems,
|
|
340
|
-
onToggleExpanded,
|
|
341
|
-
onNodeClick,
|
|
342
|
-
onNodeHover,
|
|
343
|
-
onNodeVisibilityChange,
|
|
344
|
-
visibilityByNodeId,
|
|
345
|
-
searchQuery,
|
|
346
|
-
path = ""
|
|
347
|
-
}) {
|
|
348
|
-
var _a;
|
|
349
|
-
const itemId = getItemId(item, path);
|
|
350
|
-
const hasChildren = item.children && item.children.length > 0;
|
|
351
|
-
const isExpanded = expandedItems.has(itemId);
|
|
352
|
-
const isVisible = (_a = visibilityByNodeId[itemId]) != null ? _a : true;
|
|
353
|
-
const itemMatchesSearch = searchQuery === "" || item.name.toLowerCase().includes(searchQuery.toLowerCase());
|
|
354
|
-
const visibleChildren = React.useMemo(() => {
|
|
355
|
-
if (!hasChildren) return [];
|
|
356
|
-
if (searchQuery === "") return item.children;
|
|
357
|
-
return item.children.filter(
|
|
358
|
-
(child) => child.name.toLowerCase().includes(searchQuery.toLowerCase()) || hasMatchingDescendants(child, searchQuery)
|
|
359
|
-
);
|
|
360
|
-
}, [hasChildren, item.children, searchQuery]);
|
|
361
|
-
const shouldShow = itemMatchesSearch || visibleChildren.length > 0;
|
|
362
|
-
if (!shouldShow) return null;
|
|
363
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
364
|
-
/* @__PURE__ */ jsxs(
|
|
365
|
-
"div",
|
|
366
|
-
{
|
|
367
|
-
className: "flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-accent/50 transition-colors cursor-pointer",
|
|
368
|
-
onClick: () => onNodeClick(item),
|
|
369
|
-
onMouseEnter: () => onNodeHover(item, true),
|
|
370
|
-
onMouseLeave: () => onNodeHover(item, false),
|
|
371
|
-
children: [
|
|
372
|
-
/* @__PURE__ */ jsx(
|
|
373
|
-
Button,
|
|
374
|
-
{
|
|
375
|
-
variant: "ghost",
|
|
376
|
-
size: "icon",
|
|
377
|
-
className: "h-4 w-4 p-0",
|
|
378
|
-
onClick: (e) => {
|
|
379
|
-
e.stopPropagation();
|
|
380
|
-
if (hasChildren) onToggleExpanded(itemId);
|
|
381
|
-
},
|
|
382
|
-
disabled: !hasChildren,
|
|
383
|
-
children: hasChildren ? isExpanded ? /* @__PURE__ */ jsx(LR.ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(LR.ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx("div", { className: "w-4 h-4" })
|
|
384
|
-
}
|
|
385
|
-
),
|
|
386
|
-
/* @__PURE__ */ jsx("span", { className: cn("text-sm flex-1", isVisible ? "text-foreground" : "text-muted-foreground line-through"), children: item.name }),
|
|
387
|
-
/* @__PURE__ */ jsx(
|
|
388
|
-
"div",
|
|
389
|
-
{
|
|
390
|
-
className: "flex items-center",
|
|
391
|
-
onClick: (e) => e.stopPropagation(),
|
|
392
|
-
children: /* @__PURE__ */ jsx(
|
|
393
|
-
Switch,
|
|
394
|
-
{
|
|
395
|
-
checked: isVisible,
|
|
396
|
-
onCheckedChange: (checked) => onNodeVisibilityChange(item, checked),
|
|
397
|
-
"aria-label": `Toggle visibility for ${item.name}`
|
|
398
|
-
}
|
|
399
|
-
)
|
|
400
|
-
}
|
|
401
|
-
)
|
|
402
|
-
]
|
|
403
|
-
}
|
|
404
|
-
),
|
|
405
|
-
isExpanded && visibleChildren.length > 0 && /* @__PURE__ */ jsx("div", { className: "ml-4 space-y-1", children: visibleChildren.map((child) => {
|
|
406
|
-
const childPath = `${path}/${item.name}`;
|
|
407
|
-
const childId = getItemId(child, childPath);
|
|
408
|
-
return /* @__PURE__ */ jsx(
|
|
409
|
-
SpatialTreeNode,
|
|
410
|
-
{
|
|
411
|
-
item: child,
|
|
412
|
-
getItemId,
|
|
413
|
-
expandedItems,
|
|
414
|
-
onToggleExpanded,
|
|
415
|
-
onNodeClick,
|
|
416
|
-
onNodeHover,
|
|
417
|
-
onNodeVisibilityChange,
|
|
418
|
-
visibilityByNodeId,
|
|
419
|
-
searchQuery,
|
|
420
|
-
path: childPath
|
|
421
|
-
},
|
|
422
|
-
childId
|
|
423
|
-
);
|
|
424
|
-
}) })
|
|
425
|
-
] });
|
|
426
|
-
}
|
|
427
|
-
function hasMatchingDescendants(item, searchQuery) {
|
|
428
|
-
if (searchQuery === "") return false;
|
|
429
|
-
return item.children.some(
|
|
430
|
-
(child) => child.name.toLowerCase().includes(searchQuery.toLowerCase()) || hasMatchingDescendants(child, searchQuery)
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
110
|
export {
|
|
434
111
|
SpatialStructureSection
|
|
435
112
|
};
|