| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088 |
- import { M as A, c as j, _ as O, l as et, w as Ae, d as v, O as F, N as Z, Q as xe, K as le, g as tt, v as nt, r as Oe, aB as rt, u as at, x as it, y as lt, o as ot, au as st, cd as ut, bm as Ve, p as dt, P as Se } from "./index2.js";
- import { defineComponent as Ee, ref as je, onBeforeUnmount as We, createVNode as b, shallowRef as M, computed as W, watch as ee } from "vue";
- import { i as ct } from "./isMobile.js";
- import { u as ft, F as pt, N as Be } from "./FormItemContext.js";
- import { g as mt, a as $e } from "./statusUtils.js";
- import { i as gt, g as He, d as Ge, e as vt, f as ht, h as bt, b as St, c as qe } from "./index16.js";
- function we() {
- 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("."), i = o[0] || "0", d = o[1] || "0";
- i === "0" && d === "0" && (n = !1);
- const c = n ? "-" : "";
- return {
- negative: n,
- negativeStr: c,
- trimStr: a,
- integerStr: i,
- 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(we() ? BigInt(e).toString() : Number.MAX_SAFE_INTEGER);
- if (e < Number.MIN_SAFE_INTEGER)
- return String(we() ? 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 i = o[1] || "0";
- this.decimal = BigInt(i), this.decimalLen = i.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), i = n.alignDecimal(a), d = (o + i).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 we() ? 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: i,
- decimalStr: d
- } = te(e), c = `${t}${d}`, f = `${o}${i}`;
- 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 = je(), i = (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 We(() => {
- d();
- }), () => {
- if (ct())
- return null;
- const {
- prefixCls: c,
- upDisabled: f,
- downDisabled: p
- } = e, s = `${c}-handler`, x = j(s, `${s}-up`, {
- [`${s}-up-disabled`]: f
- }), S = j(s, `${s}-down`, {
- [`${s}-down-disabled`]: p
- }), I = {
- unselectable: "on",
- role: "button",
- onMouseup: d,
- onMouseleave: d
- }, {
- upNode: $,
- downNode: E
- } = n;
- return b("div", {
- class: `${s}-wrap`
- }, [b("span", O(O({}, I), {}, {
- onMousedown: (P) => {
- i(P, !0);
- },
- "aria-label": "Increase Value",
- "aria-disabled": f,
- class: x
- }), [($ == null ? void 0 : $()) || b("span", {
- unselectable: "on",
- class: `${c}-handler-up-inner`
- }, null)]), b("span", O(O({}, I), {}, {
- onMousedown: (P) => {
- i(P, !1);
- },
- "aria-label": "Decrease Value",
- "aria-disabled": p,
- class: S
- }), [(E == null ? void 0 : E()) || b("span", {
- unselectable: "on",
- class: `${c}-handler-down-inner`
- }, null)])]);
- };
- }
- });
- function xt(e, t) {
- const n = je(null);
- function a() {
- try {
- const {
- selectionStart: i,
- selectionEnd: d,
- value: c
- } = e.value, f = c.substring(0, i), p = c.substring(d);
- n.value = {
- start: i,
- end: d,
- value: c,
- beforeTxt: f,
- afterTxt: p
- };
- } catch (i) {
- }
- }
- function o() {
- if (e.value && n.value && t.value)
- try {
- const {
- value: i
- } = e.value, {
- beforeTxt: d,
- afterTxt: c,
- start: f
- } = n.value;
- let p = i.length;
- if (i.endsWith(c))
- p = i.length - n.value.afterTxt.length;
- else if (i.startsWith(d))
- p = d.length;
- else {
- const s = d[f - 1], x = i.indexOf(s, f - 1);
- x !== -1 && (p = x + 1);
- }
- e.value.setSelectionRange(p, p);
- } catch (i) {
- et(!1, `Something warning of cursor restore. Please fire issue about this: ${i.message}`);
- }
- }
- return [a, o];
- }
- const wt = () => {
- const e = M(0), t = () => {
- Ae.cancel(e.value);
- };
- return We(() => {
- 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 Te = (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: Z([String, Number]),
- value: Z([String, Number]),
- prefixCls: xe(),
- min: Z([String, Number]),
- max: Z([String, Number]),
- step: Z([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: i
- } = t;
- const d = M(), c = M(!1), f = M(!1), p = M(!1), s = M(D(e.value));
- function x(r) {
- e.value === void 0 && (s.value = r);
- }
- const S = (r, l) => {
- if (!l)
- return e.precision >= 0 ? e.precision : Math.max(ne(r), ne(e.step));
- }, I = (r) => {
- const l = String(r);
- if (e.parser)
- return e.parser(l);
- let u = l;
- return e.decimalSeparator && (u = u.replace(e.decimalSeparator, ".")), u.replace(/[^\w.-]+/g, "");
- }, $ = M(""), E = (r, l) => {
- if (e.formatter)
- return e.formatter(r, {
- userTyping: l,
- input: String($.value)
- });
- let u = typeof r == "number" ? _e(r) : r;
- if (!l) {
- const m = S(u, l);
- 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, l) {
- $.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(!l),
- l
- );
- }
- const _ = W(() => Fe(e.max)), N = W(() => Fe(e.min)), w = W(() => !_.value || !s.value || s.value.isInvalidate() ? !1 : _.value.lessEquals(s.value)), V = W(() => !N.value || !s.value || s.value.isInvalidate() ? !1 : s.value.lessEquals(N.value)), [k, K] = xt(d, c), X = (r) => _.value && !r.lessEquals(_.value) ? _.value : N.value && !N.value.lessEquals(r) ? N.value : null, oe = (r) => !X(r), Q = (r, l) => {
- var u;
- let m = r, y = oe(m) || m.isEmpty();
- if (!m.isEmpty() && !l && (m = X(m) || m, y = !0), !e.readonly && !e.disabled && y) {
- const R = m.toString(), q = S(R, l);
- return q >= 0 && (m = D(Ie(R, ".", q))), m.equals(s.value) || (x(m), (u = e.onChange) === null || u === void 0 || u.call(e, m.isEmpty() ? null : Te(e.stringMode, m)), e.value === void 0 && C(m, l)), m;
- }
- return s.value;
- }, se = wt(), Y = (r) => {
- var l;
- if (k(), $.value = r, !p.value) {
- const u = I(r), m = D(u);
- m.isNaN() || Q(m, !0);
- }
- (l = e.onInput) === null || l === void 0 || l.call(e, r), se(() => {
- let u = r;
- e.parser || (u = r.replace(/。/g, ".")), u !== r && Y(u);
- });
- }, h = () => {
- p.value = !0;
- }, J = () => {
- p.value = !1, Y(d.value.value);
- }, H = (r) => {
- Y(r.target.value);
- }, G = (r) => {
- var l, u;
- if (r && w.value || !r && V.value)
- return;
- f.value = !1;
- let m = D(e.step);
- r || (m = m.negate());
- const y = (s.value || D(0)).add(m.toString()), R = Q(y, !1);
- (l = e.onStep) === null || l === void 0 || l.call(e, Te(e.stringMode, R), {
- offset: e.step,
- type: r ? "up" : "down"
- }), (u = d.value) === null || u === void 0 || u.focus();
- }, B = (r) => {
- const l = D(I($.value));
- let u = l;
- l.isNaN() ? u = s.value : u = Q(l, r), e.value !== void 0 ? C(s.value, !1) : u.isNaN() || C(u, !1);
- }, ue = () => {
- f.value = !0;
- }, de = (r) => {
- var l;
- const {
- which: u
- } = r;
- f.value = !0, u === le.ENTER && (p.value || (f.value = !1), B(!1), (l = e.onPressEnter) === null || l === void 0 || l.call(e, r)), e.keyboard !== !1 && !p.value && [le.UP, le.DOWN].includes(u) && (G(le.UP === u), r.preventDefault());
- }, ce = () => {
- f.value = !1;
- }, re = (r) => {
- B(!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 l = D(I($.value));
- (!r.equals(l) || !f.value || e.formatter) && C(r, f.value);
- }, {
- flush: "post"
- }), ee($, () => {
- e.formatter && K();
- }, {
- flush: "post"
- }), ee(() => e.disabled, (r) => {
- r && (c.value = !1);
- }), i({
- 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: l = "rc-input-number",
- min: u,
- max: m,
- step: y = 1,
- defaultValue: R,
- value: q,
- disabled: ae,
- readonly: ie,
- keyboard: g,
- controls: fe = !0,
- autofocus: T,
- stringMode: pe,
- parser: me,
- formatter: L,
- precision: ge,
- decimalSeparator: ve,
- onChange: he,
- onInput: Me,
- onPressEnter: Pe,
- onStep: Rt,
- lazy: ke,
- class: Ke,
- style: Xe
- } = r, Qe = 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: Ye,
- downHandler: Je
- } = a, Re = `${l}-input`, be = {};
- return ke ? be.onChange = H : be.onInput = H, b("div", {
- class: j(l, Ke, {
- [`${l}-focused`]: c.value,
- [`${l}-disabled`]: ae,
- [`${l}-readonly`]: ie,
- [`${l}-not-a-number`]: s.value.isNaN(),
- [`${l}-out-of-range`]: !s.value.isInvalidate() && !oe(s.value)
- }),
- style: Xe,
- onKeydown: de,
- onKeyup: ce
- }, [fe && b(yt, {
- prefixCls: l,
- upDisabled: w.value,
- downDisabled: V.value,
- onStep: G
- }, {
- upNode: Ye,
- downNode: Je
- }), b("div", {
- class: `${Re}-wrap`
- }, [b("input", O(O(O({
- autofocus: T,
- autocomplete: "off",
- role: "spinbutton",
- "aria-valuemin": u,
- "aria-valuemax": m,
- "aria-valuenow": s.value.isInvalidate() ? null : s.value.toString(),
- step: y
- }, Qe), {}, {
- ref: d,
- class: Re,
- value: $.value,
- disabled: ae,
- readonly: ie,
- onFocus: (Ze) => {
- c.value = !0, o("focus", Ze);
- }
- }, be), {}, {
- onBlur: re,
- onCompositionstart: h,
- onCompositionend: J,
- onBeforeinput: ue
- }), null)])]);
- };
- }
- });
- function Ne(e) {
- return e != null;
- }
- const Ct = (e) => {
- const {
- componentCls: t,
- lineWidth: n,
- lineType: a,
- colorBorder: o,
- borderRadius: i,
- fontSizeLG: d,
- controlHeightLG: c,
- controlHeightSM: f,
- colorError: p,
- inputPaddingHorizontalSM: s,
- colorTextDescription: x,
- motionDurationMid: S,
- colorPrimary: I,
- controlHeight: $,
- inputPaddingHorizontal: E,
- colorBgContainer: P,
- colorTextDisabled: C,
- borderRadiusSM: _,
- borderRadiusLG: N,
- controlWidth: w,
- handleVisible: V
- } = e;
- return [
- {
- [t]: v(v(v(v({}, Oe(e)), He(e)), Ge(e, t)), {
- display: "inline-block",
- width: w,
- margin: 0,
- padding: 0,
- border: `${n}px ${a} ${o}`,
- borderRadius: i,
- "&-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({}, qe(e)),
- "&-focused": v({}, St(e)),
- "&-disabled": v(v({}, bt(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({}, Oe(e)), ht(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: i,
- outline: 0,
- transition: `all ${S} linear`,
- appearance: "textfield",
- color: e.colorText,
- fontSize: "inherit",
- verticalAlign: "top"
- }, vt(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: i,
- borderEndEndRadius: i,
- borderEndStartRadius: 0,
- opacity: V === !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: x,
- 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({}, rt()), {
- color: x,
- transition: `all ${S} linear`,
- userSelect: "none"
- })
- },
- [`${t}-handler-up`]: {
- borderStartEndRadius: i
- },
- [`${t}-handler-down`]: {
- borderBlockStart: `${n}px ${a} ${o}`,
- borderEndEndRadius: i
- },
- // 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: i,
- borderRadiusSM: d
- } = e;
- return {
- [`${t}-affix-wrapper`]: v(v(v({}, He(e)), Ge(e, `${t}-affix-wrapper`)), {
- // or number handler will cover form status
- position: "relative",
- display: "inline-flex",
- width: o,
- padding: 0,
- paddingInlineStart: n,
- "&-lg": {
- borderRadius: i
- },
- "&-sm": {
- borderRadius: d
- },
- [`&:not(${t}-affix-wrapper-disabled):hover`]: v(v({}, qe(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 = tt("InputNumber", (e) => {
- const t = gt(e);
- return [
- Ct(t),
- _t(t),
- // =====================================================
- // == Space Compact ==
- // =====================================================
- nt(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: xe(),
- bordered: F(!0),
- placeholder: String,
- name: String,
- id: String,
- type: String,
- addonBefore: Se.any,
- addonAfter: Se.any,
- prefix: Se.any,
- "onUpdate:value": ze.onChange,
- valueModifiers: Object,
- status: xe()
- }), 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: i
- } = t;
- var d;
- const c = ft(), f = pt.useInject(), p = W(() => mt(f.status, e.status)), {
- prefixCls: s,
- size: x,
- direction: S,
- disabled: I
- } = at("input-number", e), {
- compactSize: $,
- compactItemClassnames: E
- } = it(s, S), P = lt(), C = W(() => {
- var h;
- return (h = I.value) !== null && h !== void 0 ? h : P.value;
- }), [_, N] = Dt(s), w = W(() => $.value || x.value), V = M((d = e.value) !== null && d !== void 0 ? d : e.defaultValue), k = M(!1);
- ee(() => e.value, () => {
- V.value = e.value;
- });
- const K = M(null), X = () => {
- var h;
- (h = K.value) === null || h === void 0 || h.focus();
- };
- a({
- focus: X,
- blur: () => {
- var h;
- (h = K.value) === null || h === void 0 || h.blur();
- }
- });
- const Q = (h) => {
- e.value === void 0 && (V.value = h), n("update:value", h), n("change", h), c.onFieldChange();
- }, se = (h) => {
- k.value = !1, n("blur", h), c.onFieldBlur();
- }, Y = (h) => {
- k.value = !0, n("focus", h);
- };
- return () => {
- var h, J, H, G;
- const {
- hasFeedback: B,
- isFormItemInput: ue,
- feedbackIcon: de
- } = f, ce = (h = e.id) !== null && h !== void 0 ? h : c.id.value, re = v(v(v({}, o), e), {
- id: ce,
- disabled: C.value
- }), {
- class: r,
- bordered: l,
- readonly: u,
- style: m,
- addonBefore: y = (J = i.addonBefore) === null || J === void 0 ? void 0 : J.call(i),
- addonAfter: R = (H = i.addonAfter) === null || H === void 0 ? void 0 : H.call(i),
- prefix: q = (G = i.prefix) === null || G === void 0 ? void 0 : G.call(i),
- valueModifiers: ae = {}
- } = re, ie = Mt(re, ["class", "bordered", "readonly", "style", "addonBefore", "addonAfter", "prefix", "valueModifiers"]), g = s.value, fe = j({
- [`${g}-lg`]: w.value === "large",
- [`${g}-sm`]: w.value === "small",
- [`${g}-rtl`]: S.value === "rtl",
- [`${g}-readonly`]: u,
- [`${g}-borderless`]: !l,
- [`${g}-in-form-item`]: ue
- }, $e(g, p.value), r, E.value, N.value);
- let T = b(Et, O(O({}, ot(ie, ["size", "defaultValue"])), {}, {
- ref: K,
- lazy: !!ae.lazy,
- value: V.value,
- class: fe,
- prefixCls: g,
- readonly: u,
- onChange: Q,
- onBlur: se,
- onFocus: Y
- }), {
- upHandler: i.upIcon ? () => b("span", {
- class: `${g}-handler-up-inner`
- }, [i.upIcon()]) : () => b(ut, {
- class: `${g}-handler-up-inner`
- }, null),
- downHandler: i.downIcon ? () => b("span", {
- class: `${g}-handler-down-inner`
- }, [i.downIcon()]) : () => b(st, {
- class: `${g}-handler-down-inner`
- }, null)
- });
- const pe = Ne(y) || Ne(R), me = Ne(q);
- if (me || B) {
- const L = j(`${g}-affix-wrapper`, $e(`${g}-affix-wrapper`, p.value, B), {
- [`${g}-affix-wrapper-focused`]: k.value,
- [`${g}-affix-wrapper-disabled`]: C.value,
- [`${g}-affix-wrapper-sm`]: w.value === "small",
- [`${g}-affix-wrapper-lg`]: w.value === "large",
- [`${g}-affix-wrapper-rtl`]: S.value === "rtl",
- [`${g}-affix-wrapper-readonly`]: u,
- [`${g}-affix-wrapper-borderless`]: !l,
- // className will go to addon wrapper
- [`${r}`]: !pe && r
- }, N.value);
- T = b("div", {
- class: L,
- style: m,
- onClick: X
- }, [me && b("span", {
- class: `${g}-prefix`
- }, [q]), T, B && b("span", {
- class: `${g}-suffix`
- }, [de])]);
- }
- if (pe) {
- const L = `${g}-group`, ge = `${L}-addon`, ve = y ? b("div", {
- class: ge
- }, [y]) : null, he = R ? b("div", {
- class: ge
- }, [R]) : null, Me = j(`${g}-wrapper`, L, {
- [`${L}-rtl`]: S.value === "rtl"
- }, N.value), Pe = j(`${g}-group-wrapper`, {
- [`${g}-group-wrapper-sm`]: w.value === "small",
- [`${g}-group-wrapper-lg`]: w.value === "large",
- [`${g}-group-wrapper-rtl`]: S.value === "rtl"
- }, $e(`${s}-group-wrapper`, p.value, B), r, N.value);
- T = b("div", {
- class: Pe,
- style: m
- }, [b("div", {
- class: Me
- }, [ve && b(Ve, null, {
- default: () => [b(Be, null, {
- default: () => [ve]
- })]
- }), T, he && b(Ve, null, {
- default: () => [b(Be, null, {
- default: () => [he]
- })]
- })])]);
- }
- return _(dt(T, {
- style: m
- }));
- };
- }
- }), zt = v(ye, {
- install: (e) => (e.component(ye.name, ye), e)
- });
- export {
- zt as _
- };
|