synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
22 lines (21 loc) • 1.1 kB
JavaScript
import { jsx as r } from "react/jsx-runtime";
import { isJSONPrimitive as t, isJSONObjectAllPrimitiveKeys as l } from "./JSONRendererUtils.js";
import { JSONPrimitiveRenderer as m } from "./JSONPrimitiveRenderer.js";
import { JSONArrayRenderer as a } from "./JSONArrayRenderer.js";
import { JSONObjectRenderer as n } from "./JSONObjectRenderer.js";
import { ComplexJSONRenderer as f } from "./ComplexJSONRenderer.js";
import { Typography as p } from "@mui/material";
function u(i) {
let e = i.value;
try {
typeof e == "string" && (e = JSON.parse(e));
} catch (o) {
console.warn("JSONTableCellRenderer: failed to parse JSON", o);
}
return t(e) || e === null ? /* @__PURE__ */ r(p, { variant: "smallText1", children: /* @__PURE__ */ r(m, { value: e }) }) : Array.isArray(e) && e.every(t) ? /* @__PURE__ */ r(a, { value: e }) : typeof e == "object" && // To render a simple flat table, ensure that we have no array/object values
l(e) ? /* @__PURE__ */ r(n, { value: e }) : /* @__PURE__ */ r(f, { value: e });
}
export {
u as default
};
//# sourceMappingURL=JSONTableCellRenderer.js.map