snowy-designer
Version:
基于Epic-Designer-Pro版本的设计器,可视化开发页面表单
82 lines (81 loc) • 2.98 kB
JavaScript
import { defineComponent as x, inject as y, computed as m, createElementBlock as r, openBlock as i, createCommentVNode as B, createElementVNode as d, unref as t, createVNode as p, Fragment as C, renderList as w, createBlock as D, withCtx as u, createTextVNode as E } from "vue";
/* empty css */
import "radix-vue";
import "clsx";
import "tailwind-merge";
import "lucide-vue-next";
import "../../../ui-kit/base-ui/src/shadch-ui/button/index.js";
import { useVModel as U } from "@vueuse/core";
import "../../../ui-kit/base-ui/src/shadch-ui/toast/index.js";
import "vuedraggable";
import { getFormSchemas as b } from "../../../utils/src/common/data.js";
import "../../../hooks/src/store/index.js";
import "lodash";
import "../../../utils/src/manager/pluginManager.js";
import "monaco-editor";
import "../../../utils/src/request/index.js";
import { Switch as j, Button as F } from "ant-design-vue";
import S from "./conditionItem.vue.js";
const $ = { class: "flex" }, A = {
key: 0,
class: "logical-operator"
}, L = { class: "flex-1" }, oe = /* @__PURE__ */ x({
__name: "conditionEdit",
props: {
modelValue: {}
},
emits: ["update:modelValue"],
setup(f, { emit: v }) {
const h = f, k = v, V = y("designer"), c = m(() => V.state.selectedNode), _ = m(() => {
var n;
return b(
[c.value],
(n = c.value) == null ? void 0 : n.componentProps.name
).map((e) => ({ label: e.label, value: e.field })).reverse();
}), o = U(h, "modelValue", k);
function g() {
o.value.conditions.push({});
}
function N(n) {
o.value.conditions.splice(n, 1);
}
return (n, e) => (i(), r("div", $, [
t(o).conditions.length ? (i(), r("div", A, [
e[1] || (e[1] = d("div", { class: "logical-operator__line" }, null, -1)),
p(t(j), {
checked: t(o).operator,
"onUpdate:checked": e[0] || (e[0] = (s) => t(o).operator = s),
"checked-children": "且",
"checked-value": "and",
"un-checked-value": "or",
"un-checked-children": "或"
}, null, 8, ["checked"])
])) : B("", !0),
d("div", L, [
(i(!0), r(C, null, w(t(o).conditions, (s, l) => (i(), D(S, {
key: l,
modelValue: t(o).conditions[l],
"onUpdate:modelValue": (a) => t(o).conditions[l] = a,
"field-options": _.value,
onDelete: (a) => N(l)
}, null, 8, ["modelValue", "onUpdate:modelValue", "field-options", "onDelete"]))), 128)),
p(t(F), {
class: "w-100% flex items-center justify-center",
type: "dashed",
onClick: g
}, {
icon: u(() => e[2] || (e[2] = [
d("span", { class: "icon--epic icon--epic--add-rounded mr-1" }, null, -1)
])),
default: u(() => [
e[3] || (e[3] = E(" 添加条件 "))
]),
_: 1
})
])
]));
}
});
export {
oe as default
};