@ea-lab/reactive-json
Version:
A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.
37 lines (36 loc) • 757 B
JavaScript
import { dataLocationToPath as i } from "../../engine/TemplateSystem.js";
const d = (e) => {
const { globalDataContext: a, templateContext: n } = e, { path: r, target: s } = e.args;
if (r === void 0 && s !== "currentTemplateData")
return;
let t;
if (r)
t = i({
currentPath: n.templatePath,
dataLocation: r,
globalDataContext: a,
templateContext: n
});
else {
t = n.templatePath;
let o = e.args.parentLevel ?? 0;
for (; o > 0; ) {
--o;
const l = t.lastIndexOf(".");
if (l < 1)
return;
t = t.substring(0, l);
}
}
const { increment: c } = e.args;
a == null || a.updateData(
{
increment: c
},
t,
"move"
);
};
export {
d as moveData
};