ep-craft 0.1.28 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/config-provider/index.d.ts +246 -3
- package/dist/components/config-provider/index.js +17 -3
- package/dist/components/config-provider/src/config-provider-props.d.ts +103 -0
- package/dist/components/config-provider/src/config-provider-props.js +91 -0
- package/dist/components/config-provider/src/config-provider.d.ts +150 -0
- package/dist/components/config-provider/src/config-provider.js +22 -0
- package/dist/components/config-provider/src/hooks/use-global-config.js +55 -13
- package/dist/components/input-number/EpInputNumber.vue.d.ts +51 -0
- package/dist/components/input-number/EpInputNumber.vue.js +310 -0
- package/dist/components/input-number/EpInputNumber2.vue.js +4 -0
- package/dist/components/input-number/index.d.ts +5 -2
- package/dist/components/input-number/index.js +9 -4
- package/dist/components/input-number/input-number.d.ts +169 -0
- package/dist/components/input-number/input-number.js +165 -0
- package/dist/components/input-number/instance.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +2 -0
- package/package.json +2 -1
- package/theme-chalk/src/input-number.scss +118 -0
|
@@ -1,24 +1,66 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as c, getCurrentInstance as f, inject as v, computed as i, unref as d, provide as C } from "vue";
|
|
2
2
|
import "@vue/shared";
|
|
3
3
|
import "lodash-unified";
|
|
4
4
|
import "@vueuse/core";
|
|
5
|
+
import { debugWarn as g } from "../../../../utils/error.js";
|
|
6
|
+
import { keysOf as u } from "../../../../utils/objects.js";
|
|
5
7
|
import "@element-plus/icons-vue";
|
|
6
|
-
import "../../../../hooks/use-
|
|
8
|
+
import { namespaceContextKey as y } from "../../../../hooks/use-namespace/index.js";
|
|
9
|
+
import { localeContextKey as x } from "../../../../hooks/use-locale/index.js";
|
|
10
|
+
import { SIZE_INJECTION_KEY as b } from "../../../../hooks/use-size/index.js";
|
|
7
11
|
import "@popperjs/core";
|
|
8
|
-
import "../../../../hooks/use-z-index/index.js";
|
|
12
|
+
import { zIndexContextKey as I } from "../../../../hooks/use-z-index/index.js";
|
|
9
13
|
import "../../../../hooks/use-delayed-toggle/index.js";
|
|
10
14
|
import "../../../../hooks/use-aria/index.js";
|
|
11
15
|
import "../../../../hooks/use-model-toggle/index.js";
|
|
12
|
-
import "../../../../hooks/use-empty-values/index.js";
|
|
13
|
-
import { configProviderContextKey as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
var
|
|
19
|
-
return ((
|
|
20
|
-
});
|
|
16
|
+
import { emptyValuesContextKey as K } from "../../../../hooks/use-empty-values/index.js";
|
|
17
|
+
import { configProviderContextKey as s } from "../constants.js";
|
|
18
|
+
const m = c();
|
|
19
|
+
function z(r, l = void 0) {
|
|
20
|
+
const a = f() ? v(s, m) : m;
|
|
21
|
+
return r ? i(() => {
|
|
22
|
+
var t;
|
|
23
|
+
return ((t = a.value) == null ? void 0 : t[r]) ?? l;
|
|
24
|
+
}) : a;
|
|
21
25
|
}
|
|
26
|
+
const q = (r, l, a = !1) => {
|
|
27
|
+
const t = !!f(), e = t ? z() : void 0, n = t ? C : void 0;
|
|
28
|
+
if (!n) {
|
|
29
|
+
g(
|
|
30
|
+
"provideGlobalConfig",
|
|
31
|
+
"provideGlobalConfig() can only be used inside setup()."
|
|
32
|
+
);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const o = i(() => {
|
|
36
|
+
const p = d(r);
|
|
37
|
+
return e != null && e.value ? G(e.value, p) : p;
|
|
38
|
+
});
|
|
39
|
+
return n(s, o), n(
|
|
40
|
+
x,
|
|
41
|
+
i(() => o.value.locale)
|
|
42
|
+
), n(
|
|
43
|
+
y,
|
|
44
|
+
i(() => o.value.namespace)
|
|
45
|
+
), n(
|
|
46
|
+
I,
|
|
47
|
+
i(() => o.value.zIndex)
|
|
48
|
+
), n(b, {
|
|
49
|
+
size: i(() => o.value.size || "")
|
|
50
|
+
}), n(
|
|
51
|
+
K,
|
|
52
|
+
i(() => ({
|
|
53
|
+
emptyValues: o.value.emptyValues,
|
|
54
|
+
valueOnClear: o.value.valueOnClear
|
|
55
|
+
}))
|
|
56
|
+
), (a || !m.value) && (m.value = o.value), o;
|
|
57
|
+
}, G = (r, l) => {
|
|
58
|
+
const a = [.../* @__PURE__ */ new Set([...u(r), ...u(l)])], t = {};
|
|
59
|
+
for (const e of a)
|
|
60
|
+
t[e] = l[e] !== void 0 ? l[e] : r[e];
|
|
61
|
+
return t;
|
|
62
|
+
};
|
|
22
63
|
export {
|
|
23
|
-
|
|
64
|
+
q as provideGlobalConfig,
|
|
65
|
+
z as useGlobalConfig
|
|
24
66
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { InputNumberProps } from './input-number';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_15: {}, __VLS_43: {}, __VLS_45: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
'decrease-icon'?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
'increase-icon'?: (props: typeof __VLS_15) => any;
|
|
7
|
+
} & {
|
|
8
|
+
prefix?: (props: typeof __VLS_43) => any;
|
|
9
|
+
} & {
|
|
10
|
+
suffix?: (props: typeof __VLS_45) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<InputNumberProps, {
|
|
13
|
+
/** @description get focus the input component */
|
|
14
|
+
focus: () => void;
|
|
15
|
+
/** @description remove focus the input component */
|
|
16
|
+
blur: () => void;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:modelValue": (val: number | undefined) => void;
|
|
19
|
+
change: (cur: number | undefined, prev: number | undefined) => void;
|
|
20
|
+
input: (val: number | null | undefined) => void;
|
|
21
|
+
focus: (e: FocusEvent) => void;
|
|
22
|
+
blur: (e: FocusEvent) => void;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<InputNumberProps> & Readonly<{
|
|
24
|
+
"onUpdate:modelValue"?: ((val: number | undefined) => any) | undefined;
|
|
25
|
+
onChange?: ((cur: number | undefined, prev: number | undefined) => any) | undefined;
|
|
26
|
+
onInput?: ((val: number | null | undefined) => any) | undefined;
|
|
27
|
+
onFocus?: ((e: FocusEvent) => any) | undefined;
|
|
28
|
+
onBlur?: ((e: FocusEvent) => any) | undefined;
|
|
29
|
+
}>, {
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
tabindex: string | number;
|
|
32
|
+
id: string;
|
|
33
|
+
valueOnClear: "min" | "max" | number | null;
|
|
34
|
+
readonly: boolean;
|
|
35
|
+
validateEvent: boolean;
|
|
36
|
+
inputmode: "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal";
|
|
37
|
+
max: number;
|
|
38
|
+
min: number;
|
|
39
|
+
controls: boolean;
|
|
40
|
+
step: number;
|
|
41
|
+
align: "left" | "right" | "center";
|
|
42
|
+
controlsPosition: "" | "right";
|
|
43
|
+
stepStrictly: boolean;
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
45
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
46
|
+
export default _default;
|
|
47
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { defineComponent as Ne, ref as J, reactive as ve, computed as v, toRef as Q, watch as Y, onMounted as he, onUpdated as Ve, openBlock as p, createElementBlock as w, withModifiers as ye, normalizeClass as S, unref as l, toDisplayString as Ee, createCommentVNode as R, withDirectives as Z, withKeys as _, renderSlot as A, createVNode as $, withCtx as I, createBlock as F, createSlots as ge } from "vue";
|
|
2
|
+
import { isNil as k } from "lodash-unified";
|
|
3
|
+
import { EpInput as xe } from "../input/index.js";
|
|
4
|
+
import { ElIcon as ee } from "../icon/index.js";
|
|
5
|
+
import "../form/index.js";
|
|
6
|
+
import "../../directives/click-outside/index.js";
|
|
7
|
+
import { vRepeatClick as te } from "../../directives/repeat-click/index.js";
|
|
8
|
+
import { isNumber as h, isUndefined as C } from "../../utils/types.js";
|
|
9
|
+
import "@vueuse/core";
|
|
10
|
+
import { debugWarn as z, throwError as we } from "../../utils/error.js";
|
|
11
|
+
import { isString as Se, NOOP as re } from "@vue/shared";
|
|
12
|
+
import { getEventCode as Ae, getEventKey as Ie } from "../../utils/dom/event.js";
|
|
13
|
+
import { ArrowDown as Fe, Minus as ke, ArrowUp as Ce, Plus as De } from "@element-plus/icons-vue";
|
|
14
|
+
import { EVENT_CODE as ne } from "../../constants/aria.js";
|
|
15
|
+
import { UPDATE_MODEL_EVENT as V, INPUT_EVENT as K, CHANGE_EVENT as Le } from "../../constants/event.js";
|
|
16
|
+
import "normalize-wheel-es";
|
|
17
|
+
import { useNamespace as Me } from "../../hooks/use-namespace/index.js";
|
|
18
|
+
import { useLocale as Pe } from "../../hooks/use-locale/index.js";
|
|
19
|
+
import "../../hooks/use-size/index.js";
|
|
20
|
+
import "@popperjs/core";
|
|
21
|
+
import "../../hooks/use-z-index/index.js";
|
|
22
|
+
import "../../hooks/use-delayed-toggle/index.js";
|
|
23
|
+
import "../../hooks/use-aria/index.js";
|
|
24
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
25
|
+
import "../../hooks/use-empty-values/index.js";
|
|
26
|
+
import { useFloatLabel as Te } from "../../hooks/use-float-label/index.js";
|
|
27
|
+
import { inputNumberEmits as Be } from "./input-number.js";
|
|
28
|
+
import { useFormItem as Oe } from "../form/src/hooks/use-form-item.js";
|
|
29
|
+
import { useFormSize as Re, useFormDisabled as $e } from "../form/src/hooks/use-form-common-props.js";
|
|
30
|
+
const ze = ["aria-label"], Ke = ["aria-label"], vt = /* @__PURE__ */ Ne({
|
|
31
|
+
name: "ElInputNumber",
|
|
32
|
+
__name: "EpInputNumber",
|
|
33
|
+
props: {
|
|
34
|
+
id: { default: void 0 },
|
|
35
|
+
step: { default: 1 },
|
|
36
|
+
stepStrictly: { type: Boolean, default: !1 },
|
|
37
|
+
max: { default: Number.MAX_SAFE_INTEGER },
|
|
38
|
+
min: { default: Number.MIN_SAFE_INTEGER },
|
|
39
|
+
modelValue: {},
|
|
40
|
+
readonly: { type: Boolean, default: !1 },
|
|
41
|
+
disabled: { type: Boolean, default: void 0 },
|
|
42
|
+
size: {},
|
|
43
|
+
controls: { type: Boolean, default: !0 },
|
|
44
|
+
controlsPosition: { default: "" },
|
|
45
|
+
valueOnClear: { default: null },
|
|
46
|
+
name: {},
|
|
47
|
+
placeholder: {},
|
|
48
|
+
precision: {},
|
|
49
|
+
validateEvent: { type: Boolean, default: !0 },
|
|
50
|
+
ariaLabel: {},
|
|
51
|
+
inputmode: { default: void 0 },
|
|
52
|
+
align: { default: "center" },
|
|
53
|
+
disabledScientific: { type: Boolean },
|
|
54
|
+
formatter: {},
|
|
55
|
+
parser: {},
|
|
56
|
+
tabindex: { default: 0 },
|
|
57
|
+
floatLabel: { type: Boolean }
|
|
58
|
+
},
|
|
59
|
+
emits: Be,
|
|
60
|
+
setup(u, { expose: ae, emit: le }) {
|
|
61
|
+
const r = u, s = le, { t: G } = Pe(), m = Me("input-number"), b = J(), i = ve({
|
|
62
|
+
currentValue: r.modelValue,
|
|
63
|
+
userInput: null
|
|
64
|
+
}), { formItem: c } = Oe(), U = v(
|
|
65
|
+
() => h(r.modelValue) && r.modelValue <= r.min
|
|
66
|
+
), W = v(
|
|
67
|
+
() => h(r.modelValue) && r.modelValue >= r.max
|
|
68
|
+
), ie = v(() => {
|
|
69
|
+
const e = H(r.step);
|
|
70
|
+
return C(r.precision) ? Math.max(H(r.modelValue), e) : (e > r.precision && z(
|
|
71
|
+
"InputNumber",
|
|
72
|
+
"precision should not be less than the decimal places of step"
|
|
73
|
+
), r.precision);
|
|
74
|
+
}), D = v(() => r.controls && r.controlsPosition === "right"), X = Re(), N = $e(), L = J(!1), ue = v(() => !k(i.currentValue)), { floatLabelClass: oe } = Te({
|
|
75
|
+
floatLabel: Q(r, "floatLabel"),
|
|
76
|
+
isFocused: L,
|
|
77
|
+
hasValue: ue,
|
|
78
|
+
isDisabled: N,
|
|
79
|
+
isReadonly: Q(r, "readonly")
|
|
80
|
+
}), M = v(() => {
|
|
81
|
+
if (i.userInput !== null)
|
|
82
|
+
return i.userInput;
|
|
83
|
+
let e = i.currentValue;
|
|
84
|
+
if (k(e)) return "";
|
|
85
|
+
if (h(e)) {
|
|
86
|
+
if (Number.isNaN(e)) return "";
|
|
87
|
+
C(r.precision) || (e = e.toFixed(r.precision));
|
|
88
|
+
}
|
|
89
|
+
return e;
|
|
90
|
+
}), y = (e, t) => {
|
|
91
|
+
if (C(t) && (t = ie.value), t === 0) return Math.round(e);
|
|
92
|
+
let n = String(e);
|
|
93
|
+
const a = n.indexOf(".");
|
|
94
|
+
if (a === -1 || !n.replace(".", "").split("")[a + t]) return e;
|
|
95
|
+
const g = n.length;
|
|
96
|
+
return n.charAt(g - 1) === "5" && (n = `${n.slice(0, Math.max(0, g - 1))}6`), Number.parseFloat(Number(n).toFixed(t));
|
|
97
|
+
}, H = (e) => {
|
|
98
|
+
if (k(e)) return 0;
|
|
99
|
+
const t = e.toString(), n = t.indexOf(".");
|
|
100
|
+
let a = 0;
|
|
101
|
+
return n !== -1 && (a = t.length - n - 1), a;
|
|
102
|
+
}, j = (e, t = 1) => h(e) ? e >= Number.MAX_SAFE_INTEGER && t === 1 ? (z(
|
|
103
|
+
"InputNumber",
|
|
104
|
+
"The value has reached the maximum safe integer limit."
|
|
105
|
+
), e) : e <= Number.MIN_SAFE_INTEGER && t === -1 ? (z(
|
|
106
|
+
"InputNumber",
|
|
107
|
+
"The value has reached the minimum safe integer limit."
|
|
108
|
+
), e) : y(e + r.step * t) : i.currentValue, se = (e) => {
|
|
109
|
+
const t = Ae(e), n = Ie(e);
|
|
110
|
+
if (r.disabledScientific && ["e", "E"].includes(n)) {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
switch (t) {
|
|
115
|
+
case ne.up: {
|
|
116
|
+
e.preventDefault(), P();
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case ne.down: {
|
|
120
|
+
e.preventDefault(), T();
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, P = () => {
|
|
125
|
+
if (r.readonly || N.value || W.value) return;
|
|
126
|
+
const e = Number(M.value) || 0, t = j(e);
|
|
127
|
+
E(t), s(K, i.currentValue), O();
|
|
128
|
+
}, T = () => {
|
|
129
|
+
if (r.readonly || N.value || U.value) return;
|
|
130
|
+
const e = Number(M.value) || 0, t = j(e, -1);
|
|
131
|
+
E(t), s(K, i.currentValue), O();
|
|
132
|
+
}, B = (e, t) => {
|
|
133
|
+
const { max: n, min: a, step: d, precision: f, stepStrictly: g, valueOnClear: x } = r;
|
|
134
|
+
n < a && we("InputNumber", "min should not be greater than max.");
|
|
135
|
+
let o = e ? Number.parseFloat(String(e)) : Number(e);
|
|
136
|
+
if (k(e) || Number.isNaN(o))
|
|
137
|
+
return null;
|
|
138
|
+
if (e === "") {
|
|
139
|
+
if (x === null)
|
|
140
|
+
return null;
|
|
141
|
+
o = Se(x) ? { min: a, max: n }[x] : x;
|
|
142
|
+
}
|
|
143
|
+
return g && (o = y(
|
|
144
|
+
Math.round(y(o / d)) * d,
|
|
145
|
+
f
|
|
146
|
+
), o !== e && t && s(V, o)), C(f) || (o = y(o, f)), (o > n || o < a) && (o = o > n ? n : a, t && s(V, o)), o;
|
|
147
|
+
}, E = (e, t = !0) => {
|
|
148
|
+
var d;
|
|
149
|
+
const n = i.currentValue, a = B(e);
|
|
150
|
+
if (!t) {
|
|
151
|
+
s(V, a);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
i.userInput = null, !(n === a && e) && (s(V, a), n !== a && s(Le, a, n), r.validateEvent && ((d = c == null ? void 0 : c.validate) == null || d.call(c, "change").catch(re)), i.currentValue = a);
|
|
155
|
+
}, me = (e) => {
|
|
156
|
+
i.userInput = e;
|
|
157
|
+
let t = e === "" ? null : Number.parseFloat(e);
|
|
158
|
+
Number.isNaN(t) && (t = null), s(K, t), E(t, !1);
|
|
159
|
+
}, ce = (e) => {
|
|
160
|
+
const t = e !== "" ? Number.parseFloat(e) : "";
|
|
161
|
+
(h(t) && !Number.isNaN(t) || r.formatter && Number.isNaN(t) || t === "") && E(t), O(), i.userInput = null;
|
|
162
|
+
}, q = () => {
|
|
163
|
+
var e, t;
|
|
164
|
+
(t = (e = b.value) == null ? void 0 : e.focus) == null || t.call(e);
|
|
165
|
+
}, de = () => {
|
|
166
|
+
var e, t;
|
|
167
|
+
(t = (e = b.value) == null ? void 0 : e.blur) == null || t.call(e);
|
|
168
|
+
}, fe = (e) => {
|
|
169
|
+
L.value = !0, s("focus", e);
|
|
170
|
+
}, pe = (e) => {
|
|
171
|
+
var t, n, a;
|
|
172
|
+
L.value = !1, i.userInput = null, i.currentValue === null && ((t = b.value) != null && t.input) && (b.value.input.value = ((n = r.formatter) == null ? void 0 : n.call(r, "")) ?? ""), s("blur", e), r.validateEvent && ((a = c == null ? void 0 : c.validate) == null || a.call(c, "blur").catch(re));
|
|
173
|
+
}, O = () => {
|
|
174
|
+
i.currentValue !== r.modelValue && (i.currentValue = r.modelValue);
|
|
175
|
+
}, be = (e) => {
|
|
176
|
+
document.activeElement === e.target && e.preventDefault();
|
|
177
|
+
};
|
|
178
|
+
return Y(
|
|
179
|
+
() => r.modelValue,
|
|
180
|
+
(e, t) => {
|
|
181
|
+
const n = B(e, !0);
|
|
182
|
+
i.userInput === null && n !== t && (i.currentValue = n);
|
|
183
|
+
},
|
|
184
|
+
{ immediate: !0 }
|
|
185
|
+
), Y(
|
|
186
|
+
() => r.precision,
|
|
187
|
+
() => {
|
|
188
|
+
i.currentValue = B(r.modelValue);
|
|
189
|
+
}
|
|
190
|
+
), he(() => {
|
|
191
|
+
var d;
|
|
192
|
+
const { min: e, max: t, modelValue: n } = r, a = (d = b.value) == null ? void 0 : d.input;
|
|
193
|
+
if (a.setAttribute("role", "spinbutton"), Number.isFinite(t) ? a.setAttribute("aria-valuemax", String(t)) : a.removeAttribute("aria-valuemax"), Number.isFinite(e) ? a.setAttribute("aria-valuemin", String(e)) : a.removeAttribute("aria-valuemin"), a.setAttribute(
|
|
194
|
+
"aria-valuenow",
|
|
195
|
+
i.currentValue || i.currentValue === 0 ? String(i.currentValue) : ""
|
|
196
|
+
), a.setAttribute("aria-disabled", String(N.value)), !h(n) && n != null) {
|
|
197
|
+
let f = Number(n);
|
|
198
|
+
Number.isNaN(f) && (f = null), s(V, f);
|
|
199
|
+
}
|
|
200
|
+
a.addEventListener("wheel", be, { passive: !1 });
|
|
201
|
+
}), Ve(() => {
|
|
202
|
+
var t;
|
|
203
|
+
const e = (t = b.value) == null ? void 0 : t.input;
|
|
204
|
+
e == null || e.setAttribute("aria-valuenow", `${i.currentValue ?? ""}`);
|
|
205
|
+
}), ae({
|
|
206
|
+
/** @description get focus the input component */
|
|
207
|
+
focus: q,
|
|
208
|
+
/** @description remove focus the input component */
|
|
209
|
+
blur: de
|
|
210
|
+
}), (e, t) => (p(), w("div", {
|
|
211
|
+
class: S([
|
|
212
|
+
l(m).b(),
|
|
213
|
+
l(m).m(l(X)),
|
|
214
|
+
l(m).is("disabled", l(N)),
|
|
215
|
+
l(m).is("without-controls", !u.controls),
|
|
216
|
+
l(m).is("controls-right", D.value),
|
|
217
|
+
l(m).is(u.align, !!u.align),
|
|
218
|
+
l(m).is("float-label", r.floatLabel)
|
|
219
|
+
]),
|
|
220
|
+
onDragstart: t[0] || (t[0] = ye(() => {
|
|
221
|
+
}, ["prevent"]))
|
|
222
|
+
}, [
|
|
223
|
+
r.floatLabel ? (p(), w("span", {
|
|
224
|
+
key: 0,
|
|
225
|
+
class: S(["el-float-label", l(oe)]),
|
|
226
|
+
onClick: q
|
|
227
|
+
}, Ee(u.placeholder), 3)) : R("", !0),
|
|
228
|
+
u.controls ? Z((p(), w("span", {
|
|
229
|
+
key: 1,
|
|
230
|
+
role: "button",
|
|
231
|
+
"aria-label": l(G)("el.inputNumber.decrease"),
|
|
232
|
+
class: S([l(m).e("decrease"), l(m).is("disabled", U.value)]),
|
|
233
|
+
onKeydown: _(T, ["enter"])
|
|
234
|
+
}, [
|
|
235
|
+
A(e.$slots, "decrease-icon", {}, () => [
|
|
236
|
+
$(l(ee), null, {
|
|
237
|
+
default: I(() => [
|
|
238
|
+
D.value ? (p(), F(l(Fe), { key: 0 })) : (p(), F(l(ke), { key: 1 }))
|
|
239
|
+
]),
|
|
240
|
+
_: 1
|
|
241
|
+
})
|
|
242
|
+
])
|
|
243
|
+
], 42, ze)), [
|
|
244
|
+
[l(te), T]
|
|
245
|
+
]) : R("", !0),
|
|
246
|
+
u.controls ? Z((p(), w("span", {
|
|
247
|
+
key: 2,
|
|
248
|
+
role: "button",
|
|
249
|
+
"aria-label": l(G)("el.inputNumber.increase"),
|
|
250
|
+
class: S([l(m).e("increase"), l(m).is("disabled", W.value)]),
|
|
251
|
+
onKeydown: _(P, ["enter"])
|
|
252
|
+
}, [
|
|
253
|
+
A(e.$slots, "increase-icon", {}, () => [
|
|
254
|
+
$(l(ee), null, {
|
|
255
|
+
default: I(() => [
|
|
256
|
+
D.value ? (p(), F(l(Ce), { key: 0 })) : (p(), F(l(De), { key: 1 }))
|
|
257
|
+
]),
|
|
258
|
+
_: 1
|
|
259
|
+
})
|
|
260
|
+
])
|
|
261
|
+
], 42, Ke)), [
|
|
262
|
+
[l(te), P]
|
|
263
|
+
]) : R("", !0),
|
|
264
|
+
$(l(xe), {
|
|
265
|
+
id: u.id,
|
|
266
|
+
ref_key: "input",
|
|
267
|
+
ref: b,
|
|
268
|
+
type: u.formatter ? "text" : "number",
|
|
269
|
+
step: u.step,
|
|
270
|
+
"model-value": M.value,
|
|
271
|
+
placeholder: r.floatLabel ? void 0 : u.placeholder,
|
|
272
|
+
readonly: u.readonly,
|
|
273
|
+
disabled: l(N),
|
|
274
|
+
size: l(X),
|
|
275
|
+
max: u.max,
|
|
276
|
+
min: u.min,
|
|
277
|
+
name: u.name,
|
|
278
|
+
"aria-label": u.ariaLabel,
|
|
279
|
+
"validate-event": !1,
|
|
280
|
+
inputmode: u.inputmode,
|
|
281
|
+
formatter: u.formatter,
|
|
282
|
+
parser: u.parser,
|
|
283
|
+
tabindex: u.tabindex,
|
|
284
|
+
onKeydown: se,
|
|
285
|
+
onBlur: pe,
|
|
286
|
+
onFocus: fe,
|
|
287
|
+
onInput: me,
|
|
288
|
+
onChange: ce
|
|
289
|
+
}, ge({ _: 2 }, [
|
|
290
|
+
e.$slots.prefix ? {
|
|
291
|
+
name: "prefix",
|
|
292
|
+
fn: I(() => [
|
|
293
|
+
A(e.$slots, "prefix")
|
|
294
|
+
]),
|
|
295
|
+
key: "0"
|
|
296
|
+
} : void 0,
|
|
297
|
+
e.$slots.suffix ? {
|
|
298
|
+
name: "suffix",
|
|
299
|
+
fn: I(() => [
|
|
300
|
+
A(e.$slots, "suffix")
|
|
301
|
+
]),
|
|
302
|
+
key: "1"
|
|
303
|
+
} : void 0
|
|
304
|
+
]), 1032, ["id", "type", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "inputmode", "formatter", "parser", "tabindex"])
|
|
305
|
+
], 34));
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
export {
|
|
309
|
+
vt as default
|
|
310
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from 'vue';
|
|
2
|
-
import
|
|
3
|
-
export declare const EpInputNumber: typeof
|
|
2
|
+
import _EpInputNumber from './EpInputNumber.vue';
|
|
3
|
+
export declare const EpInputNumber: typeof _EpInputNumber & Plugin;
|
|
4
4
|
export default EpInputNumber;
|
|
5
|
+
export { inputNumberEmits, inputNumberProps } from './input-number';
|
|
6
|
+
export type { InputNumberEmits, InputNumberProps, InputNumberPropsPublic, } from './input-number';
|
|
7
|
+
export type { InputNumberInstance } from './instance';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { withInstall as t } from "../../utils/with-install.js";
|
|
2
|
+
import m from "./EpInputNumber.vue.js";
|
|
3
|
+
import { inputNumberEmits as e } from "./input-number.js";
|
|
4
|
+
const o = t(
|
|
5
|
+
m,
|
|
6
|
+
"ep-input-number"
|
|
7
|
+
);
|
|
4
8
|
export {
|
|
5
|
-
|
|
9
|
+
o as EpInputNumber,
|
|
10
|
+
e as inputNumberEmits
|
|
6
11
|
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { ExtractPublicPropTypes, HTMLAttributes } from 'vue';
|
|
2
|
+
import type { ComponentSize } from '@element-plus/constants';
|
|
3
|
+
/**
|
|
4
|
+
* @description input-number component props
|
|
5
|
+
*/
|
|
6
|
+
export interface InputNumberProps {
|
|
7
|
+
/**
|
|
8
|
+
* @description same as `id` in native input
|
|
9
|
+
*/
|
|
10
|
+
id?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @description incremental step
|
|
13
|
+
*/
|
|
14
|
+
step?: number;
|
|
15
|
+
/**
|
|
16
|
+
* @description whether input value can only be multiple of step
|
|
17
|
+
*/
|
|
18
|
+
stepStrictly?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @description the maximum allowed value
|
|
21
|
+
*/
|
|
22
|
+
max?: number;
|
|
23
|
+
/**
|
|
24
|
+
* @description the minimum allowed value
|
|
25
|
+
*/
|
|
26
|
+
min?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @description binding value
|
|
29
|
+
*/
|
|
30
|
+
modelValue?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* @description same as `readonly` in native input
|
|
33
|
+
*/
|
|
34
|
+
readonly?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* @description whether the component is disabled
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @description size of the component
|
|
41
|
+
*/
|
|
42
|
+
size?: ComponentSize;
|
|
43
|
+
/**
|
|
44
|
+
* @description whether to enable the control buttons
|
|
45
|
+
*/
|
|
46
|
+
controls?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @description position of the control buttons
|
|
49
|
+
*/
|
|
50
|
+
controlsPosition?: '' | 'right';
|
|
51
|
+
/**
|
|
52
|
+
* @description value should be set when input box is cleared
|
|
53
|
+
*/
|
|
54
|
+
valueOnClear?: 'min' | 'max' | number | null;
|
|
55
|
+
/**
|
|
56
|
+
* @description same as `name` in native input
|
|
57
|
+
*/
|
|
58
|
+
name?: string;
|
|
59
|
+
/**
|
|
60
|
+
* @description same as `placeholder` in native input
|
|
61
|
+
*/
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
/**
|
|
64
|
+
* @description precision of input value
|
|
65
|
+
*/
|
|
66
|
+
precision?: number;
|
|
67
|
+
/**
|
|
68
|
+
* @description whether to trigger form validation
|
|
69
|
+
*/
|
|
70
|
+
validateEvent?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* @description native aria-label attribute
|
|
73
|
+
*/
|
|
74
|
+
ariaLabel?: string;
|
|
75
|
+
/**
|
|
76
|
+
* @description native input mode for virtual keyboards
|
|
77
|
+
*/
|
|
78
|
+
inputmode?: HTMLAttributes['inputmode'];
|
|
79
|
+
/**
|
|
80
|
+
* @description alignment for the inner input text
|
|
81
|
+
*/
|
|
82
|
+
align?: 'left' | 'right' | 'center';
|
|
83
|
+
/**
|
|
84
|
+
* @description whether to disable scientific notation input (e.g. 'e', 'E')
|
|
85
|
+
*/
|
|
86
|
+
disabledScientific?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @description specifies the format of the value presented in the input
|
|
89
|
+
*/
|
|
90
|
+
formatter?: (value: string) => string;
|
|
91
|
+
/**
|
|
92
|
+
* @description specifies the value extracted from the formatted input
|
|
93
|
+
*/
|
|
94
|
+
parser?: (value: string) => string;
|
|
95
|
+
/**
|
|
96
|
+
* @description same as `tabindex` in native input
|
|
97
|
+
*/
|
|
98
|
+
tabindex?: string | number;
|
|
99
|
+
/**
|
|
100
|
+
* @description whether to enable the floating label (Material style)
|
|
101
|
+
*/
|
|
102
|
+
floatLabel?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
|
|
106
|
+
*/
|
|
107
|
+
export declare const inputNumberProps: {
|
|
108
|
+
readonly floatLabel: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
|
|
109
|
+
readonly inputmode: import("@element-plus/utils").EpPropFinalized<(new (...args: any[]) => "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal") | (() => "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined) | (((new (...args: any[]) => "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal") | (() => "search" | "none" | "text" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined)) | null)[], unknown, unknown, undefined, boolean>;
|
|
110
|
+
readonly align: import("@element-plus/utils").EpPropFinalized<(new (...args: any[]) => "left" | "right" | "center") | (() => "left" | "right" | "center") | (((new (...args: any[]) => "left" | "right" | "center") | (() => "left" | "right" | "center")) | null)[], unknown, unknown, "center", boolean>;
|
|
111
|
+
readonly disabledScientific: BooleanConstructor;
|
|
112
|
+
readonly formatter: {
|
|
113
|
+
readonly type: import("vue").PropType<Function>;
|
|
114
|
+
readonly required: false;
|
|
115
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
116
|
+
__epPropKey: true;
|
|
117
|
+
};
|
|
118
|
+
readonly parser: {
|
|
119
|
+
readonly type: import("vue").PropType<Function>;
|
|
120
|
+
readonly required: false;
|
|
121
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
122
|
+
__epPropKey: true;
|
|
123
|
+
};
|
|
124
|
+
readonly tabindex: import("@element-plus/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
|
|
125
|
+
readonly ariaLabel: StringConstructor;
|
|
126
|
+
readonly id: import("@element-plus/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
127
|
+
readonly step: import("@element-plus/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
128
|
+
readonly stepStrictly: BooleanConstructor;
|
|
129
|
+
readonly max: import("@element-plus/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
130
|
+
readonly min: import("@element-plus/utils").EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
131
|
+
readonly modelValue: {
|
|
132
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<readonly [NumberConstructor, null], unknown, unknown>>;
|
|
133
|
+
readonly required: false;
|
|
134
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
135
|
+
__epPropKey: true;
|
|
136
|
+
};
|
|
137
|
+
readonly readonly: BooleanConstructor;
|
|
138
|
+
readonly disabled: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
139
|
+
readonly size: {
|
|
140
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
141
|
+
readonly required: false;
|
|
142
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
143
|
+
__epPropKey: true;
|
|
144
|
+
};
|
|
145
|
+
readonly controls: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
146
|
+
readonly controlsPosition: import("@element-plus/utils").EpPropFinalized<StringConstructor, "" | "right", unknown, "", boolean>;
|
|
147
|
+
readonly valueOnClear: import("@element-plus/utils").EpPropFinalized<(new (...args: any[]) => number | "max" | "min") | (() => number | "max" | "min" | null) | (((new (...args: any[]) => number | "max" | "min") | (() => number | "max" | "min" | null)) | null)[], unknown, unknown, null, boolean>;
|
|
148
|
+
readonly name: StringConstructor;
|
|
149
|
+
readonly placeholder: StringConstructor;
|
|
150
|
+
readonly precision: {
|
|
151
|
+
readonly type: import("vue").PropType<number>;
|
|
152
|
+
readonly required: false;
|
|
153
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
154
|
+
__epPropKey: true;
|
|
155
|
+
};
|
|
156
|
+
readonly validateEvent: import("@element-plus/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated Removed after 3.0.0, Use `InputNumberProps` instead.
|
|
160
|
+
*/
|
|
161
|
+
export type InputNumberPropsPublic = ExtractPublicPropTypes<typeof inputNumberProps>;
|
|
162
|
+
export declare const inputNumberEmits: {
|
|
163
|
+
change: (cur: number | undefined, prev: number | undefined) => boolean;
|
|
164
|
+
blur: (e: FocusEvent) => boolean;
|
|
165
|
+
focus: (e: FocusEvent) => boolean;
|
|
166
|
+
input: (val: number | null | undefined) => boolean;
|
|
167
|
+
"update:modelValue": (val: number | undefined) => boolean;
|
|
168
|
+
};
|
|
169
|
+
export type InputNumberEmits = typeof inputNumberEmits;
|