@aplus-frontend/ui
Version:
84 lines (83 loc) • 2.68 kB
JavaScript
import { defineComponent as I, ref as i, createElementBlock as k, openBlock as A, normalizeClass as p, unref as e, createVNode as u, withCtx as m, createElementVNode as w } from "vue";
import { Popover as B, Textarea as L } from "@aplus-frontend/antdv";
import "../../../config-provider/index.mjs";
import { IconApAdLineScreen as P } from "@aplus-frontend/icon";
import "../../../hooks/index.mjs";
import { splitValue as z } from "../utils.mjs";
import { useControllableValue as E } from "../../../hooks/useControllableValue.mjs";
import { useLocale as F } from "../../../config-provider/hooks/use-locale.mjs";
import { useNamespace as O } from "../../../config-provider/hooks/use-namespace.mjs";
const H = /* @__PURE__ */ I({
__name: "index",
props: {
_parent: {},
onClose: { type: Function },
disabled: { type: Boolean },
maxNum: {},
value: {},
"onUpdate:value": { type: Function }
},
emits: ["update:value"],
setup(f, { emit: d }) {
const t = f, v = d, { value: g, updateValue: b } = E(t, v), a = i(!1), n = i(), h = (o) => t._parent || o, { t: x } = F();
function C(o) {
const l = o.target.value || "";
let r = z(l, `
,`, `
`, t.maxNum);
if (r !== l) {
const c = n.value?.$el || n.value;
c && (c.value = r);
}
b(r);
}
function _(o) {
t.disabled ? a.value = !1 : a.value = o, !o && t.onClose?.();
}
const { b: s, e: N, em: V, bm: y } = O("batch-input-group-popover-input");
return (o, l) => (A(), k("div", {
class: p(e(s)())
}, [
u(e(B), {
"overlay-class-name": e(N)("popover"),
"get-popup-container": h,
trigger: "click",
placement: "bottomLeft",
open: a.value,
onOpenChange: _
}, {
content: m(() => [
w("div", {
class: p(e(V)("popover", "content"))
}, [
u(e(L), {
ref_key: "textAreaRef",
ref: n,
placeholder: e(x)("ap.batchInputGroup.popoverInputPlaceholder", {
maxNum: o.maxNum + ""
}),
bordered: !1,
rows: 10,
value: e(g),
"allow-clear": !1,
"auto-size": !1,
onInput: C
}, null, 8, ["placeholder", "value"])
], 2)
]),
default: m(() => [
u(e(P), {
class: p([
e(s)("trigger-icon"),
o.disabled ? e(y)("trigger-icon", "disabled") : null
])
}, null, 8, ["class"])
]),
_: 1
}, 8, ["overlay-class-name", "open"])
], 2));
}
});
export {
H as default
};