epic-designer-gold
Version:
基于vue3的设计器,可视化开发页面表单
66 lines (65 loc) • 1.7 kB
JavaScript
import { defineComponent as s, h as f, renderSlot as i } from "vue";
import { ElTable as S } from "element-plus";
const y = s({
props: {
componentSchema: {
type: Object,
require: !0,
default: () => ({})
},
modelValue: {
type: Array,
default: () => []
}
},
setup(n, { slots: c }) {
return () => {
var u;
const a = {
...n.componentSchema,
title: ((u = n.componentSchema) == null ? void 0 : u.label) ?? "",
border: !0
}, p = a.children.map((l) => {
var r, e, t, o;
return l.isDesign = (e = (r = n.componentSchema) == null ? void 0 : r.componentProps) == null ? void 0 : e.isDesign, l.align = (o = (t = n.componentSchema) == null ? void 0 : t.componentProps) == null ? void 0 : o.align, l;
});
delete a.children, a.data = n.modelValue && n.modelValue.length ? n.modelValue : [
{
id: "1"
}
];
function h({ row: l, column: r, rowIndex: e }) {
const t = a.data, o = r.property;
if (e === 0 || t[e][o] !== t[e - 1][o]) {
let d = 1;
for (let m = e + 1; m < t.length && t[m][o] === t[e][o]; m++)
d++;
return [d, 1];
}
return [0, 0];
}
return f(
S,
{
...a,
"span-method": a.componentProps.isMerge ? h : null
},
{
default: () => [
i(
c,
"edit-node",
{},
() => p.map(
(l) => i(c, "node", { componentSchema: l })
)
)
]
}
);
};
}
});
export {
y as default
};