st-comp 0.0.149 → 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/es/ChartLayout.cjs +1 -1
- package/es/ChartLayout.js +5 -4
- package/es/Dialog.cjs +1 -1
- package/es/Dialog.js +24 -22
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +52 -50
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +18 -16
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +26 -24
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +16 -14
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +58 -56
- package/es/PasswordPrompt.cjs +1 -0
- package/es/PasswordPrompt.js +13 -0
- package/es/Table.cjs +1 -1
- package/es/Table.js +105 -103
- package/es/User.cjs +1 -1
- package/es/User.js +400 -378
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +230 -228
- package/es/VirtualTable.cjs +3 -3
- package/es/VirtualTable.js +196 -194
- package/es/_initCloneObject-47814efa.cjs +1 -0
- package/es/{_initCloneObject-14b53c6f.js → _initCloneObject-e3d8a9ab.js} +21 -21
- package/es/base-0ca7c43a.cjs +5 -0
- package/es/base-19787dfb.js +303 -0
- package/es/{castArray-4251bbe4.js → castArray-8405000b.js} +1 -1
- package/es/castArray-a78ae889.cjs +1 -0
- package/es/{config-provider-55482a43.js → config-provider-0f6672af.js} +3 -3
- package/es/{config-provider-7cdfca4d.cjs → config-provider-cfbb9cd8.cjs} +1 -1
- package/es/{debounce-ac30be50.js → debounce-6cb0781f.js} +19 -19
- package/es/debounce-cf26af24.cjs +1 -0
- package/es/{dropdown-634b5e27.js → dropdown-17b3ef6a.js} +4 -4
- package/es/{dropdown-d7c59a21.cjs → dropdown-790d31ea.cjs} +1 -1
- package/es/{el-button-e1665717.js → el-button-0bf1d532.js} +17 -16
- package/es/el-button-62966947.cjs +1 -0
- package/es/{el-checkbox-group-492b95cc.cjs → el-checkbox-group-45247bbf.cjs} +1 -1
- package/es/{el-checkbox-group-e8fece80.js → el-checkbox-group-d53bc316.js} +5 -5
- package/es/el-empty-2ece1134.cjs +1 -0
- package/es/{el-empty-bacc6613.js → el-empty-bd5343a7.js} +10 -9
- package/es/{el-form-item-af1855f0.js → el-form-item-05c0e335.js} +52 -51
- package/es/el-form-item-47e255d4.cjs +12 -0
- package/es/{el-input-4961b99f.js → el-input-1e309239.js} +79 -78
- package/es/el-input-6a3805c5.cjs +1 -0
- package/es/{el-input-number-610fc8ba.js → el-input-number-60ebc58f.js} +57 -55
- package/es/el-input-number-96ff2e47.cjs +1 -0
- package/es/el-menu-item-4c9eb7ad.cjs +1 -0
- package/es/{el-menu-item-7d04c11a.js → el-menu-item-6c6236a1.js} +84 -83
- package/es/{el-message-c3b3ac96.js → el-message-7d927756.js} +55 -54
- package/es/el-message-d5ed7a4f.cjs +1 -0
- package/es/{el-overlay-12dd9b35.js → el-overlay-26bf0945.js} +73 -71
- package/es/el-overlay-41994f67.cjs +1 -0
- package/es/{el-popover-0aa071f2.js → el-popover-17e2e66c.js} +26 -24
- package/es/el-popover-7bd8a7c3.cjs +1 -0
- package/es/el-popper-7adbf1c6.cjs +1 -0
- package/es/{el-popper-50100766.js → el-popper-b6527ae2.js} +194 -193
- package/es/{el-scrollbar-562d0595.js → el-scrollbar-29bcab5f.js} +28 -28
- package/es/{el-scrollbar-d1c3e7f7.cjs → el-scrollbar-ac525239.cjs} +1 -1
- package/es/el-select-31f8ac8a.cjs +1 -0
- package/es/{el-select-9381b156.js → el-select-7395562b.js} +42 -40
- package/es/{el-table-column-55bffba5.js → el-table-column-47d80736.js} +329 -327
- package/es/el-table-column-bdc46568.cjs +14 -0
- package/es/{el-tag-985d9aff.js → el-tag-7414e0c7.js} +78 -77
- package/es/el-tag-9732314f.cjs +1 -0
- package/es/{index-deb8de52.cjs → index-1d85ba4b.cjs} +1 -1
- package/es/{index-39ec9741.js → index-273822d1.js} +21 -20
- package/es/index-2f958e56.cjs +3 -0
- package/es/index-375e8de4.cjs +5 -0
- package/es/{index-0cb48e01.js → index-621b092b.js} +1 -1
- package/es/{index-3bf8d597.cjs → index-65b4113e.cjs} +1 -1
- package/es/index-70372cdb.js +519 -0
- package/es/{use-form-common-props-f377e500.js → index-72151b24.js} +150 -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-09e01b1d.js → index-c066fe0d.js} +32 -31
- package/es/index-ce3223db.cjs +1 -0
- package/es/{index-a902a0d9.js → index-dc22ffe4.js} +2 -2
- package/es/{raf-b128c7b7.js → raf-a532c514.js} +1 -1
- package/es/{raf-8fc301fd.cjs → raf-f46caea0.cjs} +1 -1
- package/es/{scroll-41224831.cjs → scroll-339681d4.cjs} +1 -1
- package/es/{scroll-387fcfdb.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-7dfd4ed5.js → vnode-6a0c7411.js} +1 -1
- package/es/{vnode-7fbc61e1.cjs → vnode-b15eb11b.cjs} +1 -1
- package/es/{zh-cn-ab9a583d.cjs → zh-cn-36f34912.cjs} +1 -1
- package/es/{zh-cn-eb9c2820.js → zh-cn-f37255ae.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +136 -136
- package/lib/{index-d2de454d.js → index-d0cb2fa2.js} +14674 -14502
- package/lib/{python-22975586.js → python-050ba5a4.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- 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 +2 -0
- package/src/pages/PasswordPrompt/index.vue +12 -0
- package/src/router/routes.ts +5 -0
- package/es/_initCloneObject-441db749.cjs +0 -1
- package/es/base-437d17f3.js +0 -816
- package/es/base-ec05f348.cjs +0 -9
- package/es/castArray-a45823fe.cjs +0 -1
- package/es/debounce-b2ff12bd.cjs +0 -1
- package/es/el-button-196807af.cjs +0 -1
- package/es/el-empty-19ea04f4.cjs +0 -1
- package/es/el-form-item-5bdffd07.cjs +0 -12
- package/es/el-input-23e2bac3.cjs +0 -1
- package/es/el-input-number-40a81eb5.cjs +0 -1
- package/es/el-menu-item-78b858f2.cjs +0 -1
- package/es/el-message-d4df8136.cjs +0 -1
- package/es/el-overlay-bc0790a2.cjs +0 -1
- package/es/el-popover-8a77e015.cjs +0 -1
- package/es/el-popper-746070ba.cjs +0 -1
- package/es/el-select-b162dffc.cjs +0 -1
- package/es/el-table-column-6d761fce.cjs +0 -14
- package/es/el-tag-c51a6490.cjs +0 -1
- package/es/index-8a0b1c53.cjs +0 -3
- package/es/index-a387515d.cjs +0 -1
- package/es/use-form-common-props-1b84d8f4.cjs +0 -2
|
@@ -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 { u 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) => {
|
|
@@ -18,10 +20,10 @@ const De = 100, Be = 600, Z = {
|
|
|
18
20
|
c = setInterval(() => {
|
|
19
21
|
l();
|
|
20
22
|
}, a);
|
|
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,40 +69,40 @@ 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
|
-
[C]: (u) => b(u) ||
|
|
76
|
-
[N]: (u) => b(u) ||
|
|
77
|
+
[C]: (u) => b(u) || E(u),
|
|
78
|
+
[N]: (u) => b(u) || E(u)
|
|
77
79
|
}, $e = ee({
|
|
78
80
|
name: "ElInputNumber"
|
|
79
81
|
}), ze = /* @__PURE__ */ ee({
|
|
80
82
|
...$e,
|
|
81
83
|
props: Le,
|
|
82
84
|
emits: Me,
|
|
83
|
-
setup(u, { expose: V, emit:
|
|
84
|
-
const a = u, { t:
|
|
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;
|
|
94
|
-
if (
|
|
96
|
+
if (E(e))
|
|
95
97
|
return "";
|
|
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(".");
|
|
@@ -109,45 +111,45 @@ const De = 100, Be = 600, Z = {
|
|
|
109
111
|
const _ = t.length;
|
|
110
112
|
return t.charAt(_ - 1) === "5" && (t = `${t.slice(0, Math.max(0, _ - 1))}6`), Number.parseFloat(Number(t).toFixed(n));
|
|
111
113
|
}, W = (e) => {
|
|
112
|
-
if (
|
|
114
|
+
if (E(e))
|
|
113
115
|
return 0;
|
|
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
|
-
if (
|
|
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,22 +193,22 @@ 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
|
-
"aria-label": r(
|
|
204
|
+
"aria-label": r(y)("el.inputNumber.decrease"),
|
|
203
205
|
class: K([r(c).e("decrease"), r(c).is("disabled", r(g))]),
|
|
204
206
|
onKeydown: A(M, ["enter"])
|
|
205
207
|
}, [
|
|
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,17 +216,17 @@ 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
|
-
"aria-label": r(
|
|
222
|
+
"aria-label": r(y)("el.inputNumber.increase"),
|
|
221
223
|
class: K([r(c).e("increase"), r(c).is("disabled", r(Y))]),
|
|
222
224
|
onKeydown: A(L, ["enter"])
|
|
223
225
|
}, [
|
|
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;
|