ep-craft 0.1.40 → 0.1.42
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/affix/affix.d.ts +8 -0
- package/dist/components/affix/affix.js +77 -138
- package/dist/components/dialog/EpDialog.vue.d.ts +2 -2
- package/dist/components/dialog/EpDialog.vue.js +19 -19
- package/dist/components/drawer/EpDrawer.vue.d.ts +2 -2
- package/dist/components/drawer/EpDrawer.vue.js +16 -16
- package/dist/components/input-number/EpInputNumber.vue.js +62 -63
- package/dist/components/input-number/input-number.d.ts +5 -0
- package/dist/components/input-number/input-number.js +6 -6
- package/dist/components/menu/menu.js +154 -164
- package/dist/components/message-box/src/index2.vue.js +10 -10
- package/dist/components/progress/src/progress.vue.d.ts +1 -1
- package/dist/components/select/index.d.ts +6 -3
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +3 -3
- package/dist/components/select/select.vue.d.ts +3 -1
- package/dist/components/select/select.vue.js +9 -9
- package/dist/components/select/select2.vue.js +73 -75
- package/dist/components/select-v2/src/defaults.d.ts +1 -0
- package/dist/components/select-v2/src/defaults.js +1 -1
- package/dist/components/select-v2/src/select.vue.d.ts +3 -1
- package/dist/components/select-v2/src/select.vue.js +21 -21
- package/dist/components/select-v2/src/select2.vue.js +27 -29
- package/dist/components/tree-select/src/tree-select.vue.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as he, ref as Q, reactive as Ve, computed as N, toRef as Y, watch as Z, onMounted as ye, onUpdated as Ee, openBlock as b, createElementBlock as w, withModifiers as ge, normalizeClass as I, unref as
|
|
2
|
-
import { isNil as
|
|
1
|
+
import { defineComponent as he, ref as Q, reactive as Ve, computed as N, toRef as Y, watch as Z, onMounted as ye, onUpdated as Ee, openBlock as b, createElementBlock as w, withModifiers as ge, normalizeClass as I, unref as n, toDisplayString as xe, createCommentVNode as R, withDirectives as _, withKeys as ee, renderSlot as S, createVNode as $, withCtx as A, createBlock as L, createSlots as we } from "vue";
|
|
2
|
+
import { isNil as F } from "lodash-unified";
|
|
3
3
|
import { EpInput as Ie } from "../input/index.js";
|
|
4
4
|
import { ElIcon as te } from "../icon/index.js";
|
|
5
5
|
import { vRepeatClick as ae } from "../../directives/repeat-click/index.js";
|
|
6
6
|
import { useNamespace as Se } from "../../hooks/use-namespace/index.js";
|
|
7
7
|
import { useLocale as Ae } from "../../hooks/use-locale/index.js";
|
|
8
|
-
import { useId as
|
|
8
|
+
import { useId as Le } from "../../hooks/use-id/index.js";
|
|
9
9
|
import "../../hooks/use-size/index.js";
|
|
10
10
|
import "../../hooks/use-aria/index.js";
|
|
11
|
-
import { useFloatLabel as
|
|
12
|
-
import { debugWarn as z, throwError as
|
|
13
|
-
import { isString as Ce, NOOP as
|
|
14
|
-
import { isNumber as h, isUndefined as
|
|
11
|
+
import { useFloatLabel as Fe } from "../../hooks/use-float-label/index.js";
|
|
12
|
+
import { debugWarn as z, throwError as ke } from "../../utils/error.js";
|
|
13
|
+
import { isString as Ce, NOOP as re } from "@vue/shared";
|
|
14
|
+
import { isNumber as h, isUndefined as k } from "../../utils/types.js";
|
|
15
15
|
import { getEventCode as De, getEventKey as Me } from "../../utils/dom/event.js";
|
|
16
16
|
import { ArrowDown as Pe, Minus as Te, ArrowUp as Be, Plus as Oe } from "@element-plus/icons-vue";
|
|
17
17
|
import { EVENT_CODE as le } from "../../constants/aria.js";
|
|
@@ -40,6 +40,7 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
40
40
|
precision: {},
|
|
41
41
|
validateEvent: { type: Boolean, default: !0 },
|
|
42
42
|
ariaLabel: {},
|
|
43
|
+
ariaLabelledby: {},
|
|
43
44
|
inputmode: { default: void 0 },
|
|
44
45
|
align: { default: "center" },
|
|
45
46
|
disabledScientific: { type: Boolean },
|
|
@@ -49,7 +50,7 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
49
50
|
floatLabel: { type: Boolean }
|
|
50
51
|
},
|
|
51
52
|
emits: $e,
|
|
52
|
-
setup(u, { expose:
|
|
53
|
+
setup(u, { expose: ne, emit: ie }) {
|
|
53
54
|
const a = u, s = ie, { t: G } = Ae(), c = Se("input-number"), p = Q(), i = Ve({
|
|
54
55
|
currentValue: a.modelValue,
|
|
55
56
|
userInput: null
|
|
@@ -59,40 +60,38 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
59
60
|
() => h(a.modelValue) && a.modelValue >= a.max
|
|
60
61
|
), ue = N(() => {
|
|
61
62
|
const e = j(a.step);
|
|
62
|
-
return
|
|
63
|
+
return k(a.precision) ? Math.max(j(a.modelValue), e) : (e > a.precision && z(
|
|
63
64
|
"InputNumber",
|
|
64
65
|
"precision should not be less than the decimal places of step"
|
|
65
66
|
), a.precision);
|
|
66
|
-
}), C = N(() => a.controls && a.controlsPosition === "right"), X = Ke(), v = Ge(), D = Q(!1), oe = N(() => !
|
|
67
|
+
}), C = N(() => a.controls && a.controlsPosition === "right"), X = Ke(), v = Ge(), D = Q(!1), oe = N(() => !F(i.currentValue)), { floatLabelClass: se } = Fe({
|
|
67
68
|
floatLabel: Y(a, "floatLabel"),
|
|
68
69
|
isFocused: D,
|
|
69
70
|
hasValue: oe,
|
|
70
71
|
isDisabled: v,
|
|
71
72
|
isReadonly: Y(a, "readonly")
|
|
72
|
-
}), H =
|
|
73
|
-
() => a.floatLabel && a.placeholder && !a.ariaLabel ? H.value : void 0
|
|
74
|
-
), M = N(() => {
|
|
73
|
+
}), H = Le(), ce = N(() => a.ariaLabelledby ? a.ariaLabelledby : a.floatLabel && a.placeholder && !a.ariaLabel ? H.value : void 0), M = N(() => {
|
|
75
74
|
if (i.userInput !== null)
|
|
76
75
|
return i.userInput;
|
|
77
76
|
let e = i.currentValue;
|
|
78
|
-
if (
|
|
77
|
+
if (F(e)) return "";
|
|
79
78
|
if (h(e)) {
|
|
80
79
|
if (Number.isNaN(e)) return "";
|
|
81
|
-
|
|
80
|
+
k(a.precision) || (e = e.toFixed(a.precision));
|
|
82
81
|
}
|
|
83
82
|
return e;
|
|
84
83
|
}), y = (e, t) => {
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
87
|
-
const l =
|
|
88
|
-
if (l === -1 || !
|
|
89
|
-
const g =
|
|
90
|
-
return
|
|
84
|
+
if (k(t) && (t = ue.value), t === 0) return Math.round(e);
|
|
85
|
+
let r = String(e);
|
|
86
|
+
const l = r.indexOf(".");
|
|
87
|
+
if (l === -1 || !r.replace(".", "").split("")[l + t]) return e;
|
|
88
|
+
const g = r.length;
|
|
89
|
+
return r.charAt(g - 1) === "5" && (r = `${r.slice(0, Math.max(0, g - 1))}6`), Number.parseFloat(Number(r).toFixed(t));
|
|
91
90
|
}, j = (e) => {
|
|
92
|
-
if (
|
|
93
|
-
const t = e.toString(),
|
|
91
|
+
if (F(e)) return 0;
|
|
92
|
+
const t = e.toString(), r = t.indexOf(".");
|
|
94
93
|
let l = 0;
|
|
95
|
-
return
|
|
94
|
+
return r !== -1 && (l = t.length - r - 1), l;
|
|
96
95
|
}, q = (e, t = 1) => h(e) ? e >= Number.MAX_SAFE_INTEGER && t === 1 ? (z(
|
|
97
96
|
"InputNumber",
|
|
98
97
|
"The value has reached the maximum safe integer limit."
|
|
@@ -100,8 +99,8 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
100
99
|
"InputNumber",
|
|
101
100
|
"The value has reached the minimum safe integer limit."
|
|
102
101
|
), e) : y(e + a.step * t) : i.currentValue, de = (e) => {
|
|
103
|
-
const t = De(e),
|
|
104
|
-
if (a.disabledScientific && ["e", "E"].includes(
|
|
102
|
+
const t = De(e), r = Me(e);
|
|
103
|
+
if (a.disabledScientific && ["e", "E"].includes(r)) {
|
|
105
104
|
e.preventDefault();
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
@@ -124,28 +123,28 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
124
123
|
const e = Number(M.value) || 0, t = q(e, -1);
|
|
125
124
|
E(t), s(K, i.currentValue), O();
|
|
126
125
|
}, B = (e, t) => {
|
|
127
|
-
const { max:
|
|
128
|
-
|
|
126
|
+
const { max: r, min: l, step: m, precision: f, stepStrictly: g, valueOnClear: x } = a;
|
|
127
|
+
r < l && ke("InputNumber", "min should not be greater than max.");
|
|
129
128
|
let o = e ? Number.parseFloat(String(e)) : Number(e);
|
|
130
|
-
if (
|
|
129
|
+
if (F(e) || Number.isNaN(o))
|
|
131
130
|
return null;
|
|
132
131
|
if (e === "") {
|
|
133
132
|
if (x === null)
|
|
134
133
|
return null;
|
|
135
|
-
o = Ce(x) ? { min: l, max:
|
|
134
|
+
o = Ce(x) ? { min: l, max: r }[x] : x;
|
|
136
135
|
}
|
|
137
136
|
return g && (o = y(
|
|
138
137
|
Math.round(y(o / m)) * m,
|
|
139
138
|
f
|
|
140
|
-
), o !== e && t && s(V, o)),
|
|
139
|
+
), o !== e && t && s(V, o)), k(f) || (o = y(o, f)), (o > r || o < l) && (o = o > r ? r : l, t && s(V, o)), o;
|
|
141
140
|
}, E = (e, t = !0) => {
|
|
142
141
|
var m;
|
|
143
|
-
const
|
|
142
|
+
const r = i.currentValue, l = B(e);
|
|
144
143
|
if (!t) {
|
|
145
144
|
s(V, l);
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
|
-
i.userInput = null, !(
|
|
147
|
+
i.userInput = null, !(r === l && e) && (s(V, l), r !== l && s(Re, l, r), a.validateEvent && ((m = d == null ? void 0 : d.validate) == null || m.call(d, "change").catch(re)), i.currentValue = l);
|
|
149
148
|
}, me = (e) => {
|
|
150
149
|
i.userInput = e;
|
|
151
150
|
let t = e === "" ? null : Number.parseFloat(e);
|
|
@@ -162,8 +161,8 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
162
161
|
}, pe = (e) => {
|
|
163
162
|
D.value = !0, s("focus", e);
|
|
164
163
|
}, Ne = (e) => {
|
|
165
|
-
var t,
|
|
166
|
-
D.value = !1, i.userInput = null, i.currentValue === null && ((t = p.value) != null && t.input) && (p.value.input.value = ((
|
|
164
|
+
var t, r, l;
|
|
165
|
+
D.value = !1, i.userInput = null, i.currentValue === null && ((t = p.value) != null && t.input) && (p.value.input.value = ((r = a.formatter) == null ? void 0 : r.call(a, "")) ?? ""), s("blur", e), a.validateEvent && ((l = d == null ? void 0 : d.validate) == null || l.call(d, "blur").catch(re));
|
|
167
166
|
}, O = () => {
|
|
168
167
|
i.currentValue !== a.modelValue && (i.currentValue = a.modelValue);
|
|
169
168
|
}, ve = (e) => {
|
|
@@ -172,8 +171,8 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
172
171
|
return Z(
|
|
173
172
|
() => a.modelValue,
|
|
174
173
|
(e, t) => {
|
|
175
|
-
const
|
|
176
|
-
i.userInput === null &&
|
|
174
|
+
const r = B(e, !0);
|
|
175
|
+
i.userInput === null && r !== t && (i.currentValue = r);
|
|
177
176
|
},
|
|
178
177
|
{ immediate: !0 }
|
|
179
178
|
), Z(
|
|
@@ -183,12 +182,12 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
183
182
|
}
|
|
184
183
|
), ye(() => {
|
|
185
184
|
var m;
|
|
186
|
-
const { min: e, max: t, modelValue:
|
|
185
|
+
const { min: e, max: t, modelValue: r } = a, l = (m = p.value) == null ? void 0 : m.input;
|
|
187
186
|
if (l.setAttribute("role", "spinbutton"), Number.isFinite(t) ? l.setAttribute("aria-valuemax", String(t)) : l.removeAttribute("aria-valuemax"), Number.isFinite(e) ? l.setAttribute("aria-valuemin", String(e)) : l.removeAttribute("aria-valuemin"), l.setAttribute(
|
|
188
187
|
"aria-valuenow",
|
|
189
188
|
i.currentValue || i.currentValue === 0 ? String(i.currentValue) : ""
|
|
190
|
-
), l.setAttribute("aria-disabled", String(v.value)), !h(
|
|
191
|
-
let f = Number(
|
|
189
|
+
), l.setAttribute("aria-disabled", String(v.value)), !h(r) && r != null) {
|
|
190
|
+
let f = Number(r);
|
|
192
191
|
Number.isNaN(f) && (f = null), s(V, f);
|
|
193
192
|
}
|
|
194
193
|
l.addEventListener("wheel", ve, { passive: !1 });
|
|
@@ -196,67 +195,67 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
196
195
|
var t;
|
|
197
196
|
const e = (t = p.value) == null ? void 0 : t.input;
|
|
198
197
|
e == null || e.setAttribute("aria-valuenow", `${i.currentValue ?? ""}`);
|
|
199
|
-
}),
|
|
198
|
+
}), ne({
|
|
200
199
|
/** @description get focus the input component */
|
|
201
200
|
focus: J,
|
|
202
201
|
/** @description remove focus the input component */
|
|
203
202
|
blur: be
|
|
204
203
|
}), (e, t) => (b(), w("div", {
|
|
205
204
|
class: I([
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
n(c).b(),
|
|
206
|
+
n(c).m(n(X)),
|
|
207
|
+
n(c).is("disabled", n(v)),
|
|
208
|
+
n(c).is("without-controls", !u.controls),
|
|
209
|
+
n(c).is("controls-right", C.value),
|
|
210
|
+
n(c).is(u.align, !!u.align),
|
|
211
|
+
n(c).is("float-label", a.floatLabel)
|
|
213
212
|
]),
|
|
214
213
|
onDragstart: t[0] || (t[0] = ge(() => {
|
|
215
214
|
}, ["prevent"]))
|
|
216
215
|
}, [
|
|
217
216
|
a.floatLabel ? (b(), w("span", {
|
|
218
217
|
key: 0,
|
|
219
|
-
id:
|
|
220
|
-
class: I(["el-float-label",
|
|
218
|
+
id: n(H),
|
|
219
|
+
class: I(["el-float-label", n(se)]),
|
|
221
220
|
onClick: J
|
|
222
221
|
}, xe(u.placeholder), 11, Ue)) : R("", !0),
|
|
223
222
|
u.controls ? _((b(), w("span", {
|
|
224
223
|
key: 1,
|
|
225
224
|
role: "button",
|
|
226
|
-
"aria-label":
|
|
227
|
-
class: I([
|
|
225
|
+
"aria-label": n(G)("el.inputNumber.decrease"),
|
|
226
|
+
class: I([n(c).e("decrease"), n(c).is("disabled", U.value)]),
|
|
228
227
|
onKeydown: ee(T, ["enter"])
|
|
229
228
|
}, [
|
|
230
229
|
S(e.$slots, "decrease-icon", {}, () => [
|
|
231
|
-
$(
|
|
230
|
+
$(n(te), null, {
|
|
232
231
|
default: A(() => [
|
|
233
|
-
C.value ? (b(),
|
|
232
|
+
C.value ? (b(), L(n(Pe), { key: 0 })) : (b(), L(n(Te), { key: 1 }))
|
|
234
233
|
]),
|
|
235
234
|
_: 1
|
|
236
235
|
})
|
|
237
236
|
])
|
|
238
237
|
], 42, We)), [
|
|
239
|
-
[
|
|
238
|
+
[n(ae), T]
|
|
240
239
|
]) : R("", !0),
|
|
241
240
|
u.controls ? _((b(), w("span", {
|
|
242
241
|
key: 2,
|
|
243
242
|
role: "button",
|
|
244
|
-
"aria-label":
|
|
245
|
-
class: I([
|
|
243
|
+
"aria-label": n(G)("el.inputNumber.increase"),
|
|
244
|
+
class: I([n(c).e("increase"), n(c).is("disabled", W.value)]),
|
|
246
245
|
onKeydown: ee(P, ["enter"])
|
|
247
246
|
}, [
|
|
248
247
|
S(e.$slots, "increase-icon", {}, () => [
|
|
249
|
-
$(
|
|
248
|
+
$(n(te), null, {
|
|
250
249
|
default: A(() => [
|
|
251
|
-
C.value ? (b(),
|
|
250
|
+
C.value ? (b(), L(n(Be), { key: 0 })) : (b(), L(n(Oe), { key: 1 }))
|
|
252
251
|
]),
|
|
253
252
|
_: 1
|
|
254
253
|
})
|
|
255
254
|
])
|
|
256
255
|
], 42, Xe)), [
|
|
257
|
-
[
|
|
256
|
+
[n(ae), P]
|
|
258
257
|
]) : R("", !0),
|
|
259
|
-
$(
|
|
258
|
+
$(n(Ie), {
|
|
260
259
|
id: u.id,
|
|
261
260
|
ref_key: "input",
|
|
262
261
|
ref: p,
|
|
@@ -265,8 +264,8 @@ const Ue = ["id"], We = ["aria-label"], Xe = ["aria-label"], ft = /* @__PURE__ *
|
|
|
265
264
|
"model-value": M.value,
|
|
266
265
|
placeholder: a.floatLabel ? void 0 : u.placeholder,
|
|
267
266
|
readonly: u.readonly,
|
|
268
|
-
disabled:
|
|
269
|
-
size:
|
|
267
|
+
disabled: n(v),
|
|
268
|
+
size: n(X),
|
|
270
269
|
max: u.max,
|
|
271
270
|
min: u.min,
|
|
272
271
|
name: u.name,
|
|
@@ -72,6 +72,10 @@ export interface InputNumberProps {
|
|
|
72
72
|
* @description native aria-label attribute
|
|
73
73
|
*/
|
|
74
74
|
ariaLabel?: string;
|
|
75
|
+
/**
|
|
76
|
+
* @description native aria-labelledby attribute
|
|
77
|
+
*/
|
|
78
|
+
ariaLabelledby?: string;
|
|
75
79
|
/**
|
|
76
80
|
* @description native input mode for virtual keyboards
|
|
77
81
|
*/
|
|
@@ -123,6 +127,7 @@ export declare const inputNumberProps: {
|
|
|
123
127
|
};
|
|
124
128
|
readonly tabindex: import("../../utils/index.js").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 0, boolean>;
|
|
125
129
|
readonly ariaLabel: StringConstructor;
|
|
130
|
+
readonly ariaLabelledby: StringConstructor;
|
|
126
131
|
readonly id: import("../../utils/index.js").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
127
132
|
readonly step: import("../../utils/index.js").EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
128
133
|
readonly stepStrictly: BooleanConstructor;
|
|
@@ -3,9 +3,9 @@ import { isNumber as r } from "../../utils/types.js";
|
|
|
3
3
|
import { buildProps as n, definePropType as t } from "../../utils/vue/props/runtime.js";
|
|
4
4
|
import "vue";
|
|
5
5
|
import "@vueuse/core";
|
|
6
|
-
import { useSizeProp as
|
|
7
|
-
import { useAriaProps as
|
|
8
|
-
import { floatLabelProp as
|
|
6
|
+
import { useSizeProp as l } from "../../hooks/use-size/index.js";
|
|
7
|
+
import { useAriaProps as a } from "../../hooks/use-aria/index.js";
|
|
8
|
+
import { floatLabelProp as u } from "../../hooks/use-float-label/index.js";
|
|
9
9
|
import { UPDATE_MODEL_EVENT as p, INPUT_EVENT as m, CHANGE_EVENT as d } from "../../constants/event.js";
|
|
10
10
|
n({
|
|
11
11
|
/**
|
|
@@ -60,7 +60,7 @@ n({
|
|
|
60
60
|
/**
|
|
61
61
|
* @description size of the component
|
|
62
62
|
*/
|
|
63
|
-
size:
|
|
63
|
+
size: l,
|
|
64
64
|
/**
|
|
65
65
|
* @description whether to enable the control buttons
|
|
66
66
|
*/
|
|
@@ -106,7 +106,7 @@ n({
|
|
|
106
106
|
type: Boolean,
|
|
107
107
|
default: !0
|
|
108
108
|
},
|
|
109
|
-
...
|
|
109
|
+
...a(["ariaLabel", "ariaLabelledby"]),
|
|
110
110
|
/**
|
|
111
111
|
* @description native input mode for virtual keyboards
|
|
112
112
|
*/
|
|
@@ -144,7 +144,7 @@ n({
|
|
|
144
144
|
type: [String, Number],
|
|
145
145
|
default: 0
|
|
146
146
|
},
|
|
147
|
-
...
|
|
147
|
+
...u
|
|
148
148
|
});
|
|
149
149
|
const P = {
|
|
150
150
|
[d]: (e, i) => i !== e,
|