@aplus-frontend/ui
Version:
133 lines (132 loc) • 4.37 kB
JavaScript
import { defineComponent as G, ref as b, unref as e, computed as L, useSlots as M, createVNode as t, cloneVNode as P, createElementBlock as q, openBlock as k, Fragment as H, createBlock as J, createCommentVNode as Q, resolveDynamicComponent as W, withCtx as u, createElementVNode as a, normalizeClass as s, toDisplayString as m, createTextVNode as v, isRef as X } from "vue";
import { Button as y, Modal as Y, RadioGroup as Z, RadioButton as T, Divider as x } from "@aplus-frontend/antdv";
import { getSingleVNode as ee } from "../../../../utils/slot.mjs";
import { useInjectApTable as te } from "../../../context.mjs";
import "../tree-select/index.vue.mjs";
import { useTableColumnState as le } from "../../../hooks/use-table-column-state.mjs";
import "../../../../config-provider/index.mjs";
import "../sorter/index.vue.mjs";
import ne, { customCloneColumnStates as B } from "../utils.mjs";
import { SettingOutlined as oe } from "@ant-design/icons-vue";
import { useLocale as ae } from "../../../../config-provider/hooks/use-locale.mjs";
import { useNamespace as N } from "../../../../config-provider/hooks/use-namespace.mjs";
import se from "../tree-select/index.vue2.mjs";
import ie from "../sorter/index.vue2.mjs";
const Te = /* @__PURE__ */ G({
name: "ApTableSetting",
__name: "index",
props: {
config: {
default: () => ({})
}
},
setup(h) {
const c = h, {
columnsBackup: _,
size: z,
updateSize: A,
updateColumns: V
} = te(), d = b(e(z)), R = L(() => c.config.persistenceKey), {
columnState: l,
setColumnState: w,
isAllSelected: D,
toggleSelectAll: O,
columnStateBackup: U,
setColumnStateBackup: E,
cacheColumnStateIfNeeded: I
} = le(c.config, R, []), {
t: n
} = ae(), {
b: f,
be: g
} = N("ap-column-setting"), {
b: K
} = N("ap-table"), r = b(!1), $ = M(), C = ee($.trigger) || t(y, {
icon: t(oe, null, null),
class: K("setting-trigger-button")
}, null), S = C ? P(C, {
onClick: () => {
r.value = !0;
}
}) : null;
function j() {
w(B(e(U)));
}
function F() {
V?.(ne(e(_), e(l))), A?.(e(d)), r.value = !1;
const p = B(l.value);
E(p), I(p), c.config?.onChange?.(p);
}
return (p, o) => (k(), q(H, null, [e(S) ? (k(), J(W(e(S)), {
key: 0
})) : Q("", !0), t(e(Y), {
open: r.value,
"onUpdate:open": o[2] || (o[2] = (i) => r.value = i),
title: e(n)("ap.apTable.setting.title"),
width: 900,
centered: !0,
"body-style": {
padding: "0px !important",
height: "450px"
},
onOk: F
}, {
default: u(() => [a("div", {
class: s(e(f)("wrapper"))
}, [a("div", {
class: s(e(f)("left"))
}, [a("div", {
class: s(e(g)("left", "header"))
}, [a("div", null, [a("span", {
class: s(e(g)("left", "header-tips"))
}, m(e(n)("ap.apTable.setting.selectAllTip")), 3), t(e(y), {
type: "link",
size: "small",
onClick: e(O)
}, {
default: u(() => [v(m(e(D) ? e(n)("ap.apTable.setting.unSelectAll") : e(n)("ap.apTable.setting.selectAll")), 1)]),
_: 1
}, 8, ["onClick"])]), t(e(Z), {
value: d.value,
"onUpdate:value": o[0] || (o[0] = (i) => d.value = i)
}, {
default: u(() => [t(e(T), {
value: "small"
}, {
default: u(() => [v(m(e(n)("ap.apTable.setting.sizeSmall")), 1)]),
_: 1
}), t(e(T), {
value: "middle"
}, {
default: u(() => [v(m(e(n)("ap.apTable.setting.sizeNormal")), 1)]),
_: 1
})]),
_: 1
}, 8, ["value"])], 2), t(e(x), {
dashed: "",
style: {
margin: "0px"
}
}), t(se, {
class: s(e(g)("left", "content")),
value: e(l)
}, null, 8, ["class", "value"])], 2), t(e(x), {
type: "vertical",
style: {
height: "100%",
margin: "0px"
}
}), a("div", {
class: s(e(f)("right"))
}, [t(ie, {
value: e(l),
"onUpdate:value": o[1] || (o[1] = (i) => X(l) ? l.value = i : null),
onReset: j
}, null, 8, ["value"])], 2)], 2)]),
_: 1
}, 8, ["open", "title"])], 64));
}
});
export {
Te as default
};