ant-design-x-vue-next
Version:
Ant Design X for Vue — community continuation aligned with @ant-design/x
66 lines (65 loc) • 1.67 kB
JavaScript
import { isPathObject as c, getValueByPath as s, isPathValue as a } from "./utils.mjs";
import { setValueByPath as V } from "./utils.mjs";
function p(e) {
return e !== null && typeof e == "object" && typeof e.literalString == "string";
}
function f(e, n, o = !1) {
if (p(e))
return e.literalString;
if (c(e))
return o ? e : s(n, e.path);
if (a(e))
return s(n, e);
if (Array.isArray(e))
return e.map((t) => f(t, n, !1));
if (e && typeof e == "object") {
const t = {};
for (const [r, i] of Object.entries(e))
r === "value" && "key" in e ? t[r] = f(i, n, !0) : t[r] = f(i, n, !1);
return t;
}
return e;
}
function l(e, n) {
const o = {};
for (const [t, r] of Object.entries(e))
o[t] = f(r, n);
return o;
}
function b(e, n) {
const o = e == null ? void 0 : e.context;
if (!Array.isArray(o)) return [];
const t = [];
for (const r of o)
if (r && typeof r == "object" && "key" in r && "value" in r) {
const i = r.value;
if (c(i)) {
const u = n[r.key];
u !== void 0 && t.push({ path: i.path, value: u });
}
}
return t;
}
function g(e, n) {
const o = { ...e };
for (const t of n)
if ("valueString" in t && t.valueString !== void 0)
o[t.key] = t.valueString;
else if (Array.isArray(t.valueMap)) {
const r = {};
for (const { key: i, valueString: u } of t.valueMap)
r[i] = u;
o[t.key] = r;
}
return o;
}
export {
g as applyDataModelUpdateV08,
b as extractDataUpdatesV08,
s as getValueByPath,
p as isLiteralStringObject,
c as isPathObject,
a as isPathValue,
l as resolvePropsV08,
V as setValueByPath
};