UNPKG

@aplus-frontend/ui

Version:

79 lines (78 loc) 2.69 kB
import { defineComponent as b, ref as g, createElementBlock as u, openBlock as s, normalizeClass as n, unref as e, createElementVNode as c, createBlock as w, createCommentVNode as f, toDisplayString as B, withCtx as r, createVNode as i, withModifiers as v } from "vue"; import { EditOutlined as N, DeleteOutlined as A } from "@ant-design/icons-vue"; import { Flex as D, Popover as E } from "@aplus-frontend/antdv"; import "../../../../config-provider/index.mjs"; import { useInjectApColumnSetting as V } from "../context.mjs"; import "./edit-form.vue.mjs"; import { useNamespace as F } from "../../../../config-provider/hooks/use-namespace.mjs"; import O from "./edit-form.vue2.mjs"; const M = /* @__PURE__ */ b({ __name: "item", props: { value: {}, isActive: { type: Boolean }, onClick: { type: Function }, shouldRemove: { type: Boolean } }, setup(d) { const p = d, { b: l } = F("ap-column-setting-template-item"), a = g(!1), { deleteTemplate: C, cacheConfig: k } = V(); function y(t) { if (!t || t === p.value.label) return; const o = p.value; o.label = t, a.value = !1; } return (t, o) => (s(), u("div", { class: n([e(l)(), { [e(l)("active")]: t.isActive }]), onClick: o[3] || (o[3] = //@ts-ignore (...m) => t.onClick && t.onClick(...m)) }, [ c("span", { class: n(e(l)("label")) }, B(t.value.label), 3), e(k).persistenceKey ? (s(), w(e(D), { key: 0, gap: 8, class: n(e(l)("action-wrapper")) }, { default: r(() => [ i(e(E), { open: a.value, trigger: "click", arrow: !1, placement: "bottom", "destroy-tooltip-on-hide": "" }, { content: r(() => [ i(O, { "initial-values": { label: t.value.label }, onConfirm: y, onCancel: o[1] || (o[1] = () => a.value = !1) }, null, 8, ["initial-values"]) ]), default: r(() => [ c("span", { class: n(e(l)("icon-wrapper")), onClick: o[0] || (o[0] = v((m) => a.value = !0, ["stop"])) }, [ i(e(N)) ], 2) ]), _: 1 }, 8, ["open"]), t.shouldRemove ? (s(), u("span", { key: 0, class: n(e(l)("icon-wrapper")), onClick: o[2] || (o[2] = v(() => e(C)(t.value.key), ["stop"])) }, [ i(e(A)) ], 2)) : f("", !0) ]), _: 1 }, 8, ["class"])) : f("", !0) ], 2)); } }); export { M as default };