@ea-lab/reactive-json
Version:
A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.
27 lines (26 loc) • 1.07 kB
JavaScript
import { e as D } from "../../httpRequestCommon-C7MsJIKA.js";
import { evaluateTemplateValue as c } from "../../engine/TemplateSystem.js";
const x = (t) => {
var m, r;
const { globalDataContext: l, templateContext: i } = t, o = l.getRootContext ? l.getRootContext() : l;
let e = {};
(m = t == null ? void 0 : t.args) != null && m.hasOwnProperty("data") ? (e = t.args.data, e = ((a, n) => {
if (Array.isArray(a))
return a.map(n);
if (typeof a == "object" && a !== null) {
const s = Object.entries(a).map(([_, d]) => [_, n(d)]);
return Object.fromEntries(s);
} else
return n(a);
})(e, (a) => c({ valueToEvaluate: a, globalDataContext: o, templateContext: i })), o.templateData.__state !== void 0 && (e.__state = o.templateData.__state)) : (e.data = o.templateData, o.templateData.__state !== void 0 && (e.data.__state = o.templateData.__state)), D(
t,
{
method: ((r = t == null ? void 0 : t.args) == null ? void 0 : r.httpMethod) ?? "post",
data: e
},
"submitData"
);
};
export {
x as submitData
};