UNPKG

epic-designer-dev

Version:

基于vue3的设计器,可视化开发页面表单。在epic-designer的基础上新增了字典选择器

85 lines (84 loc) 2.78 kB
import { defineComponent as V, useSlots as b, provide as n, ref as v, computed as x, createElementBlock as B, openBlock as E, createElementVNode as c, createVNode as d, unref as y, withCtx as S, withDirectives as T, vShow as U } from "vue"; /* empty css */ import D from "../icon/icon.vue2.js"; import "@vueuse/core"; import "../../../../hooks/src/store/index.js"; import { pluginManager as I } from "../../../../utils/src/manager/pluginManager.js"; import N from "./treeNodes.vue.js"; const $ = { class: "epic-tree flex h-full flex-col" }, L = { class: "epic-search-box px-10px py-6px" }, M = { class: "epic-tree-main h-0 flex-1 overflow-auto" }, P = { class: "pt-42px text-center text-gray-400" }, O = /* @__PURE__ */ V({ name: "ETree", __name: "tree", props: { draggable: { type: Boolean, default: !1 }, hoverKey: { default: "" }, options: { default: () => [] }, selectedKeys: { default: () => [] } }, emits: ["update:selectedKeys", "nodeClick"], setup(_, { emit: g }) { const a = _, i = g, K = b(); n("slots", K); const C = I.getComponent("input"), l = v(""), w = v([]), p = x({ get() { return a.selectedKeys; }, set(o) { i("update:selectedKeys", o); } }), r = x({ get() { return u(a.options, l.value); }, set() { } }); function u(o, e) { const t = []; return o.forEach((s) => { var f; if ((f = s.label) != null && f.includes(e)) t.push(s); else if (s.children) { const m = u(s.children, e); if (m.length > 0) { const h = { ...s }; h.children = m, t.push(h); } } }), t; } function k(o, e) { p.value = [o], i("nodeClick", { componentSchema: e, id: o }); } return n("expandedKeys", w), n("selectedKeys", p), n("treeProps", a), n("handleSelect", k), (o, e) => (E(), B("div", $, [ c("div", L, [ d(y(C), { modelValue: l.value, "onUpdate:modelValue": e[0] || (e[0] = (t) => l.value = t), value: l.value, "onUpdate:value": e[1] || (e[1] = (t) => l.value = t), placeholder: "搜索节点", clearable: "", "allow-clear": "" }, { prefix: S(() => [ d(y(D), { name: "icon--epic--search-rounded" }) ]), _: 1 }, 8, ["modelValue", "value"]) ]), c("div", M, [ d(N, { schemas: r.value, "onUpdate:schemas": e[2] || (e[2] = (t) => r.value = t) }, null, 8, ["schemas"]), T(c("div", P, " 没有查询到的数据 ", 512), [ [U, r.value.length === 0] ]) ]) ])); } }); export { O as default };