| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084 |
- import { bV as et, c as W, _ as V, bm as A, D as tt, w as Ae, d as v, K as ie, bn as F, bp as Q, bo as we, g as nt, bW as rt, T as at, r as Ve, bX as We, bY as je, bZ as lt, b_ as it, b$ as ot, c0 as st, c1 as He, c2 as ut, U as dt, V as ct, W as ft, u as pt, X as mt, Y as gt, a5 as Se, o as vt, c3 as bt, c4 as ht, bS as Oe, c5 as Te, F as St, P as $e } from "./index2.js";
- import { defineComponent as Ee, ref as Ge, onBeforeUnmount as qe, createVNode as h, shallowRef as M, computed as j, watch as ee } from "vue";
- function xe() {
- return typeof BigInt == "function";
- }
- function te(e) {
- let t = e.trim(), n = t.startsWith("-");
- n && (t = t.slice(1)), t = t.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, ""), t.startsWith(".") && (t = `0${t}`);
- const a = t || "0", o = a.split("."), l = o[0] || "0", d = o[1] || "0";
- l === "0" && d === "0" && (n = !1);
- const c = n ? "-" : "";
- return {
- negative: n,
- negativeStr: c,
- trimStr: a,
- integerStr: l,
- decimalStr: d,
- fullStr: `${c}${a}`
- };
- }
- function Ce(e) {
- const t = String(e);
- return !Number.isNaN(Number(t)) && t.includes("e");
- }
- function ne(e) {
- const t = String(e);
- if (Ce(e)) {
- let n = Number(t.slice(t.indexOf("e-") + 2));
- const a = t.match(/\.(\d+)/);
- return a != null && a[1] && (n += a[1].length), n;
- }
- return t.includes(".") && De(t) ? t.length - t.indexOf(".") - 1 : 0;
- }
- function _e(e) {
- let t = String(e);
- if (Ce(e)) {
- if (e > Number.MAX_SAFE_INTEGER)
- return String(xe() ? BigInt(e).toString() : Number.MAX_SAFE_INTEGER);
- if (e < Number.MIN_SAFE_INTEGER)
- return String(xe() ? BigInt(e).toString() : Number.MIN_SAFE_INTEGER);
- t = e.toFixed(ne(t));
- }
- return te(t).fullStr;
- }
- function De(e) {
- return typeof e == "number" ? !Number.isNaN(e) : e ? (
- // Normal type: 11.28
- /^\s*-?\d+(\.\d+)?\s*$/.test(e) || // Pre-number: 1.
- /^\s*-?\d+\.\s*$/.test(e) || // Post-number: .1
- /^\s*-?\.\d+\s*$/.test(e)
- ) : !1;
- }
- function Le(e) {
- return !e && e !== 0 && !Number.isNaN(e) || !String(e).trim();
- }
- class z {
- constructor(t) {
- if (this.origin = "", Le(t)) {
- this.empty = !0;
- return;
- }
- this.origin = String(t), this.number = Number(t);
- }
- negate() {
- return new z(-this.toNumber());
- }
- add(t) {
- if (this.isInvalidate())
- return new z(t);
- const n = Number(t);
- if (Number.isNaN(n))
- return this;
- const a = this.number + n;
- if (a > Number.MAX_SAFE_INTEGER)
- return new z(Number.MAX_SAFE_INTEGER);
- if (a < Number.MIN_SAFE_INTEGER)
- return new z(Number.MIN_SAFE_INTEGER);
- const o = Math.max(ne(this.number), ne(n));
- return new z(a.toFixed(o));
- }
- isEmpty() {
- return this.empty;
- }
- isNaN() {
- return Number.isNaN(this.number);
- }
- isInvalidate() {
- return this.isEmpty() || this.isNaN();
- }
- equals(t) {
- return this.toNumber() === (t == null ? void 0 : t.toNumber());
- }
- lessEquals(t) {
- return this.add(t.negate().toString()).toNumber() <= 0;
- }
- toNumber() {
- return this.number;
- }
- toString() {
- return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0) ? this.isInvalidate() ? "" : _e(this.number) : this.origin;
- }
- }
- class U {
- constructor(t) {
- if (this.origin = "", Le(t)) {
- this.empty = !0;
- return;
- }
- if (this.origin = String(t), t === "-" || Number.isNaN(t)) {
- this.nan = !0;
- return;
- }
- let n = t;
- if (Ce(n) && (n = Number(n)), n = typeof n == "string" ? n : _e(n), De(n)) {
- const a = te(n);
- this.negative = a.negative;
- const o = a.trimStr.split(".");
- this.integer = BigInt(o[0]);
- const l = o[1] || "0";
- this.decimal = BigInt(l), this.decimalLen = l.length;
- } else
- this.nan = !0;
- }
- getMark() {
- return this.negative ? "-" : "";
- }
- getIntegerStr() {
- return this.integer.toString();
- }
- getDecimalStr() {
- return this.decimal.toString().padStart(this.decimalLen, "0");
- }
- /**
- * Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
- * This is used for add function only.
- */
- alignDecimal(t) {
- const n = `${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(t, "0")}`;
- return BigInt(n);
- }
- negate() {
- const t = new U(this.toString());
- return t.negative = !t.negative, t;
- }
- add(t) {
- if (this.isInvalidate())
- return new U(t);
- const n = new U(t);
- if (n.isInvalidate())
- return this;
- const a = Math.max(this.getDecimalStr().length, n.getDecimalStr().length), o = this.alignDecimal(a), l = n.alignDecimal(a), d = (o + l).toString(), {
- negativeStr: c,
- trimStr: f
- } = te(d), p = `${c}${f.padStart(a + 1, "0")}`;
- return new U(`${p.slice(0, -a)}.${p.slice(-a)}`);
- }
- isEmpty() {
- return this.empty;
- }
- isNaN() {
- return this.nan;
- }
- isInvalidate() {
- return this.isEmpty() || this.isNaN();
- }
- equals(t) {
- return this.toString() === (t == null ? void 0 : t.toString());
- }
- lessEquals(t) {
- return this.add(t.negate().toString()).toNumber() <= 0;
- }
- toNumber() {
- return this.isNaN() ? NaN : Number(this.toString());
- }
- toString() {
- return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0) ? this.isInvalidate() ? "" : te(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr : this.origin;
- }
- }
- function D(e) {
- return xe() ? new U(e) : new z(e);
- }
- function Ie(e, t, n) {
- let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
- if (e === "")
- return "";
- const {
- negativeStr: o,
- integerStr: l,
- decimalStr: d
- } = te(e), c = `${t}${d}`, f = `${o}${l}`;
- if (n >= 0) {
- const p = Number(d[n]);
- if (p >= 5 && !a) {
- const s = D(e).add(`${o}0.${"0".repeat(n)}${10 - p}`);
- return Ie(s.toString(), t, n, a);
- }
- return n === 0 ? f : `${f}${t}${d.padEnd(n, "0").slice(0, n)}`;
- }
- return c === ".0" ? f : `${f}${c}`;
- }
- const $t = 200, Nt = 600, yt = Ee({
- compatConfig: {
- MODE: 3
- },
- name: "StepHandler",
- inheritAttrs: !1,
- props: {
- prefixCls: String,
- upDisabled: Boolean,
- downDisabled: Boolean,
- onStep: A()
- },
- slots: Object,
- setup(e, t) {
- let {
- slots: n,
- emit: a
- } = t;
- const o = Ge(), l = (c, f) => {
- c.preventDefault(), a("step", f);
- function p() {
- a("step", f), o.value = setTimeout(p, $t);
- }
- o.value = setTimeout(p, Nt);
- }, d = () => {
- clearTimeout(o.value);
- };
- return qe(() => {
- d();
- }), () => {
- if (et())
- return null;
- const {
- prefixCls: c,
- upDisabled: f,
- downDisabled: p
- } = e, s = `${c}-handler`, w = W(s, `${s}-up`, {
- [`${s}-up-disabled`]: f
- }), S = W(s, `${s}-down`, {
- [`${s}-down-disabled`]: p
- }), I = {
- unselectable: "on",
- role: "button",
- onMouseup: d,
- onMouseleave: d
- }, {
- upNode: $,
- downNode: E
- } = n;
- return h("div", {
- class: `${s}-wrap`
- }, [h("span", V(V({}, I), {}, {
- onMousedown: (P) => {
- l(P, !0);
- },
- "aria-label": "Increase Value",
- "aria-disabled": f,
- class: w
- }), [($ == null ? void 0 : $()) || h("span", {
- unselectable: "on",
- class: `${c}-handler-up-inner`
- }, null)]), h("span", V(V({}, I), {}, {
- onMousedown: (P) => {
- l(P, !1);
- },
- "aria-label": "Decrease Value",
- "aria-disabled": p,
- class: S
- }), [(E == null ? void 0 : E()) || h("span", {
- unselectable: "on",
- class: `${c}-handler-down-inner`
- }, null)])]);
- };
- }
- });
- function wt(e, t) {
- const n = Ge(null);
- function a() {
- try {
- const {
- selectionStart: l,
- selectionEnd: d,
- value: c
- } = e.value, f = c.substring(0, l), p = c.substring(d);
- n.value = {
- start: l,
- end: d,
- value: c,
- beforeTxt: f,
- afterTxt: p
- };
- } catch (l) {
- }
- }
- function o() {
- if (e.value && n.value && t.value)
- try {
- const {
- value: l
- } = e.value, {
- beforeTxt: d,
- afterTxt: c,
- start: f
- } = n.value;
- let p = l.length;
- if (l.endsWith(c))
- p = l.length - n.value.afterTxt.length;
- else if (l.startsWith(d))
- p = d.length;
- else {
- const s = d[f - 1], w = l.indexOf(s, f - 1);
- w !== -1 && (p = w + 1);
- }
- e.value.setSelectionRange(p, p);
- } catch (l) {
- tt(!1, `Something warning of cursor restore. Please fire issue about this: ${l.message}`);
- }
- }
- return [a, o];
- }
- const xt = () => {
- const e = M(0), t = () => {
- Ae.cancel(e.value);
- };
- return qe(() => {
- t();
- }), (n) => {
- t(), e.value = Ae(() => {
- n();
- });
- };
- };
- var It = function(e, t) {
- var n = {};
- for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && t.indexOf(a) < 0 && (n[a] = e[a]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++)
- t.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (n[a[o]] = e[a[o]]);
- return n;
- };
- const Be = (e, t) => e || t.isEmpty() ? t.toString() : t.toNumber(), Fe = (e) => {
- const t = D(e);
- return t.isInvalidate() ? null : t;
- }, Ue = () => ({
- /** value will show as string */
- stringMode: F(),
- defaultValue: Q([String, Number]),
- value: Q([String, Number]),
- prefixCls: we(),
- min: Q([String, Number]),
- max: Q([String, Number]),
- step: Q([String, Number], 1),
- tabindex: Number,
- controls: F(!0),
- readonly: F(),
- disabled: F(),
- autofocus: F(),
- keyboard: F(!0),
- /** Parse display value to validate number */
- parser: A(),
- /** Transform `value` to display value show in input */
- formatter: A(),
- /** Syntactic sugar of `formatter`. Config precision of display. */
- precision: Number,
- /** Syntactic sugar of `formatter`. Config decimal separator of display. */
- decimalSeparator: String,
- onInput: A(),
- onChange: A(),
- onPressEnter: A(),
- onStep: A(),
- onBlur: A(),
- onFocus: A()
- }), Et = Ee({
- compatConfig: {
- MODE: 3
- },
- name: "InnerInputNumber",
- inheritAttrs: !1,
- props: v(v({}, Ue()), {
- lazy: Boolean
- }),
- slots: Object,
- setup(e, t) {
- let {
- attrs: n,
- slots: a,
- emit: o,
- expose: l
- } = t;
- const d = M(), c = M(!1), f = M(!1), p = M(!1), s = M(D(e.value));
- function w(r) {
- e.value === void 0 && (s.value = r);
- }
- const S = (r, i) => {
- if (!i)
- return e.precision >= 0 ? e.precision : Math.max(ne(r), ne(e.step));
- }, I = (r) => {
- const i = String(r);
- if (e.parser)
- return e.parser(i);
- let u = i;
- return e.decimalSeparator && (u = u.replace(e.decimalSeparator, ".")), u.replace(/[^\w.-]+/g, "");
- }, $ = M(""), E = (r, i) => {
- if (e.formatter)
- return e.formatter(r, {
- userTyping: i,
- input: String($.value)
- });
- let u = typeof r == "number" ? _e(r) : r;
- if (!i) {
- const m = S(u, i);
- if (De(u) && (e.decimalSeparator || m >= 0)) {
- const y = e.decimalSeparator || ".";
- u = Ie(u, y, m);
- }
- }
- return u;
- }, P = (() => {
- const r = e.value;
- return s.value.isInvalidate() && ["string", "number"].includes(typeof r) ? Number.isNaN(r) ? "" : r : E(s.value.toString(), !1);
- })();
- $.value = P;
- function C(r, i) {
- $.value = E(
- // Invalidate number is sometime passed by external control, we should let it go
- // Otherwise is controlled by internal interactive logic which check by userTyping
- // You can ref 'show limited value when input is not focused' test for more info.
- r.isInvalidate() ? r.toString(!1) : r.toString(!i),
- i
- );
- }
- const _ = j(() => Fe(e.max)), N = j(() => Fe(e.min)), x = j(() => !_.value || !s.value || s.value.isInvalidate() ? !1 : _.value.lessEquals(s.value)), O = j(() => !N.value || !s.value || s.value.isInvalidate() ? !1 : s.value.lessEquals(N.value)), [k, K] = wt(d, c), X = (r) => _.value && !r.lessEquals(_.value) ? _.value : N.value && !N.value.lessEquals(r) ? N.value : null, oe = (r) => !X(r), Y = (r, i) => {
- var u;
- let m = r, y = oe(m) || m.isEmpty();
- if (!m.isEmpty() && !i && (m = X(m) || m, y = !0), !e.readonly && !e.disabled && y) {
- const R = m.toString(), q = S(R, i);
- return q >= 0 && (m = D(Ie(R, ".", q))), m.equals(s.value) || (w(m), (u = e.onChange) === null || u === void 0 || u.call(e, m.isEmpty() ? null : Be(e.stringMode, m)), e.value === void 0 && C(m, i)), m;
- }
- return s.value;
- }, se = xt(), Z = (r) => {
- var i;
- if (k(), $.value = r, !p.value) {
- const u = I(r), m = D(u);
- m.isNaN() || Y(m, !0);
- }
- (i = e.onInput) === null || i === void 0 || i.call(e, r), se(() => {
- let u = r;
- e.parser || (u = r.replace(/。/g, ".")), u !== r && Z(u);
- });
- }, b = () => {
- p.value = !0;
- }, J = () => {
- p.value = !1, Z(d.value.value);
- }, H = (r) => {
- Z(r.target.value);
- }, G = (r) => {
- var i, u;
- if (r && x.value || !r && O.value)
- return;
- f.value = !1;
- let m = D(e.step);
- r || (m = m.negate());
- const y = (s.value || D(0)).add(m.toString()), R = Y(y, !1);
- (i = e.onStep) === null || i === void 0 || i.call(e, Be(e.stringMode, R), {
- offset: e.step,
- type: r ? "up" : "down"
- }), (u = d.value) === null || u === void 0 || u.focus();
- }, T = (r) => {
- const i = D(I($.value));
- let u = i;
- i.isNaN() ? u = s.value : u = Y(i, r), e.value !== void 0 ? C(s.value, !1) : u.isNaN() || C(u, !1);
- }, ue = () => {
- f.value = !0;
- }, de = (r) => {
- var i;
- const {
- which: u
- } = r;
- f.value = !0, u === ie.ENTER && (p.value || (f.value = !1), T(!1), (i = e.onPressEnter) === null || i === void 0 || i.call(e, r)), e.keyboard !== !1 && !p.value && [ie.UP, ie.DOWN].includes(u) && (G(ie.UP === u), r.preventDefault());
- }, ce = () => {
- f.value = !1;
- }, re = (r) => {
- T(!1), c.value = !1, f.value = !1, o("blur", r);
- };
- return ee(() => e.precision, () => {
- s.value.isInvalidate() || C(s.value, !1);
- }, {
- flush: "post"
- }), ee(() => e.value, () => {
- const r = D(e.value);
- s.value = r;
- const i = D(I($.value));
- (!r.equals(i) || !f.value || e.formatter) && C(r, f.value);
- }, {
- flush: "post"
- }), ee($, () => {
- e.formatter && K();
- }, {
- flush: "post"
- }), ee(() => e.disabled, (r) => {
- r && (c.value = !1);
- }), l({
- 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 r = v(v({}, n), e), {
- prefixCls: i = "rc-input-number",
- min: u,
- max: m,
- step: y = 1,
- defaultValue: R,
- value: q,
- disabled: ae,
- readonly: le,
- keyboard: g,
- controls: fe = !0,
- autofocus: B,
- stringMode: pe,
- parser: me,
- formatter: L,
- precision: ge,
- decimalSeparator: ve,
- onChange: be,
- onInput: Me,
- onPressEnter: Pe,
- onStep: Rt,
- lazy: ke,
- class: Ke,
- style: Xe
- } = r, Ye = It(r, ["prefixCls", "min", "max", "step", "defaultValue", "value", "disabled", "readonly", "keyboard", "controls", "autofocus", "stringMode", "parser", "formatter", "precision", "decimalSeparator", "onChange", "onInput", "onPressEnter", "onStep", "lazy", "class", "style"]), {
- upHandler: Ze,
- downHandler: Je
- } = a, Re = `${i}-input`, he = {};
- return ke ? he.onChange = H : he.onInput = H, h("div", {
- class: W(i, Ke, {
- [`${i}-focused`]: c.value,
- [`${i}-disabled`]: ae,
- [`${i}-readonly`]: le,
- [`${i}-not-a-number`]: s.value.isNaN(),
- [`${i}-out-of-range`]: !s.value.isInvalidate() && !oe(s.value)
- }),
- style: Xe,
- onKeydown: de,
- onKeyup: ce
- }, [fe && h(yt, {
- prefixCls: i,
- upDisabled: x.value,
- downDisabled: O.value,
- onStep: G
- }, {
- upNode: Ze,
- downNode: Je
- }), h("div", {
- class: `${Re}-wrap`
- }, [h("input", V(V(V({
- autofocus: B,
- autocomplete: "off",
- role: "spinbutton",
- "aria-valuemin": u,
- "aria-valuemax": m,
- "aria-valuenow": s.value.isInvalidate() ? null : s.value.toString(),
- step: y
- }, Ye), {}, {
- ref: d,
- class: Re,
- value: $.value,
- disabled: ae,
- readonly: le,
- onFocus: (Qe) => {
- c.value = !0, o("focus", Qe);
- }
- }, he), {}, {
- onBlur: re,
- onCompositionstart: b,
- onCompositionend: J,
- onBeforeinput: ue
- }), null)])]);
- };
- }
- });
- function Ne(e) {
- return e != null;
- }
- const Ct = (e) => {
- const {
- componentCls: t,
- lineWidth: n,
- lineType: a,
- colorBorder: o,
- borderRadius: l,
- fontSizeLG: d,
- controlHeightLG: c,
- controlHeightSM: f,
- colorError: p,
- inputPaddingHorizontalSM: s,
- colorTextDescription: w,
- motionDurationMid: S,
- colorPrimary: I,
- controlHeight: $,
- inputPaddingHorizontal: E,
- colorBgContainer: P,
- colorTextDisabled: C,
- borderRadiusSM: _,
- borderRadiusLG: N,
- controlWidth: x,
- handleVisible: O
- } = e;
- return [
- {
- [t]: v(v(v(v({}, Ve(e)), We(e)), je(e, t)), {
- display: "inline-block",
- width: x,
- margin: 0,
- padding: 0,
- border: `${n}px ${a} ${o}`,
- borderRadius: l,
- "&-rtl": {
- direction: "rtl",
- [`${t}-input`]: {
- direction: "rtl"
- }
- },
- "&-lg": {
- padding: 0,
- fontSize: d,
- borderRadius: N,
- [`input${t}-input`]: {
- height: c - 2 * n
- }
- },
- "&-sm": {
- padding: 0,
- borderRadius: _,
- [`input${t}-input`]: {
- height: f - 2 * n,
- padding: `0 ${s}px`
- }
- },
- "&:hover": v({}, He(e)),
- "&-focused": v({}, st(e)),
- "&-disabled": v(v({}, ot(e)), {
- [`${t}-input`]: {
- cursor: "not-allowed"
- }
- }),
- // ===================== Out Of Range =====================
- "&-out-of-range": {
- input: {
- color: p
- }
- },
- // Style for input-group: input with label, with button or dropdown...
- "&-group": v(v(v({}, Ve(e)), it(e)), {
- "&-wrapper": {
- display: "inline-block",
- textAlign: "start",
- verticalAlign: "top",
- [`${t}-affix-wrapper`]: {
- width: "100%"
- },
- // Size
- "&-lg": {
- [`${t}-group-addon`]: {
- borderRadius: N
- }
- },
- "&-sm": {
- [`${t}-group-addon`]: {
- borderRadius: _
- }
- }
- }
- }),
- [t]: {
- "&-input": v(v({
- width: "100%",
- height: $ - 2 * n,
- padding: `0 ${E}px`,
- textAlign: "start",
- backgroundColor: "transparent",
- border: 0,
- borderRadius: l,
- outline: 0,
- transition: `all ${S} linear`,
- appearance: "textfield",
- color: e.colorText,
- fontSize: "inherit",
- verticalAlign: "top"
- }, lt(e.colorTextPlaceholder)), {
- '&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button': {
- margin: 0,
- /* stylelint-disable-next-line property-no-vendor-prefix */
- webkitAppearance: "none",
- appearance: "none"
- }
- })
- }
- })
- },
- // Handler
- {
- [t]: {
- [`&:hover ${t}-handler-wrap, &-focused ${t}-handler-wrap`]: {
- opacity: 1
- },
- [`${t}-handler-wrap`]: {
- position: "absolute",
- insetBlockStart: 0,
- insetInlineEnd: 0,
- width: e.handleWidth,
- height: "100%",
- background: P,
- borderStartStartRadius: 0,
- borderStartEndRadius: l,
- borderEndEndRadius: l,
- borderEndStartRadius: 0,
- opacity: O === !0 ? 1 : 0,
- display: "flex",
- flexDirection: "column",
- alignItems: "stretch",
- transition: `opacity ${S} linear ${S}`,
- // Fix input number inside Menu makes icon too large
- // We arise the selector priority by nest selector here
- // https://github.com/ant-design/ant-design/issues/14367
- [`${t}-handler`]: {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- flex: "auto",
- height: "40%",
- [`
- ${t}-handler-up-inner,
- ${t}-handler-down-inner
- `]: {
- marginInlineEnd: 0,
- fontSize: e.handleFontSize
- }
- }
- },
- [`${t}-handler`]: {
- height: "50%",
- overflow: "hidden",
- color: w,
- fontWeight: "bold",
- lineHeight: 0,
- textAlign: "center",
- cursor: "pointer",
- borderInlineStart: `${n}px ${a} ${o}`,
- transition: `all ${S} linear`,
- "&:active": {
- background: e.colorFillAlter
- },
- // Hover
- "&:hover": {
- height: "60%",
- [`
- ${t}-handler-up-inner,
- ${t}-handler-down-inner
- `]: {
- color: I
- }
- },
- "&-up-inner, &-down-inner": v(v({}, ut()), {
- color: w,
- transition: `all ${S} linear`,
- userSelect: "none"
- })
- },
- [`${t}-handler-up`]: {
- borderStartEndRadius: l
- },
- [`${t}-handler-down`]: {
- borderBlockStart: `${n}px ${a} ${o}`,
- borderEndEndRadius: l
- },
- // Disabled
- "&-disabled, &-readonly": {
- [`${t}-handler-wrap`]: {
- display: "none"
- },
- [`${t}-input`]: {
- color: "inherit"
- }
- },
- [`
- ${t}-handler-up-disabled,
- ${t}-handler-down-disabled
- `]: {
- cursor: "not-allowed"
- },
- [`
- ${t}-handler-up-disabled:hover &-handler-up-inner,
- ${t}-handler-down-disabled:hover &-handler-down-inner
- `]: {
- color: C
- }
- }
- },
- // Border-less
- {
- [`${t}-borderless`]: {
- borderColor: "transparent",
- boxShadow: "none",
- [`${t}-handler-down`]: {
- borderBlockStartWidth: 0
- }
- }
- }
- ];
- }, _t = (e) => {
- const {
- componentCls: t,
- inputPaddingHorizontal: n,
- inputAffixPadding: a,
- controlWidth: o,
- borderRadiusLG: l,
- borderRadiusSM: d
- } = e;
- return {
- [`${t}-affix-wrapper`]: v(v(v({}, We(e)), je(e, `${t}-affix-wrapper`)), {
- // or number handler will cover form status
- position: "relative",
- display: "inline-flex",
- width: o,
- padding: 0,
- paddingInlineStart: n,
- "&-lg": {
- borderRadius: l
- },
- "&-sm": {
- borderRadius: d
- },
- [`&:not(${t}-affix-wrapper-disabled):hover`]: v(v({}, He(e)), {
- zIndex: 1
- }),
- "&-focused, &:focus": {
- zIndex: 1
- },
- "&-disabled": {
- [`${t}[disabled]`]: {
- background: "transparent"
- }
- },
- [`> div${t}`]: {
- width: "100%",
- border: "none",
- outline: "none",
- [`&${t}-focused`]: {
- boxShadow: "none !important"
- }
- },
- [`input${t}-input`]: {
- padding: 0
- },
- "&::before": {
- width: 0,
- visibility: "hidden",
- content: '"\\a0"'
- },
- [`${t}-handler-wrap`]: {
- zIndex: 2
- },
- [t]: {
- "&-prefix, &-suffix": {
- display: "flex",
- flex: "none",
- alignItems: "center",
- pointerEvents: "none"
- },
- "&-prefix": {
- marginInlineEnd: a
- },
- "&-suffix": {
- position: "absolute",
- insetBlockStart: 0,
- insetInlineEnd: 0,
- zIndex: 1,
- height: "100%",
- marginInlineEnd: n,
- marginInlineStart: a
- }
- }
- })
- };
- }, Dt = nt("InputNumber", (e) => {
- const t = rt(e);
- return [
- Ct(t),
- _t(t),
- // =====================================================
- // == Space Compact ==
- // =====================================================
- at(t)
- ];
- }, (e) => ({
- controlWidth: 90,
- handleWidth: e.controlHeightSM - e.lineWidth * 2,
- handleFontSize: e.fontSize / 2,
- handleVisible: "auto"
- }));
- var Mt = function(e, t) {
- var n = {};
- for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && t.indexOf(a) < 0 && (n[a] = e[a]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, a = Object.getOwnPropertySymbols(e); o < a.length; o++)
- t.indexOf(a[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, a[o]) && (n[a[o]] = e[a[o]]);
- return n;
- };
- const ze = Ue(), Pt = () => v(v({}, ze), {
- size: we(),
- bordered: F(!0),
- placeholder: String,
- name: String,
- id: String,
- type: String,
- addonBefore: $e.any,
- addonAfter: $e.any,
- prefix: $e.any,
- "onUpdate:value": ze.onChange,
- valueModifiers: Object,
- status: we()
- }), ye = Ee({
- compatConfig: {
- MODE: 3
- },
- name: "AInputNumber",
- inheritAttrs: !1,
- props: Pt(),
- // emits: ['focus', 'blur', 'change', 'input', 'update:value'],
- slots: Object,
- setup(e, t) {
- let {
- emit: n,
- expose: a,
- attrs: o,
- slots: l
- } = t;
- var d;
- const c = dt(), f = ct.useInject(), p = j(() => ft(f.status, e.status)), {
- prefixCls: s,
- size: w,
- direction: S,
- disabled: I
- } = pt("input-number", e), {
- compactSize: $,
- compactItemClassnames: E
- } = mt(s, S), P = gt(), C = j(() => {
- var b;
- return (b = I.value) !== null && b !== void 0 ? b : P.value;
- }), [_, N] = Dt(s), x = j(() => $.value || w.value), O = M((d = e.value) !== null && d !== void 0 ? d : e.defaultValue), k = M(!1);
- ee(() => e.value, () => {
- O.value = e.value;
- });
- const K = M(null), X = () => {
- var b;
- (b = K.value) === null || b === void 0 || b.focus();
- };
- a({
- focus: X,
- blur: () => {
- var b;
- (b = K.value) === null || b === void 0 || b.blur();
- }
- });
- const Y = (b) => {
- e.value === void 0 && (O.value = b), n("update:value", b), n("change", b), c.onFieldChange();
- }, se = (b) => {
- k.value = !1, n("blur", b), c.onFieldBlur();
- }, Z = (b) => {
- k.value = !0, n("focus", b);
- };
- return () => {
- var b, J, H, G;
- const {
- hasFeedback: T,
- isFormItemInput: ue,
- feedbackIcon: de
- } = f, ce = (b = e.id) !== null && b !== void 0 ? b : c.id.value, re = v(v(v({}, o), e), {
- id: ce,
- disabled: C.value
- }), {
- class: r,
- bordered: i,
- readonly: u,
- style: m,
- addonBefore: y = (J = l.addonBefore) === null || J === void 0 ? void 0 : J.call(l),
- addonAfter: R = (H = l.addonAfter) === null || H === void 0 ? void 0 : H.call(l),
- prefix: q = (G = l.prefix) === null || G === void 0 ? void 0 : G.call(l),
- valueModifiers: ae = {}
- } = re, le = Mt(re, ["class", "bordered", "readonly", "style", "addonBefore", "addonAfter", "prefix", "valueModifiers"]), g = s.value, fe = W({
- [`${g}-lg`]: x.value === "large",
- [`${g}-sm`]: x.value === "small",
- [`${g}-rtl`]: S.value === "rtl",
- [`${g}-readonly`]: u,
- [`${g}-borderless`]: !i,
- [`${g}-in-form-item`]: ue
- }, Se(g, p.value), r, E.value, N.value);
- let B = h(Et, V(V({}, vt(le, ["size", "defaultValue"])), {}, {
- ref: K,
- lazy: !!ae.lazy,
- value: O.value,
- class: fe,
- prefixCls: g,
- readonly: u,
- onChange: Y,
- onBlur: se,
- onFocus: Z
- }), {
- upHandler: l.upIcon ? () => h("span", {
- class: `${g}-handler-up-inner`
- }, [l.upIcon()]) : () => h(ht, {
- class: `${g}-handler-up-inner`
- }, null),
- downHandler: l.downIcon ? () => h("span", {
- class: `${g}-handler-down-inner`
- }, [l.downIcon()]) : () => h(bt, {
- class: `${g}-handler-down-inner`
- }, null)
- });
- const pe = Ne(y) || Ne(R), me = Ne(q);
- if (me || T) {
- const L = W(`${g}-affix-wrapper`, Se(`${g}-affix-wrapper`, p.value, T), {
- [`${g}-affix-wrapper-focused`]: k.value,
- [`${g}-affix-wrapper-disabled`]: C.value,
- [`${g}-affix-wrapper-sm`]: x.value === "small",
- [`${g}-affix-wrapper-lg`]: x.value === "large",
- [`${g}-affix-wrapper-rtl`]: S.value === "rtl",
- [`${g}-affix-wrapper-readonly`]: u,
- [`${g}-affix-wrapper-borderless`]: !i,
- // className will go to addon wrapper
- [`${r}`]: !pe && r
- }, N.value);
- B = h("div", {
- class: L,
- style: m,
- onClick: X
- }, [me && h("span", {
- class: `${g}-prefix`
- }, [q]), B, T && h("span", {
- class: `${g}-suffix`
- }, [de])]);
- }
- if (pe) {
- const L = `${g}-group`, ge = `${L}-addon`, ve = y ? h("div", {
- class: ge
- }, [y]) : null, be = R ? h("div", {
- class: ge
- }, [R]) : null, Me = W(`${g}-wrapper`, L, {
- [`${L}-rtl`]: S.value === "rtl"
- }, N.value), Pe = W(`${g}-group-wrapper`, {
- [`${g}-group-wrapper-sm`]: x.value === "small",
- [`${g}-group-wrapper-lg`]: x.value === "large",
- [`${g}-group-wrapper-rtl`]: S.value === "rtl"
- }, Se(`${s}-group-wrapper`, p.value, T), r, N.value);
- B = h("div", {
- class: Pe,
- style: m
- }, [h("div", {
- class: Me
- }, [ve && h(Oe, null, {
- default: () => [h(Te, null, {
- default: () => [ve]
- })]
- }), B, be && h(Oe, null, {
- default: () => [h(Te, null, {
- default: () => [be]
- })]
- })])]);
- }
- return _(St(B, {
- style: m
- }));
- };
- }
- }), Ot = v(ye, {
- install: (e) => (e.component(ye.name, ye), e)
- });
- export {
- Ot as _
- };
|