@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
45 lines • 4.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OverviewPanel = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const react_1 = require("@neo4j-ndl/react");
const graph_visualization_context_1 = require("../graph-visualization-context");
const graph_visualization_sidepanel_1 = require("../graph-visualization-sidepanel");
const show_all_1 = require("./show-all");
const OVERVIEW_STEP_SIZE = 25;
const OverviewPanel = () => {
const { nvlGraph } = (0, graph_visualization_context_1.useGraphVisualizationContext)();
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(graph_visualization_sidepanel_1.GraphVisualizationSidepanel.Title, { children: (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "h6", children: "Results overview" }) }), (0, jsx_runtime_1.jsx)(graph_visualization_sidepanel_1.GraphVisualizationSidepanel.Content, { children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-graph-visualization-overview-panel", children: [nvlGraph.dataLookupTable.labels.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-overview-section", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-overview-header", children: (0, jsx_runtime_1.jsxs)("span", { children: ["Nodes", ` (${nvlGraph.nodes.length.toLocaleString()})`] }) }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-overview-items", tabIndex: 0, children: (0, jsx_runtime_1.jsx)(show_all_1.ShowAll, { initiallyShown: OVERVIEW_STEP_SIZE, isButtonGroup: true, children: nvlGraph.dataLookupTable.labels.map((label) => function GraphLabelWrapper() {
var _a, _b, _c, _d;
return ((0, jsx_runtime_1.jsxs)(react_1.GraphLabel, { type: "node", htmlAttributes: {
tabIndex: -1,
}, color: (_b = (_a = nvlGraph.dataLookupTable.labelMetaData[label]) === null || _a === void 0 ? void 0 : _a.mostCommonColor) !== null && _b !== void 0 ? _b : '', as: "span", children: [label, " (", (_d = (_c = nvlGraph.dataLookupTable.labelMetaData[label]) === null || _c === void 0 ? void 0 : _c.totalCount) !== null && _d !== void 0 ? _d : 0, ")"] }, label));
}) }) })] })), nvlGraph.dataLookupTable.types.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-overview-relationships-section", children: [(0, jsx_runtime_1.jsxs)("span", { className: "ndl-overview-relationships-title", children: ["Relationships", ` (${nvlGraph.rels.length.toLocaleString()})`] }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-overview-items", children: (0, jsx_runtime_1.jsx)(show_all_1.ShowAll, { initiallyShown: OVERVIEW_STEP_SIZE, isButtonGroup: true, children: nvlGraph.dataLookupTable.types.map((type) => {
var _a, _b, _c, _d;
return ((0, jsx_runtime_1.jsxs)(react_1.GraphLabel, { type: "relationship", htmlAttributes: {
tabIndex: -1,
}, color: (_b = (_a = nvlGraph.dataLookupTable.typeMetaData[type]) === null || _a === void 0 ? void 0 : _a.mostCommonColor) !== null && _b !== void 0 ? _b : '', as: "span", children: [type, " (", (_d = (_c = nvlGraph.dataLookupTable.typeMetaData[type]) === null || _c === void 0 ? void 0 : _c.totalCount) !== null && _d !== void 0 ? _d : 0, ")"] }, type));
}) }) })] }))] }) })] }));
};
exports.OverviewPanel = OverviewPanel;
//# sourceMappingURL=overview-panel.js.map