import { a1 as _e, d as O, Q as Se, P as W, p as Q, c as z, _ as M, o as L, bX as re, u as pe, x as Ne, y as Be, af as Oe, bm as ue, at as $e, D as Ie } from "./index2.js"; import { defineComponent as J, ref as te, createVNode as g, shallowRef as K, watch as se, computed as q, onMounted as ve, Fragment as me, nextTick as ie, onBeforeUpdate as Pe, onBeforeUnmount as Fe } from "vue"; import { u as Ae, F as je, N as de } from "./FormItemContext.js"; import { g as Ee, a as ee } from "./statusUtils.js"; import { B as ze } from "./BaseInput.js"; import { u as Re } from "./index16.js"; import { i as Te } from "./isPlainObject.js"; const H = (e) => e != null && (Array.isArray(e) ? _e(e).length : !0); function ne(e) { return H(e.prefix) || H(e.suffix) || H(e.allowClear); } function X(e) { return H(e.addonBefore) || H(e.addonAfter); } function fe(e) { return typeof e == "undefined" || e === null ? "" : String(e); } function ce(e, v, t, a) { if (!t) return; const o = v; if (v.type === "click") { Object.defineProperty(o, "target", { writable: !0 }), Object.defineProperty(o, "currentTarget", { writable: !0 }); const f = e.cloneNode(!0); o.target = f, o.currentTarget = f, f.value = "", t(o); return; } if (a !== void 0) { Object.defineProperty(o, "target", { writable: !0 }), Object.defineProperty(o, "currentTarget", { writable: !0 }), o.target = e, o.currentTarget = e, e.value = a, t(o); return; } t(o); } function ke(e, v) { if (!e) return; e.focus(v); const { cursor: t } = v || {}; if (t) { const a = e.value.length; switch (t) { case "start": e.setSelectionRange(0, 0); break; case "end": e.setSelectionRange(a, a); break; default: e.setSelectionRange(0, a); } } } const Me = () => ({ addonBefore: W.any, addonAfter: W.any, prefix: W.any, suffix: W.any, clearIcon: W.any, affixWrapperClassName: String, groupClassName: String, wrapperClassName: String, inputClassName: String, allowClear: { type: Boolean, default: void 0 } }), ge = () => O(O({}, Me()), { value: { type: [String, Number, Symbol], default: void 0 }, defaultValue: { type: [String, Number, Symbol], default: void 0 }, inputElement: W.any, prefixCls: String, disabled: { type: Boolean, default: void 0 }, focused: { type: Boolean, default: void 0 }, triggerFocus: Function, readonly: { type: Boolean, default: void 0 }, handleReset: Function, hidden: { type: Boolean, default: void 0 } }), ye = () => O(O({}, ge()), { id: String, placeholder: { type: [String, Number] }, autocomplete: String, type: Se("text"), name: String, size: { type: String }, autofocus: { type: Boolean, default: void 0 }, lazy: { type: Boolean, default: !0 }, maxlength: Number, loading: { type: Boolean, default: void 0 }, bordered: { type: Boolean, default: void 0 }, showCount: { type: [Boolean, Object] }, htmlSize: Number, onPressEnter: Function, onKeydown: Function, onKeyup: Function, onFocus: Function, onBlur: Function, onChange: Function, onInput: Function, "onUpdate:value": Function, onCompositionstart: Function, onCompositionend: Function, valueModifiers: Object, hidden: { type: Boolean, default: void 0 }, status: String }), Ve = J({ name: "BaseInput", inheritAttrs: !1, props: ge(), setup(e, v) { let { slots: t, attrs: a } = v; const o = te(), f = (m) => { var c; if (!((c = o.value) === null || c === void 0) && c.contains(m.target)) { const { triggerFocus: S } = e; S == null || S(); } }, d = () => { var m; const { allowClear: c, value: S, disabled: b, readonly: P, handleReset: $, suffix: T = t.suffix, prefixCls: F } = e; if (!c) return null; const N = !b && !P && S, p = `${F}-clear-icon`, A = ((m = t.clearIcon) === null || m === void 0 ? void 0 : m.call(t)) || "*"; return g("span", { onClick: $, onMousedown: (x) => x.preventDefault(), class: z({ [`${p}-hidden`]: !N, [`${p}-has-suffix`]: !!T }, p), role: "button", tabindex: -1 }, [A]); }; return () => { var m, c; const { focused: S, value: b, disabled: P, allowClear: $, readonly: T, hidden: F, prefixCls: N, prefix: p = (m = t.prefix) === null || m === void 0 ? void 0 : m.call(t), suffix: A = (c = t.suffix) === null || c === void 0 ? void 0 : c.call(t), addonAfter: x = t.addonAfter, addonBefore: B = t.addonBefore, inputElement: V, affixWrapperClassName: r, wrapperClassName: C, groupClassName: n } = e; let i = Q(V, { value: b, hidden: F }); if (ne({ prefix: p, suffix: A, allowClear: $ })) { const u = `${N}-affix-wrapper`, y = z(u, { [`${u}-disabled`]: P, [`${u}-focused`]: S, [`${u}-readonly`]: T, [`${u}-input-with-clear-btn`]: A && $ && b }, !X({ addonAfter: x, addonBefore: B }) && a.class, r), I = (A || $) && g("span", { class: `${N}-suffix` }, [d(), A]); i = g("span", { class: y, style: a.style, hidden: !X({ addonAfter: x, addonBefore: B }) && F, onMousedown: f, ref: o }, [p && g("span", { class: `${N}-prefix` }, [p]), Q(V, { style: null, value: b, hidden: null }), I]); } if (X({ addonAfter: x, addonBefore: B })) { const u = `${N}-group`, y = `${u}-addon`, I = z(`${N}-wrapper`, u, C), k = z(`${N}-group-wrapper`, a.class, n); return g("span", { class: k, style: a.style, hidden: F }, [g("span", { class: I }, [B && g("span", { class: y }, [B]), Q(i, { style: null, hidden: null }), x && g("span", { class: y }, [x])])]); } return i; }; } }); var De = function(e, v) { var t = {}; for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++) v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]); return t; }; const We = J({ name: "VCInput", inheritAttrs: !1, props: ye(), setup(e, v) { let { slots: t, attrs: a, expose: o, emit: f } = v; const d = K(e.value === void 0 ? e.defaultValue : e.value), m = K(!1), c = K(), S = K(); se(() => e.value, () => { d.value = e.value; }), se(() => e.disabled, () => { e.disabled && (m.value = !1); }); const b = (n) => { c.value && ke(c.value.input, n); }, P = () => { var n; (n = c.value.input) === null || n === void 0 || n.blur(); }, $ = (n, i, u) => { var y; (y = c.value.input) === null || y === void 0 || y.setSelectionRange(n, i, u); }, T = () => { var n; (n = c.value.input) === null || n === void 0 || n.select(); }; o({ focus: b, blur: P, input: q(() => { var n; return (n = c.value.input) === null || n === void 0 ? void 0 : n.input; }), stateValue: d, setSelectionRange: $, select: T }); const F = (n) => { f("change", n); }, N = (n, i) => { d.value !== n && (e.value === void 0 ? d.value = n : ie(() => { var u; c.value.input.value !== d.value && ((u = S.value) === null || u === void 0 || u.$forceUpdate()); }), ie(() => { i && i(); })); }, p = (n) => { const { value: i } = n.target; if (d.value === i) return; const u = n.target.value; ce(c.value.input, n, F), N(u); }, A = (n) => { n.keyCode === 13 && f("pressEnter", n), f("keydown", n); }, x = (n) => { m.value = !0, f("focus", n); }, B = (n) => { m.value = !1, f("blur", n); }, V = (n) => { ce(c.value.input, n, F), N("", () => { b(); }); }, r = () => { var n, i; const { addonBefore: u = t.addonBefore, addonAfter: y = t.addonAfter, disabled: I, valueModifiers: k = {}, htmlSize: l, autocomplete: s, prefixCls: h, inputClassName: w, prefix: j = (n = t.prefix) === null || n === void 0 ? void 0 : n.call(t), suffix: E = (i = t.suffix) === null || i === void 0 ? void 0 : i.call(t), allowClear: R, type: G = "text" } = e, U = L(e, [ "prefixCls", "onPressEnter", "addonBefore", "addonAfter", "prefix", "suffix", "allowClear", // Input elements must be either controlled or uncontrolled, // specify either the value prop, or the defaultValue prop, but not both. "defaultValue", "size", "bordered", "htmlSize", "lazy", "showCount", "valueModifiers", "showCount", "affixWrapperClassName", "groupClassName", "inputClassName", "wrapperClassName" ]), D = O(O(O({}, U), a), { autocomplete: s, onChange: p, onInput: p, onFocus: x, onBlur: B, onKeydown: A, class: z(h, { [`${h}-disabled`]: I }, w, !X({ addonAfter: y, addonBefore: u }) && !ne({ prefix: j, suffix: E, allowClear: R }) && a.class), ref: c, key: "ant-input", size: l, type: G, lazy: e.lazy }); return k.lazy && delete D.onInput, D.autofocus || delete D.autofocus, g(ze, L(D, ["size"]), null); }, C = () => { var n; const { maxlength: i, suffix: u = (n = t.suffix) === null || n === void 0 ? void 0 : n.call(t), showCount: y, prefixCls: I } = e, k = Number(i) > 0; if (u || y) { const l = [...fe(d.value)].length, s = typeof y == "object" ? y.formatter({ count: l, maxlength: i }) : `${l}${k ? ` / ${i}` : ""}`; return g(me, null, [!!y && g("span", { class: z(`${I}-show-count-suffix`, { [`${I}-show-count-has-suffix`]: !!u }) }, [s]), u]); } return null; }; return ve(() => { process.env.NODE_ENV === "test" && e.autofocus && b(); }), () => { const { prefixCls: n, disabled: i } = e, u = De(e, ["prefixCls", "disabled"]); return g(Ve, M(M(M({}, u), a), {}, { ref: S, prefixCls: n, inputElement: r(), handleReset: V, value: fe(d.value), focused: m.value, triggerFocus: b, suffix: C(), disabled: i }), t); }; } }), ae = () => L(ye(), ["wrapperClassName", "groupClassName", "inputClassName", "affixWrapperClassName"]), Ze = () => O(O({}, L(ae(), ["prefix", "addonBefore", "addonAfter", "suffix"])), { rows: Number, autosize: { type: [Boolean, Object], default: void 0 }, autoSize: { type: [Boolean, Object], default: void 0 }, onResize: { type: Function }, onCompositionstart: re(), onCompositionend: re(), valueModifiers: Object }); var Ue = function(e, v) { var t = {}; for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++) v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]); return t; }; const Ke = J({ compatConfig: { MODE: 3 }, name: "AInput", inheritAttrs: !1, props: ae(), setup(e, v) { let { slots: t, attrs: a, expose: o, emit: f } = v; const d = te(), m = Ae(), c = je.useInject(), S = q(() => Ee(c.status, e.status)), { direction: b, prefixCls: P, size: $, autocomplete: T } = pe("input", e), { compactSize: F, compactItemClassnames: N } = Ne(P, b), p = q(() => F.value || $.value), [A, x] = Re(P), B = Be(); o({ focus: (l) => { var s; (s = d.value) === null || s === void 0 || s.focus(l); }, blur: () => { var l; (l = d.value) === null || l === void 0 || l.blur(); }, input: d, setSelectionRange: (l, s, h) => { var w; (w = d.value) === null || w === void 0 || w.setSelectionRange(l, s, h); }, select: () => { var l; (l = d.value) === null || l === void 0 || l.select(); } }); const i = te([]), u = () => { i.value.push(setTimeout(() => { var l, s, h, w; !((l = d.value) === null || l === void 0) && l.input && ((s = d.value) === null || s === void 0 ? void 0 : s.input.getAttribute("type")) === "password" && (!((h = d.value) === null || h === void 0) && h.input.hasAttribute("value")) && ((w = d.value) === null || w === void 0 || w.input.removeAttribute("value")); })); }; ve(() => { u(); }), Pe(() => { i.value.forEach((l) => clearTimeout(l)); }), Fe(() => { i.value.forEach((l) => clearTimeout(l)); }); const y = (l) => { u(), f("blur", l), m.onFieldBlur(); }, I = (l) => { u(), f("focus", l); }, k = (l) => { f("update:value", l.target.value), f("change", l), f("input", l), m.onFieldChange(); }; return () => { var l, s, h, w, j, E; const { hasFeedback: R, feedbackIcon: G } = c, { allowClear: U, bordered: D = !0, prefix: Y = (l = t.prefix) === null || l === void 0 ? void 0 : l.call(t), suffix: Z = (s = t.suffix) === null || s === void 0 ? void 0 : s.call(t), addonAfter: oe = (h = t.addonAfter) === null || h === void 0 ? void 0 : h.call(t), addonBefore: le = (w = t.addonBefore) === null || w === void 0 ? void 0 : w.call(t), id: be = (j = m.id) === null || j === void 0 ? void 0 : j.value } = e, xe = Ue(e, ["allowClear", "bordered", "prefix", "suffix", "addonAfter", "addonBefore", "id"]), Ce = (R || Z) && g(me, null, [Z, R && G]), _ = P.value, he = ne({ prefix: Y, suffix: Z }) || !!R, we = t.clearIcon || (() => g(Oe, null, null)); return A(g(We, M(M(M({}, a), L(xe, ["onUpdate:value", "onChange", "onInput"])), {}, { onChange: k, id: be, disabled: (E = e.disabled) !== null && E !== void 0 ? E : B.value, ref: d, prefixCls: _, autocomplete: T.value, onBlur: y, onFocus: I, prefix: Y, suffix: Ce, allowClear: U, addonAfter: oe && g(ue, null, { default: () => [g(de, null, { default: () => [oe] })] }), addonBefore: le && g(ue, null, { default: () => [g(de, null, { default: () => [le] })] }), class: [a.class, N.value], inputClassName: z({ [`${_}-sm`]: p.value === "small", [`${_}-lg`]: p.value === "large", [`${_}-rtl`]: b.value === "rtl", [`${_}-borderless`]: !D }, !he && ee(_, S.value), x.value), affixWrapperClassName: z({ [`${_}-affix-wrapper-sm`]: p.value === "small", [`${_}-affix-wrapper-lg`]: p.value === "large", [`${_}-affix-wrapper-rtl`]: b.value === "rtl", [`${_}-affix-wrapper-borderless`]: !D }, ee(`${_}-affix-wrapper`, S.value, R), x.value), wrapperClassName: z({ [`${_}-group-rtl`]: b.value === "rtl" }, x.value), groupClassName: z({ [`${_}-group-wrapper-sm`]: p.value === "small", [`${_}-group-wrapper-lg`]: p.value === "large", [`${_}-group-wrapper-rtl`]: b.value === "rtl" }, ee(`${_}-group-wrapper`, S.value, R), x.value) }), O(O({}, t), { clearIcon: we }))); }; } }); var Le = function(e, v) { var t = {}; for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && v.indexOf(a) < 0 && (t[a] = e[a]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++) v.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (t[a[o]] = e[a[o]]); return t; }; const et = J({ compatConfig: { MODE: 3 }, name: "AInputSearch", inheritAttrs: !1, props: O(O({}, ae()), { inputPrefixCls: String, // 不能设置默认值 https://github.com/vueComponent/ant-design-vue/issues/1916 enterButton: W.any, onSearch: { type: Function } }), setup(e, v) { let { slots: t, attrs: a, expose: o, emit: f } = v; const d = K(), m = K(!1); o({ focus: () => { var r; (r = d.value) === null || r === void 0 || r.focus(); }, blur: () => { var r; (r = d.value) === null || r === void 0 || r.blur(); } }); const b = (r) => { f("update:value", r.target.value), r && r.target && r.type === "click" && f("search", r.target.value, r), f("change", r); }, P = (r) => { var C; document.activeElement === ((C = d.value) === null || C === void 0 ? void 0 : C.input) && r.preventDefault(); }, $ = (r) => { var C, n; f("search", (n = (C = d.value) === null || C === void 0 ? void 0 : C.input) === null || n === void 0 ? void 0 : n.stateValue, r); }, T = (r) => { m.value || e.loading || $(r); }, F = (r) => { m.value = !0, f("compositionstart", r); }, N = (r) => { m.value = !1, f("compositionend", r); }, { prefixCls: p, getPrefixCls: A, direction: x, size: B } = pe("input-search", e), V = q(() => A("input", e.inputPrefixCls)); return () => { var r, C, n, i; const { disabled: u, loading: y, addonAfter: I = (r = t.addonAfter) === null || r === void 0 ? void 0 : r.call(t), suffix: k = (C = t.suffix) === null || C === void 0 ? void 0 : C.call(t) } = e, l = Le(e, ["disabled", "loading", "addonAfter", "suffix"]); let { enterButton: s = (i = (n = t.enterButton) === null || n === void 0 ? void 0 : n.call(t)) !== null && i !== void 0 ? i : !1 } = e; s = s || s === ""; const h = typeof s == "boolean" ? g($e, null, null) : null, w = `${p.value}-button`, j = Array.isArray(s) ? s[0] : s; let E; const R = j.type && Te(j.type) && j.type.__ANT_BUTTON; if (R || j.tagName === "button") E = Q(j, O({ onMousedown: P, onClick: $, key: "enterButton" }, R ? { class: w, size: B.value } : {}), !1); else { const U = h && !s; E = g(Ie, { class: w, type: s ? "primary" : void 0, size: B.value, disabled: u, key: "enterButton", onMousedown: P, onClick: $, loading: y, icon: U ? h : null }, { default: () => [U ? null : h || s] }); } I && (E = [E, I]); const G = z(p.value, { [`${p.value}-rtl`]: x.value === "rtl", [`${p.value}-${B.value}`]: !!B.value, [`${p.value}-with-button`]: !!s }, a.class); return g(Ke, M(M(M({ ref: d }, L(l, ["onUpdate:value", "onSearch", "enterButton"])), a), {}, { onPressEnter: T, onCompositionstart: F, onCompositionend: N, size: B.value, prefixCls: V.value, addonAfter: E, suffix: k, onChange: b, class: G, disabled: u }), t); }; } }); export { Ke as I, et as _, ke as a, fe as f, ae as i, ce as r, Ze as t };