@kit-data-manager/react-search-component
Version:
All-in-one component for rendering an elastic search UI for searching anything. Built-in support for visualizing related items in a graph and resolving unique identifiers.
22 lines • 959 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { PidNameDisplay } from "../../components/result/PidNameDisplay";
import { PidResolver } from "../../lib/PidResolver";
/**
* @internal
* @param data
* @constructor
*/
export function ObjectRender({ data }) {
if ("raw" in data && typeof data.raw === "string") {
if (PidResolver.isPID(data.raw)) {
return _jsx(PidNameDisplay, { pid: data.raw });
}
else {
return _jsx("div", { children: data.raw });
}
}
return (_jsx("div", { className: "rfs:min-w-0 rfs:wrap-break-word", children: Object.keys(data)
.filter((k) => !k.startsWith("_"))
.map((key) => (_jsxs("div", { children: [_jsx("div", { children: key }), _jsx("div", { className: "rfs:pl-4", children: typeof data[key] === "object" ? _jsx(ObjectRender, { data: data[key] }) : null })] }, key))) }));
}
//# sourceMappingURL=ObjectRender.js.map