UNPKG

form-designer-xinyi

Version:

基于vue3的设计器,可视化开发页面表单

109 lines (108 loc) 4.02 kB
import { createVNode as b, defineComponent as y, ref as p, h as l, renderSlot as h } from "vue"; import { Button as w, Card as P, Popover as x } from "ant-design-vue"; import { I as g, Q as j } from "./QuestionCircleOutlined-Ou8kGTML.js"; var D = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, name: "down", theme: "outlined" }; function O(t) { for (var n = 1; n < arguments.length; n++) { var e = arguments[n] != null ? Object(arguments[n]) : {}, r = Object.keys(e); typeof Object.getOwnPropertySymbols == "function" && (r = r.concat(Object.getOwnPropertySymbols(e).filter(function(a) { return Object.getOwnPropertyDescriptor(e, a).enumerable; }))), r.forEach(function(a) { _(t, a, e[a]); }); } return t; } function _(t, n, e) { return n in t ? Object.defineProperty(t, n, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = e, t; } var f = function(n, e) { var r = O({}, n, e.attrs); return b(g, O({}, r, { icon: D }), null); }; f.displayName = "DownOutlined"; f.inheritAttrs = !1; var C = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, name: "up", theme: "outlined" }; function v(t) { for (var n = 1; n < arguments.length; n++) { var e = arguments[n] != null ? Object(arguments[n]) : {}, r = Object.keys(e); typeof Object.getOwnPropertySymbols == "function" && (r = r.concat(Object.getOwnPropertySymbols(e).filter(function(a) { return Object.getOwnPropertyDescriptor(e, a).enumerable; }))), r.forEach(function(a) { L(t, a, e[a]); }); } return t; } function L(t, n, e) { return n in t ? Object.defineProperty(t, n, { value: e, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = e, t; } var m = function(n, e) { var r = v({}, n, e.attrs); return b(g, v({}, r, { icon: C }), null); }; m.displayName = "UpOutlined"; m.inheritAttrs = !1; const B = y({ props: { componentSchema: { type: Object, require: !0, default: () => ({}) } }, setup(t, { slots: n }) { const e = p(!1), r = () => { e.value = !e.value; }, a = () => { var c, i, s, d; const o = p([]); if ((c = t.componentSchema) != null && c.suffix && (o.value = t.componentSchema.suffix.split(` `).filter((u) => u.trim() !== "")), (i = t.componentSchema) != null && i.suffix) { const u = l("div", null, o.value.map((S) => l("div", null, S))); return [ ((s = t.componentSchema) == null ? void 0 : s.label) ?? "", l( x, { content: u }, () => l(j, { class: "ant-form-item__suffix" }) // 默认插槽内容 ) ]; } return ((d = t.componentSchema) == null ? void 0 : d.label) ?? ""; }; return () => { const o = { ...t.componentSchema, // title: props.componentSchema?.label ?? "", title: a(), // loading:isCollapsed.value, // extra: h('button', { onClick: toggle }, isCollapsed.value ? '展开' : '收缩'), extra: l(w, { onClick: r, type: "text" }, () => [ l(e.value ? f : m), e.value ? " 展开" : " 收起" ]) }, c = o.children ?? []; return delete o.children, l(P, o, { default: () => e.value ? null : h( n, "edit-node", {}, () => c.map( (i) => h(n, "node", { componentSchema: i }) ) ) }); }; } }); export { B as default };