st-comp 0.0.154 → 0.0.156
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 +1 -73
- package/es/Dialog.cjs +1 -1
- package/es/Dialog.js +22 -24
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +84 -86
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +16 -18
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +24 -26
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +14 -16
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +54 -56
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +2 -3
- package/es/Table.cjs +1 -1
- package/es/Table.js +154 -156
- package/es/User.cjs +1 -1
- package/es/User.js +141 -143
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +375 -377
- package/es/VirtualTable.cjs +5 -5
- package/es/VirtualTable.js +160 -162
- package/es/{_initCloneObject-e3d8a9ab.js → _initCloneObject-8f85a96c.js} +34 -35
- package/es/_initCloneObject-e4534778.cjs +1 -0
- package/es/base-12a831d5.cjs +5 -0
- package/es/{index-72151b24.js → base-684eb9e1.js} +448 -150
- package/es/{castArray-8405000b.js → castArray-40b04f9d.js} +1 -1
- package/es/castArray-636c916c.cjs +1 -0
- package/es/{config-provider-cfbb9cd8.cjs → config-provider-cbbe303b.cjs} +1 -1
- package/es/{config-provider-0f6672af.js → config-provider-d3567354.js} +3 -3
- package/es/{debounce-6cb0781f.js → debounce-1474a11f.js} +13 -13
- package/es/debounce-317b8502.cjs +1 -0
- package/es/{dropdown-17b3ef6a.js → dropdown-0df01c01.js} +4 -4
- package/es/{dropdown-790d31ea.cjs → dropdown-db585641.cjs} +1 -1
- package/es/{el-button-0bf1d532.js → el-button-45a4c20f.js} +27 -28
- package/es/el-button-d1e1053b.cjs +1 -0
- package/es/{el-checkbox-group-d53bc316.js → el-checkbox-group-0a002b34.js} +9 -9
- package/es/{el-checkbox-group-45247bbf.cjs → el-checkbox-group-f63d75fa.cjs} +1 -1
- package/es/el-empty-b90b1d71.cjs +1 -0
- package/es/{el-empty-bd5343a7.js → el-empty-d4395563.js} +18 -18
- package/es/{el-form-item-05c0e335.js → el-form-item-0e2f2f50.js} +32 -33
- package/es/el-form-item-54aa10ba.cjs +12 -0
- package/es/el-input-8f26c59f.cjs +1 -0
- package/es/{el-input-1e309239.js → el-input-9fa1ff16.js} +43 -44
- package/es/{el-input-number-60ebc58f.js → el-input-number-09ab38ca.js} +55 -57
- package/es/el-input-number-243c370c.cjs +1 -0
- package/es/el-menu-item-b0b8f7e7.cjs +1 -0
- package/es/{el-menu-item-6c6236a1.js → el-menu-item-dcd129a2.js} +63 -64
- package/es/el-message-a47aa393.cjs +1 -0
- package/es/{el-message-7d927756.js → el-message-ff58b3e1.js} +70 -71
- package/es/el-overlay-2e275c8b.cjs +1 -0
- package/es/{el-overlay-26bf0945.js → el-overlay-58488ca9.js} +69 -71
- package/es/el-popover-7f431071.cjs +1 -0
- package/es/{el-popover-17e2e66c.js → el-popover-8253cb85.js} +26 -28
- package/es/el-popper-41feed2f.cjs +1 -0
- package/es/{el-popper-b6527ae2.js → el-popper-7c6f2aa7.js} +204 -205
- package/es/{el-scrollbar-29bcab5f.js → el-scrollbar-41d54029.js} +22 -22
- package/es/el-scrollbar-994f4975.cjs +1 -0
- package/es/el-select-2001b9be.cjs +1 -0
- package/es/{el-select-7395562b.js → el-select-7126baad.js} +33 -35
- package/es/el-table-column-b7615fa7.cjs +14 -0
- package/es/{el-table-column-47d80736.js → el-table-column-cb842955.js} +260 -262
- package/es/{el-tag-7414e0c7.js → el-tag-82921cf8.js} +28 -28
- package/es/el-tag-d7d821c4.cjs +1 -0
- package/es/{index-75cce588.js → index-11219ee5.js} +11 -12
- package/es/{index-273822d1.js → index-225cc10a.js} +16 -17
- package/es/index-4a1bbe07.cjs +1 -0
- package/es/index-6fd572af.js +59 -0
- package/es/{index-621b092b.js → index-7d1d201c.js} +1 -1
- package/es/index-858867bc.cjs +3 -0
- package/es/index-b7de6897.js +81 -0
- package/es/{index-65b4113e.cjs → index-d4202769.cjs} +1 -1
- package/es/{index-1d85ba4b.cjs → index-e32698d9.cjs} +1 -1
- package/es/index-f32a92f4.cjs +1 -0
- package/es/{raf-f46caea0.cjs → raf-46aa1661.cjs} +1 -1
- package/es/raf-fef33013.js +6 -0
- package/es/{scroll-d787d648.js → scroll-037086b0.js} +5 -5
- package/es/{scroll-339681d4.cjs → scroll-7d889620.cjs} +1 -1
- package/es/style.css +1 -1
- package/es/use-form-common-props-55b310d1.js +684 -0
- package/es/use-form-common-props-87ba8842.cjs +6 -0
- package/es/{vnode-6a0c7411.js → vnode-1939d932.js} +1 -1
- package/es/{vnode-b15eb11b.cjs → vnode-7028b17d.cjs} +1 -1
- package/es/{zh-cn-36f34912.cjs → zh-cn-dba02740.cjs} +1 -1
- package/es/{zh-cn-f37255ae.js → zh-cn-fe562ff6.js} +2 -2
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +1 -1
- package/lib/{index-a646e69f.js → index-71617d1a.js} +8 -8
- package/lib/{python-5d221c15.js → python-66457064.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/VarietySearch/components/CommonIndicator/index.vue +14 -4
- package/packages/VarietySearch/index.vue +1 -1
- package/es/_initCloneObject-47814efa.cjs +0 -1
- package/es/base-0ca7c43a.cjs +0 -5
- package/es/base-19787dfb.js +0 -303
- package/es/castArray-a78ae889.cjs +0 -1
- package/es/debounce-cf26af24.cjs +0 -1
- package/es/el-button-62966947.cjs +0 -1
- package/es/el-empty-2ece1134.cjs +0 -1
- package/es/el-form-item-47e255d4.cjs +0 -12
- package/es/el-input-6a3805c5.cjs +0 -1
- package/es/el-input-number-96ff2e47.cjs +0 -1
- package/es/el-menu-item-4c9eb7ad.cjs +0 -1
- package/es/el-message-d5ed7a4f.cjs +0 -1
- package/es/el-overlay-41994f67.cjs +0 -1
- package/es/el-popover-7bd8a7c3.cjs +0 -1
- package/es/el-popper-7adbf1c6.cjs +0 -1
- package/es/el-scrollbar-ac525239.cjs +0 -1
- package/es/el-select-31f8ac8a.cjs +0 -1
- package/es/el-table-column-bdc46568.cjs +0 -14
- package/es/el-tag-9732314f.cjs +0 -1
- package/es/index-2d9c78d4.cjs +0 -1
- package/es/index-2f958e56.cjs +0 -3
- package/es/index-375e8de4.cjs +0 -5
- package/es/index-70372cdb.js +0 -519
- package/es/index-9e6e8d03.cjs +0 -1
- package/es/index-afc88a4b.cjs +0 -1
- package/es/index-c066fe0d.js +0 -82
- package/es/index-dc22ffe4.js +0 -59
- package/es/raf-a532c514.js +0 -6
- package/es/use-form-common-props-5ff2f51b.js +0 -171
- package/es/use-form-common-props-74a96df2.cjs +0 -2
|
@@ -1,16 +1,14 @@
|
|
|
1
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-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { a as xe } from "./index-70372cdb.js";
|
|
9
|
-
const De = 100, Be = 600, Z = {
|
|
2
|
+
import { E as ve, i as Ne } from "./el-input-9fa1ff16.js";
|
|
3
|
+
import { g as Q, b as Ve, s as b, v as y, u as he, p as C, x as U, E as X, y as Ie, z as ye, A as Ee, B as ge, _ as we, C as _e, D as Se, w as Ae } from "./base-684eb9e1.js";
|
|
4
|
+
import { u as Pe, e as Fe, f as Te, b as Ce, g as xe } from "./use-form-common-props-55b310d1.js";
|
|
5
|
+
import { b as De } from "./el-popper-7c6f2aa7.js";
|
|
6
|
+
import { C as ne, I as x, U as N } from "./index-7d1d201c.js";
|
|
7
|
+
const ke = 100, Be = 600, Z = {
|
|
10
8
|
beforeMount(u, V) {
|
|
11
|
-
const
|
|
9
|
+
const i = V.value, { interval: a = ke, delay: E = Be } = Q(i) ? {} : i;
|
|
12
10
|
let c, m;
|
|
13
|
-
const l = () =>
|
|
11
|
+
const l = () => Q(i) ? i() : i.handler(), f = () => {
|
|
14
12
|
m && (clearTimeout(m), m = void 0), c && (clearInterval(c), c = void 0);
|
|
15
13
|
};
|
|
16
14
|
u.addEventListener("mousedown", (g) => {
|
|
@@ -20,10 +18,10 @@ const De = 100, Be = 600, Z = {
|
|
|
20
18
|
c = setInterval(() => {
|
|
21
19
|
l();
|
|
22
20
|
}, a);
|
|
23
|
-
},
|
|
21
|
+
}, E));
|
|
24
22
|
});
|
|
25
23
|
}
|
|
26
|
-
}, Le =
|
|
24
|
+
}, Le = Ve({
|
|
27
25
|
id: {
|
|
28
26
|
type: String,
|
|
29
27
|
default: void 0
|
|
@@ -69,40 +67,40 @@ const De = 100, Be = 600, Z = {
|
|
|
69
67
|
type: Boolean,
|
|
70
68
|
default: !0
|
|
71
69
|
},
|
|
72
|
-
...
|
|
70
|
+
...De(["ariaLabel"])
|
|
73
71
|
}), Me = {
|
|
74
72
|
[ne]: (u, V) => V !== u,
|
|
75
73
|
blur: (u) => u instanceof FocusEvent,
|
|
76
74
|
focus: (u) => u instanceof FocusEvent,
|
|
77
|
-
[
|
|
78
|
-
[N]: (u) => b(u) ||
|
|
75
|
+
[x]: (u) => b(u) || y(u),
|
|
76
|
+
[N]: (u) => b(u) || y(u)
|
|
79
77
|
}, $e = ee({
|
|
80
78
|
name: "ElInputNumber"
|
|
81
79
|
}), ze = /* @__PURE__ */ ee({
|
|
82
80
|
...$e,
|
|
83
81
|
props: Le,
|
|
84
82
|
emits: Me,
|
|
85
|
-
setup(u, { expose: V, emit:
|
|
86
|
-
const a = u, { t:
|
|
83
|
+
setup(u, { expose: V, emit: i }) {
|
|
84
|
+
const a = u, { t: E } = Fe(), c = he("input-number"), m = ce(), l = de({
|
|
87
85
|
currentValue: a.modelValue,
|
|
88
86
|
userInput: null
|
|
89
|
-
}), { formItem: f } =
|
|
87
|
+
}), { formItem: f } = Te(), g = I(() => b(a.modelValue) && a.modelValue <= a.min), Y = I(() => b(a.modelValue) && a.modelValue >= a.max), te = I(() => {
|
|
90
88
|
const e = W(a.step);
|
|
91
|
-
return
|
|
92
|
-
}),
|
|
89
|
+
return C(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);
|
|
90
|
+
}), D = I(() => a.controls && a.controlsPosition === "right"), G = Ce(), h = xe(), k = I(() => {
|
|
93
91
|
if (l.userInput !== null)
|
|
94
92
|
return l.userInput;
|
|
95
93
|
let e = l.currentValue;
|
|
96
|
-
if (
|
|
94
|
+
if (y(e))
|
|
97
95
|
return "";
|
|
98
96
|
if (b(e)) {
|
|
99
97
|
if (Number.isNaN(e))
|
|
100
98
|
return "";
|
|
101
|
-
|
|
99
|
+
C(a.precision) || (e = e.toFixed(a.precision));
|
|
102
100
|
}
|
|
103
101
|
return e;
|
|
104
102
|
}), B = (e, n) => {
|
|
105
|
-
if (
|
|
103
|
+
if (C(n) && (n = te.value), n === 0)
|
|
106
104
|
return Math.round(e);
|
|
107
105
|
let t = String(e);
|
|
108
106
|
const o = t.indexOf(".");
|
|
@@ -111,45 +109,45 @@ const De = 100, Be = 600, Z = {
|
|
|
111
109
|
const _ = t.length;
|
|
112
110
|
return t.charAt(_ - 1) === "5" && (t = `${t.slice(0, Math.max(0, _ - 1))}6`), Number.parseFloat(Number(t).toFixed(n));
|
|
113
111
|
}, W = (e) => {
|
|
114
|
-
if (
|
|
112
|
+
if (y(e))
|
|
115
113
|
return 0;
|
|
116
114
|
const n = e.toString(), t = n.indexOf(".");
|
|
117
115
|
let o = 0;
|
|
118
116
|
return t !== -1 && (o = n.length - t - 1), o;
|
|
119
|
-
},
|
|
117
|
+
}, H = (e, n = 1) => b(e) ? B(e + a.step * n) : l.currentValue, L = () => {
|
|
120
118
|
if (a.readonly || h.value || Y.value)
|
|
121
119
|
return;
|
|
122
|
-
const e = Number(
|
|
123
|
-
w(n),
|
|
120
|
+
const e = Number(k.value) || 0, n = H(e);
|
|
121
|
+
w(n), i(x, l.currentValue), $();
|
|
124
122
|
}, M = () => {
|
|
125
123
|
if (a.readonly || h.value || g.value)
|
|
126
124
|
return;
|
|
127
|
-
const e = Number(
|
|
128
|
-
w(n),
|
|
129
|
-
},
|
|
130
|
-
const { max: t, min: o, step:
|
|
125
|
+
const e = Number(k.value) || 0, n = H(e, -1);
|
|
126
|
+
w(n), i(x, l.currentValue), $();
|
|
127
|
+
}, j = (e, n) => {
|
|
128
|
+
const { max: t, min: o, step: s, precision: p, stepStrictly: _, valueOnClear: S } = a;
|
|
131
129
|
t < o && _e("InputNumber", "min should not be greater than max.");
|
|
132
130
|
let d = Number(e);
|
|
133
|
-
if (
|
|
131
|
+
if (y(e) || Number.isNaN(d))
|
|
134
132
|
return null;
|
|
135
133
|
if (e === "") {
|
|
136
134
|
if (S === null)
|
|
137
135
|
return null;
|
|
138
136
|
d = Se(S) ? { min: o, max: t }[S] : S;
|
|
139
137
|
}
|
|
140
|
-
return _ && (d = B(Math.round(d /
|
|
138
|
+
return _ && (d = B(Math.round(d / s) * s, p), d !== e && n && i(N, d)), C(p) || (d = B(d, p)), (d > t || d < o) && (d = d > t ? t : o, n && i(N, d)), d;
|
|
141
139
|
}, w = (e, n = !0) => {
|
|
142
140
|
var t;
|
|
143
|
-
const o = l.currentValue,
|
|
141
|
+
const o = l.currentValue, s = j(e);
|
|
144
142
|
if (!n) {
|
|
145
|
-
|
|
143
|
+
i(N, s);
|
|
146
144
|
return;
|
|
147
145
|
}
|
|
148
|
-
o ===
|
|
146
|
+
o === s && e || (l.userInput = null, i(N, s), o !== s && i(ne, s, o), a.validateEvent && ((t = f == null ? void 0 : f.validate) == null || t.call(f, "change").catch((p) => U(p))), l.currentValue = s);
|
|
149
147
|
}, re = (e) => {
|
|
150
148
|
l.userInput = e;
|
|
151
149
|
const n = e === "" ? null : Number(e);
|
|
152
|
-
|
|
150
|
+
i(x, n), w(n, !1);
|
|
153
151
|
}, ae = (e) => {
|
|
154
152
|
const n = e !== "" ? Number(e) : "";
|
|
155
153
|
(b(n) && !Number.isNaN(n) || e === "") && w(n), $(), l.userInput = null;
|
|
@@ -160,26 +158,26 @@ const De = 100, Be = 600, Z = {
|
|
|
160
158
|
var e, n;
|
|
161
159
|
(n = (e = m.value) == null ? void 0 : e.blur) == null || n.call(e);
|
|
162
160
|
}, oe = (e) => {
|
|
163
|
-
|
|
164
|
-
},
|
|
161
|
+
i("focus", e);
|
|
162
|
+
}, se = (e) => {
|
|
165
163
|
var n, t;
|
|
166
|
-
l.userInput = null, Ne() && l.currentValue === null && ((n = m.value) != null && n.input) && (m.value.input.value = ""),
|
|
164
|
+
l.userInput = null, Ne() && l.currentValue === null && ((n = m.value) != null && n.input) && (m.value.input.value = ""), i("blur", e), a.validateEvent && ((t = f == null ? void 0 : f.validate) == null || t.call(f, "blur").catch((o) => U(o)));
|
|
167
165
|
}, $ = () => {
|
|
168
166
|
l.currentValue !== a.modelValue && (l.currentValue = a.modelValue);
|
|
169
|
-
},
|
|
167
|
+
}, ie = (e) => {
|
|
170
168
|
document.activeElement === e.target && e.preventDefault();
|
|
171
169
|
};
|
|
172
170
|
return me(() => a.modelValue, (e, n) => {
|
|
173
|
-
const t =
|
|
171
|
+
const t = j(e, !0);
|
|
174
172
|
l.userInput === null && t !== n && (l.currentValue = t);
|
|
175
173
|
}, { immediate: !0 }), pe(() => {
|
|
176
174
|
var e;
|
|
177
|
-
const { min: n, max: t, modelValue: o } = a,
|
|
178
|
-
if (
|
|
175
|
+
const { min: n, max: t, modelValue: o } = a, s = (e = m.value) == null ? void 0 : e.input;
|
|
176
|
+
if (s.setAttribute("role", "spinbutton"), Number.isFinite(t) ? s.setAttribute("aria-valuemax", String(t)) : s.removeAttribute("aria-valuemax"), Number.isFinite(n) ? s.setAttribute("aria-valuemin", String(n)) : s.removeAttribute("aria-valuemin"), s.setAttribute("aria-valuenow", l.currentValue || l.currentValue === 0 ? String(l.currentValue) : ""), s.setAttribute("aria-disabled", String(h.value)), !b(o) && o != null) {
|
|
179
177
|
let p = Number(o);
|
|
180
|
-
Number.isNaN(p) && (p = null),
|
|
178
|
+
Number.isNaN(p) && (p = null), i(N, p);
|
|
181
179
|
}
|
|
182
|
-
|
|
180
|
+
s.addEventListener("wheel", ie, { passive: !1 });
|
|
183
181
|
}), fe(() => {
|
|
184
182
|
var e, n;
|
|
185
183
|
const t = (e = m.value) == null ? void 0 : e.input;
|
|
@@ -193,7 +191,7 @@ const De = 100, Be = 600, Z = {
|
|
|
193
191
|
r(c).m(r(G)),
|
|
194
192
|
r(c).is("disabled", r(h)),
|
|
195
193
|
r(c).is("without-controls", !e.controls),
|
|
196
|
-
r(c).is("controls-right", r(
|
|
194
|
+
r(c).is("controls-right", r(D))
|
|
197
195
|
]),
|
|
198
196
|
onDragstart: O(() => {
|
|
199
197
|
}, ["prevent"])
|
|
@@ -201,14 +199,14 @@ const De = 100, Be = 600, Z = {
|
|
|
201
199
|
e.controls ? q((v(), z("span", {
|
|
202
200
|
key: 0,
|
|
203
201
|
role: "button",
|
|
204
|
-
"aria-label": r(
|
|
202
|
+
"aria-label": r(E)("el.inputNumber.decrease"),
|
|
205
203
|
class: K([r(c).e("decrease"), r(c).is("disabled", r(g))]),
|
|
206
204
|
onKeydown: A(M, ["enter"])
|
|
207
205
|
}, [
|
|
208
206
|
P(e.$slots, "decrease-icon", {}, () => [
|
|
209
|
-
R(r(
|
|
207
|
+
R(r(X), null, {
|
|
210
208
|
default: F(() => [
|
|
211
|
-
r(
|
|
209
|
+
r(D) ? (v(), T(r(Ie), { key: 0 })) : (v(), T(r(ye), { key: 1 }))
|
|
212
210
|
]),
|
|
213
211
|
_: 1
|
|
214
212
|
})
|
|
@@ -219,14 +217,14 @@ const De = 100, Be = 600, Z = {
|
|
|
219
217
|
e.controls ? q((v(), z("span", {
|
|
220
218
|
key: 1,
|
|
221
219
|
role: "button",
|
|
222
|
-
"aria-label": r(
|
|
220
|
+
"aria-label": r(E)("el.inputNumber.increase"),
|
|
223
221
|
class: K([r(c).e("increase"), r(c).is("disabled", r(Y))]),
|
|
224
222
|
onKeydown: A(L, ["enter"])
|
|
225
223
|
}, [
|
|
226
224
|
P(e.$slots, "increase-icon", {}, () => [
|
|
227
|
-
R(r(
|
|
225
|
+
R(r(X), null, {
|
|
228
226
|
default: F(() => [
|
|
229
|
-
r(
|
|
227
|
+
r(D) ? (v(), T(r(Ee), { key: 0 })) : (v(), T(r(ge), { key: 1 }))
|
|
230
228
|
]),
|
|
231
229
|
_: 1
|
|
232
230
|
})
|
|
@@ -240,7 +238,7 @@ const De = 100, Be = 600, Z = {
|
|
|
240
238
|
ref: m,
|
|
241
239
|
type: "number",
|
|
242
240
|
step: e.step,
|
|
243
|
-
"model-value": r(
|
|
241
|
+
"model-value": r(k),
|
|
244
242
|
placeholder: e.placeholder,
|
|
245
243
|
readonly: e.readonly,
|
|
246
244
|
disabled: r(h),
|
|
@@ -254,7 +252,7 @@ const De = 100, Be = 600, Z = {
|
|
|
254
252
|
A(O(L, ["prevent"]), ["up"]),
|
|
255
253
|
A(O(M, ["prevent"]), ["down"])
|
|
256
254
|
],
|
|
257
|
-
onBlur:
|
|
255
|
+
onBlur: se,
|
|
258
256
|
onFocus: oe,
|
|
259
257
|
onInput: re,
|
|
260
258
|
onChange: ae
|
|
@@ -278,7 +276,7 @@ const De = 100, Be = 600, Z = {
|
|
|
278
276
|
}
|
|
279
277
|
});
|
|
280
278
|
var Ke = /* @__PURE__ */ we(ze, [["__file", "input-number.vue"]]);
|
|
281
|
-
const
|
|
279
|
+
const He = Ae(Ke);
|
|
282
280
|
export {
|
|
283
|
-
|
|
281
|
+
He as E
|
|
284
282
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),x=require("./el-input-8f26c59f.cjs"),r=require("./base-12a831d5.cjs"),V=require("./use-form-common-props-87ba8842.cjs"),G=require("./el-popper-41feed2f.cjs"),p=require("./index-d4202769.cjs"),Y=100,H=600,U={beforeMount(o,v){const c=v.value,{interval:l=Y,delay:h=H}=r.isFunction(c)?{}:c;let d,m;const i=()=>r.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))})}},j=r.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:V.useSizeProp,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:"",values:["","right"]},valueOnClear:{type:[String,Number,null],validator:o=>o===null||r.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},...G.useAriaProps(["ariaLabel"])}),J={[p.CHANGE_EVENT]:(o,v)=>v!==o,blur:o=>o instanceof FocusEvent,focus:o=>o instanceof FocusEvent,[p.INPUT_EVENT]:o=>r.isNumber(o)||r.isNil(o),[p.UPDATE_MODEL_EVENT]:o=>r.isNumber(o)||r.isNil(o)},Q=e.defineComponent({name:"ElInputNumber"}),X=e.defineComponent({...Q,props:j,emits:J,setup(o,{expose:v,emit:c}){const l=o,{t:h}=V.useLocale(),d=r.useNamespace("input-number"),m=e.ref(),i=e.reactive({currentValue:l.modelValue,userInput:null}),{formItem:N}=V.useFormItem(),I=e.computed(()=>r.isNumber(l.modelValue)&&l.modelValue<=l.min),D=e.computed(()=>r.isNumber(l.modelValue)&&l.modelValue>=l.max),L=e.computed(()=>{const n=C(l.step);return r.isUndefined(l.precision)?Math.max(C(l.modelValue),n):(n>l.precision&&r.debugWarn("InputNumber","precision should not be less than the decimal places of step"),l.precision)}),T=e.computed(()=>l.controls&&l.controlsPosition==="right"),B=V.useFormSize(),E=V.useFormDisabled(),g=e.computed(()=>{if(i.userInput!==null)return i.userInput;let n=i.currentValue;if(r.isNil(n))return"";if(r.isNumber(n)){if(Number.isNaN(n))return"";r.isUndefined(l.precision)||(n=n.toFixed(l.precision))}return n}),P=(n,t)=>{if(r.isUndefined(t)&&(t=L.value),t===0)return Math.round(n);let u=String(n);const a=u.indexOf(".");if(a===-1||!u.replace(".","").split("")[a+t])return n;const w=u.length;return u.charAt(w-1)==="5"&&(u=`${u.slice(0,Math.max(0,w-1))}6`),Number.parseFloat(Number(u).toFixed(t))},C=n=>{if(r.isNil(n))return 0;const t=n.toString(),u=t.indexOf(".");let a=0;return u!==-1&&(a=t.length-u-1),a},F=(n,t=1)=>r.isNumber(n)?P(n+l.step*t):i.currentValue,A=()=>{if(l.readonly||E.value||D.value)return;const n=Number(g.value)||0,t=F(n);y(t),c(p.INPUT_EVENT,i.currentValue),k()},S=()=>{if(l.readonly||E.value||I.value)return;const n=Number(g.value)||0,t=F(n,-1);y(t),c(p.INPUT_EVENT,i.currentValue),k()},M=(n,t)=>{const{max:u,min:a,step:s,precision:b,stepStrictly:w,valueOnClear:_}=l;u<a&&r.throwError("InputNumber","min should not be greater than max.");let f=Number(n);if(r.isNil(n)||Number.isNaN(f))return null;if(n===""){if(_===null)return null;f=r.isString$1(_)?{min:a,max:u}[_]:_}return w&&(f=P(Math.round(f/s)*s,b),f!==n&&t&&c(p.UPDATE_MODEL_EVENT,f)),r.isUndefined(b)||(f=P(f,b)),(f>u||f<a)&&(f=f>u?u:a,t&&c(p.UPDATE_MODEL_EVENT,f)),f},y=(n,t=!0)=>{var u;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&&((u=N==null?void 0:N.validate)==null||u.call(N,"change").catch(b=>r.debugWarn(b))),i.currentValue=s)},O=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):"";(r.isNumber(t)&&!Number.isNaN(t)||n==="")&&y(t),k(),i.userInput=null},$=()=>{var n,t;(t=(n=m.value)==null?void 0:n.focus)==null||t.call(n)},z=()=>{var n,t;(t=(n=m.value)==null?void 0:n.blur)==null||t.call(n)},q=n=>{c("focus",n)},R=n=>{var t,u;i.userInput=null,x.isFirefox()&&i.currentValue===null&&((t=m.value)!=null&&t.input)&&(m.value.input.value=""),c("blur",n),l.validateEvent&&((u=N==null?void 0:N.validate)==null||u.call(N,"blur").catch(a=>r.debugWarn(a)))},k=()=>{i.currentValue!==l.modelValue&&(i.currentValue=l.modelValue)},W=n=>{document.activeElement===n.target&&n.preventDefault()};return e.watch(()=>l.modelValue,(n,t)=>{const u=M(n,!0);i.userInput===null&&u!==t&&(i.currentValue=u)},{immediate:!0}),e.onMounted(()=>{var n;const{min:t,max:u,modelValue:a}=l,s=(n=m.value)==null?void 0:n.input;if(s.setAttribute("role","spinbutton"),Number.isFinite(u)?s.setAttribute("aria-valuemax",String(u)):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(E.value)),!r.isNumber(a)&&a!=null){let b=Number(a);Number.isNaN(b)&&(b=null),c(p.UPDATE_MODEL_EVENT,b)}s.addEventListener("wheel",W,{passive:!1})}),e.onUpdated(()=>{var n,t;const u=(n=m.value)==null?void 0:n.input;u==null||u.setAttribute("aria-valuenow",`${(t=i.currentValue)!=null?t:""}`)}),v({focus:$,blur:z}),(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(d).b(),e.unref(d).m(e.unref(B)),e.unref(d).is("disabled",e.unref(E)),e.unref(d).is("without-controls",!n.controls),e.unref(d).is("controls-right",e.unref(T))]),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(S,["enter"])},[e.renderSlot(n.$slots,"decrease-icon",{},()=>[e.createVNode(e.unref(r.ElIcon),null,{default:e.withCtx(()=>[e.unref(T)?(e.openBlock(),e.createBlock(e.unref(r.arrow_down_default),{key:0})):(e.openBlock(),e.createBlock(e.unref(r.minus_default),{key:1}))]),_:1})])],42,["aria-label","onKeydown"])),[[e.unref(U),S]]):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(D))]),onKeydown:e.withKeys(A,["enter"])},[e.renderSlot(n.$slots,"increase-icon",{},()=>[e.createVNode(e.unref(r.ElIcon),null,{default:e.withCtx(()=>[e.unref(T)?(e.openBlock(),e.createBlock(e.unref(r.arrow_up_default),{key:0})):(e.openBlock(),e.createBlock(e.unref(r.plus_default),{key:1}))]),_:1})])],42,["aria-label","onKeydown"])),[[e.unref(U),A]]):e.createCommentVNode("v-if",!0),e.createVNode(e.unref(x.ElInput),{id:n.id,ref_key:"input",ref:m,type:"number",step:n.step,"model-value":e.unref(g),placeholder:n.placeholder,readonly:n.readonly,disabled:e.unref(E),size:e.unref(B),max:n.max,min:n.min,name:n.name,"aria-label":n.ariaLabel,"validate-event":!1,onKeydown:[e.withKeys(e.withModifiers(A,["prevent"]),["up"]),e.withKeys(e.withModifiers(S,["prevent"]),["down"])],onBlur:R,onFocus:q,onInput:O,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 Z=r._export_sfc(X,[["__file","input-number.vue"]]);const ee=r.withInstall(Z);exports.ElInputNumber=ee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),ne=require("./el-scrollbar-994f4975.cjs"),l=require("./base-12a831d5.cjs"),y=require("./index-d4202769.cjs"),K=require("./el-popper-41feed2f.cjs"),oe=require("./index-eea0bcb3.cjs"),V=require("./use-form-common-props-87ba8842.cjs"),se=require("./el-tag-d7d821c4.cjs"),le=require("./typescript-b63f8e83.cjs"),ae=require("./vnode-7028b17d.cjs"),ue=e.defineComponent({name:"ElCollapseTransition"}),re=e.defineComponent({...ue,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 ie=l._export_sfc(re,[["__file","collapse-transition.vue"]]);const ce=l.withInstall(ie);let de=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})})}},pe=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 de(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()})}},me=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 pe(d,s)})}};const ve=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 fe(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 he=l._export_sfc(ve,[["render",fe],["__file","menu-collapse-transition.vue"]]);function Q(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 ge(t){return e.computed(()=>{const o=t.backgroundColor;return o?new oe.TinyColor(o).shade(20).toString():""})}const X=(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":ge(t).value||"","active-color":t.activeTextColor||"",level:`${s}`}))},be=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}}),G="ElSubMenu";var J=e.defineComponent({name:G,props:be,setup(t,{slots:s,expose:o}){const d=e.getCurrentInstance(),{indexPath:n,parentMenu:C}=Q(d,e.computed(()=>t.index)),v=l.useNamespace("menu"),E=l.useNamespace("sub-menu"),i=e.inject("rootMenu");i||l.throwError(G,"can not inject root menu");const m=e.inject(`subMenu:${C.value.uid}`);m||l.throwError(G,"can not inject sub menu");const f=e.ref({}),b=e.ref({});let I;const S=e.ref(!1),j=e.ref(),H=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:l.arrow_down_default:t.collapseCloseIcon&&t.collapseOpenIcon?x.value?t.collapseOpenIcon:t.collapseCloseIcon:l.arrow_right_default),w=e.computed(()=>m.level===0),z=e.computed(()=>{const r=t.teleported;return r===void 0?w.value:r}),W=e.computed(()=>i.props.collapse?`${v.namespace.value}-zoom-in-left`:`${v.namespace.value}-zoom-in-top`),F=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)),$=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),P=e.reactive({index:t.index,indexPath:n,active:$}),D=X(i.props,m.level+1),q=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}),L=e.computed(()=>{var r;return(r=t.showTimeout)!=null?r:i.props.showTimeout}),R=e.computed(()=>{var r;return(r=t.hideTimeout)!=null?r:i.props.hideTimeout}),a=()=>{var r,p,M;return(M=(p=(r=H.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:$.value})},h=(r,p=L.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),R.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(P),m.addSubMenu(P)}),e.onBeforeUnmount(()=>{m.removeSubMenu(P),i.removeSubMenu(P)}),()=>{var r;const p=[(r=s.title)==null?void 0:r.call(s),e.h(l.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$1(O.value)?e.h(d.appContext.components[O.value]):e.h(O.value)})],M=i.isMenuPopup?e.h(K.ElTooltip,{ref:H,visible:x.value,effect:"light",pure:!0,offset:q.value,showArrow:!1,persistent:!0,popperClass:B.value,placement:N.value,teleported:z.value,fallbackPlacements:F.value,transition:W.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:j,onClick:c},p),e.h(ce,{},{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",$.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 Me=l.buildProps({mode:{type:String,values:["horizontal","vertical"],default:"vertical"},defaultActive:{type:String,default:""},defaultOpeneds:{type:l.definePropType(Array),default:()=>le.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:()=>l.more_default},popperEffect:{type:l.definePropType(String),default:"dark"},popperClass:String,showTimeout:{type:Number,default:300},hideTimeout:{type:Number,default:300}}),U=t=>l.isArray(t)&&t.every(s=>l.isString$1(s)),ye={close:(t,s)=>l.isString$1(t)&&U(s),open:(t,s)=>l.isString$1(t)&&U(s),select:(t,s,o,d)=>l.isString$1(t)&&U(s)&&l.isObject(o)&&(d===void 0||d instanceof Promise)};var Ee=e.defineComponent({name:"ElMenu",props:Me,emits:ye,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({}),j=e.computed(()=>t.mode==="horizontal"||t.mode==="vertical"&&t.collapse),H=()=>{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)},W=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})},F=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},$=()=>{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,te)=>{A.nodeName!=="#comment"&&(T+=x(A),T<=M-h&&(k=te+1))}),k===c.length?-1:k},_=a=>S.value[a].indexPath,P=(a,u=33.34)=>{let c;return()=>{c&&clearTimeout(c),c=setTimeout(()=>{a()},u)}};let D=!0;const q=()=>{if(m.value===$())return;const a=()=>{m.value=-1,e.nextTick(()=>{m.value=$()})};D?a():P(a)(),D=!1};e.watch(()=>t.defaultActive,a=>{I.value[a]||(b.value=""),F(a)}),e.watch(()=>t.collapse,a=>{a&&(f.value=[])}),e.watch(I.value,H);let B;e.watchEffect(()=>{t.mode==="horizontal"&&t.ellipsis?B=ne.useResizeObserver(v,q).stop:B==null||B()});const L=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:j,addMenuItem:c,removeMenuItem:h,addSubMenu:a,removeSubMenu:u,openMenu:N,closeMenu:w,handleMenuItemClick:W,handleSubMenuClick:z})),e.provide(`subMenu:${n.uid}`,{addSubMenu:a,removeSubMenu:u,mouseInChild:L,level:0})}e.onMounted(()=>{t.mode==="horizontal"&&new me(n.vnode.el,E.namespace.value)}),d({open:u=>{const{indexPath:c}=S.value[u];c.forEach(h=>N(h,c))},close:O,handleResize:q});const R=X(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=ae.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(J,{index:"sub-menu-more",class:i.e("hide-arrow"),popperOffset:t.popperOffset},{title:()=>e.h(l.ElIcon,{class:i.e("icon-more")},{default:()=>e.h(t.ellipsisIcon)}),default:()=>T})))}const g=t.closeOnClickOutside?[[se.ClickOutside,()=>{f.value.length&&(L.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:R.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(he,()=>r):r}}});const Ce=l.buildProps({index:{type:l.definePropType([String,null]),default:null},route:{type:l.definePropType([String,Object])},disabled:Boolean}),Ie={click:t=>l.isString$1(t.index)&&l.isArray(t.indexPath)},Z="ElMenuItem",Te=e.defineComponent({name:Z,components:{ElTooltip:K.ElTooltip},props:Ce,emits:Ie,setup(t,{emit:s}){const o=e.getCurrentInstance(),d=e.inject("rootMenu"),n=l.useNamespace("menu"),C=l.useNamespace("menu-item");d||l.throwError(Z,"can not inject root menu");const{parentMenu:v,indexPath:E}=Q(o,e.toRef(t,"index")),i=e.inject(`subMenu:${v.value.uid}`);i||l.throwError(Z,"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 xe(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 Y=l._export_sfc(Te,[["render",xe],["__file","menu-item.vue"]]);const Se={title:String},Ne="ElMenuItemGroup",we=e.defineComponent({name:Ne,props:Se,setup(){return{ns:l.useNamespace("menu-item-group")}}});function _e(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 ee=l._export_sfc(we,[["render",_e],["__file","menu-item-group.vue"]]);const ke=l.withInstall(Ee,{MenuItem:Y,MenuItemGroup:ee,SubMenu:J}),Oe=l.withNoopInstall(Y);l.withNoopInstall(ee);l.withNoopInstall(J);exports.ElMenu=ke;exports.ElMenuItem=Oe;
|