st-comp 0.0.148 → 0.0.150
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/components.d.ts +3 -0
- package/es/ChartLayout.cjs +1 -1
- package/es/ChartLayout.js +5 -4
- package/es/Dialog.cjs +1 -1
- package/es/Dialog.js +28 -24
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +577 -631
- package/es/Kline.cjs +1 -0
- package/es/Kline.js +1903 -0
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +677 -1428
- package/es/KlineNew.cjs +1 -3
- package/es/KlineNew.js +316 -2740
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +60 -58
- package/es/PasswordPrompt.cjs +1 -0
- package/es/PasswordPrompt.js +13 -0
- package/es/Table.cjs +1 -1
- package/es/Table.js +102 -98
- package/es/User.cjs +1 -1
- package/es/User.js +397 -373
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +2395 -1
- package/es/VirtualTable.cjs +5 -5
- package/es/VirtualTable.js +154 -151
- package/es/_initCloneObject-47814efa.cjs +1 -0
- package/es/{_initCloneObject-ec5c9523.js → _initCloneObject-e3d8a9ab.js} +13 -13
- package/es/base-0ca7c43a.cjs +5 -0
- package/es/base-19787dfb.js +303 -0
- package/es/{castArray-c770910d.js → castArray-8405000b.js} +1 -1
- package/es/castArray-a78ae889.cjs +1 -0
- package/es/{config-provider-feed0e8a.js → config-provider-0f6672af.js} +3 -3
- package/es/{config-provider-c87e277f.cjs → config-provider-cfbb9cd8.cjs} +1 -1
- package/es/{debounce-c64fb3b5.js → debounce-6cb0781f.js} +29 -29
- package/es/debounce-cf26af24.cjs +1 -0
- package/es/{dropdown-c9272ca3.js → dropdown-17b3ef6a.js} +4 -4
- package/es/{dropdown-6bdb3cf4.cjs → dropdown-790d31ea.cjs} +1 -1
- package/es/el-button-0bf1d532.js +236 -0
- package/es/el-button-62966947.cjs +1 -0
- package/es/el-checkbox-group-45247bbf.cjs +1 -0
- package/es/el-checkbox-group-d53bc316.js +67 -0
- package/es/el-empty-2ece1134.cjs +1 -0
- package/es/{el-empty-89a523ed.js → el-empty-bd5343a7.js} +10 -9
- package/es/{el-form-item-55d36086.js → el-form-item-05c0e335.js} +82 -81
- package/es/el-form-item-47e255d4.cjs +12 -0
- package/es/{el-input-cb528574.js → el-input-1e309239.js} +46 -45
- package/es/el-input-6a3805c5.cjs +1 -0
- package/es/{el-input-number-ce30bfa8.js → el-input-number-60ebc58f.js} +50 -48
- package/es/el-input-number-96ff2e47.cjs +1 -0
- package/es/el-menu-item-4c9eb7ad.cjs +1 -0
- package/es/el-menu-item-6c6236a1.js +772 -0
- package/es/{el-message-d51d032b.js → el-message-7d927756.js} +56 -55
- package/es/el-message-d5ed7a4f.cjs +1 -0
- package/es/el-overlay-26bf0945.js +521 -0
- package/es/el-overlay-41994f67.cjs +1 -0
- package/es/el-popover-17e2e66c.js +140 -0
- package/es/el-popover-7bd8a7c3.cjs +1 -0
- package/es/el-popper-7adbf1c6.cjs +1 -0
- package/es/{el-popper-f4b01f85.js → el-popper-b6527ae2.js} +217 -216
- package/es/{el-scrollbar-e8e93751.js → el-scrollbar-29bcab5f.js} +22 -22
- package/es/el-scrollbar-ac525239.cjs +1 -0
- package/es/el-select-31f8ac8a.cjs +1 -0
- package/es/{el-select-e71af2e6.js → el-select-7395562b.js} +42 -40
- package/es/el-table-column-47d80736.js +3804 -0
- package/es/el-table-column-bdc46568.cjs +14 -0
- package/es/{el-tag-d65768f4.js → el-tag-7414e0c7.js} +59 -58
- package/es/el-tag-9732314f.cjs +1 -0
- package/es/{index-da646183.cjs → index-1d85ba4b.cjs} +1 -1
- package/es/{index-92ba4292.js → index-273822d1.js} +26 -25
- package/es/index-2f958e56.cjs +3 -0
- package/es/index-375e8de4.cjs +5 -0
- package/es/{index-121e2861.js → index-621b092b.js} +3 -3
- package/es/index-657047bb.js +513 -0
- package/es/{index-18416440.cjs → index-65b4113e.cjs} +1 -1
- package/es/index-70372cdb.js +519 -0
- package/es/{use-form-common-props-4d37077d.js → index-72151b24.js} +151 -312
- package/es/index-9e6e8d03.cjs +1 -0
- package/es/index-ab96bbf4.js +156 -0
- package/es/index-afc88a4b.cjs +1 -0
- package/es/index-c066fe0d.js +82 -0
- package/es/index-ce3223db.cjs +1 -0
- package/es/{index-709675d5.js → index-dc22ffe4.js} +18 -18
- package/es/index-eea0bcb3.cjs +1 -0
- package/es/index.esm-8d9a2abe.js +2432 -0
- package/es/index.esm-94a95a2a.cjs +3 -0
- package/es/{raf-f55e0daa.js → raf-a532c514.js} +1 -1
- package/es/{raf-2d77cbbe.cjs → raf-f46caea0.cjs} +1 -1
- package/es/{scroll-c8ac196e.cjs → scroll-339681d4.cjs} +1 -1
- package/es/{scroll-ca84f80a.js → scroll-d787d648.js} +1 -1
- package/es/style.css +1 -1
- package/es/use-form-common-props-5ff2f51b.js +171 -0
- package/es/use-form-common-props-74a96df2.cjs +2 -0
- package/es/vnode-6a0c7411.js +14 -0
- package/es/vnode-b15eb11b.cjs +1 -0
- package/es/{zh-cn-414d7f0c.cjs → zh-cn-36f34912.cjs} +1 -1
- package/es/{zh-cn-23c8e0d1.js → zh-cn-f37255ae.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +206 -206
- package/lib/{index-ffeb163e.js → index-d0cb2fa2.js} +33754 -31705
- package/lib/{python-0ec8f68c.js → python-050ba5a4.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/Kline/components/Contextmenu/index.vue +110 -0
- package/packages/Kline/components/Tips/index.vue +40 -0
- package/packages/Kline/componentsNew/KlineSlide/index.vue +155 -0
- package/packages/Kline/componentsNew/KlineSub/index.vue +297 -0
- package/packages/Kline/componentsNew/KlineTips/index.vue +66 -0
- package/packages/Kline/componentsNew/KlineUtils/index.vue +84 -0
- package/packages/Kline/componentsNew/Tips/index.vue +33 -0
- package/packages/Kline/formatKlineData.ts +109 -0
- package/packages/Kline/images/buy.svg +1 -0
- package/packages/Kline/images/pen.png +0 -0
- package/packages/Kline/images/sell.svg +1 -0
- package/packages/Kline/images/t.svg +1 -0
- package/packages/Kline/index.ts +16 -0
- package/packages/Kline/index.vue +891 -0
- package/packages/Kline/option.ts +539 -0
- package/packages/Kline/type.d.ts +219 -0
- package/packages/Kline/utils.ts +682 -0
- package/packages/PasswordPrompt/index.ts +8 -0
- package/packages/PasswordPrompt/index.vue +266 -0
- package/packages/User/index.vue +97 -58
- package/packages/index.ts +4 -0
- package/src/pages/Kline/index.vue +12 -0
- package/src/pages/PasswordPrompt/index.vue +12 -0
- package/src/router/routes.ts +10 -0
- package/es/_initCloneObject-476b02ce.cjs +0 -1
- package/es/base-6ccc8fc2.cjs +0 -9
- package/es/base-950bac7e.js +0 -816
- package/es/castArray-374558a5.cjs +0 -1
- package/es/debounce-a6b4f91b.cjs +0 -1
- package/es/el-button-b8f71c7d.cjs +0 -1
- package/es/el-button-d7b6eebd.js +0 -745
- package/es/el-empty-12eece57.cjs +0 -1
- package/es/el-form-item-ebbf096d.cjs +0 -12
- package/es/el-input-2c7e70a3.cjs +0 -1
- package/es/el-input-number-8e168e83.cjs +0 -1
- package/es/el-message-612c2346.cjs +0 -1
- package/es/el-overlay-07414277.js +0 -526
- package/es/el-overlay-fb255b83.cjs +0 -1
- package/es/el-popper-8360bd91.cjs +0 -1
- package/es/el-scrollbar-271142ad.cjs +0 -1
- package/es/el-select-2e71d4af.cjs +0 -1
- package/es/el-table-column-9fe79f05.cjs +0 -14
- package/es/el-table-column-dc562f14.js +0 -3933
- package/es/el-tag-930e7b32.cjs +0 -1
- package/es/index-0ed86daf.cjs +0 -3
- package/es/index-674d2fd7.cjs +0 -1
- package/es/index-aece600c.js +0 -81
- package/es/use-form-common-props-c1960844.cjs +0 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { computed as p, getCurrentInstance as Ke, defineComponent as ze, useAttrs as je, useSlots as We, shallowRef as
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { computed as p, getCurrentInstance as Ke, defineComponent as ze, useAttrs as je, useSlots as We, shallowRef as _, ref as q, watch as J, nextTick as L, onMounted as Ue, toRef as Ye, openBlock as c, createElementBlock as b, normalizeClass as m, unref as t, normalizeStyle as be, createCommentVNode as f, Fragment as Q, renderSlot as K, createElementVNode as k, createBlock as S, withCtx as M, resolveDynamicComponent as j, mergeProps as xe, withModifiers as Xe, createVNode as Ge, toDisplayString as W } from "vue";
|
|
2
|
+
import { a as Ze } from "./el-scrollbar-29bcab5f.js";
|
|
3
|
+
import { v as _e, s as qe, E as B, n as Je } from "./index-72151b24.js";
|
|
4
|
+
import { h as Pe, a as we, b as Qe, d as ee, i as te, e as U, G as et, u as Se, p as tt, N as ot, _ as nt, f as Ce, w as at } from "./base-19787dfb.js";
|
|
5
|
+
import { u as st, i as Ie, d as lt, e as rt, a as it, b as ut, V as dt } from "./use-form-common-props-5ff2f51b.js";
|
|
5
6
|
import { m as ct } from "./typescript-7ae59c4c.js";
|
|
6
|
-
import {
|
|
7
|
-
import { U as oe } from "./index-
|
|
8
|
-
import {
|
|
7
|
+
import { u as pt } from "./el-popper-b6527ae2.js";
|
|
8
|
+
import { U as oe } from "./index-621b092b.js";
|
|
9
|
+
import { a as ft, u as vt } from "./index-dc22ffe4.js";
|
|
9
10
|
const mt = () => Pe && /firefox/i.test(window.navigator.userAgent);
|
|
10
11
|
let g;
|
|
11
12
|
const ht = {
|
|
@@ -49,22 +50,22 @@ function Ee(n, v = 1, i) {
|
|
|
49
50
|
const C = {};
|
|
50
51
|
l === "border-box" ? d = d + u : l === "content-box" && (d = d - r), g.value = "";
|
|
51
52
|
const h = g.scrollHeight - r;
|
|
52
|
-
if (
|
|
53
|
+
if (we(v)) {
|
|
53
54
|
let y = h * v;
|
|
54
55
|
l === "border-box" && (y = y + r + u), d = Math.max(y, d), C.minHeight = `${y}px`;
|
|
55
56
|
}
|
|
56
|
-
if (
|
|
57
|
+
if (we(i)) {
|
|
57
58
|
let y = h * i;
|
|
58
59
|
l === "border-box" && (y = y + r + u), d = Math.min(y, d);
|
|
59
60
|
}
|
|
60
61
|
return C.height = `${d}px`, (o = g.parentNode) == null || o.removeChild(g), g = void 0, C;
|
|
61
62
|
}
|
|
62
|
-
const bt =
|
|
63
|
+
const bt = Qe({
|
|
63
64
|
id: {
|
|
64
65
|
type: String,
|
|
65
66
|
default: void 0
|
|
66
67
|
},
|
|
67
|
-
size:
|
|
68
|
+
size: st,
|
|
68
69
|
disabled: Boolean,
|
|
69
70
|
modelValue: {
|
|
70
71
|
type: ee([
|
|
@@ -113,10 +114,10 @@ const bt = st({
|
|
|
113
114
|
showPassword: Boolean,
|
|
114
115
|
showWordLimit: Boolean,
|
|
115
116
|
suffixIcon: {
|
|
116
|
-
type:
|
|
117
|
+
type: Ie
|
|
117
118
|
},
|
|
118
119
|
prefixIcon: {
|
|
119
|
-
type:
|
|
120
|
+
type: Ie
|
|
120
121
|
},
|
|
121
122
|
containerRole: {
|
|
122
123
|
type: String,
|
|
@@ -157,7 +158,7 @@ const bt = st({
|
|
|
157
158
|
const { excludeListeners: v = !1, excludeKeys: i } = n, o = p(() => ((i == null ? void 0 : i.value) || []).concat(wt)), r = Ke();
|
|
158
159
|
return r ? p(() => {
|
|
159
160
|
var u;
|
|
160
|
-
return
|
|
161
|
+
return et(Object.entries((u = r.proxy) == null ? void 0 : u.$attrs).filter(([l]) => !o.value.includes(l) && !(v && St.test(l))));
|
|
161
162
|
}) : (U("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), p(() => ({})));
|
|
162
163
|
};
|
|
163
164
|
function It(n) {
|
|
@@ -220,9 +221,9 @@ const Et = ze({
|
|
|
220
221
|
]), d = p(() => [
|
|
221
222
|
a.e("wrapper"),
|
|
222
223
|
a.is("focus", A.value)
|
|
223
|
-
]), { form: C, formItem: h } =
|
|
224
|
+
]), { form: C, formItem: h } = lt(), { inputId: y } = rt(o, {
|
|
224
225
|
formItemContext: h
|
|
225
|
-
}), F =
|
|
226
|
+
}), F = it(), E = ut(), a = Se("input"), ne = Se("textarea"), O = _(), w = _(), Y = q(!1), $ = q(!1), ae = q(), H = _(o.inputStyle), z = p(() => O.value || w.value), { wrapperRef: Ne, isFocused: A, handleFocus: ke, handleBlur: Fe } = ft(z, {
|
|
226
227
|
beforeFocus() {
|
|
227
228
|
return E.value;
|
|
228
229
|
},
|
|
@@ -233,14 +234,14 @@ const Et = ze({
|
|
|
233
234
|
}), se = p(() => {
|
|
234
235
|
var e;
|
|
235
236
|
return (e = C == null ? void 0 : C.statusIcon) != null ? e : !1;
|
|
236
|
-
}), V = p(() => (h == null ? void 0 : h.validateState) || ""), le = p(() => V.value &&
|
|
237
|
+
}), V = p(() => (h == null ? void 0 : h.validateState) || ""), le = p(() => V.value && dt[V.value]), Ve = p(() => $.value ? _e : qe), Te = p(() => [
|
|
237
238
|
r.style
|
|
238
239
|
]), re = p(() => [
|
|
239
240
|
o.inputStyle,
|
|
240
|
-
|
|
241
|
+
H.value,
|
|
241
242
|
{ resize: o.resize }
|
|
242
|
-
]), I = p(() =>
|
|
243
|
-
|
|
243
|
+
]), I = p(() => tt(o.modelValue) ? "" : String(o.modelValue)), D = p(() => o.clearable && !E.value && !o.readonly && !!I.value && (A.value || Y.value)), X = p(() => o.showPassword && !E.value && !!I.value && (!!I.value || A.value)), P = p(() => o.showWordLimit && !!o.maxlength && (o.type === "text" || o.type === "textarea") && !E.value && !o.readonly && !o.showPassword), G = p(() => I.value.length), Re = p(() => !!P.value && G.value > Number(o.maxlength)), Le = p(() => !!l.suffix || !!o.suffixIcon || D.value || o.showPassword || P.value || !!V.value && se.value), [ie, ue] = It(O);
|
|
244
|
+
Ze(w, (e) => {
|
|
244
245
|
if (Me(), !P.value || o.resize !== "both")
|
|
245
246
|
return;
|
|
246
247
|
const s = e[0], { width: N } = s.contentRect;
|
|
@@ -252,15 +253,15 @@ const Et = ze({
|
|
|
252
253
|
const { type: e, autosize: s } = o;
|
|
253
254
|
if (!(!Pe || e !== "textarea" || !w.value))
|
|
254
255
|
if (s) {
|
|
255
|
-
const N =
|
|
256
|
-
|
|
256
|
+
const N = Ce(s) ? s.minRows : void 0, ye = Ce(s) ? s.maxRows : void 0, ge = Ee(w.value, N, ye);
|
|
257
|
+
H.value = {
|
|
257
258
|
overflowY: "hidden",
|
|
258
259
|
...ge
|
|
259
260
|
}, L(() => {
|
|
260
|
-
w.value.offsetHeight,
|
|
261
|
+
w.value.offsetHeight, H.value = ge;
|
|
261
262
|
});
|
|
262
263
|
} else
|
|
263
|
-
|
|
264
|
+
H.value = {
|
|
264
265
|
minHeight: Ee(w.value).minHeight
|
|
265
266
|
};
|
|
266
267
|
}, Me = ((e) => {
|
|
@@ -274,7 +275,7 @@ const Et = ze({
|
|
|
274
275
|
})(T), R = () => {
|
|
275
276
|
const e = z.value, s = o.formatter ? o.formatter(I.value) : I.value;
|
|
276
277
|
!e || e.value === s || (e.value = s);
|
|
277
|
-
},
|
|
278
|
+
}, Z = async (e) => {
|
|
278
279
|
ie();
|
|
279
280
|
let { value: s } = e.target;
|
|
280
281
|
if (o.formatter && (s = o.parser ? o.parser(s) : s), !ce.value) {
|
|
@@ -291,15 +292,15 @@ const Et = ze({
|
|
|
291
292
|
handleCompositionStart: pe,
|
|
292
293
|
handleCompositionUpdate: fe,
|
|
293
294
|
handleCompositionEnd: ve
|
|
294
|
-
} = vt({ emit: i, afterComposition:
|
|
295
|
-
ie(),
|
|
296
|
-
},
|
|
295
|
+
} = vt({ emit: i, afterComposition: Z }), Be = () => {
|
|
296
|
+
ie(), $.value = !$.value, setTimeout(ue);
|
|
297
|
+
}, Oe = () => {
|
|
297
298
|
var e;
|
|
298
299
|
return (e = z.value) == null ? void 0 : e.focus();
|
|
299
|
-
},
|
|
300
|
+
}, $e = () => {
|
|
300
301
|
var e;
|
|
301
302
|
return (e = z.value) == null ? void 0 : e.blur();
|
|
302
|
-
},
|
|
303
|
+
}, He = (e) => {
|
|
303
304
|
Y.value = !1, i("mouseleave", e);
|
|
304
305
|
}, Ae = (e) => {
|
|
305
306
|
Y.value = !0, i("mouseenter", e);
|
|
@@ -319,14 +320,14 @@ const Et = ze({
|
|
|
319
320
|
}), Ue(() => {
|
|
320
321
|
!o.formatter && o.parser && U("ElInput", "If you set the parser, you also need to set the formatter."), R(), L(T);
|
|
321
322
|
}), v({
|
|
322
|
-
input:
|
|
323
|
+
input: O,
|
|
323
324
|
textarea: w,
|
|
324
325
|
ref: z,
|
|
325
326
|
textareaStyle: re,
|
|
326
327
|
autosize: Ye(o, "autosize"),
|
|
327
328
|
isComposing: ce,
|
|
328
|
-
focus:
|
|
329
|
-
blur:
|
|
329
|
+
focus: Oe,
|
|
330
|
+
blur: $e,
|
|
330
331
|
select: De,
|
|
331
332
|
clear: he,
|
|
332
333
|
resizeTextarea: T
|
|
@@ -340,7 +341,7 @@ const Et = ze({
|
|
|
340
341
|
]),
|
|
341
342
|
style: be(t(Te)),
|
|
342
343
|
onMouseenter: Ae,
|
|
343
|
-
onMouseleave:
|
|
344
|
+
onMouseleave: He
|
|
344
345
|
}, [
|
|
345
346
|
f(" input "),
|
|
346
347
|
e.type !== "textarea" ? (c(), b(Q, { key: 0 }, [
|
|
@@ -379,12 +380,12 @@ const Et = ze({
|
|
|
379
380
|
k("input", xe({
|
|
380
381
|
id: t(y),
|
|
381
382
|
ref_key: "input",
|
|
382
|
-
ref:
|
|
383
|
+
ref: O,
|
|
383
384
|
class: t(a).e("inner")
|
|
384
385
|
}, t(u), {
|
|
385
386
|
minlength: e.minlength,
|
|
386
387
|
maxlength: e.maxlength,
|
|
387
|
-
type: e.showPassword ?
|
|
388
|
+
type: e.showPassword ? $.value ? "text" : "password" : e.type,
|
|
388
389
|
disabled: t(E),
|
|
389
390
|
readonly: e.readonly,
|
|
390
391
|
autocomplete: e.autocomplete,
|
|
@@ -398,7 +399,7 @@ const Et = ze({
|
|
|
398
399
|
onCompositionstart: t(pe),
|
|
399
400
|
onCompositionupdate: t(fe),
|
|
400
401
|
onCompositionend: t(ve),
|
|
401
|
-
onInput:
|
|
402
|
+
onInput: Z,
|
|
402
403
|
onChange: de,
|
|
403
404
|
onKeydown: me
|
|
404
405
|
}), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
|
|
@@ -425,11 +426,11 @@ const Et = ze({
|
|
|
425
426
|
t(D) ? (c(), S(t(B), {
|
|
426
427
|
key: 1,
|
|
427
428
|
class: m([t(a).e("icon"), t(a).e("clear")]),
|
|
428
|
-
onMousedown: Xe(t(
|
|
429
|
+
onMousedown: Xe(t(ot), ["prevent"]),
|
|
429
430
|
onClick: he
|
|
430
431
|
}, {
|
|
431
432
|
default: M(() => [
|
|
432
|
-
|
|
433
|
+
Ge(t(Je))
|
|
433
434
|
]),
|
|
434
435
|
_: 1
|
|
435
436
|
}, 8, ["class", "onMousedown"])) : f("v-if", !0),
|
|
@@ -449,7 +450,7 @@ const Et = ze({
|
|
|
449
450
|
}, [
|
|
450
451
|
k("span", {
|
|
451
452
|
class: m(t(a).e("count-inner"))
|
|
452
|
-
}, W(t(
|
|
453
|
+
}, W(t(G)) + " / " + W(e.maxlength), 3)
|
|
453
454
|
], 2)) : f("v-if", !0),
|
|
454
455
|
t(V) && t(le) && t(se) ? (c(), S(t(B), {
|
|
455
456
|
key: 4,
|
|
@@ -498,7 +499,7 @@ const Et = ze({
|
|
|
498
499
|
onCompositionstart: t(pe),
|
|
499
500
|
onCompositionupdate: t(fe),
|
|
500
501
|
onCompositionend: t(ve),
|
|
501
|
-
onInput:
|
|
502
|
+
onInput: Z,
|
|
502
503
|
onFocus: t(ke),
|
|
503
504
|
onBlur: t(Fe),
|
|
504
505
|
onChange: de,
|
|
@@ -508,14 +509,14 @@ const Et = ze({
|
|
|
508
509
|
key: 0,
|
|
509
510
|
style: be(ae.value),
|
|
510
511
|
class: m(t(a).e("count"))
|
|
511
|
-
}, W(t(
|
|
512
|
+
}, W(t(G)) + " / " + W(e.maxlength), 7)) : f("v-if", !0)
|
|
512
513
|
], 64))
|
|
513
514
|
], 38));
|
|
514
515
|
}
|
|
515
516
|
});
|
|
516
|
-
var Pt = /* @__PURE__ */
|
|
517
|
-
const
|
|
517
|
+
var Pt = /* @__PURE__ */ nt(zt, [["__file", "input.vue"]]);
|
|
518
|
+
const $t = at(Pt);
|
|
518
519
|
export {
|
|
519
|
-
|
|
520
|
+
$t as E,
|
|
520
521
|
mt as i
|
|
521
522
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),be=require("./el-scrollbar-ac525239.cjs"),C=require("./index-afc88a4b.cjs"),s=require("./base-0ca7c43a.cjs"),x=require("./use-form-common-props-74a96df2.cjs"),Ce=require("./typescript-b63f8e83.cjs"),xe=require("./el-popper-7adbf1c6.cjs"),$=require("./index-65b4113e.cjs"),oe=require("./index-1d85ba4b.cjs"),re=()=>s.isClient&&/firefox/i.test(window.navigator.userAgent);let v;const we={height:"0",visibility:"hidden",overflow:re()?"":"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},Ee=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function ke(n){const p=window.getComputedStyle(n),u=p.getPropertyValue("box-sizing"),o=Number.parseFloat(p.getPropertyValue("padding-bottom"))+Number.parseFloat(p.getPropertyValue("padding-top")),i=Number.parseFloat(p.getPropertyValue("border-bottom-width"))+Number.parseFloat(p.getPropertyValue("border-top-width"));return{contextStyle:Ee.map(l=>[l,p.getPropertyValue(l)]),paddingSize:o,borderSize:i,boxSizing:u}}function ne(n,p=1,u){var o;v||(v=document.createElement("textarea"),document.body.appendChild(v));const{paddingSize:i,borderSize:c,boxSizing:l,contextStyle:h}=ke(n);h.forEach(([m,I])=>v==null?void 0:v.style.setProperty(m,I)),Object.entries(we).forEach(([m,I])=>v==null?void 0:v.style.setProperty(m,I,"important")),v.value=n.value||n.placeholder||"";let d=v.scrollHeight;const g={};l==="border-box"?d=d+c:l==="content-box"&&(d=d-i),v.value="";const f=v.scrollHeight-i;if(s.isNumber(p)){let m=f*p;l==="border-box"&&(m=m+i+c),d=Math.max(m,d),g.minHeight=`${m}px`}if(s.isNumber(u)){let m=f*u;l==="border-box"&&(m=m+i+c),d=Math.min(m,d)}return g.height=`${d}px`,(o=v.parentNode)==null||o.removeChild(v),v=void 0,g}const Se=s.buildProps({id:{type:String,default:void 0},size:x.useSizeProp,disabled:Boolean,modelValue:{type:s.definePropType([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:s.definePropType([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,showPassword:Boolean,showWordLimit:Boolean,suffixIcon:{type:x.iconPropType},prefixIcon:{type:x.iconPropType},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:s.definePropType([Object,Array,String]),default:()=>Ce.mutable({})},autofocus:Boolean,rows:{type:Number,default:2},...xe.useAriaProps(["ariaLabel"])}),Ie={[$.UPDATE_MODEL_EVENT]:n=>s.isString(n),input:n=>s.isString(n),change:n=>s.isString(n),focus:n=>n instanceof FocusEvent,blur:n=>n instanceof FocusEvent,clear:()=>!0,mouseleave:n=>n instanceof MouseEvent,mouseenter:n=>n instanceof MouseEvent,keydown:n=>n instanceof Event,compositionstart:n=>n instanceof CompositionEvent,compositionupdate:n=>n instanceof CompositionEvent,compositionend:n=>n instanceof CompositionEvent},Be=["class","style"],Ne=/^on[A-Z]/,ze=(n={})=>{const{excludeListeners:p=!1,excludeKeys:u}=n,o=e.computed(()=>((u==null?void 0:u.value)||[]).concat(Be)),i=e.getCurrentInstance();return i?e.computed(()=>{var c;return s.fromPairs(Object.entries((c=i.proxy)==null?void 0:c.$attrs).filter(([l])=>!o.value.includes(l)&&!(p&&Ne.test(l))))}):(s.debugWarn("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),e.computed(()=>({})))};function Ve(n){let p;function u(){if(n.value==null)return;const{selectionStart:i,selectionEnd:c,value:l}=n.value;if(i==null||c==null)return;const h=l.slice(0,Math.max(0,i)),d=l.slice(Math.max(0,c));p={selectionStart:i,selectionEnd:c,value:l,beforeTxt:h,afterTxt:d}}function o(){if(n.value==null||p==null)return;const{value:i}=n.value,{beforeTxt:c,afterTxt:l,selectionStart:h}=p;if(c==null||l==null||h==null)return;let d=i.length;if(i.endsWith(l))d=i.length-l.length;else if(i.startsWith(c))d=c.length;else{const g=c[h-1],f=i.indexOf(g,h-1);f!==-1&&(d=f+1)}n.value.setSelectionRange(d,d)}return[u,o]}const Pe=e.defineComponent({name:"ElInput",inheritAttrs:!1}),Te=e.defineComponent({...Pe,props:Se,emits:Ie,setup(n,{expose:p,emit:u}){const o=n,i=e.useAttrs(),c=ze(),l=e.useSlots(),h=e.computed(()=>[o.type==="textarea"?A.b():r.b(),r.m(I.value),r.is("disabled",w.value),r.is("exceed",ce.value),{[r.b("group")]:l.prepend||l.append,[r.m("prefix")]:l.prefix||o.prefixIcon,[r.m("suffix")]:l.suffix||o.suffixIcon||o.clearable||o.showPassword,[r.bm("suffix","password-clear")]:D.value&&L.value,[r.b("hidden")]:o.type==="hidden"},i.class]),d=e.computed(()=>[r.e("wrapper"),r.is("focus",F.value)]),{form:g,formItem:f}=x.useFormItem(),{inputId:m}=x.useFormItemInputId(o,{formItemContext:f}),I=x.useFormSize(),w=x.useFormDisabled(),r=s.useNamespace("input"),A=s.useNamespace("textarea"),V=e.shallowRef(),y=e.shallowRef(),R=e.ref(!1),P=e.ref(!1),H=e.ref(),T=e.shallowRef(o.inputStyle),E=e.computed(()=>V.value||y.value),{wrapperRef:ae,isFocused:F,handleFocus:le,handleBlur:se}=oe.useFocusController(E,{beforeFocus(){return w.value},afterBlur(){var t;o.validateEvent&&((t=f==null?void 0:f.validate)==null||t.call(f,"blur").catch(a=>s.debugWarn(a)))}}),q=e.computed(()=>{var t;return(t=g==null?void 0:g.statusIcon)!=null?t:!1}),B=e.computed(()=>(f==null?void 0:f.validateState)||""),W=e.computed(()=>B.value&&x.ValidateComponentsMap[B.value]),ie=e.computed(()=>P.value?C.view_default:C.hide_default),ue=e.computed(()=>[i.style]),K=e.computed(()=>[o.inputStyle,T.value,{resize:o.resize}]),b=e.computed(()=>s.isNil(o.modelValue)?"":String(o.modelValue)),D=e.computed(()=>o.clearable&&!w.value&&!o.readonly&&!!b.value&&(F.value||R.value)),L=e.computed(()=>o.showPassword&&!w.value&&!!b.value&&(!!b.value||F.value)),k=e.computed(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!w.value&&!o.readonly&&!o.showPassword),M=e.computed(()=>b.value.length),ce=e.computed(()=>!!k.value&&M.value>Number(o.maxlength)),de=e.computed(()=>!!l.suffix||!!o.suffixIcon||D.value||o.showPassword||k.value||!!B.value&&q.value),[j,U]=Ve(V);be.useResizeObserver(y,t=>{if(pe(),!k.value||o.resize!=="both")return;const a=t[0],{width:S}=a.contentRect;H.value={right:`calc(100% - ${S+15+6}px)`}});const N=()=>{const{type:t,autosize:a}=o;if(!(!s.isClient||t!=="textarea"||!y.value))if(a){const S=s.isObject(a)?a.minRows:void 0,ee=s.isObject(a)?a.maxRows:void 0,te=ne(y.value,S,ee);T.value={overflowY:"hidden",...te},e.nextTick(()=>{y.value.offsetHeight,T.value=te})}else T.value={minHeight:ne(y.value).minHeight}},pe=(t=>{let a=!1;return()=>{var S;if(a||!o.autosize)return;((S=y.value)==null?void 0:S.offsetParent)===null||(t(),a=!0)}})(N),z=()=>{const t=E.value,a=o.formatter?o.formatter(b.value):b.value;!t||t.value===a||(t.value=a)},O=async t=>{j();let{value:a}=t.target;if(o.formatter&&(a=o.parser?o.parser(a):a),!_.value){if(a===b.value){z();return}u($.UPDATE_MODEL_EVENT,a),u("input",a),await e.nextTick(),z(),U()}},Y=t=>{u("change",t.target.value)},{isComposing:_,handleCompositionStart:X,handleCompositionUpdate:Z,handleCompositionEnd:G}=oe.useComposition({emit:u,afterComposition:O}),fe=()=>{j(),P.value=!P.value,setTimeout(U)},me=()=>{var t;return(t=E.value)==null?void 0:t.focus()},ve=()=>{var t;return(t=E.value)==null?void 0:t.blur()},he=t=>{R.value=!1,u("mouseleave",t)},ye=t=>{R.value=!0,u("mouseenter",t)},J=t=>{u("keydown",t)},ge=()=>{var t;(t=E.value)==null||t.select()},Q=()=>{u($.UPDATE_MODEL_EVENT,""),u("change",""),u("clear"),u("input","")};return e.watch(()=>o.modelValue,()=>{var t;e.nextTick(()=>N()),o.validateEvent&&((t=f==null?void 0:f.validate)==null||t.call(f,"change").catch(a=>s.debugWarn(a)))}),e.watch(b,()=>z()),e.watch(()=>o.type,async()=>{await e.nextTick(),z(),N()}),e.onMounted(()=>{!o.formatter&&o.parser&&s.debugWarn("ElInput","If you set the parser, you also need to set the formatter."),z(),e.nextTick(N)}),p({input:V,textarea:y,ref:E,textareaStyle:K,autosize:e.toRef(o,"autosize"),isComposing:_,focus:me,blur:ve,select:ge,clear:Q,resizeTextarea:N}),(t,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(h),{[e.unref(r).bm("group","append")]:t.$slots.append,[e.unref(r).bm("group","prepend")]:t.$slots.prepend}]),style:e.normalizeStyle(e.unref(ue)),onMouseenter:ye,onMouseleave:he},[e.createCommentVNode(" input "),t.type!=="textarea"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createCommentVNode(" prepend slot "),t.$slots.prepend?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(r).be("group","prepend"))},[e.renderSlot(t.$slots,"prepend")],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",{ref_key:"wrapperRef",ref:ae,class:e.normalizeClass(e.unref(d))},[e.createCommentVNode(" prefix slot "),t.$slots.prefix||t.prefixIcon?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(r).e("prefix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).e("prefix-inner"))},[e.renderSlot(t.$slots,"prefix"),t.prefixIcon?(e.openBlock(),e.createBlock(e.unref(C.ElIcon),{key:0,class:e.normalizeClass(e.unref(r).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.prefixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",e.mergeProps({id:e.unref(m),ref_key:"input",ref:V,class:e.unref(r).e("inner")},e.unref(c),{minlength:t.minlength,maxlength:t.maxlength,type:t.showPassword?P.value?"text":"password":t.type,disabled:e.unref(w),readonly:t.readonly,autocomplete:t.autocomplete,tabindex:t.tabindex,"aria-label":t.ariaLabel,placeholder:t.placeholder,style:t.inputStyle,form:t.form,autofocus:t.autofocus,role:t.containerRole,onCompositionstart:e.unref(X),onCompositionupdate:e.unref(Z),onCompositionend:e.unref(G),onInput:O,onChange:Y,onKeydown:J}),null,16,["id","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","role","onCompositionstart","onCompositionupdate","onCompositionend"]),e.createCommentVNode(" suffix slot "),e.unref(de)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(r).e("suffix"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).e("suffix-inner"))},[!e.unref(D)||!e.unref(L)||!e.unref(k)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(t.$slots,"suffix"),t.suffixIcon?(e.openBlock(),e.createBlock(e.unref(C.ElIcon),{key:0,class:e.normalizeClass(e.unref(r).e("icon"))},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.suffixIcon)))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],64)):e.createCommentVNode("v-if",!0),e.unref(D)?(e.openBlock(),e.createBlock(e.unref(C.ElIcon),{key:1,class:e.normalizeClass([e.unref(r).e("icon"),e.unref(r).e("clear")]),onMousedown:e.withModifiers(e.unref(s.NOOP),["prevent"]),onClick:Q},{default:e.withCtx(()=>[e.createVNode(e.unref(C.circle_close_default))]),_:1},8,["class","onMousedown"])):e.createCommentVNode("v-if",!0),e.unref(L)?(e.openBlock(),e.createBlock(e.unref(C.ElIcon),{key:2,class:e.normalizeClass([e.unref(r).e("icon"),e.unref(r).e("password")]),onClick:fe},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(ie))))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:3,class:e.normalizeClass(e.unref(r).e("count"))},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(r).e("count-inner"))},e.toDisplayString(e.unref(M))+" / "+e.toDisplayString(t.maxlength),3)],2)):e.createCommentVNode("v-if",!0),e.unref(B)&&e.unref(W)&&e.unref(q)?(e.openBlock(),e.createBlock(e.unref(C.ElIcon),{key:4,class:e.normalizeClass([e.unref(r).e("icon"),e.unref(r).e("validateIcon"),e.unref(r).is("loading",e.unref(B)==="validating")])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(W))))]),_:1},8,["class"])):e.createCommentVNode("v-if",!0)],2)],2)):e.createCommentVNode("v-if",!0)],2),e.createCommentVNode(" append slot "),t.$slots.append?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(r).be("group","append"))},[e.renderSlot(t.$slots,"append")],2)):e.createCommentVNode("v-if",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" textarea "),e.createElementVNode("textarea",e.mergeProps({id:e.unref(m),ref_key:"textarea",ref:y,class:[e.unref(A).e("inner"),e.unref(r).is("focus",e.unref(F))]},e.unref(c),{minlength:t.minlength,maxlength:t.maxlength,tabindex:t.tabindex,disabled:e.unref(w),readonly:t.readonly,autocomplete:t.autocomplete,style:e.unref(K),"aria-label":t.ariaLabel,placeholder:t.placeholder,form:t.form,autofocus:t.autofocus,rows:t.rows,role:t.containerRole,onCompositionstart:e.unref(X),onCompositionupdate:e.unref(Z),onCompositionend:e.unref(G),onInput:O,onFocus:e.unref(le),onBlur:e.unref(se),onChange:Y,onKeydown:J}),null,16,["id","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","role","onCompositionstart","onCompositionupdate","onCompositionend","onFocus","onBlur"]),e.unref(k)?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(H.value),class:e.normalizeClass(e.unref(r).e("count"))},e.toDisplayString(e.unref(M))+" / "+e.toDisplayString(t.maxlength),7)):e.createCommentVNode("v-if",!0)],64))],38))}});var Fe=s._export_sfc(Te,[["__file","input.vue"]]);const De=s.withInstall(Fe);exports.ElInput=De;exports.isFirefox=re;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { defineComponent as ee, ref as ce, reactive as de, computed as I, watch as me, onMounted as pe, onUpdated as fe, openBlock as v, createElementBlock as z, normalizeClass as K, unref as r, withModifiers as O, withDirectives as
|
|
2
|
-
import { E as ve, i as Ne } from "./el-input-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { b as ke } from "./
|
|
6
|
-
import {
|
|
1
|
+
import { defineComponent as ee, ref as ce, reactive as de, computed as I, watch as me, onMounted as pe, onUpdated as fe, openBlock as v, createElementBlock as z, normalizeClass as K, unref as r, withModifiers as O, withDirectives as q, withKeys as A, renderSlot as P, createVNode as R, withCtx as F, createBlock as T, createCommentVNode as J, createSlots as be } from "vue";
|
|
2
|
+
import { E as ve, i as Ne } from "./el-input-1e309239.js";
|
|
3
|
+
import { E as Q, a as Ve, j as he, k as Ie, p as Ee } from "./index-72151b24.js";
|
|
4
|
+
import { g as X, b as ye, a as b, p as E, u as ge, k, e as U, _ as we, t as _e, i as Se, w as Ae } from "./base-19787dfb.js";
|
|
5
|
+
import { u as Pe, d as Fe, a as Te, b as ke } from "./use-form-common-props-5ff2f51b.js";
|
|
6
|
+
import { u as Ce } from "./el-popper-b6527ae2.js";
|
|
7
|
+
import { C as ne, I as C, U as N } from "./index-621b092b.js";
|
|
8
|
+
import { a as xe } from "./index-70372cdb.js";
|
|
7
9
|
const De = 100, Be = 600, Z = {
|
|
8
10
|
beforeMount(u, V) {
|
|
9
|
-
const
|
|
11
|
+
const s = V.value, { interval: a = De, delay: y = Be } = X(s) ? {} : s;
|
|
10
12
|
let c, m;
|
|
11
|
-
const l = () => X(
|
|
13
|
+
const l = () => X(s) ? s() : s.handler(), f = () => {
|
|
12
14
|
m && (clearTimeout(m), m = void 0), c && (clearInterval(c), c = void 0);
|
|
13
15
|
};
|
|
14
16
|
u.addEventListener("mousedown", (g) => {
|
|
@@ -21,7 +23,7 @@ const De = 100, Be = 600, Z = {
|
|
|
21
23
|
}, y));
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
}, Le =
|
|
26
|
+
}, Le = ye({
|
|
25
27
|
id: {
|
|
26
28
|
type: String,
|
|
27
29
|
default: void 0
|
|
@@ -42,7 +44,7 @@ const De = 100, Be = 600, Z = {
|
|
|
42
44
|
modelValue: Number,
|
|
43
45
|
readonly: Boolean,
|
|
44
46
|
disabled: Boolean,
|
|
45
|
-
size:
|
|
47
|
+
size: Pe,
|
|
46
48
|
controls: {
|
|
47
49
|
type: Boolean,
|
|
48
50
|
default: !0
|
|
@@ -67,12 +69,12 @@ const De = 100, Be = 600, Z = {
|
|
|
67
69
|
type: Boolean,
|
|
68
70
|
default: !0
|
|
69
71
|
},
|
|
70
|
-
...
|
|
72
|
+
...Ce(["ariaLabel"])
|
|
71
73
|
}), Me = {
|
|
72
74
|
[ne]: (u, V) => V !== u,
|
|
73
75
|
blur: (u) => u instanceof FocusEvent,
|
|
74
76
|
focus: (u) => u instanceof FocusEvent,
|
|
75
|
-
[
|
|
77
|
+
[C]: (u) => b(u) || E(u),
|
|
76
78
|
[N]: (u) => b(u) || E(u)
|
|
77
79
|
}, $e = ee({
|
|
78
80
|
name: "ElInputNumber"
|
|
@@ -80,14 +82,14 @@ const De = 100, Be = 600, Z = {
|
|
|
80
82
|
...$e,
|
|
81
83
|
props: Le,
|
|
82
84
|
emits: Me,
|
|
83
|
-
setup(u, { expose: V, emit:
|
|
84
|
-
const a = u, { t: y } =
|
|
85
|
+
setup(u, { expose: V, emit: s }) {
|
|
86
|
+
const a = u, { t: y } = xe(), c = ge("input-number"), m = ce(), l = de({
|
|
85
87
|
currentValue: a.modelValue,
|
|
86
88
|
userInput: null
|
|
87
|
-
}), { formItem: f } =
|
|
89
|
+
}), { formItem: f } = Fe(), g = I(() => b(a.modelValue) && a.modelValue <= a.min), Y = I(() => b(a.modelValue) && a.modelValue >= a.max), te = I(() => {
|
|
88
90
|
const e = W(a.step);
|
|
89
|
-
return
|
|
90
|
-
}),
|
|
91
|
+
return k(a.precision) ? Math.max(W(a.modelValue), e) : (e > a.precision && U("InputNumber", "precision should not be less than the decimal places of step"), a.precision);
|
|
92
|
+
}), x = I(() => a.controls && a.controlsPosition === "right"), G = Te(), h = ke(), D = I(() => {
|
|
91
93
|
if (l.userInput !== null)
|
|
92
94
|
return l.userInput;
|
|
93
95
|
let e = l.currentValue;
|
|
@@ -96,11 +98,11 @@ const De = 100, Be = 600, Z = {
|
|
|
96
98
|
if (b(e)) {
|
|
97
99
|
if (Number.isNaN(e))
|
|
98
100
|
return "";
|
|
99
|
-
|
|
101
|
+
k(a.precision) || (e = e.toFixed(a.precision));
|
|
100
102
|
}
|
|
101
103
|
return e;
|
|
102
104
|
}), B = (e, n) => {
|
|
103
|
-
if (
|
|
105
|
+
if (k(n) && (n = te.value), n === 0)
|
|
104
106
|
return Math.round(e);
|
|
105
107
|
let t = String(e);
|
|
106
108
|
const o = t.indexOf(".");
|
|
@@ -114,40 +116,40 @@ const De = 100, Be = 600, Z = {
|
|
|
114
116
|
const n = e.toString(), t = n.indexOf(".");
|
|
115
117
|
let o = 0;
|
|
116
118
|
return t !== -1 && (o = n.length - t - 1), o;
|
|
117
|
-
},
|
|
119
|
+
}, j = (e, n = 1) => b(e) ? B(e + a.step * n) : l.currentValue, L = () => {
|
|
118
120
|
if (a.readonly || h.value || Y.value)
|
|
119
121
|
return;
|
|
120
|
-
const e = Number(D.value) || 0, n =
|
|
121
|
-
w(n),
|
|
122
|
+
const e = Number(D.value) || 0, n = j(e);
|
|
123
|
+
w(n), s(C, l.currentValue), $();
|
|
122
124
|
}, M = () => {
|
|
123
125
|
if (a.readonly || h.value || g.value)
|
|
124
126
|
return;
|
|
125
|
-
const e = Number(D.value) || 0, n =
|
|
126
|
-
w(n),
|
|
127
|
+
const e = Number(D.value) || 0, n = j(e, -1);
|
|
128
|
+
w(n), s(C, l.currentValue), $();
|
|
127
129
|
}, H = (e, n) => {
|
|
128
|
-
const { max: t, min: o, step:
|
|
129
|
-
t < o &&
|
|
130
|
+
const { max: t, min: o, step: i, precision: p, stepStrictly: _, valueOnClear: S } = a;
|
|
131
|
+
t < o && _e("InputNumber", "min should not be greater than max.");
|
|
130
132
|
let d = Number(e);
|
|
131
133
|
if (E(e) || Number.isNaN(d))
|
|
132
134
|
return null;
|
|
133
135
|
if (e === "") {
|
|
134
136
|
if (S === null)
|
|
135
137
|
return null;
|
|
136
|
-
d =
|
|
138
|
+
d = Se(S) ? { min: o, max: t }[S] : S;
|
|
137
139
|
}
|
|
138
|
-
return _ && (d = B(Math.round(d /
|
|
140
|
+
return _ && (d = B(Math.round(d / i) * i, p), d !== e && n && s(N, d)), k(p) || (d = B(d, p)), (d > t || d < o) && (d = d > t ? t : o, n && s(N, d)), d;
|
|
139
141
|
}, w = (e, n = !0) => {
|
|
140
142
|
var t;
|
|
141
|
-
const o = l.currentValue,
|
|
143
|
+
const o = l.currentValue, i = H(e);
|
|
142
144
|
if (!n) {
|
|
143
|
-
|
|
145
|
+
s(N, i);
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
146
|
-
o ===
|
|
148
|
+
o === i && e || (l.userInput = null, s(N, i), o !== i && s(ne, i, o), a.validateEvent && ((t = f == null ? void 0 : f.validate) == null || t.call(f, "change").catch((p) => U(p))), l.currentValue = i);
|
|
147
149
|
}, re = (e) => {
|
|
148
150
|
l.userInput = e;
|
|
149
151
|
const n = e === "" ? null : Number(e);
|
|
150
|
-
|
|
152
|
+
s(C, n), w(n, !1);
|
|
151
153
|
}, ae = (e) => {
|
|
152
154
|
const n = e !== "" ? Number(e) : "";
|
|
153
155
|
(b(n) && !Number.isNaN(n) || e === "") && w(n), $(), l.userInput = null;
|
|
@@ -158,13 +160,13 @@ const De = 100, Be = 600, Z = {
|
|
|
158
160
|
var e, n;
|
|
159
161
|
(n = (e = m.value) == null ? void 0 : e.blur) == null || n.call(e);
|
|
160
162
|
}, oe = (e) => {
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
+
s("focus", e);
|
|
164
|
+
}, ie = (e) => {
|
|
163
165
|
var n, t;
|
|
164
|
-
l.userInput = null, Ne() && l.currentValue === null && ((n = m.value) != null && n.input) && (m.value.input.value = ""),
|
|
166
|
+
l.userInput = null, Ne() && l.currentValue === null && ((n = m.value) != null && n.input) && (m.value.input.value = ""), s("blur", e), a.validateEvent && ((t = f == null ? void 0 : f.validate) == null || t.call(f, "blur").catch((o) => U(o)));
|
|
165
167
|
}, $ = () => {
|
|
166
168
|
l.currentValue !== a.modelValue && (l.currentValue = a.modelValue);
|
|
167
|
-
},
|
|
169
|
+
}, se = (e) => {
|
|
168
170
|
document.activeElement === e.target && e.preventDefault();
|
|
169
171
|
};
|
|
170
172
|
return me(() => a.modelValue, (e, n) => {
|
|
@@ -172,12 +174,12 @@ const De = 100, Be = 600, Z = {
|
|
|
172
174
|
l.userInput === null && t !== n && (l.currentValue = t);
|
|
173
175
|
}, { immediate: !0 }), pe(() => {
|
|
174
176
|
var e;
|
|
175
|
-
const { min: n, max: t, modelValue: o } = a,
|
|
176
|
-
if (
|
|
177
|
+
const { min: n, max: t, modelValue: o } = a, i = (e = m.value) == null ? void 0 : e.input;
|
|
178
|
+
if (i.setAttribute("role", "spinbutton"), Number.isFinite(t) ? i.setAttribute("aria-valuemax", String(t)) : i.removeAttribute("aria-valuemax"), Number.isFinite(n) ? i.setAttribute("aria-valuemin", String(n)) : i.removeAttribute("aria-valuemin"), i.setAttribute("aria-valuenow", l.currentValue || l.currentValue === 0 ? String(l.currentValue) : ""), i.setAttribute("aria-disabled", String(h.value)), !b(o) && o != null) {
|
|
177
179
|
let p = Number(o);
|
|
178
|
-
Number.isNaN(p) && (p = null),
|
|
180
|
+
Number.isNaN(p) && (p = null), s(N, p);
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
i.addEventListener("wheel", se, { passive: !1 });
|
|
181
183
|
}), fe(() => {
|
|
182
184
|
var e, n;
|
|
183
185
|
const t = (e = m.value) == null ? void 0 : e.input;
|
|
@@ -191,12 +193,12 @@ const De = 100, Be = 600, Z = {
|
|
|
191
193
|
r(c).m(r(G)),
|
|
192
194
|
r(c).is("disabled", r(h)),
|
|
193
195
|
r(c).is("without-controls", !e.controls),
|
|
194
|
-
r(c).is("controls-right", r(
|
|
196
|
+
r(c).is("controls-right", r(x))
|
|
195
197
|
]),
|
|
196
198
|
onDragstart: O(() => {
|
|
197
199
|
}, ["prevent"])
|
|
198
200
|
}, [
|
|
199
|
-
e.controls ?
|
|
201
|
+
e.controls ? q((v(), z("span", {
|
|
200
202
|
key: 0,
|
|
201
203
|
role: "button",
|
|
202
204
|
"aria-label": r(y)("el.inputNumber.decrease"),
|
|
@@ -206,7 +208,7 @@ const De = 100, Be = 600, Z = {
|
|
|
206
208
|
P(e.$slots, "decrease-icon", {}, () => [
|
|
207
209
|
R(r(Q), null, {
|
|
208
210
|
default: F(() => [
|
|
209
|
-
r(
|
|
211
|
+
r(x) ? (v(), T(r(Ve), { key: 0 })) : (v(), T(r(he), { key: 1 }))
|
|
210
212
|
]),
|
|
211
213
|
_: 1
|
|
212
214
|
})
|
|
@@ -214,7 +216,7 @@ const De = 100, Be = 600, Z = {
|
|
|
214
216
|
], 42, ["aria-label", "onKeydown"])), [
|
|
215
217
|
[r(Z), M]
|
|
216
218
|
]) : J("v-if", !0),
|
|
217
|
-
e.controls ?
|
|
219
|
+
e.controls ? q((v(), z("span", {
|
|
218
220
|
key: 1,
|
|
219
221
|
role: "button",
|
|
220
222
|
"aria-label": r(y)("el.inputNumber.increase"),
|
|
@@ -224,7 +226,7 @@ const De = 100, Be = 600, Z = {
|
|
|
224
226
|
P(e.$slots, "increase-icon", {}, () => [
|
|
225
227
|
R(r(Q), null, {
|
|
226
228
|
default: F(() => [
|
|
227
|
-
r(
|
|
229
|
+
r(x) ? (v(), T(r(Ie), { key: 0 })) : (v(), T(r(Ee), { key: 1 }))
|
|
228
230
|
]),
|
|
229
231
|
_: 1
|
|
230
232
|
})
|
|
@@ -252,7 +254,7 @@ const De = 100, Be = 600, Z = {
|
|
|
252
254
|
A(O(L, ["prevent"]), ["up"]),
|
|
253
255
|
A(O(M, ["prevent"]), ["down"])
|
|
254
256
|
],
|
|
255
|
-
onBlur:
|
|
257
|
+
onBlur: ie,
|
|
256
258
|
onFocus: oe,
|
|
257
259
|
onInput: re,
|
|
258
260
|
onChange: ae
|
|
@@ -275,8 +277,8 @@ const De = 100, Be = 600, Z = {
|
|
|
275
277
|
], 42, ["onDragstart"]));
|
|
276
278
|
}
|
|
277
279
|
});
|
|
278
|
-
var Ke = /* @__PURE__ */
|
|
279
|
-
const qe =
|
|
280
|
+
var Ke = /* @__PURE__ */ we(ze, [["__file", "input-number.vue"]]);
|
|
281
|
+
const qe = Ae(Ke);
|
|
280
282
|
export {
|
|
281
283
|
qe as E
|
|
282
284
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),U=require("./el-input-6a3805c5.cjs"),v=require("./index-afc88a4b.cjs"),u=require("./base-0ca7c43a.cjs"),T=require("./use-form-common-props-74a96df2.cjs"),Y=require("./el-popper-7adbf1c6.cjs"),p=require("./index-65b4113e.cjs"),H=require("./index-375e8de4.cjs"),j=100,J=600,L={beforeMount(o,E){const c=E.value,{interval:l=j,delay:h=J}=u.isFunction(c)?{}:c;let d,m;const i=()=>u.isFunction(c)?c():c.handler(),N=()=>{m&&(clearTimeout(m),m=void 0),d&&(clearInterval(d),d=void 0)};o.addEventListener("mousedown",I=>{I.button===0&&(N(),i(),document.addEventListener("mouseup",()=>N(),{once:!0}),m=setTimeout(()=>{d=setInterval(()=>{i()},l)},h))})}},Q=u.buildProps({id:{type:String,default:void 0},step:{type:Number,default:1},stepStrictly:Boolean,max:{type:Number,default:Number.POSITIVE_INFINITY},min:{type:Number,default:Number.NEGATIVE_INFINITY},modelValue:Number,readonly:Boolean,disabled:Boolean,size:T.useSizeProp,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:"",values:["","right"]},valueOnClear:{type:[String,Number,null],validator:o=>o===null||u.isNumber(o)||["min","max"].includes(o),default:null},name:String,placeholder:String,precision:{type:Number,validator:o=>o>=0&&o===Number.parseInt(`${o}`,10)},validateEvent:{type:Boolean,default:!0},...Y.useAriaProps(["ariaLabel"])}),X={[p.CHANGE_EVENT]:(o,E)=>E!==o,blur:o=>o instanceof FocusEvent,focus:o=>o instanceof FocusEvent,[p.INPUT_EVENT]:o=>u.isNumber(o)||u.isNil(o),[p.UPDATE_MODEL_EVENT]:o=>u.isNumber(o)||u.isNil(o)},Z=e.defineComponent({name:"ElInputNumber"}),ee=e.defineComponent({...Z,props:Q,emits:X,setup(o,{expose:E,emit:c}){const l=o,{t:h}=H.useLocale(),d=u.useNamespace("input-number"),m=e.ref(),i=e.reactive({currentValue:l.modelValue,userInput:null}),{formItem:N}=T.useFormItem(),I=e.computed(()=>u.isNumber(l.modelValue)&&l.modelValue<=l.min),B=e.computed(()=>u.isNumber(l.modelValue)&&l.modelValue>=l.max),O=e.computed(()=>{const n=F(l.step);return u.isUndefined(l.precision)?Math.max(F(l.modelValue),n):(n>l.precision&&u.debugWarn("InputNumber","precision should not be less than the decimal places of step"),l.precision)}),g=e.computed(()=>l.controls&&l.controlsPosition==="right"),C=T.useFormSize(),V=T.useFormDisabled(),P=e.computed(()=>{if(i.userInput!==null)return i.userInput;let n=i.currentValue;if(u.isNil(n))return"";if(u.isNumber(n)){if(Number.isNaN(n))return"";u.isUndefined(l.precision)||(n=n.toFixed(l.precision))}return n}),A=(n,t)=>{if(u.isUndefined(t)&&(t=O.value),t===0)return Math.round(n);let r=String(n);const a=r.indexOf(".");if(a===-1||!r.replace(".","").split("")[a+t])return n;const w=r.length;return r.charAt(w-1)==="5"&&(r=`${r.slice(0,Math.max(0,w-1))}6`),Number.parseFloat(Number(r).toFixed(t))},F=n=>{if(u.isNil(n))return 0;const t=n.toString(),r=t.indexOf(".");let a=0;return r!==-1&&(a=t.length-r-1),a},x=(n,t=1)=>u.isNumber(n)?A(n+l.step*t):i.currentValue,S=()=>{if(l.readonly||V.value||B.value)return;const n=Number(P.value)||0,t=x(n);y(t),c(p.INPUT_EVENT,i.currentValue),D()},k=()=>{if(l.readonly||V.value||I.value)return;const n=Number(P.value)||0,t=x(n,-1);y(t),c(p.INPUT_EVENT,i.currentValue),D()},M=(n,t)=>{const{max:r,min:a,step:s,precision:b,stepStrictly:w,valueOnClear:_}=l;r<a&&u.throwError("InputNumber","min should not be greater than max.");let f=Number(n);if(u.isNil(n)||Number.isNaN(f))return null;if(n===""){if(_===null)return null;f=u.isString(_)?{min:a,max:r}[_]:_}return w&&(f=A(Math.round(f/s)*s,b),f!==n&&t&&c(p.UPDATE_MODEL_EVENT,f)),u.isUndefined(b)||(f=A(f,b)),(f>r||f<a)&&(f=f>r?r:a,t&&c(p.UPDATE_MODEL_EVENT,f)),f},y=(n,t=!0)=>{var r;const a=i.currentValue,s=M(n);if(!t){c(p.UPDATE_MODEL_EVENT,s);return}a===s&&n||(i.userInput=null,c(p.UPDATE_MODEL_EVENT,s),a!==s&&c(p.CHANGE_EVENT,s,a),l.validateEvent&&((r=N==null?void 0:N.validate)==null||r.call(N,"change").catch(b=>u.debugWarn(b))),i.currentValue=s)},$=n=>{i.userInput=n;const t=n===""?null:Number(n);c(p.INPUT_EVENT,t),y(t,!1)},K=n=>{const t=n!==""?Number(n):"";(u.isNumber(t)&&!Number.isNaN(t)||n==="")&&y(t),D(),i.userInput=null},z=()=>{var n,t;(t=(n=m.value)==null?void 0:n.focus)==null||t.call(n)},q=()=>{var n,t;(t=(n=m.value)==null?void 0:n.blur)==null||t.call(n)},R=n=>{c("focus",n)},W=n=>{var t,r;i.userInput=null,U.isFirefox()&&i.currentValue===null&&((t=m.value)!=null&&t.input)&&(m.value.input.value=""),c("blur",n),l.validateEvent&&((r=N==null?void 0:N.validate)==null||r.call(N,"blur").catch(a=>u.debugWarn(a)))},D=()=>{i.currentValue!==l.modelValue&&(i.currentValue=l.modelValue)},G=n=>{document.activeElement===n.target&&n.preventDefault()};return e.watch(()=>l.modelValue,(n,t)=>{const r=M(n,!0);i.userInput===null&&r!==t&&(i.currentValue=r)},{immediate:!0}),e.onMounted(()=>{var n;const{min:t,max:r,modelValue:a}=l,s=(n=m.value)==null?void 0:n.input;if(s.setAttribute("role","spinbutton"),Number.isFinite(r)?s.setAttribute("aria-valuemax",String(r)):s.removeAttribute("aria-valuemax"),Number.isFinite(t)?s.setAttribute("aria-valuemin",String(t)):s.removeAttribute("aria-valuemin"),s.setAttribute("aria-valuenow",i.currentValue||i.currentValue===0?String(i.currentValue):""),s.setAttribute("aria-disabled",String(V.value)),!u.isNumber(a)&&a!=null){let b=Number(a);Number.isNaN(b)&&(b=null),c(p.UPDATE_MODEL_EVENT,b)}s.addEventListener("wheel",G,{passive:!1})}),e.onUpdated(()=>{var n,t;const r=(n=m.value)==null?void 0:n.input;r==null||r.setAttribute("aria-valuenow",`${(t=i.currentValue)!=null?t:""}`)}),E({focus:z,blur:q}),(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(d).b(),e.unref(d).m(e.unref(C)),e.unref(d).is("disabled",e.unref(V)),e.unref(d).is("without-controls",!n.controls),e.unref(d).is("controls-right",e.unref(g))]),onDragstart:e.withModifiers(()=>{},["prevent"])},[n.controls?e.withDirectives((e.openBlock(),e.createElementBlock("span",{key:0,role:"button","aria-label":e.unref(h)("el.inputNumber.decrease"),class:e.normalizeClass([e.unref(d).e("decrease"),e.unref(d).is("disabled",e.unref(I))]),onKeydown:e.withKeys(k,["enter"])},[e.renderSlot(n.$slots,"decrease-icon",{},()=>[e.createVNode(e.unref(v.ElIcon),null,{default:e.withCtx(()=>[e.unref(g)?(e.openBlock(),e.createBlock(e.unref(v.arrow_down_default),{key:0})):(e.openBlock(),e.createBlock(e.unref(v.minus_default),{key:1}))]),_:1})])],42,["aria-label","onKeydown"])),[[e.unref(L),k]]):e.createCommentVNode("v-if",!0),n.controls?e.withDirectives((e.openBlock(),e.createElementBlock("span",{key:1,role:"button","aria-label":e.unref(h)("el.inputNumber.increase"),class:e.normalizeClass([e.unref(d).e("increase"),e.unref(d).is("disabled",e.unref(B))]),onKeydown:e.withKeys(S,["enter"])},[e.renderSlot(n.$slots,"increase-icon",{},()=>[e.createVNode(e.unref(v.ElIcon),null,{default:e.withCtx(()=>[e.unref(g)?(e.openBlock(),e.createBlock(e.unref(v.arrow_up_default),{key:0})):(e.openBlock(),e.createBlock(e.unref(v.plus_default),{key:1}))]),_:1})])],42,["aria-label","onKeydown"])),[[e.unref(L),S]]):e.createCommentVNode("v-if",!0),e.createVNode(e.unref(U.ElInput),{id:n.id,ref_key:"input",ref:m,type:"number",step:n.step,"model-value":e.unref(P),placeholder:n.placeholder,readonly:n.readonly,disabled:e.unref(V),size:e.unref(C),max:n.max,min:n.min,name:n.name,"aria-label":n.ariaLabel,"validate-event":!1,onKeydown:[e.withKeys(e.withModifiers(S,["prevent"]),["up"]),e.withKeys(e.withModifiers(k,["prevent"]),["down"])],onBlur:W,onFocus:R,onInput:$,onChange:K},e.createSlots({_:2},[n.$slots.prefix?{name:"prefix",fn:e.withCtx(()=>[e.renderSlot(n.$slots,"prefix")])}:void 0,n.$slots.suffix?{name:"suffix",fn:e.withCtx(()=>[e.renderSlot(n.$slots,"suffix")])}:void 0]),1032,["id","step","model-value","placeholder","readonly","disabled","size","max","min","name","aria-label","onKeydown"])],42,["onDragstart"]))}});var ne=u._export_sfc(ee,[["__file","input-number.vue"]]);const te=u.withInstall(ne);exports.ElInputNumber=te;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),oe=require("./el-scrollbar-ac525239.cjs"),H=require("./index-afc88a4b.cjs"),y=require("./index-65b4113e.cjs"),l=require("./base-0ca7c43a.cjs"),Q=require("./el-popper-7adbf1c6.cjs"),se=require("./index-eea0bcb3.cjs"),V=require("./use-form-common-props-74a96df2.cjs"),le=require("./el-tag-9732314f.cjs"),ae=require("./typescript-b63f8e83.cjs"),ue=require("./vnode-b15eb11b.cjs"),re=e.defineComponent({name:"ElCollapseTransition"}),ie=e.defineComponent({...re,setup(t){const s=l.useNamespace("collapse-transition"),o=n=>{n.style.maxHeight="",n.style.overflow=n.dataset.oldOverflow,n.style.paddingTop=n.dataset.oldPaddingTop,n.style.paddingBottom=n.dataset.oldPaddingBottom},d={beforeEnter(n){n.dataset||(n.dataset={}),n.dataset.oldPaddingTop=n.style.paddingTop,n.dataset.oldPaddingBottom=n.style.paddingBottom,n.style.height&&(n.dataset.elExistsHeight=n.style.height),n.style.maxHeight=0,n.style.paddingTop=0,n.style.paddingBottom=0},enter(n){requestAnimationFrame(()=>{n.dataset.oldOverflow=n.style.overflow,n.dataset.elExistsHeight?n.style.maxHeight=n.dataset.elExistsHeight:n.scrollHeight!==0?n.style.maxHeight=`${n.scrollHeight}px`:n.style.maxHeight=0,n.style.paddingTop=n.dataset.oldPaddingTop,n.style.paddingBottom=n.dataset.oldPaddingBottom,n.style.overflow="hidden"})},afterEnter(n){n.style.maxHeight="",n.style.overflow=n.dataset.oldOverflow},enterCancelled(n){o(n)},beforeLeave(n){n.dataset||(n.dataset={}),n.dataset.oldPaddingTop=n.style.paddingTop,n.dataset.oldPaddingBottom=n.style.paddingBottom,n.dataset.oldOverflow=n.style.overflow,n.style.maxHeight=`${n.scrollHeight}px`,n.style.overflow="hidden"},leave(n){n.scrollHeight!==0&&(n.style.maxHeight=0,n.style.paddingTop=0,n.style.paddingBottom=0)},afterLeave(n){o(n)},leaveCancelled(n){o(n)}};return(n,C)=>(e.openBlock(),e.createBlock(e.Transition,e.mergeProps({name:e.unref(s).b()},e.toHandlers(d)),{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},16,["name"]))}});var ce=l._export_sfc(ie,[["__file","collapse-transition.vue"]]);const de=l.withInstall(ce);let pe=class{constructor(s,o){this.parent=s,this.domNode=o,this.subIndex=0,this.subIndex=0,this.init()}init(){this.subMenuItems=this.domNode.querySelectorAll("li"),this.addListeners()}gotoSubIndex(s){s===this.subMenuItems.length?s=0:s<0&&(s=this.subMenuItems.length-1),this.subMenuItems[s].focus(),this.subIndex=s}addListeners(){const s=this.parent.domNode;Array.prototype.forEach.call(this.subMenuItems,o=>{o.addEventListener("keydown",d=>{let n=!1;switch(d.code){case y.EVENT_CODE.down:{this.gotoSubIndex(this.subIndex+1),n=!0;break}case y.EVENT_CODE.up:{this.gotoSubIndex(this.subIndex-1),n=!0;break}case y.EVENT_CODE.tab:{y.triggerEvent(s,"mouseleave");break}case y.EVENT_CODE.enter:case y.EVENT_CODE.numpadEnter:case y.EVENT_CODE.space:{n=!0,d.currentTarget.click();break}}return n&&(d.preventDefault(),d.stopPropagation()),!1})})}},me=class{constructor(s,o){this.domNode=s,this.submenu=null,this.submenu=null,this.init(o)}init(s){this.domNode.setAttribute("tabindex","0");const o=this.domNode.querySelector(`.${s}-menu`);o&&(this.submenu=new pe(this,o)),this.addListeners()}addListeners(){this.domNode.addEventListener("keydown",s=>{let o=!1;switch(s.code){case y.EVENT_CODE.down:{y.triggerEvent(s.currentTarget,"mouseenter"),this.submenu&&this.submenu.gotoSubIndex(0),o=!0;break}case y.EVENT_CODE.up:{y.triggerEvent(s.currentTarget,"mouseenter"),this.submenu&&this.submenu.gotoSubIndex(this.submenu.subMenuItems.length-1),o=!0;break}case y.EVENT_CODE.tab:{y.triggerEvent(s.currentTarget,"mouseleave");break}case y.EVENT_CODE.enter:case y.EVENT_CODE.numpadEnter:case y.EVENT_CODE.space:{o=!0,s.currentTarget.click();break}}o&&s.preventDefault()})}},ve=class{constructor(s,o){this.domNode=s,this.init(o)}init(s){const o=this.domNode.childNodes;Array.from(o).forEach(d=>{d.nodeType===1&&new me(d,s)})}};const fe=e.defineComponent({name:"ElMenuCollapseTransition",setup(){const t=l.useNamespace("menu");return{listeners:{onBeforeEnter:o=>o.style.opacity="0.2",onEnter(o,d){l.addClass(o,`${t.namespace.value}-opacity-transition`),o.style.opacity="1",d()},onAfterEnter(o){l.removeClass(o,`${t.namespace.value}-opacity-transition`),o.style.opacity=""},onBeforeLeave(o){o.dataset||(o.dataset={}),l.hasClass(o,t.m("collapse"))?(l.removeClass(o,t.m("collapse")),o.dataset.oldOverflow=o.style.overflow,o.dataset.scrollWidth=o.clientWidth.toString(),l.addClass(o,t.m("collapse"))):(l.addClass(o,t.m("collapse")),o.dataset.oldOverflow=o.style.overflow,o.dataset.scrollWidth=o.clientWidth.toString(),l.removeClass(o,t.m("collapse"))),o.style.width=`${o.scrollWidth}px`,o.style.overflow="hidden"},onLeave(o){l.addClass(o,"horizontal-collapse-transition"),o.style.width=`${o.dataset.scrollWidth}px`}}}}});function he(t,s,o,d,n,C){return e.openBlock(),e.createBlock(e.Transition,e.mergeProps({mode:"out-in"},t.listeners),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)}var ge=l._export_sfc(fe,[["render",he],["__file","menu-collapse-transition.vue"]]);function X(t,s){const o=e.computed(()=>{let n=t.parent;const C=[s.value];for(;n.type.name!=="ElMenu";)n.props.index&&C.unshift(n.props.index),n=n.parent;return C});return{parentMenu:e.computed(()=>{let n=t.parent;for(;n&&!["ElMenu","ElSubMenu"].includes(n.type.name);)n=n.parent;return n}),indexPath:o}}function be(t){return e.computed(()=>{const o=t.backgroundColor;return o?new se.TinyColor(o).shade(20).toString():""})}const Y=(t,s)=>{const o=l.useNamespace("menu");return e.computed(()=>o.cssVarBlock({"text-color":t.textColor||"","hover-text-color":t.textColor||"","bg-color":t.backgroundColor||"","hover-bg-color":be(t).value||"","active-color":t.activeTextColor||"",level:`${s}`}))},Me=l.buildProps({index:{type:String,required:!0},showTimeout:Number,hideTimeout:Number,popperClass:String,disabled:Boolean,teleported:{type:Boolean,default:void 0},popperOffset:Number,expandCloseIcon:{type:V.iconPropType},expandOpenIcon:{type:V.iconPropType},collapseCloseIcon:{type:V.iconPropType},collapseOpenIcon:{type:V.iconPropType}}),U="ElSubMenu";var K=e.defineComponent({name:U,props:Me,setup(t,{slots:s,expose:o}){const d=e.getCurrentInstance(),{indexPath:n,parentMenu:C}=X(d,e.computed(()=>t.index)),v=l.useNamespace("menu"),E=l.useNamespace("sub-menu"),i=e.inject("rootMenu");i||l.throwError(U,"can not inject root menu");const m=e.inject(`subMenu:${C.value.uid}`);m||l.throwError(U,"can not inject sub menu");const f=e.ref({}),b=e.ref({});let I;const S=e.ref(!1),W=e.ref(),q=e.ref(null),N=e.computed(()=>_.value==="horizontal"&&w.value?"bottom-start":"right-start"),O=e.computed(()=>_.value==="horizontal"&&w.value||_.value==="vertical"&&!i.props.collapse?t.expandCloseIcon&&t.expandOpenIcon?x.value?t.expandOpenIcon:t.expandCloseIcon:H.arrow_down_default:t.collapseCloseIcon&&t.collapseOpenIcon?x.value?t.collapseOpenIcon:t.collapseCloseIcon:H.arrow_right_default),w=e.computed(()=>m.level===0),z=e.computed(()=>{const r=t.teleported;return r===void 0?w.value:r}),F=e.computed(()=>i.props.collapse?`${v.namespace.value}-zoom-in-left`:`${v.namespace.value}-zoom-in-top`),R=e.computed(()=>_.value==="horizontal"&&w.value?["bottom-start","bottom-end","top-start","top-end","right-start","left-start"]:["right-start","right","right-end","left-start","bottom-start","bottom-end","top-start","top-end"]),x=e.computed(()=>i.openedMenus.includes(t.index)),P=e.computed(()=>{let r=!1;return Object.values(f.value).forEach(p=>{p.active&&(r=!0)}),Object.values(b.value).forEach(p=>{p.active&&(r=!0)}),r}),_=e.computed(()=>i.props.mode),$=e.reactive({index:t.index,indexPath:n,active:P}),D=Y(i.props,m.level+1),L=e.computed(()=>{var r;return(r=t.popperOffset)!=null?r:i.props.popperOffset}),B=e.computed(()=>{var r;return(r=t.popperClass)!=null?r:i.props.popperClass}),j=e.computed(()=>{var r;return(r=t.showTimeout)!=null?r:i.props.showTimeout}),G=e.computed(()=>{var r;return(r=t.hideTimeout)!=null?r:i.props.hideTimeout}),a=()=>{var r,p,M;return(M=(p=(r=q.value)==null?void 0:r.popperRef)==null?void 0:p.popperInstanceRef)==null?void 0:M.destroy()},u=r=>{r||a()},c=()=>{i.props.menuTrigger==="hover"&&i.props.mode==="horizontal"||i.props.collapse&&i.props.mode==="vertical"||t.disabled||i.handleSubMenuClick({index:t.index,indexPath:n.value,active:P.value})},h=(r,p=j.value)=>{var M;if(r.type!=="focus"){if(i.props.menuTrigger==="click"&&i.props.mode==="horizontal"||!i.props.collapse&&i.props.mode==="vertical"||t.disabled){m.mouseInChild.value=!0;return}m.mouseInChild.value=!0,I==null||I(),{stop:I}=l.useTimeoutFn(()=>{i.openMenu(t.index,n.value)},p),z.value&&((M=C.value.vnode.el)==null||M.dispatchEvent(new MouseEvent("mouseenter")))}},g=(r=!1)=>{var p;if(i.props.menuTrigger==="click"&&i.props.mode==="horizontal"||!i.props.collapse&&i.props.mode==="vertical"){m.mouseInChild.value=!1;return}I==null||I(),m.mouseInChild.value=!1,{stop:I}=l.useTimeoutFn(()=>!S.value&&i.closeMenu(t.index,n.value),G.value),z.value&&r&&((p=m.handleMouseleave)==null||p.call(m,!0))};e.watch(()=>i.props.collapse,r=>u(!!r));{const r=M=>{b.value[M.index]=M},p=M=>{delete b.value[M.index]};e.provide(`subMenu:${d.uid}`,{addSubMenu:r,removeSubMenu:p,handleMouseleave:g,mouseInChild:S,level:m.level+1})}return o({opened:x}),e.onMounted(()=>{i.addSubMenu($),m.addSubMenu($)}),e.onBeforeUnmount(()=>{m.removeSubMenu($),i.removeSubMenu($)}),()=>{var r;const p=[(r=s.title)==null?void 0:r.call(s),e.h(H.ElIcon,{class:E.e("icon-arrow"),style:{transform:x.value?t.expandCloseIcon&&t.expandOpenIcon||t.collapseCloseIcon&&t.collapseOpenIcon&&i.props.collapse?"none":"rotateZ(180deg)":"none"}},{default:()=>l.isString(O.value)?e.h(d.appContext.components[O.value]):e.h(O.value)})],M=i.isMenuPopup?e.h(Q.ElTooltip,{ref:q,visible:x.value,effect:"light",pure:!0,offset:L.value,showArrow:!1,persistent:!0,popperClass:B.value,placement:N.value,teleported:z.value,fallbackPlacements:R.value,transition:F.value,gpuAcceleration:!1},{content:()=>{var T;return e.h("div",{class:[v.m(_.value),v.m("popup-container"),B.value],onMouseenter:k=>h(k,100),onMouseleave:()=>g(!0),onFocus:k=>h(k,100)},[e.h("ul",{class:[v.b(),v.m("popup"),v.m(`popup-${N.value}`)],style:D.value},[(T=s.default)==null?void 0:T.call(s)])])},default:()=>e.h("div",{class:E.e("title"),onClick:c},p)}):e.h(e.Fragment,{},[e.h("div",{class:E.e("title"),ref:W,onClick:c},p),e.h(de,{},{default:()=>{var T;return e.withDirectives(e.h("ul",{role:"menu",class:[v.b(),v.m("inline")],style:D.value},[(T=s.default)==null?void 0:T.call(s)]),[[e.vShow,x.value]])}})]);return e.h("li",{class:[E.b(),E.is("active",P.value),E.is("opened",x.value),E.is("disabled",t.disabled)],role:"menuitem",ariaHaspopup:!0,ariaExpanded:x.value,onMouseenter:h,onMouseleave:()=>g(),onFocus:h},[M])}}});const ye=l.buildProps({mode:{type:String,values:["horizontal","vertical"],default:"vertical"},defaultActive:{type:String,default:""},defaultOpeneds:{type:l.definePropType(Array),default:()=>ae.mutable([])},uniqueOpened:Boolean,router:Boolean,menuTrigger:{type:String,values:["hover","click"],default:"hover"},collapse:Boolean,backgroundColor:String,textColor:String,activeTextColor:String,closeOnClickOutside:Boolean,collapseTransition:{type:Boolean,default:!0},ellipsis:{type:Boolean,default:!0},popperOffset:{type:Number,default:6},ellipsisIcon:{type:V.iconPropType,default:()=>H.more_default},popperEffect:{type:l.definePropType(String),default:"dark"},popperClass:String,showTimeout:{type:Number,default:300},hideTimeout:{type:Number,default:300}}),Z=t=>l.isArray(t)&&t.every(s=>l.isString(s)),Ee={close:(t,s)=>l.isString(t)&&Z(s),open:(t,s)=>l.isString(t)&&Z(s),select:(t,s,o,d)=>l.isString(t)&&Z(s)&&l.isObject(o)&&(d===void 0||d instanceof Promise)};var Ce=e.defineComponent({name:"ElMenu",props:ye,emits:Ee,setup(t,{emit:s,slots:o,expose:d}){const n=e.getCurrentInstance(),C=n.appContext.config.globalProperties.$router,v=e.ref(),E=l.useNamespace("menu"),i=l.useNamespace("sub-menu"),m=e.ref(-1),f=e.ref(t.defaultOpeneds&&!t.collapse?t.defaultOpeneds.slice(0):[]),b=e.ref(t.defaultActive),I=e.ref({}),S=e.ref({}),W=e.computed(()=>t.mode==="horizontal"||t.mode==="vertical"&&t.collapse),q=()=>{const a=b.value&&I.value[b.value];if(!a||t.mode==="horizontal"||t.collapse)return;a.indexPath.forEach(c=>{const h=S.value[c];h&&N(c,h.indexPath)})},N=(a,u)=>{f.value.includes(a)||(t.uniqueOpened&&(f.value=f.value.filter(c=>u.includes(c))),f.value.push(a),s("open",a,u))},O=a=>{const u=f.value.indexOf(a);u!==-1&&f.value.splice(u,1)},w=(a,u)=>{O(a),s("close",a,u)},z=({index:a,indexPath:u})=>{f.value.includes(a)?w(a,u):N(a,u)},F=a=>{(t.mode==="horizontal"||t.collapse)&&(f.value=[]);const{index:u,indexPath:c}=a;if(!(l.isNil(u)||l.isNil(c)))if(t.router&&C){const h=a.route||u,g=C.push(h).then(r=>(r||(b.value=u),r));s("select",u,c,{index:u,indexPath:c,route:h},g)}else b.value=u,s("select",u,c,{index:u,indexPath:c})},R=a=>{const u=I.value,c=u[a]||b.value&&u[b.value]||u[t.defaultActive];c?b.value=c.index:b.value=a},x=a=>{const u=getComputedStyle(a),c=Number.parseInt(u.marginLeft,10),h=Number.parseInt(u.marginRight,10);return a.offsetWidth+c+h||0},P=()=>{var a,u;if(!v.value)return-1;const c=Array.from((u=(a=v.value)==null?void 0:a.childNodes)!=null?u:[]).filter(A=>A.nodeName!=="#text"||A.nodeValue),h=64,g=getComputedStyle(v.value),r=Number.parseInt(g.paddingLeft,10),p=Number.parseInt(g.paddingRight,10),M=v.value.clientWidth-r-p;let T=0,k=0;return c.forEach((A,ne)=>{A.nodeName!=="#comment"&&(T+=x(A),T<=M-h&&(k=ne+1))}),k===c.length?-1:k},_=a=>S.value[a].indexPath,$=(a,u=33.34)=>{let c;return()=>{c&&clearTimeout(c),c=setTimeout(()=>{a()},u)}};let D=!0;const L=()=>{if(m.value===P())return;const a=()=>{m.value=-1,e.nextTick(()=>{m.value=P()})};D?a():$(a)(),D=!1};e.watch(()=>t.defaultActive,a=>{I.value[a]||(b.value=""),R(a)}),e.watch(()=>t.collapse,a=>{a&&(f.value=[])}),e.watch(I.value,q);let B;e.watchEffect(()=>{t.mode==="horizontal"&&t.ellipsis?B=oe.useResizeObserver(v,L).stop:B==null||B()});const j=e.ref(!1);{const a=g=>{S.value[g.index]=g},u=g=>{delete S.value[g.index]},c=g=>{I.value[g.index]=g},h=g=>{delete I.value[g.index]};e.provide("rootMenu",e.reactive({props:t,openedMenus:f,items:I,subMenus:S,activeIndex:b,isMenuPopup:W,addMenuItem:c,removeMenuItem:h,addSubMenu:a,removeSubMenu:u,openMenu:N,closeMenu:w,handleMenuItemClick:F,handleSubMenuClick:z})),e.provide(`subMenu:${n.uid}`,{addSubMenu:a,removeSubMenu:u,mouseInChild:j,level:0})}e.onMounted(()=>{t.mode==="horizontal"&&new ve(n.vnode.el,E.namespace.value)}),d({open:u=>{const{indexPath:c}=S.value[u];c.forEach(h=>N(h,c))},close:O,handleResize:L});const G=Y(t,0);return()=>{var a,u;let c=(u=(a=o.default)==null?void 0:a.call(o))!=null?u:[];const h=[];if(t.mode==="horizontal"&&v.value){const p=ue.flattedChildren(c),M=m.value===-1?p:p.slice(0,m.value),T=m.value===-1?[]:p.slice(m.value);T!=null&&T.length&&t.ellipsis&&(c=M,h.push(e.h(K,{index:"sub-menu-more",class:i.e("hide-arrow"),popperOffset:t.popperOffset},{title:()=>e.h(H.ElIcon,{class:i.e("icon-more")},{default:()=>e.h(t.ellipsisIcon)}),default:()=>T})))}const g=t.closeOnClickOutside?[[le.ClickOutside,()=>{f.value.length&&(j.value||(f.value.forEach(p=>s("close",p,_(p))),f.value=[]))}]]:[],r=e.withDirectives(e.h("ul",{key:String(t.collapse),role:"menubar",ref:v,style:G.value,class:{[E.b()]:!0,[E.m(t.mode)]:!0,[E.m("collapse")]:t.collapse}},[...c,...h]),g);return t.collapseTransition&&t.mode==="vertical"?e.h(ge,()=>r):r}}});const Ie=l.buildProps({index:{type:l.definePropType([String,null]),default:null},route:{type:l.definePropType([String,Object])},disabled:Boolean}),Te={click:t=>l.isString(t.index)&&l.isArray(t.indexPath)},J="ElMenuItem",xe=e.defineComponent({name:J,components:{ElTooltip:Q.ElTooltip},props:Ie,emits:Te,setup(t,{emit:s}){const o=e.getCurrentInstance(),d=e.inject("rootMenu"),n=l.useNamespace("menu"),C=l.useNamespace("menu-item");d||l.throwError(J,"can not inject root menu");const{parentMenu:v,indexPath:E}=X(o,e.toRef(t,"index")),i=e.inject(`subMenu:${v.value.uid}`);i||l.throwError(J,"can not inject sub menu");const m=e.computed(()=>t.index===d.activeIndex),f=e.reactive({index:t.index,indexPath:E,active:m}),b=()=>{t.disabled||(d.handleMenuItemClick({index:t.index,indexPath:E.value,route:t.route}),s("click",f))};return e.onMounted(()=>{i.addSubMenu(f),d.addMenuItem(f)}),e.onBeforeUnmount(()=>{i.removeSubMenu(f),d.removeMenuItem(f)}),{parentMenu:v,rootMenu:d,active:m,nsMenu:n,nsMenuItem:C,handleClick:b}}});function Se(t,s,o,d,n,C){const v=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass([t.nsMenuItem.b(),t.nsMenuItem.is("active",t.active),t.nsMenuItem.is("disabled",t.disabled)]),role:"menuitem",tabindex:"-1",onClick:t.handleClick},[t.parentMenu.type.name==="ElMenu"&&t.rootMenu.props.collapse&&t.$slots.title?(e.openBlock(),e.createBlock(v,{key:0,effect:t.rootMenu.props.popperEffect,placement:"right","fallback-placements":["left"],persistent:""},{content:e.withCtx(()=>[e.renderSlot(t.$slots,"title")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(t.nsMenu.be("tooltip","trigger"))},[e.renderSlot(t.$slots,"default")],2)]),_:3},8,["effect"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"default"),e.renderSlot(t.$slots,"title")],64))],10,["onClick"])}var ee=l._export_sfc(xe,[["render",Se],["__file","menu-item.vue"]]);const Ne={title:String},we="ElMenuItemGroup",_e=e.defineComponent({name:we,props:Ne,setup(){return{ns:l.useNamespace("menu-item-group")}}});function ke(t,s,o,d,n,C){return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(t.ns.b())},[e.createElementVNode("div",{class:e.normalizeClass(t.ns.e("title"))},[t.$slots.title?e.renderSlot(t.$slots,"title",{key:1}):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(t.title),1)],64))],2),e.createElementVNode("ul",null,[e.renderSlot(t.$slots,"default")])],2)}var te=l._export_sfc(_e,[["render",ke],["__file","menu-item-group.vue"]]);const Oe=l.withInstall(Ce,{MenuItem:ee,MenuItemGroup:te,SubMenu:K}),Pe=l.withNoopInstall(ee);l.withNoopInstall(te);l.withNoopInstall(K);exports.ElMenu=Oe;exports.ElMenuItem=Pe;
|