synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
23 lines (22 loc) • 953 B
JavaScript
import { jsx as l } from "react/jsx-runtime";
import { getDefaultRegistry as A } from "@rjsf/core";
import { ADDITIONAL_PROPERTY_FLAG as j, deepEquals as p } from "@rjsf/utils";
import { useEffect as b } from "react";
import { getPossibleTopLevelPropertiesInObjectSchema as d, convertToArray as u } from "../AnnotationEditorUtils.js";
function g(a) {
const { schema: s, formData: r, onChange: n } = a, {
fields: { ObjectField: c }
} = A();
return b(() => {
const t = { ...r }, f = d(s);
f && (Object.entries(f).forEach(([i, e]) => {
const o = t[i];
e[j] ? Array.isArray(o) || (t[i] = u(o)) : typeof e == "object" && "type" in e && e.type !== "array" && Array.isArray(o) && (t[i] = o.map((m) => `${m}`).join(", "));
}), p(r, t) || n(t));
}, [s, r, n]), /* @__PURE__ */ l(c, { ...a });
}
export {
g as SynapseAnnotationsRJSFObjectField,
g as default
};
//# sourceMappingURL=SynapseAnnotationsRJSFObjectField.js.map