UNPKG

@huyuchen/visual

Version:

## 组件环境

87 lines (86 loc) 2.79 kB
import { useCssVars as S, computed as T, openBlock as a, createElementBlock as n, Fragment as r, renderList as p, createBlock as f, unref as s, normalizeClass as i, withCtx as u, createVNode as y, createTextVNode as g, toDisplayString as h, resolveDynamicComponent as k } from "vue"; import { ElRow as D, ElCol as m } from "element-plus"; import "element-plus/theme-chalk/base.css"; import "element-plus/theme-chalk/el-col.css"; import "element-plus/theme-chalk/el-row.css"; import "./HuLayoutTable.vue2.js"; import B from "../_virtual/_plugin-vue_export-helper.js"; const E = { class: "HuLayoutTable" }, N = { name: "HuLayoutTable" }, V = Object.assign(N, { props: { column: { type: Array, default: () => [] }, tableData: { type: Object, default: () => { } }, labelSpan: { // label的宽度 type: Number, default: 2 }, borderColor: { type: String, default: "#527ca7" }, rowHeight: { type: String, default: "30px" } }, setup(o) { S((d) => ({ "69b8e95e": o.borderColor, "1ecb57b0": o.rowHeight })); const w = o, c = T(() => w.column.reduce((e, l) => { const t = l.span || 24, _ = ((e || []).at(-1) || []).reduce((x, C) => { const H = C.span || 24; return x += H; }, t); return t === 24 ? (e.push([l]), e) : _ <= 24 ? (e[e.length - 1] || (e[e.length - 1] = []), e[e.length - 1].push(l), e) : (e.push([l]), e); }, [])); return (d, L) => (a(), n("div", E, [ (a(!0), n(r, null, p(c.value, (e, l) => (a(), f(s(D), { gutter: 0, class: i([l !== c.value.length - 1 ? "border-bottom" : "", "HuLayoutTable-row"]) }, { default: u(() => [ (a(!0), n(r, null, p(e, (t, b) => (a(), n(r, null, [ y(s(m), { span: o.labelSpan, class: "border-right HuLayoutTable-label" }, { default: u(() => [ g(h(t.label), 1) ]), _: 2 }, 1032, ["span"]), y(s(m), { span: (t.span || 24) - o.labelSpan, class: i([b !== e.length - 1 ? "border-right" : "", "HuLayoutTable-content"]) }, { default: u(() => [ t.render ? (a(), f(k(t.render), { key: 0, row: t }, null, 8, ["row"])) : (a(), n(r, { key: 1 }, [ g(h(o.tableData[t.prop]), 1) ], 64)) ]), _: 2 }, 1032, ["span", "class"]) ], 64))), 256)) ]), _: 2 }, 1032, ["class"]))), 256)) ])); } }), q = /* @__PURE__ */ B(V, [["__scopeId", "data-v-afee6ae8"]]); export { q as default };