@aplus-frontend/ui
Version:
135 lines (134 loc) • 4.47 kB
JavaScript
import { defineComponent as B, createElementBlock as v, openBlock as n, normalizeClass as t, unref as e, createElementVNode as p, createVNode as s, createCommentVNode as c, createBlock as r, resolveDynamicComponent as E, withCtx as u } from "vue";
import { HolderOutlined as I, VerticalAlignTopOutlined as g, VerticalAlignMiddleOutlined as O, DeleteOutlined as D } from "@ant-design/icons-vue";
import { Space as z, Tooltip as f } from "@aplus-frontend/antdv";
import "../../../../config-provider/index.mjs";
import A from "../images/icon_carst_down.svg.mjs";
import M from "../images/icon_fill_right.svg.mjs";
import { useInjectSorterMethods as S } from "../sorter/context.mjs";
import { getLabelRenderNode as U } from "../utils.mjs";
import { useNamespace as j } from "../../../../config-provider/hooks/use-namespace.mjs";
import { useLocale as H } from "../../../../config-provider/hooks/use-locale.mjs";
const q = ["src"], ee = /* @__PURE__ */ B({
__name: "item",
props: {
value: {},
"onUpdate:value": { type: Function },
level: {},
open: { type: Boolean }
},
emits: ["update:open", "update:value"],
setup(k, { emit: b }) {
const o = k, x = b, { b: a, be: m, is: C } = j("ap-column-setting-sortable-item-meta"), { fixedToLeft: T, fixedToRight: w, unFixed: V } = S(), { t: d } = H();
function h(l) {
const i = o.value;
return i.fixed = l, i.children?.forEach((N) => N.fixed = l), i;
}
function y() {
const l = h("left");
T(l);
}
function _() {
const l = h("right");
w(l);
}
function R() {
const l = h(void 0);
V(l);
}
function F() {
x("update:open", !o.open);
}
function L() {
const l = o.value;
l.show = !1, l.children?.forEach((i) => i.show = !1);
}
return (l, i) => (n(), v("div", {
class: t(e(a)())
}, [
p("span", {
class: t(e(a)("left"))
}, [
s(e(I), {
class: t(e(m)("left", "holder")),
style: { "font-size": "16px", color: "#abb7cc" }
}, null, 8, ["class"]),
p("span", {
class: t(e(m)("left", "indicator")),
onClick: F
}, [
l.value.children?.length ? (n(), v("img", {
key: 0,
src: o.open ? e(M) : e(A)
}, null, 8, q)) : c("", !0)
], 2),
p("span", {
class: t([e(m)("left", "label-wrapper"), e(C)("level2", o.level === 2)])
}, [
(n(), r(E(e(U)(l.value.label))))
], 2)
], 2),
p("span", {
class: t(e(a)("right"))
}, [
s(e(z), null, {
default: u(() => [
o.level !== 2 && l.value.fixed !== "left" ? (n(), r(e(f), {
key: 0,
title: e(d)("ap.apTable.setting.fixToLeft")
}, {
default: u(() => [
s(e(g), {
rotate: 270,
class: t(e(a)("action-icon")),
onClick: y
}, null, 8, ["class"])
]),
_: 1
}, 8, ["title"])) : c("", !0),
o.level !== 2 && l.value.fixed ? (n(), r(e(f), {
key: 1,
title: e(d)("ap.apTable.setting.unFixed")
}, {
default: u(() => [
s(e(O), {
class: t(e(a)("action-icon")),
onClick: R
}, null, 8, ["class"])
]),
_: 1
}, 8, ["title"])) : c("", !0),
o.level !== 2 && l.value.fixed !== "right" ? (n(), r(e(f), {
key: 2,
title: e(d)("ap.apTable.setting.fixToRight")
}, {
default: u(() => [
s(e(g), {
rotate: 90,
class: t(e(a)("action-icon")),
onClick: _
}, null, 8, ["class"])
]),
_: 1
}, 8, ["title"])) : c("", !0),
l.value.disabled ? c("", !0) : (n(), r(e(f), {
key: 3,
title: e(d)("ap.apTable.setting.delete")
}, {
default: u(() => [
s(e(D), {
class: t(e(a)("action-icon")),
onClick: L
}, null, 8, ["class"])
]),
_: 1
}, 8, ["title"]))
]),
_: 1
})
], 2)
], 2));
}
});
export {
ee as default
};