| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- import { t as fe, f as Ie, a as ze, r as X, i as Ae, I as b, _ as Re } from "./Search.js";
- import { u as ae, _ as F, c as j, a1 as Te, f as O, P as $e, aK as Pe, p as te, af as Ee, w as Y, aL as _e, o as le, d as C, R as Fe, y as Ve, n as Be, V as Oe, bW as Me } from "./index2.js";
- import { defineComponent as H, computed as B, createVNode as w, ref as M, onBeforeUnmount as re, watchEffect as oe, watch as ne, getCurrentInstance as ve, shallowRef as V, nextTick as ue } from "vue";
- import { F as Z, u as je } from "./FormItemContext.js";
- import { u as me } from "./index16.js";
- import { a as ge, g as pe } from "./statusUtils.js";
- import { B as ke } from "./BaseInput.js";
- const De = H({
- compatConfig: {
- MODE: 3
- },
- name: "AInputGroup",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- size: {
- type: String
- },
- compact: {
- type: Boolean,
- default: void 0
- }
- },
- setup(e, m) {
- let {
- slots: l,
- attrs: n
- } = m;
- const {
- prefixCls: i,
- direction: h,
- getPrefixCls: v
- } = ae("input-group", e), o = Z.useInject();
- Z.useProvide(o, {
- isFormItemInput: !1
- });
- const d = B(() => v("input")), [s, g] = me(d), u = B(() => {
- const a = i.value;
- return {
- [`${a}`]: !0,
- [g.value]: !0,
- [`${a}-lg`]: e.size === "large",
- [`${a}-sm`]: e.size === "small",
- [`${a}-compact`]: e.compact,
- [`${a}-rtl`]: h.value === "rtl"
- };
- });
- return () => {
- var a;
- return s(w("span", F(F({}, n), {}, {
- class: j(u.value, n.class)
- }), [(a = l.default) === null || a === void 0 ? void 0 : a.call(l)]));
- };
- }
- }), de = (e) => e != null && (Array.isArray(e) ? Te(e).length : !0);
- function He(e) {
- return de(e.addonBefore) || de(e.addonAfter);
- }
- const Le = ["text", "input"], Ge = H({
- compatConfig: {
- MODE: 3
- },
- name: "ClearableLabeledInput",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- inputType: $e.oneOf(Pe("text", "input")),
- value: O(),
- defaultValue: O(),
- allowClear: {
- type: Boolean,
- default: void 0
- },
- element: O(),
- handleReset: Function,
- disabled: {
- type: Boolean,
- default: void 0
- },
- direction: {
- type: String
- },
- size: {
- type: String
- },
- suffix: O(),
- prefix: O(),
- addonBefore: O(),
- addonAfter: O(),
- readonly: {
- type: Boolean,
- default: void 0
- },
- focused: {
- type: Boolean,
- default: void 0
- },
- bordered: {
- type: Boolean,
- default: !0
- },
- triggerFocus: {
- type: Function
- },
- hidden: Boolean,
- status: String,
- hashId: String
- },
- setup(e, m) {
- let {
- slots: l,
- attrs: n
- } = m;
- const i = Z.useInject(), h = (o) => {
- const {
- value: d,
- disabled: s,
- readonly: g,
- handleReset: u,
- suffix: a = l.suffix
- } = e, x = !s && !g && d, S = `${o}-clear-icon`;
- return w(Ee, {
- onClick: u,
- onMousedown: ($) => $.preventDefault(),
- class: j({
- [`${S}-hidden`]: !x,
- [`${S}-has-suffix`]: !!a
- }, S),
- role: "button"
- }, null);
- }, v = (o, d) => {
- const {
- value: s,
- allowClear: g,
- direction: u,
- bordered: a,
- hidden: x,
- status: S,
- addonAfter: $ = l.addonAfter,
- addonBefore: f = l.addonBefore,
- hashId: T
- } = e, {
- status: y,
- hasFeedback: I
- } = i;
- if (!g)
- return te(d, {
- value: s,
- disabled: e.disabled
- });
- const z = j(`${o}-affix-wrapper`, `${o}-affix-wrapper-textarea-with-clear-btn`, ge(`${o}-affix-wrapper`, pe(y, S), I), {
- [`${o}-affix-wrapper-rtl`]: u === "rtl",
- [`${o}-affix-wrapper-borderless`]: !a,
- // className will go to addon wrapper
- [`${n.class}`]: !He({
- addonAfter: $,
- addonBefore: f
- }) && n.class
- }, T);
- return w("span", {
- class: z,
- style: n.style,
- hidden: x
- }, [te(d, {
- style: null,
- value: s,
- disabled: e.disabled
- }), h(o)]);
- };
- return () => {
- var o;
- const {
- prefixCls: d,
- inputType: s,
- element: g = (o = l.element) === null || o === void 0 ? void 0 : o.call(l)
- } = e;
- return s === Le[0] ? v(d, g) : null;
- };
- }
- }), Ne = `
- min-height:0 !important;
- max-height:none !important;
- height:0 !important;
- visibility:hidden !important;
- overflow:hidden !important;
- position:absolute !important;
- z-index:-1000 !important;
- top:0 !important;
- right:0 !important;
- pointer-events: none !important;
- `, Ye = ["letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing", "word-break", "white-space"], q = {};
- let R;
- function Ze(e) {
- let m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
- const l = e.getAttribute("id") || e.getAttribute("data-reactid") || e.getAttribute("name");
- if (m && q[l])
- return q[l];
- const n = window.getComputedStyle(e), i = n.getPropertyValue("box-sizing") || n.getPropertyValue("-moz-box-sizing") || n.getPropertyValue("-webkit-box-sizing"), h = parseFloat(n.getPropertyValue("padding-bottom")) + parseFloat(n.getPropertyValue("padding-top")), v = parseFloat(n.getPropertyValue("border-bottom-width")) + parseFloat(n.getPropertyValue("border-top-width")), d = {
- sizingStyle: Ye.map((s) => `${s}:${n.getPropertyValue(s)}`).join(";"),
- paddingSize: h,
- borderSize: v,
- boxSizing: i
- };
- return m && l && (q[l] = d), d;
- }
- function Ke(e) {
- let m = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
- R || (R = document.createElement("textarea"), R.setAttribute("tab-index", "-1"), R.setAttribute("aria-hidden", "true"), document.body.appendChild(R)), e.getAttribute("wrap") ? R.setAttribute("wrap", e.getAttribute("wrap")) : R.removeAttribute("wrap");
- const {
- paddingSize: i,
- borderSize: h,
- boxSizing: v,
- sizingStyle: o
- } = Ze(e, m);
- R.setAttribute("style", `${o};${Ne}`), R.value = e.value || e.placeholder || "";
- let d, s, g, u = R.scrollHeight;
- if (v === "border-box" ? u += h : v === "content-box" && (u -= i), l !== null || n !== null) {
- R.value = " ";
- const x = R.scrollHeight - i;
- l !== null && (d = x * l, v === "border-box" && (d = d + i + h), u = Math.max(d, u)), n !== null && (s = x * n, v === "border-box" && (s = s + i + h), g = u > s ? "" : "hidden", u = Math.min(s, u));
- }
- const a = {
- height: `${u}px`,
- overflowY: g,
- resize: "none"
- };
- return d && (a.minHeight = `${d}px`), s && (a.maxHeight = `${s}px`), a;
- }
- const J = 0, Q = 1, ee = 2, Ue = H({
- compatConfig: {
- MODE: 3
- },
- name: "ResizableTextArea",
- inheritAttrs: !1,
- props: fe(),
- setup(e, m) {
- let {
- attrs: l,
- emit: n,
- expose: i
- } = m, h, v;
- const o = M(), d = M({}), s = M(ee);
- re(() => {
- Y.cancel(h), Y.cancel(v);
- });
- const g = () => {
- try {
- if (o.value && document.activeElement === o.value.input) {
- const c = o.value.getSelectionStart(), k = o.value.getSelectionEnd(), D = o.value.getScrollTop();
- o.value.setSelectionRange(c, k), o.value.setScrollTop(D);
- }
- } catch (c) {
- }
- }, u = M(), a = M();
- oe(() => {
- const c = e.autoSize || e.autosize;
- c ? (u.value = c.minRows, a.value = c.maxRows) : (u.value = void 0, a.value = void 0);
- });
- const x = B(() => !!(e.autoSize || e.autosize)), S = () => {
- s.value = J;
- };
- ne([() => e.value, u, a, x], () => {
- x.value && S();
- }, {
- immediate: !0
- });
- const $ = M();
- ne([s, o], () => {
- if (o.value)
- if (s.value === J)
- s.value = Q;
- else if (s.value === Q) {
- const c = Ke(o.value.input, !1, u.value, a.value);
- s.value = ee, $.value = c;
- } else
- g();
- }, {
- immediate: !0,
- flush: "post"
- });
- const f = ve(), T = M(), y = () => {
- Y.cancel(T.value);
- }, I = (c) => {
- s.value === ee && (n("resize", c), x.value && (y(), T.value = Y(() => {
- S();
- })));
- };
- re(() => {
- y();
- }), i({
- resizeTextarea: () => {
- S();
- },
- textArea: B(() => {
- var c;
- return (c = o.value) === null || c === void 0 ? void 0 : c.input;
- }),
- instance: f
- }), _e(e.autosize === void 0, "Input.TextArea", "autosize is deprecated, please use autoSize instead.");
- const P = () => {
- const {
- prefixCls: c,
- disabled: k
- } = e, D = le(e, ["prefixCls", "onPressEnter", "autoSize", "autosize", "defaultValue", "allowClear", "type", "maxlength", "valueModifiers"]), K = j(c, l.class, {
- [`${c}-disabled`]: k
- }), L = x.value ? $.value : null, G = [l.style, d.value, L], _ = C(C(C({}, D), l), {
- style: G,
- class: K
- });
- return (s.value === J || s.value === Q) && G.push({
- overflowX: "hidden",
- overflowY: "hidden"
- }), _.autofocus || delete _.autofocus, _.rows === 0 && delete _.rows, w(Fe, {
- onResize: I,
- disabled: !x.value
- }, {
- default: () => [w(ke, F(F({}, _), {}, {
- ref: o,
- tag: "textarea"
- }), null)]
- });
- };
- return () => P();
- }
- });
- function he(e, m) {
- return [...e || ""].slice(0, m).join("");
- }
- function ce(e, m, l, n) {
- let i = l;
- return e ? i = he(l, n) : [...m || ""].length < l.length && [...l || ""].length > n && (i = m), i;
- }
- const We = H({
- compatConfig: {
- MODE: 3
- },
- name: "ATextarea",
- inheritAttrs: !1,
- props: fe(),
- setup(e, m) {
- let {
- attrs: l,
- expose: n,
- emit: i
- } = m;
- var h;
- const v = je(), o = Z.useInject(), d = B(() => pe(o.status, e.status)), s = V((h = e.value) !== null && h !== void 0 ? h : e.defaultValue), g = V(), u = V(""), {
- prefixCls: a,
- size: x,
- direction: S
- } = ae("input", e), [$, f] = me(a), T = Ve(), y = B(() => e.showCount === "" || e.showCount || !1), I = B(() => Number(e.maxlength) > 0), z = V(!1), P = V(), c = V(0), k = (t) => {
- z.value = !0, P.value = u.value, c.value = t.currentTarget.selectionStart, i("compositionstart", t);
- }, D = (t) => {
- var r;
- z.value = !1;
- let p = t.currentTarget.value;
- if (I.value) {
- const E = c.value >= e.maxlength + 1 || c.value === ((r = P.value) === null || r === void 0 ? void 0 : r.length);
- p = ce(E, P.value, p, e.maxlength);
- }
- p !== u.value && (_(p), X(t.currentTarget, t, U, p)), i("compositionend", t);
- }, K = ve();
- ne(() => e.value, () => {
- var t;
- "value" in K.vnode.props, s.value = (t = e.value) !== null && t !== void 0 ? t : "";
- });
- const L = (t) => {
- var r;
- ze((r = g.value) === null || r === void 0 ? void 0 : r.textArea, t);
- }, G = () => {
- var t, r;
- (r = (t = g.value) === null || t === void 0 ? void 0 : t.textArea) === null || r === void 0 || r.blur();
- }, _ = (t, r) => {
- s.value !== t && (e.value === void 0 ? s.value = t : ue(() => {
- var p, E, A;
- g.value.textArea.value !== u.value && ((A = (p = g.value) === null || p === void 0 ? void 0 : (E = p.instance).update) === null || A === void 0 || A.call(E));
- }), ue(() => {
- r && r();
- }));
- }, xe = (t) => {
- t.keyCode === 13 && i("pressEnter", t), i("keydown", t);
- }, be = (t) => {
- const {
- onBlur: r
- } = e;
- r == null || r(t), v.onFieldBlur();
- }, U = (t) => {
- i("update:value", t.target.value), i("change", t), i("input", t), v.onFieldChange();
- }, ye = (t) => {
- X(g.value.textArea, t, U), _("", () => {
- L();
- });
- }, se = (t) => {
- let r = t.target.value;
- if (s.value !== r) {
- if (I.value) {
- const p = t.target, E = p.selectionStart >= e.maxlength + 1 || p.selectionStart === r.length || !p.selectionStart;
- r = ce(E, u.value, r, e.maxlength);
- }
- X(t.currentTarget, t, U, r), _(r);
- }
- }, Se = () => {
- var t, r;
- const {
- class: p
- } = l, {
- bordered: E = !0
- } = e, A = C(C(C({}, le(e, ["allowClear"])), l), {
- class: [{
- [`${a.value}-borderless`]: !E,
- [`${p}`]: p && !y.value,
- [`${a.value}-sm`]: x.value === "small",
- [`${a.value}-lg`]: x.value === "large"
- }, ge(a.value, d.value), f.value],
- disabled: T.value,
- showCount: null,
- prefixCls: a.value,
- onInput: se,
- onChange: se,
- onBlur: be,
- onKeydown: xe,
- onCompositionstart: k,
- onCompositionend: D
- });
- return !((t = e.valueModifiers) === null || t === void 0) && t.lazy && delete A.onInput, w(Ue, F(F({}, A), {}, {
- id: (r = A == null ? void 0 : A.id) !== null && r !== void 0 ? r : v.id.value,
- ref: g,
- maxlength: e.maxlength,
- lazy: e.lazy
- }), null);
- };
- return n({
- focus: L,
- blur: G,
- resizableTextArea: g
- }), oe(() => {
- let t = Ie(s.value);
- !z.value && I.value && (e.value === null || e.value === void 0) && (t = he(t, e.maxlength)), u.value = t;
- }), () => {
- var t;
- const {
- maxlength: r,
- bordered: p = !0,
- hidden: E
- } = e, {
- style: A,
- class: Ce
- } = l, we = C(C(C({}, e), l), {
- prefixCls: a.value,
- inputType: "text",
- handleReset: ye,
- direction: S.value,
- bordered: p,
- style: y.value ? void 0 : A,
- hashId: f.value,
- disabled: (t = e.disabled) !== null && t !== void 0 ? t : T.value
- });
- let W = w(Ge, F(F({}, we), {}, {
- value: u.value,
- status: e.status
- }), {
- element: Se
- });
- if (y.value || o.hasFeedback) {
- const ie = [...u.value].length;
- let N = "";
- typeof y.value == "object" ? N = y.value.formatter({
- value: u.value,
- count: ie,
- maxlength: r
- }) : N = `${ie}${I.value ? ` / ${r}` : ""}`, W = w("div", {
- hidden: E,
- class: j(`${a.value}-textarea`, {
- [`${a.value}-textarea-rtl`]: S.value === "rtl",
- [`${a.value}-textarea-show-count`]: y.value,
- [`${a.value}-textarea-in-form-item`]: o.isFormItemInput
- }, `${a.value}-textarea-show-count`, Ce, f.value),
- style: A,
- "data-count": typeof N != "object" ? N : void 0
- }, [W, o.hasFeedback && w("span", {
- class: `${a.value}-textarea-suffix`
- }, [o.feedbackIcon])]);
- }
- return $(W);
- };
- }
- });
- var Xe = function(e, m) {
- var l = {};
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && m.indexOf(n) < 0 && (l[n] = e[n]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
- m.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (l[n[i]] = e[n[i]]);
- return l;
- };
- const qe = {
- click: "onClick",
- hover: "onMouseover"
- }, Je = (e) => e ? w(Oe, null, null) : w(Me, null, null), Qe = H({
- compatConfig: {
- MODE: 3
- },
- name: "AInputPassword",
- inheritAttrs: !1,
- props: C(C({}, Ae()), {
- prefixCls: String,
- inputPrefixCls: String,
- action: {
- type: String,
- default: "click"
- },
- visibilityToggle: {
- type: Boolean,
- default: !0
- },
- visible: {
- type: Boolean,
- default: void 0
- },
- "onUpdate:visible": Function,
- iconRender: Function
- }),
- setup(e, m) {
- let {
- slots: l,
- attrs: n,
- expose: i,
- emit: h
- } = m;
- const v = V(!1), o = () => {
- const {
- disabled: f
- } = e;
- f || (v.value = !v.value, h("update:visible", v.value));
- };
- oe(() => {
- e.visible !== void 0 && (v.value = !!e.visible);
- });
- const d = V();
- i({
- focus: () => {
- var f;
- (f = d.value) === null || f === void 0 || f.focus();
- },
- blur: () => {
- var f;
- (f = d.value) === null || f === void 0 || f.blur();
- }
- });
- const u = (f) => {
- const {
- action: T,
- iconRender: y = l.iconRender || Je
- } = e, I = qe[T] || "", z = y(v.value), P = {
- [I]: o,
- class: `${f}-icon`,
- key: "passwordIcon",
- onMousedown: (c) => {
- c.preventDefault();
- },
- onMouseup: (c) => {
- c.preventDefault();
- }
- };
- return te(Be(z) ? z : w("span", null, [z]), P);
- }, {
- prefixCls: a,
- getPrefixCls: x
- } = ae("input-password", e), S = B(() => x("input", e.inputPrefixCls)), $ = () => {
- const {
- size: f,
- visibilityToggle: T
- } = e, y = Xe(e, ["size", "visibilityToggle"]), I = T && u(a.value), z = j(a.value, n.class, {
- [`${a.value}-${f}`]: !!f
- }), P = C(C(C({}, le(y, ["suffix", "iconRender", "action"])), n), {
- type: v.value ? "text" : "password",
- class: z,
- prefixCls: S.value,
- suffix: I
- });
- return f && (P.size = f), w(b, F({
- ref: d
- }, P), l);
- };
- return () => $();
- }
- });
- b.Group = De;
- b.Search = Re;
- b.TextArea = We;
- b.Password = Qe;
- b.install = function(e) {
- return e.component(b.name, b), e.component(b.Group.name, b.Group), e.component(b.Search.name, b.Search), e.component(b.TextArea.name, b.TextArea), e.component(b.Password.name, b.Password), e;
- };
|