@nhdropshipping/y-components 1.0.0
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/README.md +102 -0
- package/dist/components/QueryEncapsulation.vue.d.ts +76 -0
- package/dist/components/QueryEncapsulation.vue.d.ts.map +1 -0
- package/dist/components/ybadge.vue.d.ts +83 -0
- package/dist/components/ybadge.vue.d.ts.map +1 -0
- package/dist/components/ybutton.vue.d.ts +130 -0
- package/dist/components/ybutton.vue.d.ts.map +1 -0
- package/dist/components/ydialog.vue.d.ts +89 -0
- package/dist/components/ydialog.vue.d.ts.map +1 -0
- package/dist/components/ydrawer.vue.d.ts +88 -0
- package/dist/components/ydrawer.vue.d.ts.map +1 -0
- package/dist/components/ydropdown.vue.d.ts +47 -0
- package/dist/components/ydropdown.vue.d.ts.map +1 -0
- package/dist/components/yimage.vue.d.ts +64 -0
- package/dist/components/yimage.vue.d.ts.map +1 -0
- package/dist/components/yinput.vue.d.ts +89 -0
- package/dist/components/yinput.vue.d.ts.map +1 -0
- package/dist/components/ymessage/ymessage.d.ts +20 -0
- package/dist/components/ymessage/ymessage.d.ts.map +1 -0
- package/dist/components/ymessage/ymessageToast.vue.d.ts +50 -0
- package/dist/components/ymessage/ymessageToast.vue.d.ts.map +1 -0
- package/dist/components/ypagination.vue.d.ts +57 -0
- package/dist/components/ypagination.vue.d.ts.map +1 -0
- package/dist/components/ypopover.vue.d.ts +110 -0
- package/dist/components/ypopover.vue.d.ts.map +1 -0
- package/dist/components/yselect.vue.d.ts +106 -0
- package/dist/components/yselect.vue.d.ts.map +1 -0
- package/dist/components/yswitch.vue.d.ts +79 -0
- package/dist/components/yswitch.vue.d.ts.map +1 -0
- package/dist/components/ytable.vue.d.ts +124 -0
- package/dist/components/ytable.vue.d.ts.map +1 -0
- package/dist/components/ytime.vue.d.ts +103 -0
- package/dist/components/ytime.vue.d.ts.map +1 -0
- package/dist/components/ytree.vue.d.ts +223 -0
- package/dist/components/ytree.vue.d.ts.map +1 -0
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3646 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,3646 @@
|
|
|
1
|
+
import { defineComponent as me, computed as O, createElementBlock as i, openBlock as a, normalizeClass as z, createElementVNode as n, renderSlot as ue, Fragment as re, renderList as ve, createCommentVNode as A, toDisplayString as G, normalizeStyle as ye, ref as R, watch as oe, onMounted as _e, onUnmounted as Be, createVNode as de, withKeys as be, withModifiers as Q, withDirectives as Ee, createTextVNode as De, vModelText as et, Transition as ke, withCtx as he, createBlock as Le, Teleport as Ve, nextTick as fe, vShow as Ke, resolveComponent as tt, provide as nt, reactive as lt, TransitionGroup as ot, resolveDynamicComponent as at, onBeforeUnmount as st, render as qe } from "vue";
|
|
2
|
+
const it = ["type", "disabled", "aria-busy", "aria-disabled"], rt = { class: "content" }, ut = {
|
|
3
|
+
key: 1,
|
|
4
|
+
class: "y-btn-group",
|
|
5
|
+
role: "group"
|
|
6
|
+
}, dt = ["type", "disabled", "aria-busy", "aria-disabled", "aria-label", "onClick"], ct = { class: "content" }, ft = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "icon",
|
|
9
|
+
viewBox: "0 0 20 20",
|
|
10
|
+
fill: "currentColor",
|
|
11
|
+
"aria-hidden": "true"
|
|
12
|
+
}, vt = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "icon",
|
|
15
|
+
viewBox: "0 0 20 20",
|
|
16
|
+
fill: "currentColor",
|
|
17
|
+
"aria-hidden": "true"
|
|
18
|
+
}, ht = { key: 2 }, pt = /* @__PURE__ */ me({
|
|
19
|
+
__name: "ybutton",
|
|
20
|
+
props: {
|
|
21
|
+
htmlType: { default: "button" },
|
|
22
|
+
variant: { default: "primary" },
|
|
23
|
+
size: { default: "medium" },
|
|
24
|
+
disabled: { type: Boolean, default: !1 },
|
|
25
|
+
loading: { type: Boolean, default: !1 },
|
|
26
|
+
block: { type: Boolean, default: !1 },
|
|
27
|
+
groupPosition: { default: "single" },
|
|
28
|
+
groupItems: { default: void 0 }
|
|
29
|
+
},
|
|
30
|
+
emits: ["click", "group-click"],
|
|
31
|
+
setup(e, { emit: m }) {
|
|
32
|
+
const t = e, l = m;
|
|
33
|
+
function c(L) {
|
|
34
|
+
if (t.disabled || t.loading) {
|
|
35
|
+
L.preventDefault(), L.stopPropagation();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
l("click", L);
|
|
39
|
+
}
|
|
40
|
+
const s = O(() => {
|
|
41
|
+
switch (t.groupPosition) {
|
|
42
|
+
case "start":
|
|
43
|
+
return "group-pos-start";
|
|
44
|
+
case "middle":
|
|
45
|
+
return "group-pos-middle";
|
|
46
|
+
case "end":
|
|
47
|
+
return "group-pos-end";
|
|
48
|
+
default:
|
|
49
|
+
return "group-pos-single";
|
|
50
|
+
}
|
|
51
|
+
}), k = O(() => Array.isArray(t.groupItems) && t.groupItems.length > 0);
|
|
52
|
+
function C(L, I) {
|
|
53
|
+
if (t.disabled || t.loading || L.disabled || L.loading) {
|
|
54
|
+
I.preventDefault(), I.stopPropagation();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
l("group-click", L.value, I);
|
|
58
|
+
}
|
|
59
|
+
return (L, I) => k.value ? (a(), i("div", ut, [
|
|
60
|
+
(a(!0), i(re, null, ve(e.groupItems, (h, d) => {
|
|
61
|
+
var u;
|
|
62
|
+
return a(), i("button", {
|
|
63
|
+
key: h.value ?? d,
|
|
64
|
+
class: z(["y-btn", [
|
|
65
|
+
`y-btn--${h.variant ?? e.variant}`,
|
|
66
|
+
`y-btn--${h.size ?? e.size}`,
|
|
67
|
+
"is-grouped",
|
|
68
|
+
d === 0 ? "group-pos-start" : d === (((u = e.groupItems) == null ? void 0 : u.length) || 0) - 1 ? "group-pos-end" : "group-pos-middle",
|
|
69
|
+
{ "is-loading": h.loading || e.loading }
|
|
70
|
+
]]),
|
|
71
|
+
type: e.htmlType,
|
|
72
|
+
disabled: (h.disabled ?? !1) || e.disabled || e.loading || h.loading,
|
|
73
|
+
"aria-busy": h.loading || e.loading ? "true" : "false",
|
|
74
|
+
"aria-disabled": (h.disabled ?? !1) || e.disabled || e.loading || h.loading ? "true" : "false",
|
|
75
|
+
"aria-label": h.ariaLabel || h.label,
|
|
76
|
+
onClick: (K) => C(h, K)
|
|
77
|
+
}, [
|
|
78
|
+
n("span", ct, [
|
|
79
|
+
h.icon === "chevron-left" ? (a(), i("svg", ft, [...I[0] || (I[0] = [
|
|
80
|
+
n("path", {
|
|
81
|
+
"fill-rule": "evenodd",
|
|
82
|
+
d: "M12.78 15.22a.75.75 0 01-1.06 0l-5-5a.75.75 0 010-1.06l5-5a.75.75 0 111.06 1.06L8.81 10l3.97 3.97a.75.75 0 010 1.06z",
|
|
83
|
+
"clip-rule": "evenodd"
|
|
84
|
+
}, null, -1)
|
|
85
|
+
])])) : h.icon === "chevron-right" ? (a(), i("svg", vt, [...I[1] || (I[1] = [
|
|
86
|
+
n("path", {
|
|
87
|
+
"fill-rule": "evenodd",
|
|
88
|
+
d: "M7.22 4.78a.75.75 0 011.06 0l5 5a.75.75 0 010 1.06l-5 5a.75.75 0 11-1.06-1.06L11.19 10 7.22 6.03a.75.75 0 010-1.06z",
|
|
89
|
+
"clip-rule": "evenodd"
|
|
90
|
+
}, null, -1)
|
|
91
|
+
])])) : A("", !0),
|
|
92
|
+
h.label && !h.onlyIcon ? (a(), i("span", ht, G(h.label), 1)) : A("", !0)
|
|
93
|
+
])
|
|
94
|
+
], 10, dt);
|
|
95
|
+
}), 128))
|
|
96
|
+
])) : (a(), i("button", {
|
|
97
|
+
key: 0,
|
|
98
|
+
class: z(["y-btn", [
|
|
99
|
+
`y-btn--${e.variant}`,
|
|
100
|
+
`y-btn--${e.size}`,
|
|
101
|
+
{ "is-block": e.block, "is-loading": e.loading },
|
|
102
|
+
e.groupPosition !== "single" ? "is-grouped" : "",
|
|
103
|
+
s.value
|
|
104
|
+
]]),
|
|
105
|
+
type: e.htmlType,
|
|
106
|
+
disabled: e.disabled || e.loading,
|
|
107
|
+
"aria-busy": e.loading ? "true" : "false",
|
|
108
|
+
"aria-disabled": e.disabled || e.loading ? "true" : "false",
|
|
109
|
+
onClick: c
|
|
110
|
+
}, [
|
|
111
|
+
n("span", rt, [
|
|
112
|
+
ue(L.$slots, "default", {}, void 0, !0)
|
|
113
|
+
])
|
|
114
|
+
], 10, it));
|
|
115
|
+
}
|
|
116
|
+
}), we = (e, m) => {
|
|
117
|
+
const t = e.__vccOpts || e;
|
|
118
|
+
for (const [l, c] of m)
|
|
119
|
+
t[l] = c;
|
|
120
|
+
return t;
|
|
121
|
+
}, Re = /* @__PURE__ */ we(pt, [["__scopeId", "data-v-0c27d1bc"]]), gt = ["id", "name", "type", "placeholder", "autocomplete", "inputmode", "disabled", "required", "value"], yt = /* @__PURE__ */ me({
|
|
122
|
+
__name: "yinput",
|
|
123
|
+
props: {
|
|
124
|
+
modelValue: { default: "" },
|
|
125
|
+
type: { default: "text" },
|
|
126
|
+
placeholder: { default: "" },
|
|
127
|
+
autocomplete: { default: "off" },
|
|
128
|
+
inputmode: { default: void 0 },
|
|
129
|
+
id: { default: void 0 },
|
|
130
|
+
name: { default: void 0 },
|
|
131
|
+
disabled: { type: Boolean, default: !1 },
|
|
132
|
+
required: { type: Boolean, default: !1 },
|
|
133
|
+
block: { type: Boolean, default: !1 },
|
|
134
|
+
size: { default: "medium" },
|
|
135
|
+
width: { default: "200px" }
|
|
136
|
+
},
|
|
137
|
+
emits: ["update:modelValue"],
|
|
138
|
+
setup(e, { emit: m }) {
|
|
139
|
+
const t = m;
|
|
140
|
+
function l(c) {
|
|
141
|
+
const s = c.target;
|
|
142
|
+
t("update:modelValue", s.value);
|
|
143
|
+
}
|
|
144
|
+
return (c, s) => (a(), i("div", {
|
|
145
|
+
class: z(["y-input-wrap", { "is-block": e.block }]),
|
|
146
|
+
style: ye({ width: e.width })
|
|
147
|
+
}, [
|
|
148
|
+
n("input", {
|
|
149
|
+
class: z(["y-input", `y-input--${e.size}`]),
|
|
150
|
+
id: e.id,
|
|
151
|
+
name: e.name,
|
|
152
|
+
type: e.type,
|
|
153
|
+
placeholder: e.placeholder,
|
|
154
|
+
autocomplete: e.autocomplete,
|
|
155
|
+
inputmode: e.inputmode,
|
|
156
|
+
disabled: e.disabled,
|
|
157
|
+
required: e.required,
|
|
158
|
+
value: e.modelValue,
|
|
159
|
+
onInput: l
|
|
160
|
+
}, null, 42, gt)
|
|
161
|
+
], 6));
|
|
162
|
+
}
|
|
163
|
+
}), Ze = /* @__PURE__ */ we(yt, [["__scopeId", "data-v-9e6869ef"]]), mt = ["onKeydown", "aria-expanded"], wt = ["src"], bt = ["placeholder", "onKeydown"], kt = ["onClick", "onMouseenter"], xt = ["src"], Dt = /* @__PURE__ */ me({
|
|
164
|
+
__name: "yselect",
|
|
165
|
+
props: {
|
|
166
|
+
modelValue: {},
|
|
167
|
+
options: {},
|
|
168
|
+
placeholder: { default: "请选择" },
|
|
169
|
+
disabled: { type: Boolean, default: !1 },
|
|
170
|
+
error: { type: Boolean, default: !1 },
|
|
171
|
+
clearable: { type: Boolean, default: !0 },
|
|
172
|
+
clearTo: { default: void 0 },
|
|
173
|
+
filterable: { type: Boolean, default: !1 },
|
|
174
|
+
valueKey: { default: "value" },
|
|
175
|
+
labelKey: { default: "label" },
|
|
176
|
+
disabledKey: { default: "disabled" },
|
|
177
|
+
size: { default: "medium" },
|
|
178
|
+
width: { default: "200px" }
|
|
179
|
+
},
|
|
180
|
+
emits: ["update:modelValue", "change", "focus", "blur", "clear"],
|
|
181
|
+
setup(e, { emit: m }) {
|
|
182
|
+
const t = e, l = m, c = R(!1), s = R(-1), k = R(), C = R(), L = R(), I = R(), h = R(!1), d = R(), u = R(""), K = O(() => t.options.find((p) => V(p) === t.modelValue) || null), j = O(() => K.value ? H(K.value) : ""), U = O(() => {
|
|
183
|
+
if (!t.filterable) return t.options;
|
|
184
|
+
const p = u.value.trim().toLowerCase();
|
|
185
|
+
return p ? t.options.filter((D) => {
|
|
186
|
+
const F = H(D);
|
|
187
|
+
return String(F).toLowerCase().includes(p);
|
|
188
|
+
}) : t.options;
|
|
189
|
+
}), N = O(() => {
|
|
190
|
+
var Y;
|
|
191
|
+
const p = { position: "fixed", zIndex: "4000" }, D = C.value;
|
|
192
|
+
if (!D) return p;
|
|
193
|
+
const F = D.getBoundingClientRect(), ne = ((Y = L.value) == null ? void 0 : Y.getBoundingClientRect().width) || F.width;
|
|
194
|
+
return p.left = `${F.left}px`, p.width = `${ne}px`, h.value ? (p.bottom = `${window.innerHeight - F.top + 4}px`, p.top = "auto") : p.top = `${F.bottom + 4}px`, p;
|
|
195
|
+
});
|
|
196
|
+
function $() {
|
|
197
|
+
!c.value || !C.value || fe(() => {
|
|
198
|
+
const p = C.value;
|
|
199
|
+
if (!p) return;
|
|
200
|
+
const D = p.getBoundingClientRect(), F = window.innerHeight, ne = 200, Y = D.bottom + ne + 4, ee = D.top - ne - 4, Ie = Y <= F - 20, $e = ee >= 20;
|
|
201
|
+
h.value = !Ie && $e;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function V(p) {
|
|
205
|
+
return typeof p == "object" && p !== null ? p[t.valueKey] : p;
|
|
206
|
+
}
|
|
207
|
+
function H(p) {
|
|
208
|
+
return typeof p == "object" && p !== null ? p[t.labelKey] || String(p[t.valueKey]) : String(p);
|
|
209
|
+
}
|
|
210
|
+
function T(p, D) {
|
|
211
|
+
return typeof p == "object" && p !== null && p.id !== void 0 ? p.id : V(p) || D;
|
|
212
|
+
}
|
|
213
|
+
function q(p) {
|
|
214
|
+
return V(p) === t.modelValue;
|
|
215
|
+
}
|
|
216
|
+
function te(p) {
|
|
217
|
+
return typeof p == "object" && p !== null ? p[t.disabledKey] === !0 : !1;
|
|
218
|
+
}
|
|
219
|
+
function X() {
|
|
220
|
+
t.disabled || (c.value ? ae() : pe());
|
|
221
|
+
}
|
|
222
|
+
function pe() {
|
|
223
|
+
t.disabled || (c.value = !0, fe(() => {
|
|
224
|
+
$(), w(), t.filterable && d.value && (d.value.focus(), u.value = "");
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
function ae() {
|
|
228
|
+
c.value = !1, s.value = -1, h.value = !1, t.filterable && (u.value = "");
|
|
229
|
+
}
|
|
230
|
+
function y(p, D) {
|
|
231
|
+
if (te(p)) return;
|
|
232
|
+
const F = V(p);
|
|
233
|
+
l("update:modelValue", F), l("change", F, p), ae();
|
|
234
|
+
}
|
|
235
|
+
function g() {
|
|
236
|
+
if (!t.clearable || t.disabled) return;
|
|
237
|
+
const p = t.clearTo;
|
|
238
|
+
l("update:modelValue", p), l("change", p, null), l("clear"), ae();
|
|
239
|
+
}
|
|
240
|
+
function v(p) {
|
|
241
|
+
if (!U.value || U.value.length === 0) {
|
|
242
|
+
s.value = -1;
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
let D = s.value;
|
|
246
|
+
const F = U.value.length;
|
|
247
|
+
D === -1 ? D = p > 0 ? 0 : F - 1 : D = (D + p + F) % F;
|
|
248
|
+
let ne = 0;
|
|
249
|
+
for (; ne < F && te(U.value[D]); )
|
|
250
|
+
D = (D + p + F) % F, ne++;
|
|
251
|
+
s.value = ne >= F ? -1 : D, b();
|
|
252
|
+
}
|
|
253
|
+
function f() {
|
|
254
|
+
if (s.value < 0) return;
|
|
255
|
+
const p = U.value[s.value];
|
|
256
|
+
!p || te(p) || y(p, s.value);
|
|
257
|
+
}
|
|
258
|
+
function w() {
|
|
259
|
+
if (!k.value) return;
|
|
260
|
+
const p = k.value.querySelector(".yselect__option--selected");
|
|
261
|
+
p && p.scrollIntoView({ block: "nearest" });
|
|
262
|
+
}
|
|
263
|
+
function b() {
|
|
264
|
+
if (!k.value || s.value < 0) return;
|
|
265
|
+
const D = k.value.querySelectorAll(".yselect__option")[s.value];
|
|
266
|
+
D && D.scrollIntoView({ block: "nearest" });
|
|
267
|
+
}
|
|
268
|
+
function S(p) {
|
|
269
|
+
const D = p.target;
|
|
270
|
+
(!L.value || !L.value.contains(D)) && ae();
|
|
271
|
+
}
|
|
272
|
+
oe(() => t.modelValue, () => {
|
|
273
|
+
s.value = -1;
|
|
274
|
+
});
|
|
275
|
+
function W() {
|
|
276
|
+
c.value && $();
|
|
277
|
+
}
|
|
278
|
+
return _e(() => {
|
|
279
|
+
document.addEventListener("click", S), window.addEventListener("resize", W), window.addEventListener("scroll", W, !0);
|
|
280
|
+
}), Be(() => {
|
|
281
|
+
document.removeEventListener("click", S), window.removeEventListener("resize", W), window.removeEventListener("scroll", W, !0);
|
|
282
|
+
}), (p, D) => (a(), i("div", {
|
|
283
|
+
class: z(["yselect", { "yselect--disabled": e.disabled, [`yselect--${e.size}`]: !0 }]),
|
|
284
|
+
style: ye({ width: e.width }),
|
|
285
|
+
ref_key: "selectContainer",
|
|
286
|
+
ref: L
|
|
287
|
+
}, [
|
|
288
|
+
n("div", {
|
|
289
|
+
ref_key: "triggerElement",
|
|
290
|
+
ref: C,
|
|
291
|
+
class: z(["yselect__trigger", {
|
|
292
|
+
"yselect__trigger--open": c.value,
|
|
293
|
+
"yselect__trigger--disabled": e.disabled,
|
|
294
|
+
"yselect__trigger--error": e.error
|
|
295
|
+
}]),
|
|
296
|
+
onMousedown: Q(X, ["prevent", "stop"]),
|
|
297
|
+
onKeydown: [
|
|
298
|
+
be(Q(X, ["prevent"]), ["enter"]),
|
|
299
|
+
be(Q(X, ["prevent"]), ["space"]),
|
|
300
|
+
be(ae, ["escape"]),
|
|
301
|
+
be(Q(pe, ["prevent"]), ["arrow-down"]),
|
|
302
|
+
be(Q(pe, ["prevent"]), ["arrow-up"])
|
|
303
|
+
],
|
|
304
|
+
tabindex: "0",
|
|
305
|
+
role: "combobox",
|
|
306
|
+
"aria-expanded": c.value,
|
|
307
|
+
"aria-haspopup": !0
|
|
308
|
+
}, [
|
|
309
|
+
!e.filterable || !c.value ? (a(), i("span", {
|
|
310
|
+
key: 0,
|
|
311
|
+
class: z(["yselect__value", { yselect__placeholder: !j.value }])
|
|
312
|
+
}, [
|
|
313
|
+
ue(p.$slots, "value", {
|
|
314
|
+
value: K.value,
|
|
315
|
+
label: j.value
|
|
316
|
+
}, () => {
|
|
317
|
+
var F;
|
|
318
|
+
return [
|
|
319
|
+
K.value ? (a(), i(re, { key: 0 }, [
|
|
320
|
+
(F = K.value) != null && F.flagImg ? (a(), i("img", {
|
|
321
|
+
key: 0,
|
|
322
|
+
class: "yselect__flag",
|
|
323
|
+
src: K.value.flagImg,
|
|
324
|
+
alt: "flag"
|
|
325
|
+
}, null, 8, wt)) : A("", !0),
|
|
326
|
+
De(" " + G(j.value), 1)
|
|
327
|
+
], 64)) : (a(), i(re, { key: 1 }, [
|
|
328
|
+
De(G(e.placeholder), 1)
|
|
329
|
+
], 64))
|
|
330
|
+
];
|
|
331
|
+
}, !0)
|
|
332
|
+
], 2)) : Ee((a(), i("input", {
|
|
333
|
+
key: 1,
|
|
334
|
+
ref_key: "inputElement",
|
|
335
|
+
ref: d,
|
|
336
|
+
class: "yselect__input",
|
|
337
|
+
type: "text",
|
|
338
|
+
placeholder: j.value || e.placeholder,
|
|
339
|
+
"onUpdate:modelValue": D[0] || (D[0] = (F) => u.value = F),
|
|
340
|
+
onKeydown: [
|
|
341
|
+
D[1] || (D[1] = Q(() => {
|
|
342
|
+
}, ["stop"])),
|
|
343
|
+
D[2] || (D[2] = be(Q((F) => v(1), ["prevent"]), ["arrow-down"])),
|
|
344
|
+
D[3] || (D[3] = be(Q((F) => v(-1), ["prevent"]), ["arrow-up"])),
|
|
345
|
+
D[4] || (D[4] = be(Q((F) => f(), ["prevent"]), ["enter"])),
|
|
346
|
+
be(Q(ae, ["prevent"]), ["esc"]),
|
|
347
|
+
be(Q(g, ["prevent"]), ["delete"])
|
|
348
|
+
]
|
|
349
|
+
}, null, 40, bt)), [
|
|
350
|
+
[et, u.value]
|
|
351
|
+
]),
|
|
352
|
+
e.clearable && !e.disabled && K.value ? (a(), i("span", {
|
|
353
|
+
key: 2,
|
|
354
|
+
class: "yselect__clear",
|
|
355
|
+
title: "清空",
|
|
356
|
+
onClick: Q(g, ["stop"])
|
|
357
|
+
}, [...D[8] || (D[8] = [
|
|
358
|
+
n("svg", {
|
|
359
|
+
width: "12",
|
|
360
|
+
height: "12",
|
|
361
|
+
viewBox: "0 0 12 12",
|
|
362
|
+
fill: "none"
|
|
363
|
+
}, [
|
|
364
|
+
n("path", {
|
|
365
|
+
d: "M3 3l6 6M9 3L3 9",
|
|
366
|
+
stroke: "currentColor",
|
|
367
|
+
"stroke-width": "1.5",
|
|
368
|
+
"stroke-linecap": "round"
|
|
369
|
+
})
|
|
370
|
+
], -1)
|
|
371
|
+
])])) : A("", !0),
|
|
372
|
+
n("span", {
|
|
373
|
+
class: z(["yselect__arrow", { "yselect__arrow--open": c.value }])
|
|
374
|
+
}, [...D[9] || (D[9] = [
|
|
375
|
+
n("svg", {
|
|
376
|
+
width: "12",
|
|
377
|
+
height: "12",
|
|
378
|
+
viewBox: "0 0 12 12",
|
|
379
|
+
fill: "none"
|
|
380
|
+
}, [
|
|
381
|
+
n("path", {
|
|
382
|
+
d: "M3 4.5L6 7.5L9 4.5",
|
|
383
|
+
stroke: "currentColor",
|
|
384
|
+
"stroke-width": "1.5",
|
|
385
|
+
"stroke-linecap": "round",
|
|
386
|
+
"stroke-linejoin": "round"
|
|
387
|
+
})
|
|
388
|
+
], -1)
|
|
389
|
+
])], 2)
|
|
390
|
+
], 42, mt),
|
|
391
|
+
de(ke, { name: "yselect-dropdown" }, {
|
|
392
|
+
default: he(() => [
|
|
393
|
+
(a(), Le(Ve, { to: "body" }, [
|
|
394
|
+
c.value ? (a(), i("div", {
|
|
395
|
+
key: 0,
|
|
396
|
+
ref_key: "dropdownEl",
|
|
397
|
+
ref: I,
|
|
398
|
+
class: z(["yselect__dropdown yselect__dropdown--portal", { "yselect__dropdown--top": h.value }]),
|
|
399
|
+
style: ye(N.value),
|
|
400
|
+
onMousedown: D[6] || (D[6] = Q(() => {
|
|
401
|
+
}, ["stop"])),
|
|
402
|
+
onClick: D[7] || (D[7] = Q(() => {
|
|
403
|
+
}, ["stop"]))
|
|
404
|
+
}, [
|
|
405
|
+
n("div", {
|
|
406
|
+
class: "yselect__options",
|
|
407
|
+
ref_key: "optionsContainer",
|
|
408
|
+
ref: k
|
|
409
|
+
}, [
|
|
410
|
+
(a(!0), i(re, null, ve(U.value, (F, ne) => (a(), i("div", {
|
|
411
|
+
key: T(F, ne),
|
|
412
|
+
class: z(["yselect__option", {
|
|
413
|
+
"yselect__option--selected": q(F),
|
|
414
|
+
"yselect__option--disabled": te(F),
|
|
415
|
+
"yselect__option--hover": s.value === ne
|
|
416
|
+
}]),
|
|
417
|
+
onClick: (Y) => y(F),
|
|
418
|
+
onMouseenter: (Y) => s.value = ne,
|
|
419
|
+
onMouseleave: D[5] || (D[5] = (Y) => s.value = -1)
|
|
420
|
+
}, [
|
|
421
|
+
ue(p.$slots, "option", {
|
|
422
|
+
option: F,
|
|
423
|
+
index: ne,
|
|
424
|
+
selected: q(F)
|
|
425
|
+
}, () => [
|
|
426
|
+
F != null && F.flagImg ? (a(), i("img", {
|
|
427
|
+
key: 0,
|
|
428
|
+
class: "yselect__flag",
|
|
429
|
+
src: F.flagImg,
|
|
430
|
+
alt: "flag"
|
|
431
|
+
}, null, 8, xt)) : A("", !0),
|
|
432
|
+
De(" " + G(H(F)), 1)
|
|
433
|
+
], !0)
|
|
434
|
+
], 42, kt))), 128))
|
|
435
|
+
], 512)
|
|
436
|
+
], 38)) : A("", !0)
|
|
437
|
+
]))
|
|
438
|
+
]),
|
|
439
|
+
_: 3
|
|
440
|
+
})
|
|
441
|
+
], 6));
|
|
442
|
+
}
|
|
443
|
+
}), Ye = /* @__PURE__ */ we(Dt, [["__scopeId", "data-v-6cd47cb7"]]), $t = { class: "ypagination" }, Ct = { class: "page-actions" }, _t = { class: "page-size-select" }, St = /* @__PURE__ */ me({
|
|
444
|
+
__name: "ypagination",
|
|
445
|
+
props: {
|
|
446
|
+
currentPage: {},
|
|
447
|
+
pageSize: {},
|
|
448
|
+
loading: { type: Boolean, default: !1 },
|
|
449
|
+
pageSizeOptions: { default: () => [
|
|
450
|
+
{ label: "10/页", value: 10 },
|
|
451
|
+
{ label: "20/页", value: 20 },
|
|
452
|
+
{ label: "50/页", value: 50 },
|
|
453
|
+
{ label: "100/页", value: 100 }
|
|
454
|
+
] }
|
|
455
|
+
},
|
|
456
|
+
emits: ["update:currentPage", "update:pageSize", "page-change", "page-size-change"],
|
|
457
|
+
setup(e, { emit: m }) {
|
|
458
|
+
const t = e, l = m, c = R(t.pageSize), s = O(() => t.pageSizeOptions), k = O({
|
|
459
|
+
get: () => t.currentPage,
|
|
460
|
+
set: (h) => {
|
|
461
|
+
l("update:currentPage", h), l("page-change", h);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
function C(h) {
|
|
465
|
+
t.loading || h >= 1 && h !== t.currentPage && (k.value = h);
|
|
466
|
+
}
|
|
467
|
+
function L(h) {
|
|
468
|
+
t.loading || (c.value = h, l("update:pageSize", h), l("page-size-change", h), k.value = 1);
|
|
469
|
+
}
|
|
470
|
+
function I(h) {
|
|
471
|
+
t.loading || (h === "prev" ? C(k.value - 1) : h === "next" && C(k.value + 1));
|
|
472
|
+
}
|
|
473
|
+
return c.value = t.pageSize, oe(
|
|
474
|
+
() => t.pageSize,
|
|
475
|
+
(h) => {
|
|
476
|
+
typeof h == "number" && c.value !== h && (c.value = h);
|
|
477
|
+
}
|
|
478
|
+
), (h, d) => (a(), i("div", $t, [
|
|
479
|
+
n("div", Ct, [
|
|
480
|
+
de(Re, {
|
|
481
|
+
size: "small",
|
|
482
|
+
variant: "secondary",
|
|
483
|
+
disabled: k.value === 1 || e.loading,
|
|
484
|
+
onClick: d[0] || (d[0] = (u) => C(1))
|
|
485
|
+
}, {
|
|
486
|
+
default: he(() => [...d[2] || (d[2] = [
|
|
487
|
+
De("首页", -1)
|
|
488
|
+
])]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 8, ["disabled"]),
|
|
491
|
+
de(Re, {
|
|
492
|
+
class: "ml-1",
|
|
493
|
+
variant: "secondary",
|
|
494
|
+
size: "small",
|
|
495
|
+
groupItems: [
|
|
496
|
+
{ label: "上一页", value: "prev", disabled: k.value === 1 || e.loading, icon: "chevron-left", onlyIcon: !0, ariaLabel: "上一页" },
|
|
497
|
+
{ label: "下一页", value: "next", disabled: e.loading, icon: "chevron-right", onlyIcon: !0, ariaLabel: "下一页" }
|
|
498
|
+
],
|
|
499
|
+
onGroupClick: I
|
|
500
|
+
}, null, 8, ["groupItems"]),
|
|
501
|
+
n("div", _t, [
|
|
502
|
+
de(Ye, {
|
|
503
|
+
modelValue: c.value,
|
|
504
|
+
"onUpdate:modelValue": d[1] || (d[1] = (u) => c.value = u),
|
|
505
|
+
options: s.value,
|
|
506
|
+
size: "small",
|
|
507
|
+
width: "105px",
|
|
508
|
+
clearable: !1,
|
|
509
|
+
disabled: e.loading,
|
|
510
|
+
onChange: L
|
|
511
|
+
}, null, 8, ["modelValue", "options", "disabled"])
|
|
512
|
+
])
|
|
513
|
+
])
|
|
514
|
+
]));
|
|
515
|
+
}
|
|
516
|
+
}), Qe = /* @__PURE__ */ we(St, [["__scopeId", "data-v-d5f9d1dc"]]), Mt = {
|
|
517
|
+
key: 0,
|
|
518
|
+
class: "bulk-bar"
|
|
519
|
+
}, Lt = { class: "bulk-left" }, It = { class: "bulk-actions" }, Et = { class: "card" }, Bt = { class: "table" }, Tt = {
|
|
520
|
+
key: 0,
|
|
521
|
+
style: { width: "40px", "min-width": "40px" }
|
|
522
|
+
}, zt = {
|
|
523
|
+
key: 0,
|
|
524
|
+
class: "col-select"
|
|
525
|
+
}, Kt = ["checked"], Ht = {
|
|
526
|
+
key: 0,
|
|
527
|
+
class: "loading-overlay"
|
|
528
|
+
}, Rt = {
|
|
529
|
+
key: 1,
|
|
530
|
+
class: "empty-overlay"
|
|
531
|
+
}, Vt = {
|
|
532
|
+
key: 0,
|
|
533
|
+
style: { width: "40px", "min-width": "40px" }
|
|
534
|
+
}, At = {
|
|
535
|
+
key: 0,
|
|
536
|
+
class: "col-select"
|
|
537
|
+
}, Ft = ["value", "checked", "onChange"], Wt = /* @__PURE__ */ me({
|
|
538
|
+
__name: "ytable",
|
|
539
|
+
props: {
|
|
540
|
+
data: {},
|
|
541
|
+
columns: {},
|
|
542
|
+
selectable: { type: Boolean, default: !1 },
|
|
543
|
+
showBulkActions: { type: Boolean, default: !1 },
|
|
544
|
+
pagination: { type: Boolean, default: !0 },
|
|
545
|
+
pageSize: { default: 10 },
|
|
546
|
+
currentPage: {},
|
|
547
|
+
total: {},
|
|
548
|
+
loading: { type: Boolean, default: !1 },
|
|
549
|
+
pageSizeOptions: { default: () => [
|
|
550
|
+
{ label: "1/页", value: 1 },
|
|
551
|
+
{ label: "20/页", value: 20 },
|
|
552
|
+
{ label: "50/页", value: 50 },
|
|
553
|
+
{ label: "100/页", value: 100 }
|
|
554
|
+
] },
|
|
555
|
+
rowKey: { type: [String, Function], default: "id" },
|
|
556
|
+
emptyText: { default: "无数据" },
|
|
557
|
+
searchKeyword: { default: "" },
|
|
558
|
+
searchFields: { default: () => [] },
|
|
559
|
+
stickyHeader: { type: Boolean, default: !1 }
|
|
560
|
+
},
|
|
561
|
+
emits: ["edit", "select", "update:selectedItems", "page-change", "page-size-change"],
|
|
562
|
+
setup(e, { emit: m }) {
|
|
563
|
+
const t = e, l = m, c = R(t.currentPage || 1), s = R(t.pageSize), k = R([]), C = R("none"), L = R(), I = R(), h = R(), d = R(), u = R([]), K = R(), j = R({
|
|
564
|
+
show: !1,
|
|
565
|
+
thumbHeight: 40,
|
|
566
|
+
thumbTop: 0
|
|
567
|
+
});
|
|
568
|
+
let U = !1, N = 0, $ = 0;
|
|
569
|
+
const V = R(0), H = O(() => {
|
|
570
|
+
if (!t.searchKeyword || !t.searchFields.length)
|
|
571
|
+
return t.data;
|
|
572
|
+
const x = t.searchKeyword.toLowerCase();
|
|
573
|
+
return t.data.filter((B) => t.searchFields.some((_) => {
|
|
574
|
+
const M = y(B, _);
|
|
575
|
+
return String(M).toLowerCase().includes(x);
|
|
576
|
+
}));
|
|
577
|
+
}), T = O(() => (t.pagination, H.value)), q = O(() => {
|
|
578
|
+
if (!t.selectable) return !1;
|
|
579
|
+
const x = T.value.map((B, _) => ae(B, _));
|
|
580
|
+
return x.length > 0 && x.every((B) => k.value.includes(B));
|
|
581
|
+
}), te = O(() => {
|
|
582
|
+
const x = [];
|
|
583
|
+
let B = t.selectable ? 40 : 0;
|
|
584
|
+
for (let _ = 0; _ < t.columns.length; _++) {
|
|
585
|
+
const M = t.columns[_];
|
|
586
|
+
if (M.fixed === "left") {
|
|
587
|
+
let Z = 80;
|
|
588
|
+
if (M.width) {
|
|
589
|
+
const J = parseFloat(M.width);
|
|
590
|
+
Z = isNaN(J) ? 80 : J;
|
|
591
|
+
} else if (u.value[_]) {
|
|
592
|
+
const J = parseFloat(u.value[_]);
|
|
593
|
+
Z = isNaN(J) ? 80 : J;
|
|
594
|
+
}
|
|
595
|
+
x.push(B), B += Z;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return x;
|
|
599
|
+
}), X = O(() => {
|
|
600
|
+
const x = [];
|
|
601
|
+
let B = 0;
|
|
602
|
+
const _ = [];
|
|
603
|
+
for (let M = t.columns.length - 1; M >= 0; M--) {
|
|
604
|
+
const Z = t.columns[M];
|
|
605
|
+
if (Z.fixed === "right") {
|
|
606
|
+
let J = 80;
|
|
607
|
+
if (Z.width) {
|
|
608
|
+
const ce = parseFloat(Z.width);
|
|
609
|
+
J = isNaN(ce) ? 80 : ce;
|
|
610
|
+
} else if (u.value[M]) {
|
|
611
|
+
const ce = parseFloat(u.value[M]);
|
|
612
|
+
J = isNaN(ce) ? 80 : ce;
|
|
613
|
+
}
|
|
614
|
+
_.push({ index: M, width: J });
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
for (let M = 0; M < _.length; M++)
|
|
618
|
+
x.push(B), B += _[M].width;
|
|
619
|
+
return x;
|
|
620
|
+
});
|
|
621
|
+
function pe(x, B) {
|
|
622
|
+
if (B === "left") {
|
|
623
|
+
let _ = 0;
|
|
624
|
+
for (let M = 0; M < x; M++)
|
|
625
|
+
t.columns[M].fixed === "left" && _++;
|
|
626
|
+
return _;
|
|
627
|
+
} else {
|
|
628
|
+
let _ = 0;
|
|
629
|
+
for (let M = t.columns.length - 1; M > x; M--)
|
|
630
|
+
t.columns[M].fixed === "right" && _++;
|
|
631
|
+
return _;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function ae(x, B) {
|
|
635
|
+
return typeof t.rowKey == "function" ? t.rowKey(x) : x[t.rowKey] || B;
|
|
636
|
+
}
|
|
637
|
+
function y(x, B) {
|
|
638
|
+
return B.split(".").reduce((_, M) => _ == null ? void 0 : _[M], x);
|
|
639
|
+
}
|
|
640
|
+
function g(x, B = !1) {
|
|
641
|
+
const _ = [];
|
|
642
|
+
return x.align && _.push(`text-${x.align}`), x.fixed === "right" && (_.push("col-fixed-right"), B && _.push("col-fixed-right-header")), x.fixed === "left" && (_.push("col-fixed-left"), B && _.push("col-fixed-left-header")), _.join(" ");
|
|
643
|
+
}
|
|
644
|
+
function v(x, B, _) {
|
|
645
|
+
const M = {};
|
|
646
|
+
if (x.width ? (M.width = x.width, M.minWidth = x.width, M.maxWidth = x.width) : (M.width = "auto", M.minWidth = "80px", M.maxWidth = "none"), x.fixed === "left") {
|
|
647
|
+
const Z = pe(B, "left"), J = te.value[Z] || 0;
|
|
648
|
+
M.left = `${J}px`, M.zIndex = _ ? `${10 + Z}` : `${5 + Z}`;
|
|
649
|
+
} else if (x.fixed === "right") {
|
|
650
|
+
const Z = pe(B, "right"), J = X.value[Z] || 0;
|
|
651
|
+
_ ? M.right = `${J - 3}px` : M.right = `${J}px`, M.zIndex = _ ? `${10 + Z}` : `${5 + Z}`;
|
|
652
|
+
}
|
|
653
|
+
return M;
|
|
654
|
+
}
|
|
655
|
+
function f(x, B) {
|
|
656
|
+
const _ = y(x, B.key);
|
|
657
|
+
return B.formatter ? B.formatter(_, x) : _ || "";
|
|
658
|
+
}
|
|
659
|
+
function w(x) {
|
|
660
|
+
k.value.includes(x) ? k.value = k.value.filter((B) => B !== x) : k.value = [...k.value, x], l("select", k.value), l("update:selectedItems", k.value);
|
|
661
|
+
}
|
|
662
|
+
function b() {
|
|
663
|
+
const x = T.value.map((B, _) => ae(B, _));
|
|
664
|
+
if (x.every((B) => k.value.includes(B)))
|
|
665
|
+
k.value = k.value.filter((B) => !x.includes(B));
|
|
666
|
+
else {
|
|
667
|
+
const B = /* @__PURE__ */ new Set([...k.value, ...x]);
|
|
668
|
+
k.value = Array.from(B);
|
|
669
|
+
}
|
|
670
|
+
l("select", k.value), l("update:selectedItems", k.value);
|
|
671
|
+
}
|
|
672
|
+
function S() {
|
|
673
|
+
k.value = [], l("select", k.value), l("update:selectedItems", k.value);
|
|
674
|
+
}
|
|
675
|
+
oe(() => t.searchKeyword, () => {
|
|
676
|
+
c.value = 1;
|
|
677
|
+
}), oe(() => t.data, () => {
|
|
678
|
+
t.total || (c.value = 1);
|
|
679
|
+
}, { deep: !0 });
|
|
680
|
+
function W(x) {
|
|
681
|
+
c.value = x, l("page-change", x);
|
|
682
|
+
}
|
|
683
|
+
function p(x) {
|
|
684
|
+
s.value = x, c.value = 1, l("page-size-change", x);
|
|
685
|
+
}
|
|
686
|
+
oe(() => t.currentPage, (x) => {
|
|
687
|
+
const B = typeof x == "number" && x > 0 ? x : 1;
|
|
688
|
+
c.value !== B && (c.value = B);
|
|
689
|
+
}), oe(() => t.pageSize, (x) => {
|
|
690
|
+
const B = typeof x == "number" && x > 0 ? x : 10;
|
|
691
|
+
s.value !== B && (s.value = B);
|
|
692
|
+
});
|
|
693
|
+
function D() {
|
|
694
|
+
L.value && fe(() => {
|
|
695
|
+
const x = L.value.getBoundingClientRect(), B = window.innerHeight, _ = x.top, M = L.value.querySelector(".table-header"), Z = M ? M.offsetHeight : 40, J = L.value.querySelector(".ypagination"), ce = J ? J.offsetHeight : 60, o = L.value.querySelector(".bulk-bar"), r = o ? o.offsetHeight : 0, E = Z + ce + r + 20, P = B - _ - E, le = Math.max(200, P), ie = L.value.querySelector(".table-body-wrap .table");
|
|
696
|
+
ie && (ie.offsetHeight > P ? C.value = `${le}px` : C.value = "none");
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
let F = !1;
|
|
700
|
+
function ne() {
|
|
701
|
+
!I.value || !h.value || F || I.value.scrollLeft !== h.value.scrollLeft && (F = !0, I.value.scrollLeft = h.value.scrollLeft, requestAnimationFrame(() => {
|
|
702
|
+
F = !1;
|
|
703
|
+
}));
|
|
704
|
+
}
|
|
705
|
+
function Y() {
|
|
706
|
+
!I.value || !h.value || F || h.value.scrollLeft !== I.value.scrollLeft && (F = !0, h.value.scrollLeft = I.value.scrollLeft, requestAnimationFrame(() => {
|
|
707
|
+
F = !1;
|
|
708
|
+
}));
|
|
709
|
+
}
|
|
710
|
+
function ee() {
|
|
711
|
+
fe(() => {
|
|
712
|
+
if (!h.value) return;
|
|
713
|
+
const x = h.value, B = x.scrollHeight, _ = x.clientHeight, M = x.scrollTop, Z = B > _ + 1;
|
|
714
|
+
if (j.value.show = Z, !Z) return;
|
|
715
|
+
const J = 24, ce = _ / B, o = K.value ? K.value.clientHeight : _, r = Math.max(J, Math.floor(o * ce));
|
|
716
|
+
j.value.thumbHeight = r;
|
|
717
|
+
const E = Math.max(0, o - r), P = Math.max(1, B - _);
|
|
718
|
+
j.value.thumbTop = Math.min(E, Math.floor(M / P * E));
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function Ie(x) {
|
|
722
|
+
if (!U || !h.value || !K.value) return;
|
|
723
|
+
x.preventDefault();
|
|
724
|
+
const B = K.value.clientHeight, _ = Math.max(0, B - j.value.thumbHeight), M = h.value, Z = M.scrollHeight, J = M.clientHeight, ce = Math.max(1, Z - J), r = (x.clientY - N) / Math.max(1, _) * ce;
|
|
725
|
+
M.scrollTop = Math.min(ce, Math.max(0, $ + r)), ee();
|
|
726
|
+
}
|
|
727
|
+
function $e() {
|
|
728
|
+
U = !1, window.removeEventListener("mousemove", Ie), window.removeEventListener("mouseup", $e);
|
|
729
|
+
}
|
|
730
|
+
function Ae() {
|
|
731
|
+
fe(() => {
|
|
732
|
+
var _;
|
|
733
|
+
if (u.value.length === t.columns.length && u.value.every((M) => !!M))
|
|
734
|
+
return;
|
|
735
|
+
const x = [];
|
|
736
|
+
for (const M of t.columns)
|
|
737
|
+
if (M.width && typeof M.width == "string" && M.width.trim())
|
|
738
|
+
x.push(M.width);
|
|
739
|
+
else {
|
|
740
|
+
const Z = u.value[x.length];
|
|
741
|
+
x.push(Z || "");
|
|
742
|
+
}
|
|
743
|
+
const B = (_ = d.value) == null ? void 0 : _.querySelector("tbody tr");
|
|
744
|
+
if (B) {
|
|
745
|
+
const M = t.selectable ? 1 : 0, Z = Array.from(B.children);
|
|
746
|
+
for (let J = 0; J < t.columns.length; J++)
|
|
747
|
+
if (!x[J]) {
|
|
748
|
+
const ce = Z[M + J];
|
|
749
|
+
if (ce) {
|
|
750
|
+
const o = ce.clientWidth;
|
|
751
|
+
x[J] = (o > 0 ? o : 80) + "px";
|
|
752
|
+
} else
|
|
753
|
+
x[J] = "80px";
|
|
754
|
+
}
|
|
755
|
+
} else
|
|
756
|
+
for (let M = 0; M < x.length; M++)
|
|
757
|
+
x[M] || (x[M] = u.value[M] || "80px");
|
|
758
|
+
u.value = x;
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
function He() {
|
|
762
|
+
D(), Ce();
|
|
763
|
+
}
|
|
764
|
+
oe(() => t.data, () => {
|
|
765
|
+
fe(() => {
|
|
766
|
+
D(), ne(), Ce();
|
|
767
|
+
});
|
|
768
|
+
}, { deep: !0 }), oe([c, s], () => {
|
|
769
|
+
fe(() => {
|
|
770
|
+
D(), ne(), Ce();
|
|
771
|
+
});
|
|
772
|
+
}), oe(() => t.columns, () => {
|
|
773
|
+
u.value = [], fe(() => {
|
|
774
|
+
Ae(), ne(), Ce();
|
|
775
|
+
});
|
|
776
|
+
}, { deep: !0 }), oe(() => k.value, () => {
|
|
777
|
+
fe(() => {
|
|
778
|
+
D(), Ce();
|
|
779
|
+
});
|
|
780
|
+
}, { deep: !0 }), oe(() => t.loading, () => {
|
|
781
|
+
fe(() => {
|
|
782
|
+
Ce();
|
|
783
|
+
});
|
|
784
|
+
}), _e(() => {
|
|
785
|
+
var x, B;
|
|
786
|
+
fe(() => {
|
|
787
|
+
D(), Ae(), Ce(), ee();
|
|
788
|
+
}), window.addEventListener("resize", He), window.addEventListener("scroll", He, !0), (x = h.value) == null || x.addEventListener("scroll", () => {
|
|
789
|
+
ne(), ee(), Ce();
|
|
790
|
+
}, { passive: !0 }), (B = I.value) == null || B.addEventListener("scroll", () => {
|
|
791
|
+
Y();
|
|
792
|
+
}, { passive: !0 }), fe(() => ne()), h.value && typeof ResizeObserver < "u" && (ze = new ResizeObserver(() => {
|
|
793
|
+
Ce();
|
|
794
|
+
}), ze.observe(h.value));
|
|
795
|
+
}), Be(() => {
|
|
796
|
+
var x, B;
|
|
797
|
+
window.removeEventListener("resize", He), window.removeEventListener("scroll", He, !0), (x = h.value) == null || x.removeEventListener("scroll", ne), (B = I.value) == null || B.removeEventListener("scroll", Y), window.removeEventListener("mousemove", Ie), window.removeEventListener("mouseup", $e), ze && (ze.disconnect(), ze = null);
|
|
798
|
+
});
|
|
799
|
+
let Te = -1;
|
|
800
|
+
function Ce() {
|
|
801
|
+
!I.value || !h.value || requestAnimationFrame(() => {
|
|
802
|
+
if (!I.value || !h.value) return;
|
|
803
|
+
const x = h.value, B = Math.ceil(x.offsetWidth - x.clientWidth);
|
|
804
|
+
if (V.value = B, B !== Te) {
|
|
805
|
+
Te = B;
|
|
806
|
+
const _ = I.value.querySelector(".table"), M = d.value;
|
|
807
|
+
_ && M && (I.value.style.paddingRight = "0px", _.style.width = "", _.style.marginRight = "", B > 0 ? (I.value.style.paddingRight = `${B}px`, _.style.width = "100%", _.style.marginRight = `-${B}px`) : (I.value.style.paddingRight = "0px", _.style.width = "100%", _.style.marginRight = "0px"));
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
let ze = null;
|
|
812
|
+
return (x, B) => (a(), i("div", {
|
|
813
|
+
class: "ytable-container",
|
|
814
|
+
ref_key: "tableContainer",
|
|
815
|
+
ref: L
|
|
816
|
+
}, [
|
|
817
|
+
de(ke, { name: "bulk-slide" }, {
|
|
818
|
+
default: he(() => [
|
|
819
|
+
k.value.length && e.showBulkActions ? (a(), i("div", Mt, [
|
|
820
|
+
n("div", Lt, "已选择 " + G(k.value.length) + " 项", 1),
|
|
821
|
+
n("div", It, [
|
|
822
|
+
ue(x.$slots, "bulk-actions", {
|
|
823
|
+
selectedItems: k.value,
|
|
824
|
+
clearSelection: S
|
|
825
|
+
}, () => [
|
|
826
|
+
n("button", {
|
|
827
|
+
class: "btn",
|
|
828
|
+
onClick: S
|
|
829
|
+
}, "清除选择")
|
|
830
|
+
], !0)
|
|
831
|
+
])
|
|
832
|
+
])) : A("", !0)
|
|
833
|
+
]),
|
|
834
|
+
_: 3
|
|
835
|
+
}),
|
|
836
|
+
n("div", Et, [
|
|
837
|
+
n("div", {
|
|
838
|
+
class: "table-header",
|
|
839
|
+
ref_key: "headerRef",
|
|
840
|
+
ref: I
|
|
841
|
+
}, [
|
|
842
|
+
n("table", Bt, [
|
|
843
|
+
n("colgroup", null, [
|
|
844
|
+
e.selectable ? (a(), i("col", Tt)) : A("", !0),
|
|
845
|
+
(a(!0), i(re, null, ve(e.columns, (_, M) => (a(), i("col", {
|
|
846
|
+
key: _.key,
|
|
847
|
+
style: ye({ width: u.value[M] || void 0, minWidth: u.value[M] || "80px" })
|
|
848
|
+
}, null, 4))), 128))
|
|
849
|
+
]),
|
|
850
|
+
n("thead", null, [
|
|
851
|
+
n("tr", null, [
|
|
852
|
+
e.selectable ? (a(), i("th", zt, [
|
|
853
|
+
n("input", {
|
|
854
|
+
type: "checkbox",
|
|
855
|
+
checked: q.value,
|
|
856
|
+
onChange: b
|
|
857
|
+
}, null, 40, Kt)
|
|
858
|
+
])) : A("", !0),
|
|
859
|
+
(a(!0), i(re, null, ve(e.columns, (_, M) => (a(), i("th", {
|
|
860
|
+
key: _.key,
|
|
861
|
+
class: z(g(_, !0)),
|
|
862
|
+
style: ye(v(_, M, !0))
|
|
863
|
+
}, G(_.title), 7))), 128))
|
|
864
|
+
])
|
|
865
|
+
])
|
|
866
|
+
])
|
|
867
|
+
], 512),
|
|
868
|
+
n("div", {
|
|
869
|
+
class: z(["table-body-wrap", { "is-loading": e.loading, "is-empty": !T.value.length && !e.loading }]),
|
|
870
|
+
ref_key: "bodyWrapRef",
|
|
871
|
+
ref: h,
|
|
872
|
+
style: ye({ maxHeight: C.value })
|
|
873
|
+
}, [
|
|
874
|
+
e.loading ? (a(), i("div", Ht, [...B[2] || (B[2] = [
|
|
875
|
+
n("div", { class: "loading-spinner" }, null, -1),
|
|
876
|
+
n("div", { class: "loading-text" }, "加载中...", -1)
|
|
877
|
+
])])) : A("", !0),
|
|
878
|
+
!T.value.length && !e.loading ? (a(), i("div", Rt, [
|
|
879
|
+
ue(x.$slots, "empty", {}, () => [
|
|
880
|
+
De(G(e.emptyText), 1)
|
|
881
|
+
], !0)
|
|
882
|
+
])) : A("", !0),
|
|
883
|
+
n("table", {
|
|
884
|
+
class: z(["table", { "loading-table": e.loading }]),
|
|
885
|
+
ref_key: "bodyTableRef",
|
|
886
|
+
ref: d
|
|
887
|
+
}, [
|
|
888
|
+
n("colgroup", null, [
|
|
889
|
+
e.selectable ? (a(), i("col", Vt)) : A("", !0),
|
|
890
|
+
(a(!0), i(re, null, ve(e.columns, (_, M) => (a(), i("col", {
|
|
891
|
+
key: _.key,
|
|
892
|
+
style: ye({ width: u.value[M] || void 0, minWidth: u.value[M] || "80px" })
|
|
893
|
+
}, null, 4))), 128))
|
|
894
|
+
]),
|
|
895
|
+
n("tbody", null, [
|
|
896
|
+
(a(!0), i(re, null, ve(T.value, (_, M) => (a(), i("tr", {
|
|
897
|
+
key: ae(_, M)
|
|
898
|
+
}, [
|
|
899
|
+
e.selectable ? (a(), i("td", At, [
|
|
900
|
+
n("input", {
|
|
901
|
+
type: "checkbox",
|
|
902
|
+
value: ae(_, M),
|
|
903
|
+
checked: k.value.includes(ae(_, M)),
|
|
904
|
+
onChange: (Z) => w(ae(_, M))
|
|
905
|
+
}, null, 40, Ft)
|
|
906
|
+
])) : A("", !0),
|
|
907
|
+
(a(!0), i(re, null, ve(e.columns, (Z, J) => (a(), i("td", {
|
|
908
|
+
key: Z.key,
|
|
909
|
+
class: z(g(Z)),
|
|
910
|
+
style: ye(v(Z, J, !1))
|
|
911
|
+
}, [
|
|
912
|
+
ue(x.$slots, `cell-${Z.key}`, {
|
|
913
|
+
item: _,
|
|
914
|
+
value: y(_, Z.key),
|
|
915
|
+
index: M
|
|
916
|
+
}, () => [
|
|
917
|
+
De(G(f(_, Z)), 1)
|
|
918
|
+
], !0)
|
|
919
|
+
], 6))), 128))
|
|
920
|
+
]))), 128))
|
|
921
|
+
])
|
|
922
|
+
], 2)
|
|
923
|
+
], 6),
|
|
924
|
+
e.pagination ? (a(), Le(Qe, {
|
|
925
|
+
key: 0,
|
|
926
|
+
class: "align-right",
|
|
927
|
+
"current-page": c.value,
|
|
928
|
+
"onUpdate:currentPage": B[0] || (B[0] = (_) => c.value = _),
|
|
929
|
+
"page-size": s.value,
|
|
930
|
+
"onUpdate:pageSize": B[1] || (B[1] = (_) => s.value = _),
|
|
931
|
+
loading: t.loading,
|
|
932
|
+
"page-size-options": e.pageSizeOptions,
|
|
933
|
+
onPageChange: W,
|
|
934
|
+
onPageSizeChange: p
|
|
935
|
+
}, null, 8, ["current-page", "page-size", "loading", "page-size-options"])) : A("", !0)
|
|
936
|
+
])
|
|
937
|
+
], 512));
|
|
938
|
+
}
|
|
939
|
+
}), Nt = /* @__PURE__ */ we(Wt, [["__scopeId", "data-v-a5047b07"]]), Pt = ["aria-label"], Yt = { class: "y-badge__inner" }, jt = {
|
|
940
|
+
key: 0,
|
|
941
|
+
class: "y-badge__progress",
|
|
942
|
+
"aria-hidden": "true"
|
|
943
|
+
}, Ot = {
|
|
944
|
+
key: 0,
|
|
945
|
+
class: "icon",
|
|
946
|
+
viewBox: "0 0 20 20",
|
|
947
|
+
fill: "currentColor"
|
|
948
|
+
}, Ut = {
|
|
949
|
+
key: 1,
|
|
950
|
+
class: "icon",
|
|
951
|
+
viewBox: "0 0 20 20",
|
|
952
|
+
fill: "currentColor"
|
|
953
|
+
}, qt = {
|
|
954
|
+
key: 2,
|
|
955
|
+
class: "icon",
|
|
956
|
+
viewBox: "0 0 20 20",
|
|
957
|
+
fill: "currentColor"
|
|
958
|
+
}, Zt = {
|
|
959
|
+
key: 1,
|
|
960
|
+
class: "y-badge__icon",
|
|
961
|
+
"aria-hidden": "true"
|
|
962
|
+
}, Qt = {
|
|
963
|
+
key: 0,
|
|
964
|
+
class: "icon",
|
|
965
|
+
viewBox: "0 0 20 20",
|
|
966
|
+
fill: "currentColor"
|
|
967
|
+
}, Jt = {
|
|
968
|
+
key: 1,
|
|
969
|
+
class: "icon",
|
|
970
|
+
viewBox: "0 0 20 20",
|
|
971
|
+
fill: "currentColor"
|
|
972
|
+
}, Xt = {
|
|
973
|
+
key: 2,
|
|
974
|
+
class: "icon",
|
|
975
|
+
viewBox: "0 0 20 20",
|
|
976
|
+
fill: "currentColor"
|
|
977
|
+
}, Gt = {
|
|
978
|
+
key: 3,
|
|
979
|
+
class: "icon",
|
|
980
|
+
viewBox: "0 0 20 20",
|
|
981
|
+
fill: "currentColor"
|
|
982
|
+
}, en = { class: "y-badge__label" }, tn = /* @__PURE__ */ me({
|
|
983
|
+
__name: "ybadge",
|
|
984
|
+
props: {
|
|
985
|
+
tone: { default: "default" },
|
|
986
|
+
size: { default: "medium" },
|
|
987
|
+
progress: { default: void 0 },
|
|
988
|
+
icon: { default: void 0 },
|
|
989
|
+
pill: { type: Boolean, default: !0 },
|
|
990
|
+
outline: { type: Boolean, default: !1 },
|
|
991
|
+
label: { default: "" }
|
|
992
|
+
},
|
|
993
|
+
setup(e) {
|
|
994
|
+
const m = e, t = O(() => m.tone || "default"), l = O(() => {
|
|
995
|
+
const c = (m.label || "").trim(), s = m.tone, k = m.progress;
|
|
996
|
+
if (k) {
|
|
997
|
+
const C = {
|
|
998
|
+
incomplete: "未完成",
|
|
999
|
+
partiallyComplete: "部分完成",
|
|
1000
|
+
complete: "已完成"
|
|
1001
|
+
};
|
|
1002
|
+
return c ? `${c},进度:${C[k] || k}` : `进度:${C[k] || k}`;
|
|
1003
|
+
}
|
|
1004
|
+
if (s && s !== "default") {
|
|
1005
|
+
const C = {
|
|
1006
|
+
informational: "信息",
|
|
1007
|
+
success: "成功",
|
|
1008
|
+
attention: "注意",
|
|
1009
|
+
warning: "警告",
|
|
1010
|
+
critical: "严重",
|
|
1011
|
+
default: "默认"
|
|
1012
|
+
};
|
|
1013
|
+
return c ? `${c},语气:${C[s] || s}` : `语气:${C[s] || s}`;
|
|
1014
|
+
}
|
|
1015
|
+
return c || "标记";
|
|
1016
|
+
});
|
|
1017
|
+
return (c, s) => (a(), i("span", {
|
|
1018
|
+
class: z(["y-badge", [
|
|
1019
|
+
`y-badge--${t.value}`,
|
|
1020
|
+
`y-badge--${e.size}`,
|
|
1021
|
+
{ "is-outline": e.outline, "is-pill": e.pill },
|
|
1022
|
+
e.progress ? `y-badge--progress-${e.progress}` : ""
|
|
1023
|
+
]]),
|
|
1024
|
+
role: "status",
|
|
1025
|
+
"aria-label": l.value
|
|
1026
|
+
}, [
|
|
1027
|
+
n("span", Yt, [
|
|
1028
|
+
e.progress ? (a(), i("span", jt, [
|
|
1029
|
+
e.progress === "incomplete" ? (a(), i("svg", Ot, [...s[0] || (s[0] = [
|
|
1030
|
+
n("circle", {
|
|
1031
|
+
cx: "10",
|
|
1032
|
+
cy: "10",
|
|
1033
|
+
r: "5"
|
|
1034
|
+
}, null, -1)
|
|
1035
|
+
])])) : e.progress === "partiallyComplete" ? (a(), i("svg", Ut, [...s[1] || (s[1] = [
|
|
1036
|
+
n("path", { d: "M10 5a5 5 0 100 10V5z" }, null, -1),
|
|
1037
|
+
n("circle", {
|
|
1038
|
+
cx: "10",
|
|
1039
|
+
cy: "10",
|
|
1040
|
+
r: "5",
|
|
1041
|
+
fill: "none",
|
|
1042
|
+
stroke: "currentColor",
|
|
1043
|
+
"stroke-width": "2"
|
|
1044
|
+
}, null, -1)
|
|
1045
|
+
])])) : e.progress === "complete" ? (a(), i("svg", qt, [...s[2] || (s[2] = [
|
|
1046
|
+
n("path", {
|
|
1047
|
+
"fill-rule": "evenodd",
|
|
1048
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-7.25 7.25a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L8.75 11.086l6.543-6.543a1 1 0 011.414 0z",
|
|
1049
|
+
"clip-rule": "evenodd"
|
|
1050
|
+
}, null, -1)
|
|
1051
|
+
])])) : A("", !0)
|
|
1052
|
+
])) : e.icon ? (a(), i("span", Zt, [
|
|
1053
|
+
e.icon === "dot" ? (a(), i("svg", Qt, [...s[3] || (s[3] = [
|
|
1054
|
+
n("circle", {
|
|
1055
|
+
cx: "10",
|
|
1056
|
+
cy: "10",
|
|
1057
|
+
r: "4"
|
|
1058
|
+
}, null, -1)
|
|
1059
|
+
])])) : e.icon === "check" ? (a(), i("svg", Jt, [...s[4] || (s[4] = [
|
|
1060
|
+
n("path", {
|
|
1061
|
+
"fill-rule": "evenodd",
|
|
1062
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-7.25 7.25a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L8.75 11.086l6.543-6.543a1 1 0 011.414 0z",
|
|
1063
|
+
"clip-rule": "evenodd"
|
|
1064
|
+
}, null, -1)
|
|
1065
|
+
])])) : e.icon === "alert" ? (a(), i("svg", Xt, [...s[5] || (s[5] = [
|
|
1066
|
+
n("path", {
|
|
1067
|
+
"fill-rule": "evenodd",
|
|
1068
|
+
d: "M8.257 3.099c.765-1.36 2.721-1.36 3.486 0l6.518 11.59c.75 1.334-.214 3.011-1.743 3.011H3.482c-1.53 0-2.493-1.677-1.743-3.01L8.257 3.1zM11 14a1 1 0 10-2 0 1 1 0 002 0zm-1-2a1 1 0 01-1-1V8a1 1 0 112 0v3a1 1 0 01-1 1z",
|
|
1069
|
+
"clip-rule": "evenodd"
|
|
1070
|
+
}, null, -1)
|
|
1071
|
+
])])) : (a(), i("svg", Gt, [...s[6] || (s[6] = [
|
|
1072
|
+
n("circle", {
|
|
1073
|
+
cx: "10",
|
|
1074
|
+
cy: "10",
|
|
1075
|
+
r: "4"
|
|
1076
|
+
}, null, -1)
|
|
1077
|
+
])]))
|
|
1078
|
+
])) : A("", !0),
|
|
1079
|
+
n("span", en, [
|
|
1080
|
+
ue(c.$slots, "default", {}, () => [
|
|
1081
|
+
De(G(e.label), 1)
|
|
1082
|
+
], !0)
|
|
1083
|
+
])
|
|
1084
|
+
])
|
|
1085
|
+
], 10, Pt));
|
|
1086
|
+
}
|
|
1087
|
+
}), nn = /* @__PURE__ */ we(tn, [["__scopeId", "data-v-ce819797"]]), ln = ["aria-hidden"], on = ["onKeydown"], an = {
|
|
1088
|
+
key: 0,
|
|
1089
|
+
class: "y-dialog-header"
|
|
1090
|
+
}, sn = { class: "y-dialog-title" }, rn = { class: "y-dialog-body" }, un = {
|
|
1091
|
+
key: 1,
|
|
1092
|
+
class: "y-dialog-footer"
|
|
1093
|
+
}, dn = /* @__PURE__ */ me({
|
|
1094
|
+
__name: "ydialog",
|
|
1095
|
+
props: {
|
|
1096
|
+
modelValue: { type: Boolean, default: !1 },
|
|
1097
|
+
title: { default: "" },
|
|
1098
|
+
width: { default: "520px" },
|
|
1099
|
+
top: { default: "15vh" },
|
|
1100
|
+
closable: { type: Boolean, default: !0 },
|
|
1101
|
+
maskClosable: { type: Boolean, default: !0 },
|
|
1102
|
+
zIndex: { default: 3e3 },
|
|
1103
|
+
showHeader: { type: Boolean, default: !0 },
|
|
1104
|
+
center: { type: Boolean, default: !1 }
|
|
1105
|
+
},
|
|
1106
|
+
emits: ["update:modelValue", "open", "close"],
|
|
1107
|
+
setup(e, { emit: m }) {
|
|
1108
|
+
const t = e, l = m, c = O({
|
|
1109
|
+
get: () => t.modelValue,
|
|
1110
|
+
set: (d) => l("update:modelValue", d)
|
|
1111
|
+
}), s = R(null), k = O(() => {
|
|
1112
|
+
const d = {};
|
|
1113
|
+
return d.width = typeof t.width == "number" ? `${t.width}px` : String(t.width), d.margin = "0 auto", d.top = t.top, d;
|
|
1114
|
+
});
|
|
1115
|
+
function C() {
|
|
1116
|
+
t.maskClosable && L();
|
|
1117
|
+
}
|
|
1118
|
+
function L() {
|
|
1119
|
+
c.value && (c.value = !1, l("close"));
|
|
1120
|
+
}
|
|
1121
|
+
function I() {
|
|
1122
|
+
t.closable && L();
|
|
1123
|
+
}
|
|
1124
|
+
function h(d) {
|
|
1125
|
+
d.key === "Escape" && I();
|
|
1126
|
+
}
|
|
1127
|
+
return oe(() => t.modelValue, (d) => {
|
|
1128
|
+
d ? (l("open"), requestAnimationFrame(() => {
|
|
1129
|
+
var u;
|
|
1130
|
+
return (u = s.value) == null ? void 0 : u.focus();
|
|
1131
|
+
}), document.addEventListener("keydown", h), document.body.style.overflow = "hidden") : (document.removeEventListener("keydown", h), document.body.style.overflow = "");
|
|
1132
|
+
}), _e(() => {
|
|
1133
|
+
t.modelValue && (document.addEventListener("keydown", h), document.body.style.overflow = "hidden");
|
|
1134
|
+
}), Be(() => {
|
|
1135
|
+
document.removeEventListener("keydown", h), document.body.style.overflow = "";
|
|
1136
|
+
}), (d, u) => (a(), Le(Ve, { to: "body" }, [
|
|
1137
|
+
Ee(n("div", {
|
|
1138
|
+
class: "y-dialog-root",
|
|
1139
|
+
role: "dialog",
|
|
1140
|
+
"aria-modal": !0,
|
|
1141
|
+
"aria-hidden": !c.value,
|
|
1142
|
+
style: ye({ zIndex: String(e.zIndex) })
|
|
1143
|
+
}, [
|
|
1144
|
+
n("div", {
|
|
1145
|
+
class: "y-dialog-mask",
|
|
1146
|
+
onClick: C
|
|
1147
|
+
}),
|
|
1148
|
+
de(ke, { name: "dialog-zoom-fade" }, {
|
|
1149
|
+
default: he(() => [
|
|
1150
|
+
Ee(n("div", {
|
|
1151
|
+
ref_key: "panelRef",
|
|
1152
|
+
ref: s,
|
|
1153
|
+
class: z(["y-dialog-panel", [e.center ? "is-center" : ""]]),
|
|
1154
|
+
style: ye(k.value),
|
|
1155
|
+
onKeydown: be(Q(I, ["prevent", "stop"]), ["esc"]),
|
|
1156
|
+
tabindex: "-1"
|
|
1157
|
+
}, [
|
|
1158
|
+
e.showHeader ? (a(), i("div", an, [
|
|
1159
|
+
ue(d.$slots, "header", {}, () => [
|
|
1160
|
+
n("div", sn, G(e.title), 1)
|
|
1161
|
+
], !0),
|
|
1162
|
+
e.closable ? (a(), i("button", {
|
|
1163
|
+
key: 0,
|
|
1164
|
+
type: "button",
|
|
1165
|
+
class: "y-dialog-close",
|
|
1166
|
+
"aria-label": "Close",
|
|
1167
|
+
onClick: L
|
|
1168
|
+
}, " ✕ ")) : A("", !0)
|
|
1169
|
+
])) : A("", !0),
|
|
1170
|
+
n("div", rn, [
|
|
1171
|
+
ue(d.$slots, "default", {}, void 0, !0)
|
|
1172
|
+
]),
|
|
1173
|
+
d.$slots.footer ? (a(), i("div", un, [
|
|
1174
|
+
ue(d.$slots, "footer", {}, void 0, !0)
|
|
1175
|
+
])) : A("", !0)
|
|
1176
|
+
], 46, on), [
|
|
1177
|
+
[Ke, c.value]
|
|
1178
|
+
])
|
|
1179
|
+
]),
|
|
1180
|
+
_: 3
|
|
1181
|
+
})
|
|
1182
|
+
], 12, ln), [
|
|
1183
|
+
[Ke, c.value]
|
|
1184
|
+
])
|
|
1185
|
+
]));
|
|
1186
|
+
}
|
|
1187
|
+
}), cn = /* @__PURE__ */ we(dn, [["__scopeId", "data-v-a7acc6dc"]]), fn = { class: "ypopover__inner" }, vn = /* @__PURE__ */ me({
|
|
1188
|
+
__name: "ypopover",
|
|
1189
|
+
props: {
|
|
1190
|
+
trigger: { default: "click" },
|
|
1191
|
+
placement: { default: "bottom" },
|
|
1192
|
+
showArrow: { type: Boolean, default: !0 },
|
|
1193
|
+
showPadding: { type: Boolean, default: !0 },
|
|
1194
|
+
dark: { type: Boolean, default: !1 },
|
|
1195
|
+
disabled: { type: Boolean, default: !1 },
|
|
1196
|
+
openDelay: { default: 0 },
|
|
1197
|
+
closeDelay: { default: 200 },
|
|
1198
|
+
closeOnClickOutside: { type: Boolean, default: !0 },
|
|
1199
|
+
closeOnClickContent: { type: Boolean, default: !1 },
|
|
1200
|
+
width: { default: "auto" },
|
|
1201
|
+
maxWidth: { default: "300px" },
|
|
1202
|
+
offset: { default: 8 },
|
|
1203
|
+
modelValue: { type: Boolean, default: !1 }
|
|
1204
|
+
},
|
|
1205
|
+
emits: ["update:modelValue", "show", "hide", "before-show", "before-hide"],
|
|
1206
|
+
setup(e, { expose: m, emit: t }) {
|
|
1207
|
+
const l = e, c = t, s = R(), k = R(), C = R(), L = R(!1), I = R(), h = R(), d = R({});
|
|
1208
|
+
let u = null, K = null;
|
|
1209
|
+
const j = O(() => {
|
|
1210
|
+
if (!L.value || !I.value) return {};
|
|
1211
|
+
const v = {};
|
|
1212
|
+
l.width !== "auto" && (v.width = typeof l.width == "number" ? `${l.width}px` : l.width), l.maxWidth && (v.maxWidth = typeof l.maxWidth == "number" ? `${l.maxWidth}px` : l.maxWidth);
|
|
1213
|
+
const { top: f, left: w } = N();
|
|
1214
|
+
return v.top = `${f}px`, v.left = `${w}px`, v;
|
|
1215
|
+
}), U = O(() => {
|
|
1216
|
+
if (!l.showArrow) return {};
|
|
1217
|
+
if (Object.keys(d.value).length > 0)
|
|
1218
|
+
return d.value;
|
|
1219
|
+
const v = {};
|
|
1220
|
+
return l.placement.startsWith("top") || l.placement.startsWith("bottom") ? v.left = "50%" : v.top = "50%", v;
|
|
1221
|
+
});
|
|
1222
|
+
function N() {
|
|
1223
|
+
var Y, ee;
|
|
1224
|
+
if (!I.value) return { top: 0, left: 0 };
|
|
1225
|
+
const { width: v, height: f, top: w, left: b } = I.value, S = ((Y = C.value) == null ? void 0 : Y.offsetWidth) || 200, W = ((ee = C.value) == null ? void 0 : ee.offsetHeight) || 100;
|
|
1226
|
+
let p = 0, D = 0;
|
|
1227
|
+
switch (l.placement) {
|
|
1228
|
+
case "top":
|
|
1229
|
+
p = w - W - l.offset, D = b + (v - S) / 2;
|
|
1230
|
+
break;
|
|
1231
|
+
case "top-start":
|
|
1232
|
+
p = w - W - l.offset, D = b;
|
|
1233
|
+
break;
|
|
1234
|
+
case "top-end":
|
|
1235
|
+
p = w - W - l.offset, D = b + v - S;
|
|
1236
|
+
break;
|
|
1237
|
+
case "bottom":
|
|
1238
|
+
p = w + f + l.offset, D = b + (v - S) / 2;
|
|
1239
|
+
break;
|
|
1240
|
+
case "bottom-start":
|
|
1241
|
+
p = w + f + l.offset, D = b;
|
|
1242
|
+
break;
|
|
1243
|
+
case "bottom-end":
|
|
1244
|
+
p = w + f + l.offset, D = b + v - S;
|
|
1245
|
+
break;
|
|
1246
|
+
case "left":
|
|
1247
|
+
p = w + (f - W) / 2, D = b - S - l.offset;
|
|
1248
|
+
break;
|
|
1249
|
+
case "left-start":
|
|
1250
|
+
p = w, D = b - S - l.offset;
|
|
1251
|
+
break;
|
|
1252
|
+
case "left-end":
|
|
1253
|
+
p = w + f - W, D = b - S - l.offset;
|
|
1254
|
+
break;
|
|
1255
|
+
case "right":
|
|
1256
|
+
p = w + (f - W) / 2, D = b + v + l.offset;
|
|
1257
|
+
break;
|
|
1258
|
+
case "right-start":
|
|
1259
|
+
p = w, D = b + v + l.offset;
|
|
1260
|
+
break;
|
|
1261
|
+
case "right-end":
|
|
1262
|
+
p = w + f - W, D = b + v + l.offset;
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
const F = window.innerWidth, ne = window.innerHeight;
|
|
1266
|
+
return D < 8 && (D = 8), D + S > F - 8 && (D = F - S - 8), p < 8 && (p = 8), p + W > ne - 8 && (p = ne - W - 8), { top: p, left: D };
|
|
1267
|
+
}
|
|
1268
|
+
function $() {
|
|
1269
|
+
l.disabled || L.value || (q(), l.openDelay > 0 ? u = setTimeout(() => {
|
|
1270
|
+
V();
|
|
1271
|
+
}, l.openDelay) : V());
|
|
1272
|
+
}
|
|
1273
|
+
function V() {
|
|
1274
|
+
c("before-show"), L.value = !0, c("update:modelValue", !0), c("show"), fe(() => {
|
|
1275
|
+
fe(() => {
|
|
1276
|
+
X();
|
|
1277
|
+
});
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
function H() {
|
|
1281
|
+
L.value && (q(), l.closeDelay > 0 ? K = setTimeout(() => {
|
|
1282
|
+
T();
|
|
1283
|
+
}, l.closeDelay) : T());
|
|
1284
|
+
}
|
|
1285
|
+
function T() {
|
|
1286
|
+
c("before-hide"), L.value = !1, c("update:modelValue", !1), c("hide");
|
|
1287
|
+
}
|
|
1288
|
+
function q() {
|
|
1289
|
+
u && (clearTimeout(u), u = null), K && (clearTimeout(K), K = null);
|
|
1290
|
+
}
|
|
1291
|
+
function te() {
|
|
1292
|
+
if (!l.showArrow || !I.value || !C.value) {
|
|
1293
|
+
d.value = {};
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
const v = I.value, f = C.value.getBoundingClientRect();
|
|
1297
|
+
if (f.width === 0 || f.height === 0) {
|
|
1298
|
+
const b = {};
|
|
1299
|
+
l.placement.startsWith("top") || l.placement.startsWith("bottom") ? b.left = "50%" : b.top = "50%", d.value = b;
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
const w = {};
|
|
1303
|
+
if (l.placement.startsWith("top")) {
|
|
1304
|
+
w.bottom = "-6px";
|
|
1305
|
+
const b = v.left + v.width / 2, S = f.left, W = b - S;
|
|
1306
|
+
w.left = `${Math.max(12, Math.min(W, f.width - 12))}px`;
|
|
1307
|
+
} else if (l.placement.startsWith("bottom")) {
|
|
1308
|
+
w.top = "-6px";
|
|
1309
|
+
const b = v.left + v.width / 2, S = f.left, W = b - S;
|
|
1310
|
+
w.left = `${Math.max(12, Math.min(W, f.width - 12))}px`;
|
|
1311
|
+
} else if (l.placement.startsWith("left")) {
|
|
1312
|
+
w.right = "-6px";
|
|
1313
|
+
const b = v.top + v.height / 2, S = f.top, W = b - S;
|
|
1314
|
+
w.top = `${Math.max(12, Math.min(W, f.height - 12))}px`;
|
|
1315
|
+
} else if (l.placement.startsWith("right")) {
|
|
1316
|
+
w.left = "-6px";
|
|
1317
|
+
const b = v.top + v.height / 2, S = f.top, W = b - S;
|
|
1318
|
+
w.top = `${Math.max(12, Math.min(W, f.height - 12))}px`;
|
|
1319
|
+
}
|
|
1320
|
+
d.value = w;
|
|
1321
|
+
}
|
|
1322
|
+
function X() {
|
|
1323
|
+
k.value && (I.value = k.value.getBoundingClientRect(), C.value && (h.value = C.value.getBoundingClientRect(), te(), L.value && requestAnimationFrame(() => {
|
|
1324
|
+
C.value && (h.value = C.value.getBoundingClientRect(), te());
|
|
1325
|
+
})));
|
|
1326
|
+
}
|
|
1327
|
+
function pe() {
|
|
1328
|
+
l.disabled || l.trigger === "click" && (L.value ? H() : $());
|
|
1329
|
+
}
|
|
1330
|
+
function ae() {
|
|
1331
|
+
l.disabled || l.trigger !== "hover" || (q(), $());
|
|
1332
|
+
}
|
|
1333
|
+
function y() {
|
|
1334
|
+
l.disabled || l.trigger !== "hover" || H();
|
|
1335
|
+
}
|
|
1336
|
+
function g(v) {
|
|
1337
|
+
if (!l.closeOnClickOutside || !L.value) return;
|
|
1338
|
+
const f = v.target;
|
|
1339
|
+
s.value && !s.value.contains(f) && C.value && !C.value.contains(f) && H();
|
|
1340
|
+
}
|
|
1341
|
+
return oe(() => l.modelValue, (v) => {
|
|
1342
|
+
v !== L.value && (v ? $() : H());
|
|
1343
|
+
}), oe(L, (v) => {
|
|
1344
|
+
v ? (document.addEventListener("click", g), window.addEventListener("resize", X), window.addEventListener("scroll", X, !0)) : (document.removeEventListener("click", g), window.removeEventListener("resize", X), window.removeEventListener("scroll", X, !0));
|
|
1345
|
+
}), _e(() => {
|
|
1346
|
+
l.modelValue && $();
|
|
1347
|
+
}), Be(() => {
|
|
1348
|
+
q(), document.removeEventListener("click", g), window.removeEventListener("resize", X), window.removeEventListener("scroll", X, !0);
|
|
1349
|
+
}), m({
|
|
1350
|
+
show: $,
|
|
1351
|
+
hide: H,
|
|
1352
|
+
updatePosition: X
|
|
1353
|
+
}), (v, f) => (a(), i("div", {
|
|
1354
|
+
class: "ypopover",
|
|
1355
|
+
ref_key: "popoverRef",
|
|
1356
|
+
ref: s
|
|
1357
|
+
}, [
|
|
1358
|
+
n("div", {
|
|
1359
|
+
ref_key: "triggerRef",
|
|
1360
|
+
ref: k,
|
|
1361
|
+
onClick: pe,
|
|
1362
|
+
onMouseenter: ae,
|
|
1363
|
+
onMouseleave: y
|
|
1364
|
+
}, [
|
|
1365
|
+
ue(v.$slots, "reference", {}, void 0, !0)
|
|
1366
|
+
], 544),
|
|
1367
|
+
(a(), Le(Ve, { to: "body" }, [
|
|
1368
|
+
de(ke, { name: "ypopover-fade" }, {
|
|
1369
|
+
default: he(() => [
|
|
1370
|
+
L.value ? (a(), i("div", {
|
|
1371
|
+
key: 0,
|
|
1372
|
+
ref_key: "contentRef",
|
|
1373
|
+
ref: C,
|
|
1374
|
+
class: z(["ypopover__content", [
|
|
1375
|
+
`ypopover__content--${e.placement}`,
|
|
1376
|
+
{
|
|
1377
|
+
"ypopover__content--dark": e.dark,
|
|
1378
|
+
"ypopover__content--no-padding": !e.showPadding
|
|
1379
|
+
}
|
|
1380
|
+
]]),
|
|
1381
|
+
style: ye(j.value),
|
|
1382
|
+
onClick: f[0] || (f[0] = Q(() => {
|
|
1383
|
+
}, ["stop"]))
|
|
1384
|
+
}, [
|
|
1385
|
+
e.showArrow ? (a(), i("div", {
|
|
1386
|
+
key: 0,
|
|
1387
|
+
class: z(["ypopover__arrow", `ypopover__arrow--${e.placement}`]),
|
|
1388
|
+
style: ye(U.value)
|
|
1389
|
+
}, null, 6)) : A("", !0),
|
|
1390
|
+
n("div", fn, [
|
|
1391
|
+
ue(v.$slots, "default", {}, void 0, !0)
|
|
1392
|
+
])
|
|
1393
|
+
], 6)) : A("", !0)
|
|
1394
|
+
]),
|
|
1395
|
+
_: 3
|
|
1396
|
+
})
|
|
1397
|
+
]))
|
|
1398
|
+
], 512));
|
|
1399
|
+
}
|
|
1400
|
+
}), hn = /* @__PURE__ */ we(vn, [["__scopeId", "data-v-905c83cd"]]), pn = { class: "relative" }, gn = ["value", "placeholder"], yn = { class: "nh-time-suffix" }, mn = { class: "nh-time-shortcuts" }, wn = { class: "nh-time-shortcuts-list" }, bn = ["onClick", "onKeydown", "onMouseenter"], kn = { class: "nh-time-custom" }, xn = { class: "nh-time-custom-header" }, Dn = { class: "nh-time-selection-status" }, $n = {
|
|
1401
|
+
key: 0,
|
|
1402
|
+
class: "status-text"
|
|
1403
|
+
}, Cn = {
|
|
1404
|
+
key: 1,
|
|
1405
|
+
class: "status-text"
|
|
1406
|
+
}, _n = {
|
|
1407
|
+
key: 2,
|
|
1408
|
+
class: "status-text status-complete"
|
|
1409
|
+
}, Sn = { class: "nh-time-pickers" }, Mn = { class: "nh-time-picker" }, Ln = { class: "nh-date-picker" }, In = { class: "nh-date-picker-header" }, En = { class: "nh-date-picker-header-label" }, Bn = { class: "nh-date-picker-content" }, Tn = { class: "nh-date-table" }, zn = ["onClick"], Kn = { class: "nh-date-table-cell" }, Hn = { key: 0 }, Rn = { class: "nh-time-picker" }, Vn = { class: "nh-date-picker" }, An = { class: "nh-date-picker-header" }, Fn = { class: "nh-date-picker-header-label" }, Wn = { class: "nh-date-picker-content" }, Nn = { class: "nh-date-table" }, Pn = ["onClick"], Yn = { class: "nh-date-table-cell" }, jn = { key: 0 }, On = { class: "nh-time-actions" }, Un = /* @__PURE__ */ me({
|
|
1410
|
+
__name: "ytime",
|
|
1411
|
+
props: {
|
|
1412
|
+
modelValue: { default: () => ({ startDate: null, endDate: null }) },
|
|
1413
|
+
placeholder: { default: "请选择日期范围" },
|
|
1414
|
+
shortcuts: { default: () => [
|
|
1415
|
+
{
|
|
1416
|
+
label: "今天",
|
|
1417
|
+
getValue: () => {
|
|
1418
|
+
const e = /* @__PURE__ */ new Date(), m = new Date(e.getFullYear(), e.getMonth(), e.getDate()), t = new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59);
|
|
1419
|
+
return { startDate: m, endDate: t };
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
label: "昨天",
|
|
1424
|
+
getValue: () => {
|
|
1425
|
+
const e = /* @__PURE__ */ new Date();
|
|
1426
|
+
e.setDate(e.getDate() - 1);
|
|
1427
|
+
const m = new Date(e.getFullYear(), e.getMonth(), e.getDate()), t = new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59);
|
|
1428
|
+
return { startDate: m, endDate: t };
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
label: "近7天",
|
|
1433
|
+
getValue: () => {
|
|
1434
|
+
const e = /* @__PURE__ */ new Date(), m = /* @__PURE__ */ new Date();
|
|
1435
|
+
return m.setDate(m.getDate() - 6), m.setHours(0, 0, 0, 0), e.setHours(23, 59, 59, 999), { startDate: m, endDate: e };
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
label: "近30天",
|
|
1440
|
+
getValue: () => {
|
|
1441
|
+
const e = /* @__PURE__ */ new Date(), m = /* @__PURE__ */ new Date();
|
|
1442
|
+
return m.setDate(m.getDate() - 29), m.setHours(0, 0, 0, 0), e.setHours(23, 59, 59, 999), { startDate: m, endDate: e };
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
label: "近3个月",
|
|
1447
|
+
getValue: () => {
|
|
1448
|
+
const e = /* @__PURE__ */ new Date(), m = /* @__PURE__ */ new Date();
|
|
1449
|
+
return m.setMonth(m.getMonth() - 3), m.setHours(0, 0, 0, 0), e.setHours(23, 59, 59, 999), { startDate: m, endDate: e };
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
] },
|
|
1453
|
+
clearable: { type: Boolean, default: !0 },
|
|
1454
|
+
format: { default: "timestamp" },
|
|
1455
|
+
includeTime: { type: Boolean, default: !1 },
|
|
1456
|
+
size: { default: "small" }
|
|
1457
|
+
},
|
|
1458
|
+
emits: ["update:modelValue", "change"],
|
|
1459
|
+
setup(e, { emit: m }) {
|
|
1460
|
+
const t = e, l = m, c = R(!1), s = R(-1), k = R(-1), C = R(null), L = R(), I = R(), h = R({
|
|
1461
|
+
top: !0,
|
|
1462
|
+
left: !0
|
|
1463
|
+
}), d = R({
|
|
1464
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
1465
|
+
month: (/* @__PURE__ */ new Date()).getMonth()
|
|
1466
|
+
}), u = R({
|
|
1467
|
+
year: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
1468
|
+
month: (/* @__PURE__ */ new Date()).getMonth() + 1
|
|
1469
|
+
}), K = () => {
|
|
1470
|
+
const o = new Date(d.value.year, d.value.month).getTime(), r = new Date(u.value.year, u.value.month).getTime();
|
|
1471
|
+
if (o >= r) {
|
|
1472
|
+
const E = new Date(d.value.year, d.value.month + 1);
|
|
1473
|
+
u.value.year = E.getFullYear(), u.value.month = E.getMonth();
|
|
1474
|
+
}
|
|
1475
|
+
}, j = () => {
|
|
1476
|
+
const o = new Date(d.value.year, d.value.month).getTime();
|
|
1477
|
+
if (new Date(u.value.year, u.value.month).getTime() <= o) {
|
|
1478
|
+
const E = new Date(u.value.year, u.value.month - 1);
|
|
1479
|
+
d.value.year = E.getFullYear(), d.value.month = E.getMonth();
|
|
1480
|
+
}
|
|
1481
|
+
}, U = ["一", "二", "三", "四", "五", "六", "日"], N = R(null), $ = R(null), V = (o) => {
|
|
1482
|
+
if (!o) return null;
|
|
1483
|
+
if (o instanceof Date) return o;
|
|
1484
|
+
if (typeof o == "number")
|
|
1485
|
+
return new Date(o);
|
|
1486
|
+
if (typeof o == "string") {
|
|
1487
|
+
const r = new Date(o);
|
|
1488
|
+
return isNaN(r.getTime()) ? null : r;
|
|
1489
|
+
}
|
|
1490
|
+
return null;
|
|
1491
|
+
}, H = (o) => {
|
|
1492
|
+
if (!o) return null;
|
|
1493
|
+
const r = o.getFullYear(), E = String(o.getMonth() + 1).padStart(2, "0"), P = String(o.getDate()).padStart(2, "0");
|
|
1494
|
+
if (t.includeTime) {
|
|
1495
|
+
const se = String(o.getHours()).padStart(2, "0"), le = String(o.getMinutes()).padStart(2, "0"), ie = String(o.getSeconds()).padStart(2, "0");
|
|
1496
|
+
return `${r}-${E}-${P} ${se}:${le}:${ie}`;
|
|
1497
|
+
} else
|
|
1498
|
+
return `${r}-${E}-${P}`;
|
|
1499
|
+
}, T = (o) => o ? o.getTime() : null, q = (o) => o ? {
|
|
1500
|
+
startDate: V(o.startDate),
|
|
1501
|
+
endDate: V(o.endDate)
|
|
1502
|
+
} : { startDate: null, endDate: null }, te = (o) => t.format === "string" ? {
|
|
1503
|
+
startDate: H(o.startDate),
|
|
1504
|
+
endDate: H(o.endDate)
|
|
1505
|
+
} : t.format === "timestamp" ? {
|
|
1506
|
+
startDate: T(o.startDate),
|
|
1507
|
+
endDate: T(o.endDate)
|
|
1508
|
+
} : o, X = (o, r) => `${String(r + 1).padStart(2, "0")}/${o}`, pe = (o, r) => o.getFullYear() === r.getFullYear() && o.getMonth() === r.getMonth() && o.getDate() === r.getDate(), ae = (o, r, E) => !r || !E ? !1 : o >= r && o <= E, y = (o) => {
|
|
1509
|
+
const r = q(o);
|
|
1510
|
+
if (!(r != null && r.startDate) || !(r != null && r.endDate))
|
|
1511
|
+
return -1;
|
|
1512
|
+
for (let E = 0; E < t.shortcuts.length; E++) {
|
|
1513
|
+
const P = t.shortcuts[E].getValue();
|
|
1514
|
+
if (P.startDate && P.endDate && r.startDate && r.endDate) {
|
|
1515
|
+
const se = new Date(
|
|
1516
|
+
r.startDate.getFullYear(),
|
|
1517
|
+
r.startDate.getMonth(),
|
|
1518
|
+
r.startDate.getDate()
|
|
1519
|
+
), le = new Date(
|
|
1520
|
+
r.endDate.getFullYear(),
|
|
1521
|
+
r.endDate.getMonth(),
|
|
1522
|
+
r.endDate.getDate()
|
|
1523
|
+
), ie = new Date(
|
|
1524
|
+
P.startDate.getFullYear(),
|
|
1525
|
+
P.startDate.getMonth(),
|
|
1526
|
+
P.startDate.getDate()
|
|
1527
|
+
), xe = new Date(
|
|
1528
|
+
P.endDate.getFullYear(),
|
|
1529
|
+
P.endDate.getMonth(),
|
|
1530
|
+
P.endDate.getDate()
|
|
1531
|
+
);
|
|
1532
|
+
if (se.getTime() === ie.getTime() && le.getTime() === xe.getTime())
|
|
1533
|
+
return E;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return -1;
|
|
1537
|
+
}, g = (o, r) => {
|
|
1538
|
+
const E = new Date(o, r, 1), P = new Date(o, r + 1, 0), se = E.getDay(), le = P.getDate(), ie = [], xe = /* @__PURE__ */ new Date(), We = se === 0 ? 6 : se - 1, Xe = new Date(o, r, 0);
|
|
1539
|
+
for (let ge = We - 1; ge >= 0; ge--) {
|
|
1540
|
+
const Se = new Date(o, r - 1, Xe.getDate() - ge);
|
|
1541
|
+
ie.push({
|
|
1542
|
+
date: Se,
|
|
1543
|
+
day: Se.getDate(),
|
|
1544
|
+
isCurrentMonth: !1,
|
|
1545
|
+
isToday: pe(Se, xe),
|
|
1546
|
+
isSelected: !1,
|
|
1547
|
+
isInRange: !1,
|
|
1548
|
+
isDisabled: !0
|
|
1549
|
+
// 禁用非当前月的日期
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
for (let ge = 1; ge <= le; ge++) {
|
|
1553
|
+
const Se = new Date(o, r, ge);
|
|
1554
|
+
ie.push({
|
|
1555
|
+
date: Se,
|
|
1556
|
+
day: ge,
|
|
1557
|
+
isCurrentMonth: !0,
|
|
1558
|
+
isToday: pe(Se, xe),
|
|
1559
|
+
isSelected: !1,
|
|
1560
|
+
isInRange: !1,
|
|
1561
|
+
isDisabled: !1
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
const Ge = 42 - ie.length;
|
|
1565
|
+
for (let ge = 1; ge <= Ge; ge++) {
|
|
1566
|
+
const Se = new Date(o, r + 1, ge);
|
|
1567
|
+
ie.push({
|
|
1568
|
+
date: Se,
|
|
1569
|
+
day: ge,
|
|
1570
|
+
isCurrentMonth: !1,
|
|
1571
|
+
isToday: pe(Se, xe),
|
|
1572
|
+
isSelected: !1,
|
|
1573
|
+
isInRange: !1,
|
|
1574
|
+
isDisabled: !0
|
|
1575
|
+
// 禁用非当前月的日期
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
const je = [];
|
|
1579
|
+
for (let ge = 0; ge < ie.length; ge += 7)
|
|
1580
|
+
je.push(ie.slice(ge, ge + 7));
|
|
1581
|
+
return je;
|
|
1582
|
+
}, v = (o) => {
|
|
1583
|
+
const r = te(o);
|
|
1584
|
+
l("update:modelValue", r), l("change", r);
|
|
1585
|
+
}, f = () => {
|
|
1586
|
+
if (!L.value || !I.value) return;
|
|
1587
|
+
const o = L.value.getBoundingClientRect(), r = I.value.getBoundingClientRect(), E = window.innerWidth, se = window.innerHeight - o.bottom, le = o.top, ie = r.height || 400;
|
|
1588
|
+
se < ie && le > ie ? h.value.top = !1 : h.value.top = !0;
|
|
1589
|
+
const xe = E - o.left, We = r.width || 640;
|
|
1590
|
+
xe < We ? h.value.left = !1 : h.value.left = !0;
|
|
1591
|
+
}, w = () => {
|
|
1592
|
+
if (c.value = !c.value, c.value) {
|
|
1593
|
+
const o = q(t.modelValue);
|
|
1594
|
+
if (N.value = (o == null ? void 0 : o.startDate) || null, $.value = (o == null ? void 0 : o.endDate) || null, k.value = y(t.modelValue), s.value = -1, o != null && o.startDate && (d.value.year = o.startDate.getFullYear(), d.value.month = o.startDate.getMonth()), o != null && o.endDate)
|
|
1595
|
+
u.value.year = o.endDate.getFullYear(), u.value.month = o.endDate.getMonth();
|
|
1596
|
+
else {
|
|
1597
|
+
const r = new Date(d.value.year, d.value.month + 1);
|
|
1598
|
+
u.value.year = r.getFullYear(), u.value.month = r.getMonth();
|
|
1599
|
+
}
|
|
1600
|
+
K(), fe(() => {
|
|
1601
|
+
f();
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
}, b = (o) => {
|
|
1605
|
+
const r = o.target, E = L.value, P = I.value;
|
|
1606
|
+
E && P && !E.contains(r) && !P.contains(r) && (c.value = !1, s.value = -1);
|
|
1607
|
+
}, S = (o) => {
|
|
1608
|
+
o.key === "Enter" || o.key === " " ? (o.preventDefault(), w()) : o.key === "ArrowDown" && (o.preventDefault(), c.value = !0, fe(() => {
|
|
1609
|
+
f(), ne();
|
|
1610
|
+
}));
|
|
1611
|
+
}, W = (o) => {
|
|
1612
|
+
var r;
|
|
1613
|
+
o.key === "Escape" && (c.value = !1, s.value = -1, (r = L.value) == null || r.focus());
|
|
1614
|
+
}, p = (o, r) => {
|
|
1615
|
+
o.key === "ArrowDown" ? (o.preventDefault(), s.value = Math.min(r + 1, t.shortcuts.length - 1), Y(s.value)) : o.key === "ArrowUp" ? (o.preventDefault(), s.value = Math.max(r - 1, 0), Y(s.value)) : (o.key === "Enter" || o.key === " ") && (o.preventDefault(), ee(t.shortcuts[r]));
|
|
1616
|
+
}, D = (o) => {
|
|
1617
|
+
s.value = o;
|
|
1618
|
+
}, F = () => {
|
|
1619
|
+
s.value = -1;
|
|
1620
|
+
}, ne = () => {
|
|
1621
|
+
s.value = 0, Y(0);
|
|
1622
|
+
}, Y = (o) => {
|
|
1623
|
+
if (I.value) {
|
|
1624
|
+
const E = I.value.querySelectorAll(".nh-time-shortcut")[o];
|
|
1625
|
+
E && E.focus();
|
|
1626
|
+
}
|
|
1627
|
+
}, ee = (o) => {
|
|
1628
|
+
const r = o.getValue();
|
|
1629
|
+
t.includeTime && r.startDate && r.endDate && (r.startDate.setHours(0, 0, 0, 0), r.endDate.setHours(23, 59, 59, 999)), v(r), k.value = t.shortcuts.findIndex((E) => E.label === o.label), s.value = -1, c.value = !1;
|
|
1630
|
+
}, Ie = (o, r) => {
|
|
1631
|
+
if (!o || o.isDisabled) return;
|
|
1632
|
+
let E;
|
|
1633
|
+
if (t.includeTime ? (E = new Date(o.date), r === "start" || !N.value ? E.setHours(0, 0, 0, 0) : E.setHours(23, 59, 59, 999)) : E = new Date(o.date.getFullYear(), o.date.getMonth(), o.date.getDate()), !N.value && !$.value)
|
|
1634
|
+
N.value = E, $.value = null;
|
|
1635
|
+
else if (N.value && !$.value)
|
|
1636
|
+
if (E >= N.value)
|
|
1637
|
+
t.includeTime && E.setHours(23, 59, 59, 999), $.value = E;
|
|
1638
|
+
else {
|
|
1639
|
+
const P = N.value;
|
|
1640
|
+
t.includeTime && P.setHours(23, 59, 59, 999), $.value = P, N.value = E;
|
|
1641
|
+
}
|
|
1642
|
+
else
|
|
1643
|
+
N.value = E, $.value = null;
|
|
1644
|
+
if (k.value = -1, N.value && $.value) {
|
|
1645
|
+
const P = new Date($.value);
|
|
1646
|
+
t.includeTime && P.setHours(23, 59, 59, 999), C.value = {
|
|
1647
|
+
startDate: N.value,
|
|
1648
|
+
endDate: P
|
|
1649
|
+
};
|
|
1650
|
+
} else
|
|
1651
|
+
C.value = null;
|
|
1652
|
+
}, $e = (o, r) => {
|
|
1653
|
+
if (!o) return ["nh-date-table-td"];
|
|
1654
|
+
const E = ["nh-date-table-td"];
|
|
1655
|
+
return o.isCurrentMonth || E.push("is-prev-month"), o.isToday && E.push("is-today"), o.isDisabled && E.push("is-disabled"), N.value && pe(o.date, N.value) && E.push("is-selected", "is-start"), $.value && pe(o.date, $.value) && E.push("is-selected", "is-end"), N.value && $.value && ae(o.date, N.value, $.value) && E.push("is-in-range"), E;
|
|
1656
|
+
}, Ae = () => {
|
|
1657
|
+
C.value && (t.includeTime && C.value.endDate && C.value.endDate.setHours(23, 59, 59, 999), v(C.value), k.value = y(C.value), c.value = !1);
|
|
1658
|
+
}, He = () => {
|
|
1659
|
+
v({ startDate: null, endDate: null }), Z(), s.value = -1, c.value = !1;
|
|
1660
|
+
}, Te = () => {
|
|
1661
|
+
c.value && fe(() => {
|
|
1662
|
+
f();
|
|
1663
|
+
});
|
|
1664
|
+
}, Ce = O(() => g(d.value.year, d.value.month)), ze = O(() => g(u.value.year, u.value.month)), x = O(() => {
|
|
1665
|
+
const o = q(t.modelValue);
|
|
1666
|
+
if (!o || !o.startDate || !o.endDate)
|
|
1667
|
+
return "";
|
|
1668
|
+
const r = (se) => {
|
|
1669
|
+
const le = String(se.getFullYear()), ie = String(se.getMonth() + 1).padStart(2, "0"), xe = String(se.getDate()).padStart(2, "0");
|
|
1670
|
+
return `${le}/${ie}/${xe}`;
|
|
1671
|
+
}, E = r(o.startDate), P = r(o.endDate);
|
|
1672
|
+
return !t.includeTime && E === P ? E : `${E} - ${P}`;
|
|
1673
|
+
}), B = O(() => [
|
|
1674
|
+
"nh-time-dropdown",
|
|
1675
|
+
{
|
|
1676
|
+
"nh-time-dropdown-top": !h.value.top,
|
|
1677
|
+
"nh-time-dropdown-right": !h.value.left
|
|
1678
|
+
}
|
|
1679
|
+
]), _ = O(() => {
|
|
1680
|
+
const o = q(t.modelValue);
|
|
1681
|
+
return !!(o != null && o.startDate && (o != null && o.endDate));
|
|
1682
|
+
}), M = O(() => !!(N.value && $.value)), Z = () => {
|
|
1683
|
+
N.value = null, $.value = null, C.value = null, k.value = -1;
|
|
1684
|
+
};
|
|
1685
|
+
oe(() => t.modelValue, (o) => {
|
|
1686
|
+
const r = q(o);
|
|
1687
|
+
if (r != null && r.startDate) {
|
|
1688
|
+
const E = r.startDate;
|
|
1689
|
+
d.value.year = E.getFullYear(), d.value.month = E.getMonth();
|
|
1690
|
+
}
|
|
1691
|
+
if (r != null && r.endDate) {
|
|
1692
|
+
const E = r.endDate;
|
|
1693
|
+
u.value.year = E.getFullYear(), u.value.month = E.getMonth();
|
|
1694
|
+
} else if (r != null && r.startDate) {
|
|
1695
|
+
const E = new Date(d.value.year, d.value.month + 1);
|
|
1696
|
+
u.value.year = E.getFullYear(), u.value.month = E.getMonth();
|
|
1697
|
+
}
|
|
1698
|
+
(r != null && r.startDate || r != null && r.endDate) && K(), c.value || (k.value = y(o));
|
|
1699
|
+
}, { immediate: !0, deep: !0 }), oe([d, u], () => {
|
|
1700
|
+
const o = new Date(d.value.year, d.value.month).getTime(), r = new Date(u.value.year, u.value.month).getTime();
|
|
1701
|
+
if (o === r) {
|
|
1702
|
+
const E = new Date(d.value.year, d.value.month + 1);
|
|
1703
|
+
u.value.year = E.getFullYear(), u.value.month = E.getMonth();
|
|
1704
|
+
}
|
|
1705
|
+
}, { deep: !0 }), _e(() => {
|
|
1706
|
+
document.addEventListener("click", b), window.addEventListener("resize", Te), window.addEventListener("scroll", Te), k.value = y(t.modelValue);
|
|
1707
|
+
const o = q(t.modelValue);
|
|
1708
|
+
if (o != null && o.startDate && (d.value.year = o.startDate.getFullYear(), d.value.month = o.startDate.getMonth()), o != null && o.endDate)
|
|
1709
|
+
u.value.year = o.endDate.getFullYear(), u.value.month = o.endDate.getMonth();
|
|
1710
|
+
else {
|
|
1711
|
+
const r = new Date(d.value.year, d.value.month + 1);
|
|
1712
|
+
u.value.year = r.getFullYear(), u.value.month = r.getMonth();
|
|
1713
|
+
}
|
|
1714
|
+
K();
|
|
1715
|
+
}), Be(() => {
|
|
1716
|
+
document.removeEventListener("click", b), window.removeEventListener("resize", Te), window.removeEventListener("scroll", Te);
|
|
1717
|
+
});
|
|
1718
|
+
const J = () => {
|
|
1719
|
+
t.clearable && (v({ startDate: null, endDate: null }), Z(), s.value = -1);
|
|
1720
|
+
}, ce = (o, r) => {
|
|
1721
|
+
if (o === "start") {
|
|
1722
|
+
const E = new Date(d.value.year, d.value.month + r, 1);
|
|
1723
|
+
d.value.year = E.getFullYear(), d.value.month = E.getMonth(), K();
|
|
1724
|
+
} else {
|
|
1725
|
+
const E = new Date(u.value.year, u.value.month + r, 1);
|
|
1726
|
+
u.value.year = E.getFullYear(), u.value.month = E.getMonth(), j();
|
|
1727
|
+
}
|
|
1728
|
+
};
|
|
1729
|
+
return (o, r) => {
|
|
1730
|
+
const E = tt("ybutton");
|
|
1731
|
+
return a(), i("div", {
|
|
1732
|
+
class: z(["nh-time-search", [`nh-time--${e.size}`]])
|
|
1733
|
+
}, [
|
|
1734
|
+
n("div", pn, [
|
|
1735
|
+
n("div", {
|
|
1736
|
+
ref_key: "trigger",
|
|
1737
|
+
ref: L,
|
|
1738
|
+
onClick: w,
|
|
1739
|
+
onKeydown: S,
|
|
1740
|
+
class: z(["nh-time-trigger", { "is-focus": c.value, "has-value": _.value }]),
|
|
1741
|
+
tabindex: "0"
|
|
1742
|
+
}, [
|
|
1743
|
+
n("input", {
|
|
1744
|
+
readonly: "",
|
|
1745
|
+
value: x.value,
|
|
1746
|
+
placeholder: e.placeholder,
|
|
1747
|
+
class: "nh-time-input"
|
|
1748
|
+
}, null, 8, gn),
|
|
1749
|
+
n("span", yn, [
|
|
1750
|
+
e.clearable && _.value ? (a(), i("i", {
|
|
1751
|
+
key: 0,
|
|
1752
|
+
onClick: Q(J, ["stop"]),
|
|
1753
|
+
class: "nh-time-clear"
|
|
1754
|
+
}, [...r[4] || (r[4] = [
|
|
1755
|
+
n("svg", {
|
|
1756
|
+
viewBox: "0 0 1024 1024",
|
|
1757
|
+
width: "14",
|
|
1758
|
+
height: "14"
|
|
1759
|
+
}, [
|
|
1760
|
+
n("path", {
|
|
1761
|
+
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1 1.9-11.2c1.5-1.2 3.3-1.9 5.2-1.9l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130.1 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z",
|
|
1762
|
+
fill: "currentColor"
|
|
1763
|
+
})
|
|
1764
|
+
], -1)
|
|
1765
|
+
])])) : A("", !0),
|
|
1766
|
+
r[6] || (r[6] = n("i", { class: "nh-time-icon" }, [
|
|
1767
|
+
n("svg", {
|
|
1768
|
+
viewBox: "0 0 1024 1024",
|
|
1769
|
+
width: "14",
|
|
1770
|
+
height: "14"
|
|
1771
|
+
}, [
|
|
1772
|
+
n("path", {
|
|
1773
|
+
d: "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zM648 248v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h112v120H152V248h112v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h312zm184 584H192V424h640v408z",
|
|
1774
|
+
fill: "currentColor"
|
|
1775
|
+
})
|
|
1776
|
+
])
|
|
1777
|
+
], -1)),
|
|
1778
|
+
n("i", {
|
|
1779
|
+
class: z(["nh-time-arrow", { "is-reverse": c.value }])
|
|
1780
|
+
}, [...r[5] || (r[5] = [
|
|
1781
|
+
n("svg", {
|
|
1782
|
+
viewBox: "0 0 1024 1024",
|
|
1783
|
+
width: "12",
|
|
1784
|
+
height: "12"
|
|
1785
|
+
}, [
|
|
1786
|
+
n("path", {
|
|
1787
|
+
d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3 0.1-12.7-6.4-12.7z",
|
|
1788
|
+
fill: "currentColor"
|
|
1789
|
+
})
|
|
1790
|
+
], -1)
|
|
1791
|
+
])], 2)
|
|
1792
|
+
])
|
|
1793
|
+
], 34),
|
|
1794
|
+
de(ke, { name: "el-zoom-in-top" }, {
|
|
1795
|
+
default: he(() => [
|
|
1796
|
+
c.value ? (a(), i("div", {
|
|
1797
|
+
key: 0,
|
|
1798
|
+
ref_key: "dropdown",
|
|
1799
|
+
ref: I,
|
|
1800
|
+
class: z(B.value),
|
|
1801
|
+
onKeydown: W
|
|
1802
|
+
}, [
|
|
1803
|
+
n("div", mn, [
|
|
1804
|
+
r[7] || (r[7] = n("div", { class: "nh-time-shortcuts-title" }, "快捷选项", -1)),
|
|
1805
|
+
n("ul", wn, [
|
|
1806
|
+
(a(!0), i(re, null, ve(e.shortcuts, (P, se) => (a(), i("li", {
|
|
1807
|
+
key: P.label,
|
|
1808
|
+
onClick: (le) => ee(P),
|
|
1809
|
+
onKeydown: (le) => p(le, se),
|
|
1810
|
+
onMouseenter: (le) => D(se),
|
|
1811
|
+
onMouseleave: F,
|
|
1812
|
+
class: z([
|
|
1813
|
+
"nh-time-shortcut",
|
|
1814
|
+
{
|
|
1815
|
+
"is-active": s.value === se,
|
|
1816
|
+
"is-selected": k.value === se
|
|
1817
|
+
}
|
|
1818
|
+
]),
|
|
1819
|
+
tabindex: "0"
|
|
1820
|
+
}, G(P.label), 43, bn))), 128))
|
|
1821
|
+
])
|
|
1822
|
+
]),
|
|
1823
|
+
n("div", kn, [
|
|
1824
|
+
n("div", xn, [
|
|
1825
|
+
r[8] || (r[8] = n("span", null, "自定义时间", -1)),
|
|
1826
|
+
n("div", Dn, [
|
|
1827
|
+
!N.value && !$.value ? (a(), i("span", $n, " 请选择开始日期 ")) : N.value && !$.value ? (a(), i("span", Cn, " 请选择结束日期 ")) : N.value && $.value ? (a(), i("span", _n, " 已选择完整范围 ")) : A("", !0)
|
|
1828
|
+
])
|
|
1829
|
+
]),
|
|
1830
|
+
n("div", Sn, [
|
|
1831
|
+
n("div", Mn, [
|
|
1832
|
+
n("div", Ln, [
|
|
1833
|
+
n("div", In, [
|
|
1834
|
+
n("button", {
|
|
1835
|
+
onClick: r[0] || (r[0] = (P) => ce("start", -1)),
|
|
1836
|
+
class: "nh-date-picker-btn nh-date-picker-prev-btn",
|
|
1837
|
+
type: "button"
|
|
1838
|
+
}, [...r[9] || (r[9] = [
|
|
1839
|
+
n("svg", {
|
|
1840
|
+
viewBox: "0 0 1024 1024",
|
|
1841
|
+
width: "12",
|
|
1842
|
+
height: "12"
|
|
1843
|
+
}, [
|
|
1844
|
+
n("path", {
|
|
1845
|
+
d: "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.2 4.1 12.9 0.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z",
|
|
1846
|
+
fill: "currentColor"
|
|
1847
|
+
})
|
|
1848
|
+
], -1)
|
|
1849
|
+
])]),
|
|
1850
|
+
n("span", En, G(X(d.value.year, d.value.month)), 1),
|
|
1851
|
+
n("button", {
|
|
1852
|
+
onClick: r[1] || (r[1] = (P) => ce("start", 1)),
|
|
1853
|
+
class: "nh-date-picker-btn nh-date-picker-next-btn",
|
|
1854
|
+
type: "button"
|
|
1855
|
+
}, [...r[10] || (r[10] = [
|
|
1856
|
+
n("svg", {
|
|
1857
|
+
viewBox: "0 0 1024 1024",
|
|
1858
|
+
width: "12",
|
|
1859
|
+
height: "12"
|
|
1860
|
+
}, [
|
|
1861
|
+
n("path", {
|
|
1862
|
+
d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.8 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z",
|
|
1863
|
+
fill: "currentColor"
|
|
1864
|
+
})
|
|
1865
|
+
], -1)
|
|
1866
|
+
])])
|
|
1867
|
+
]),
|
|
1868
|
+
n("div", Bn, [
|
|
1869
|
+
n("table", Tn, [
|
|
1870
|
+
n("thead", null, [
|
|
1871
|
+
n("tr", null, [
|
|
1872
|
+
(a(), i(re, null, ve(U, (P) => n("th", {
|
|
1873
|
+
key: P,
|
|
1874
|
+
class: "nh-date-table-th"
|
|
1875
|
+
}, G(P), 1)), 64))
|
|
1876
|
+
])
|
|
1877
|
+
]),
|
|
1878
|
+
n("tbody", null, [
|
|
1879
|
+
(a(!0), i(re, null, ve(Ce.value, (P, se) => (a(), i("tr", {
|
|
1880
|
+
key: `start-week-${se}`
|
|
1881
|
+
}, [
|
|
1882
|
+
(a(!0), i(re, null, ve(P, (le, ie) => (a(), i("td", {
|
|
1883
|
+
key: `start-day-${se}-${ie}`,
|
|
1884
|
+
class: z($e(le)),
|
|
1885
|
+
onClick: (xe) => Ie(le, "start")
|
|
1886
|
+
}, [
|
|
1887
|
+
n("div", Kn, [
|
|
1888
|
+
le ? (a(), i("span", Hn, G(le.day), 1)) : A("", !0)
|
|
1889
|
+
])
|
|
1890
|
+
], 10, zn))), 128))
|
|
1891
|
+
]))), 128))
|
|
1892
|
+
])
|
|
1893
|
+
])
|
|
1894
|
+
])
|
|
1895
|
+
])
|
|
1896
|
+
]),
|
|
1897
|
+
n("div", Rn, [
|
|
1898
|
+
n("div", Vn, [
|
|
1899
|
+
n("div", An, [
|
|
1900
|
+
n("button", {
|
|
1901
|
+
onClick: r[2] || (r[2] = (P) => ce("end", -1)),
|
|
1902
|
+
class: "nh-date-picker-btn nh-date-picker-prev-btn",
|
|
1903
|
+
type: "button"
|
|
1904
|
+
}, [...r[11] || (r[11] = [
|
|
1905
|
+
n("svg", {
|
|
1906
|
+
viewBox: "0 0 1024 1024",
|
|
1907
|
+
width: "12",
|
|
1908
|
+
height: "12"
|
|
1909
|
+
}, [
|
|
1910
|
+
n("path", {
|
|
1911
|
+
d: "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.2 4.1 12.9 0.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z",
|
|
1912
|
+
fill: "currentColor"
|
|
1913
|
+
})
|
|
1914
|
+
], -1)
|
|
1915
|
+
])]),
|
|
1916
|
+
n("span", Fn, G(X(u.value.year, u.value.month)), 1),
|
|
1917
|
+
n("button", {
|
|
1918
|
+
onClick: r[3] || (r[3] = (P) => ce("end", 1)),
|
|
1919
|
+
class: "nh-date-picker-btn nh-date-picker-next-btn",
|
|
1920
|
+
type: "button"
|
|
1921
|
+
}, [...r[12] || (r[12] = [
|
|
1922
|
+
n("svg", {
|
|
1923
|
+
viewBox: "0 0 1024 1024",
|
|
1924
|
+
width: "12",
|
|
1925
|
+
height: "12"
|
|
1926
|
+
}, [
|
|
1927
|
+
n("path", {
|
|
1928
|
+
d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.8 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z",
|
|
1929
|
+
fill: "currentColor"
|
|
1930
|
+
})
|
|
1931
|
+
], -1)
|
|
1932
|
+
])])
|
|
1933
|
+
]),
|
|
1934
|
+
n("div", Wn, [
|
|
1935
|
+
n("table", Nn, [
|
|
1936
|
+
n("thead", null, [
|
|
1937
|
+
n("tr", null, [
|
|
1938
|
+
(a(), i(re, null, ve(U, (P) => n("th", {
|
|
1939
|
+
key: P,
|
|
1940
|
+
class: "nh-date-table-th"
|
|
1941
|
+
}, G(P), 1)), 64))
|
|
1942
|
+
])
|
|
1943
|
+
]),
|
|
1944
|
+
n("tbody", null, [
|
|
1945
|
+
(a(!0), i(re, null, ve(ze.value, (P, se) => (a(), i("tr", {
|
|
1946
|
+
key: `end-week-${se}`
|
|
1947
|
+
}, [
|
|
1948
|
+
(a(!0), i(re, null, ve(P, (le, ie) => (a(), i("td", {
|
|
1949
|
+
key: `end-day-${se}-${ie}`,
|
|
1950
|
+
class: z($e(le)),
|
|
1951
|
+
onClick: (xe) => Ie(le, "end")
|
|
1952
|
+
}, [
|
|
1953
|
+
n("div", Yn, [
|
|
1954
|
+
le ? (a(), i("span", jn, G(le.day), 1)) : A("", !0)
|
|
1955
|
+
])
|
|
1956
|
+
], 10, Pn))), 128))
|
|
1957
|
+
]))), 128))
|
|
1958
|
+
])
|
|
1959
|
+
])
|
|
1960
|
+
])
|
|
1961
|
+
])
|
|
1962
|
+
])
|
|
1963
|
+
]),
|
|
1964
|
+
n("div", On, [
|
|
1965
|
+
e.clearable ? (a(), Le(E, {
|
|
1966
|
+
key: 0,
|
|
1967
|
+
onClick: He,
|
|
1968
|
+
variant: "secondary",
|
|
1969
|
+
size: e.size
|
|
1970
|
+
}, {
|
|
1971
|
+
default: he(() => [...r[13] || (r[13] = [
|
|
1972
|
+
De(" 清空 ", -1)
|
|
1973
|
+
])]),
|
|
1974
|
+
_: 1
|
|
1975
|
+
}, 8, ["size"])) : A("", !0),
|
|
1976
|
+
de(E, {
|
|
1977
|
+
onClick: Ae,
|
|
1978
|
+
disabled: !M.value,
|
|
1979
|
+
variant: "primary",
|
|
1980
|
+
size: e.size
|
|
1981
|
+
}, {
|
|
1982
|
+
default: he(() => [
|
|
1983
|
+
De(G(N.value && !$.value ? "继续选择结束日期" : "确认"), 1)
|
|
1984
|
+
]),
|
|
1985
|
+
_: 1
|
|
1986
|
+
}, 8, ["disabled", "size"])
|
|
1987
|
+
])
|
|
1988
|
+
])
|
|
1989
|
+
], 34)) : A("", !0)
|
|
1990
|
+
]),
|
|
1991
|
+
_: 1
|
|
1992
|
+
})
|
|
1993
|
+
])
|
|
1994
|
+
], 2);
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
}), Je = /* @__PURE__ */ we(Un, [["__scopeId", "data-v-188f57ca"]]), qn = ["aria-checked", "aria-disabled", "disabled", "onKeydown"], Zn = { class: "yswitch__thumb" }, Qn = {
|
|
1998
|
+
key: 0,
|
|
1999
|
+
class: "yswitch__spinner",
|
|
2000
|
+
"aria-hidden": "true"
|
|
2001
|
+
}, Jn = /* @__PURE__ */ me({
|
|
2002
|
+
__name: "yswitch",
|
|
2003
|
+
props: {
|
|
2004
|
+
modelValue: { default: !1 },
|
|
2005
|
+
trueValue: { default: !0 },
|
|
2006
|
+
falseValue: { default: !1 },
|
|
2007
|
+
disabled: { type: Boolean, default: !1 },
|
|
2008
|
+
loading: { type: Boolean, default: !1 },
|
|
2009
|
+
size: { default: "medium" },
|
|
2010
|
+
activeColor: { default: "#10b981" },
|
|
2011
|
+
inactiveColor: { default: "#e5e7eb" },
|
|
2012
|
+
activeText: { default: "开" },
|
|
2013
|
+
inactiveText: { default: "关" },
|
|
2014
|
+
showText: { type: Boolean, default: !1 }
|
|
2015
|
+
},
|
|
2016
|
+
emits: ["update:modelValue", "change", "focus", "blur"],
|
|
2017
|
+
setup(e, { emit: m }) {
|
|
2018
|
+
const t = e, l = m, c = R(), s = O(() => t.modelValue === t.trueValue), k = O(() => {
|
|
2019
|
+
const L = {};
|
|
2020
|
+
return L.background = s.value ? t.activeColor : t.inactiveColor, L;
|
|
2021
|
+
});
|
|
2022
|
+
function C() {
|
|
2023
|
+
if (t.disabled || t.loading) return;
|
|
2024
|
+
const L = s.value ? t.falseValue : t.trueValue;
|
|
2025
|
+
l("update:modelValue", L), l("change", L);
|
|
2026
|
+
}
|
|
2027
|
+
return _e(() => {
|
|
2028
|
+
const L = c.value;
|
|
2029
|
+
L && (L.addEventListener("focus", (I) => l("focus", I)), L.addEventListener("blur", (I) => l("blur", I)));
|
|
2030
|
+
}), (L, I) => (a(), i("button", {
|
|
2031
|
+
ref_key: "rootEl",
|
|
2032
|
+
ref: c,
|
|
2033
|
+
class: z(["yswitch", [
|
|
2034
|
+
`yswitch--${e.size}`,
|
|
2035
|
+
{ "yswitch--checked": s.value, "yswitch--disabled": e.disabled, "yswitch--loading": e.loading }
|
|
2036
|
+
]]),
|
|
2037
|
+
style: ye(k.value),
|
|
2038
|
+
role: "switch",
|
|
2039
|
+
"aria-checked": s.value,
|
|
2040
|
+
"aria-disabled": e.disabled,
|
|
2041
|
+
disabled: e.disabled || e.loading,
|
|
2042
|
+
onClick: C,
|
|
2043
|
+
onKeydown: [
|
|
2044
|
+
be(Q(C, ["prevent"]), ["enter"]),
|
|
2045
|
+
be(Q(C, ["prevent"]), ["space"])
|
|
2046
|
+
]
|
|
2047
|
+
}, [
|
|
2048
|
+
I[0] || (I[0] = n("span", { class: "yswitch__track" }, null, -1)),
|
|
2049
|
+
n("span", Zn, [
|
|
2050
|
+
e.loading ? (a(), i("span", Qn)) : A("", !0)
|
|
2051
|
+
]),
|
|
2052
|
+
e.showText ? (a(), i("span", {
|
|
2053
|
+
key: 0,
|
|
2054
|
+
class: z(["yswitch__label", { "yswitch__label--left": !s.value, "yswitch__label--right": s.value }])
|
|
2055
|
+
}, G(s.value ? e.activeText : e.inactiveText), 3)) : A("", !0)
|
|
2056
|
+
], 46, qn));
|
|
2057
|
+
}
|
|
2058
|
+
}), Xn = /* @__PURE__ */ we(Jn, [["__scopeId", "data-v-0b157fc4"]]), Gn = ["src", "alt"], el = ["src", "alt"], tl = /* @__PURE__ */ me({
|
|
2059
|
+
__name: "yimage",
|
|
2060
|
+
props: {
|
|
2061
|
+
src: {},
|
|
2062
|
+
alt: { default: "" },
|
|
2063
|
+
width: {},
|
|
2064
|
+
height: {},
|
|
2065
|
+
lazy: { type: Boolean, default: !0 },
|
|
2066
|
+
preview: { type: Boolean, default: !0 },
|
|
2067
|
+
fit: { default: "cover" },
|
|
2068
|
+
radius: { default: "0" },
|
|
2069
|
+
className: { default: "" },
|
|
2070
|
+
previewSrcList: {}
|
|
2071
|
+
},
|
|
2072
|
+
emits: ["load", "error", "preview"],
|
|
2073
|
+
setup(e, { expose: m, emit: t }) {
|
|
2074
|
+
const l = e, c = t, s = R(), k = R(), C = R(), L = R(!1), I = R(!1), h = R(!1), d = R(!1), u = R(!1), K = R("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDIwMCAyMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPCEtLSDog4zmma8gLS0+CiAgPHJlY3Qgd2lkdGg9IjIwMCIgaGVpZ2h0PSIyMDAiIGZpbGw9IiNGM0Y0RjYiLz4KICAKICA8IS0tIOWbvueJh+WbvuaghyAtLT4KICA8cmVjdCB4PSI1MCIgeT0iNDAiIHdpZHRoPSIxMDAiIGhlaWdodD0iODAiIHJ4PSI0IiBmaWxsPSIjRDFENURCIiBzdHJva2U9IiM5Q0EzQUYiIHN0cm9rZS13aWR0aD0iMiIvPgogIAogIDwhLS0g5Zu+54mH5YaF6YOo6KOF6aWwIC0tPgogIDxjaXJjbGUgY3g9IjgwIiBjeT0iNzAiIHI9IjgiIGZpbGw9IiM5Q0EzQUYiLz4KICA8cGF0aCBkPSJNNjAgMTAwIEw5MCA4NSBMMTIwIDk1IEwxNDAgODAiIHN0cm9rZT0iIzlDQTNBRiIgc3Ryb2tlLXdpZHRoPSIyIiBmaWxsPSJub25lIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KICAKICA8IS0tIOaWh+WtlyAtLT4KICA8dGV4dCB4PSIxMDAiIHk9IjE2MCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iIzZCNzI4MCIgZm9udC1mYW1pbHk9IkFyaWFsLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjEyIiBmb250LXdlaWdodD0iNTAwIj4KICAgIEltYWdlIG5vdCBhdmFpbGFibGUKICA8L3RleHQ+Cjwvc3ZnPiA="), j = R(""), U = R(1), N = R(!1), $ = R({
|
|
2075
|
+
overflow: "",
|
|
2076
|
+
paddingRight: ""
|
|
2077
|
+
}), V = O(() => [
|
|
2078
|
+
l.className,
|
|
2079
|
+
"overflow-hidden"
|
|
2080
|
+
].filter(Boolean).join(" ")), H = O(() => [
|
|
2081
|
+
X(),
|
|
2082
|
+
ae()
|
|
2083
|
+
].filter(Boolean).join(" ")), T = O(() => [
|
|
2084
|
+
"w-full h-full bg-white",
|
|
2085
|
+
pe(),
|
|
2086
|
+
ae(),
|
|
2087
|
+
l.preview ? "cursor-pointer hover:opacity-90 transition-opacity duration-200" : ""
|
|
2088
|
+
].filter(Boolean).join(" ")), q = O(() => [
|
|
2089
|
+
X(),
|
|
2090
|
+
ae()
|
|
2091
|
+
].filter(Boolean).join(" ")), te = O(() => {
|
|
2092
|
+
const Y = {};
|
|
2093
|
+
return l.width && (Y.width = typeof l.width == "number" ? `${l.width}px` : l.width), l.height && (Y.height = typeof l.height == "number" ? `${l.height}px` : l.height), Y;
|
|
2094
|
+
}), X = () => l.width && l.height ? "" : "w-full h-full", pe = () => ({
|
|
2095
|
+
cover: "object-cover",
|
|
2096
|
+
contain: "object-contain",
|
|
2097
|
+
fill: "object-fill",
|
|
2098
|
+
none: "object-none",
|
|
2099
|
+
"scale-down": "object-scale-down"
|
|
2100
|
+
})[l.fit] || "object-cover", ae = () => typeof l.radius == "number" ? `rounded-${l.radius}` : typeof l.radius == "string" ? l.radius.includes("px") ? "" : `rounded-${l.radius}` : "", y = () => {
|
|
2101
|
+
const Y = document.createElement("div");
|
|
2102
|
+
Y.style.cssText = "width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px;", document.body.appendChild(Y);
|
|
2103
|
+
const ee = Y.offsetWidth - Y.clientWidth;
|
|
2104
|
+
return document.body.removeChild(Y), ee;
|
|
2105
|
+
}, g = () => {
|
|
2106
|
+
if ($.value = {
|
|
2107
|
+
overflow: document.body.style.overflow || "",
|
|
2108
|
+
paddingRight: document.body.style.paddingRight || ""
|
|
2109
|
+
}, document.body.scrollHeight > window.innerHeight) {
|
|
2110
|
+
const ee = y();
|
|
2111
|
+
document.body.style.paddingRight = `${ee}px`;
|
|
2112
|
+
}
|
|
2113
|
+
document.body.style.overflow = "hidden";
|
|
2114
|
+
}, v = () => {
|
|
2115
|
+
document.body.style.overflow = $.value.overflow, document.body.style.paddingRight = $.value.paddingRight;
|
|
2116
|
+
};
|
|
2117
|
+
let f = null;
|
|
2118
|
+
const w = () => {
|
|
2119
|
+
!l.lazy || !s.value || (f = new IntersectionObserver(
|
|
2120
|
+
(Y) => {
|
|
2121
|
+
Y.forEach((ee) => {
|
|
2122
|
+
ee.isIntersecting && (d.value = !0, K.value = l.src, f == null || f.unobserve(ee.target));
|
|
2123
|
+
});
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
rootMargin: "50px"
|
|
2127
|
+
}
|
|
2128
|
+
), f.observe(s.value));
|
|
2129
|
+
}, b = (Y) => {
|
|
2130
|
+
L.value = !0, I.value = !1, h.value = !1, c("load", Y);
|
|
2131
|
+
}, S = (Y) => {
|
|
2132
|
+
h.value = !0, I.value = !1, L.value = !1, c("error", Y);
|
|
2133
|
+
}, W = () => {
|
|
2134
|
+
h.value = !1, I.value = !0, L.value = !1, fe(() => {
|
|
2135
|
+
k.value && (k.value.src = l.src);
|
|
2136
|
+
});
|
|
2137
|
+
}, p = () => {
|
|
2138
|
+
if (!l.preview || h.value) return;
|
|
2139
|
+
U.value = 1;
|
|
2140
|
+
const Y = new Image();
|
|
2141
|
+
Y.onload = () => {
|
|
2142
|
+
j.value = l.src, fe(() => {
|
|
2143
|
+
u.value = !0, g(), c("preview", l.src);
|
|
2144
|
+
});
|
|
2145
|
+
}, Y.onerror = () => {
|
|
2146
|
+
j.value = l.src, u.value = !0, g(), c("preview", l.src);
|
|
2147
|
+
}, Y.src = l.src;
|
|
2148
|
+
}, D = () => {
|
|
2149
|
+
u.value = !1, setTimeout(() => {
|
|
2150
|
+
v();
|
|
2151
|
+
}, 300);
|
|
2152
|
+
}, F = (Y) => {
|
|
2153
|
+
const ee = Y.deltaY < 0 ? 1 : -1;
|
|
2154
|
+
let $e = U.value + ee * 0.1;
|
|
2155
|
+
$e = Math.max(0.5, Math.min(2, $e)), U.value = $e;
|
|
2156
|
+
};
|
|
2157
|
+
return _e(() => {
|
|
2158
|
+
l.lazy ? w() : d.value = !0, d.value && (I.value = !0), N.value = !0;
|
|
2159
|
+
}), Be(() => {
|
|
2160
|
+
f && f.disconnect(), u.value && v();
|
|
2161
|
+
}), oe(() => K.value, () => {
|
|
2162
|
+
l.src && d.value && (I.value = !0, h.value = !1, L.value = !1);
|
|
2163
|
+
}), oe(() => l.src, (Y) => {
|
|
2164
|
+
K.value = Y || "";
|
|
2165
|
+
}), m({
|
|
2166
|
+
retryLoad: W,
|
|
2167
|
+
closePreview: D
|
|
2168
|
+
}), (Y, ee) => (a(), i("div", {
|
|
2169
|
+
ref_key: "containerRef",
|
|
2170
|
+
ref: s,
|
|
2171
|
+
class: z(["relative inline-block", V.value])
|
|
2172
|
+
}, [
|
|
2173
|
+
!L.value && !h.value && !d.value ? (a(), i("div", {
|
|
2174
|
+
key: 0,
|
|
2175
|
+
class: z(["bg-gray-200 animate-pulse rounded", H.value])
|
|
2176
|
+
}, [...ee[1] || (ee[1] = [
|
|
2177
|
+
n("div", { class: "flex items-center justify-center h-full" }, [
|
|
2178
|
+
n("svg", {
|
|
2179
|
+
class: "w-6 h-6 text-gray-400",
|
|
2180
|
+
fill: "none",
|
|
2181
|
+
stroke: "currentColor",
|
|
2182
|
+
viewBox: "0 0 24 24"
|
|
2183
|
+
}, [
|
|
2184
|
+
n("path", {
|
|
2185
|
+
"stroke-linecap": "round",
|
|
2186
|
+
"stroke-linejoin": "round",
|
|
2187
|
+
"stroke-width": "2",
|
|
2188
|
+
d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
2189
|
+
})
|
|
2190
|
+
])
|
|
2191
|
+
], -1)
|
|
2192
|
+
])], 2)) : A("", !0),
|
|
2193
|
+
I.value && !h.value ? (a(), i("div", {
|
|
2194
|
+
key: 1,
|
|
2195
|
+
class: z(["absolute inset-0 flex items-center justify-center bg-gray-100 rounded", T.value])
|
|
2196
|
+
}, [...ee[2] || (ee[2] = [
|
|
2197
|
+
n("div", { class: "flex flex-col items-center space-y-2" }, [
|
|
2198
|
+
n("div", { class: "w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin" })
|
|
2199
|
+
], -1)
|
|
2200
|
+
])], 2)) : A("", !0),
|
|
2201
|
+
h.value ? (a(), i("div", {
|
|
2202
|
+
key: 2,
|
|
2203
|
+
class: z(["bg-gray-100 rounded flex items-center justify-center", q.value]),
|
|
2204
|
+
onClick: W
|
|
2205
|
+
}, [
|
|
2206
|
+
n("img", {
|
|
2207
|
+
src: "https://img.nihaojewelry.com/media/2025/6/27/1938511770352222208.png",
|
|
2208
|
+
alt: "Error Image",
|
|
2209
|
+
class: z(["w-[70%] h-[70%] object-contain cursor-pointer", ae()])
|
|
2210
|
+
}, null, 2)
|
|
2211
|
+
], 2)) : A("", !0),
|
|
2212
|
+
Ee(n("img", {
|
|
2213
|
+
ref_key: "imageRef",
|
|
2214
|
+
ref: k,
|
|
2215
|
+
src: K.value,
|
|
2216
|
+
alt: e.alt,
|
|
2217
|
+
class: z(T.value),
|
|
2218
|
+
onLoad: b,
|
|
2219
|
+
onError: S,
|
|
2220
|
+
onClick: p,
|
|
2221
|
+
style: ye(te.value)
|
|
2222
|
+
}, null, 46, Gn), [
|
|
2223
|
+
[Ke, L.value && !h.value]
|
|
2224
|
+
]),
|
|
2225
|
+
N.value ? (a(), Le(Ve, {
|
|
2226
|
+
key: 3,
|
|
2227
|
+
to: "body"
|
|
2228
|
+
}, [
|
|
2229
|
+
de(ke, { name: "fade" }, {
|
|
2230
|
+
default: he(() => [
|
|
2231
|
+
u.value ? (a(), i("div", {
|
|
2232
|
+
key: 0,
|
|
2233
|
+
class: "fixed inset-0 bg-black/75 flex items-center justify-center",
|
|
2234
|
+
style: { "z-index": "99999" },
|
|
2235
|
+
onClick: Q(D, ["self"]),
|
|
2236
|
+
onWheel: Q(F, ["prevent"])
|
|
2237
|
+
}, [
|
|
2238
|
+
n("div", {
|
|
2239
|
+
class: z(["relative max-w-4xl max-h-full p-4 transform transition-transform duration-300", { "scale-100": u.value, "scale-95": !u.value }])
|
|
2240
|
+
}, [
|
|
2241
|
+
n("img", {
|
|
2242
|
+
ref_key: "previewImageRef",
|
|
2243
|
+
ref: C,
|
|
2244
|
+
src: l.previewSrcList || j.value || l.src,
|
|
2245
|
+
alt: e.alt,
|
|
2246
|
+
class: "max-w-full max-h-full object-contain rounded shadow-2xl transition-transform duration-200",
|
|
2247
|
+
style: ye({ transform: `scale(${U.value})` }),
|
|
2248
|
+
onClick: ee[0] || (ee[0] = Q(() => {
|
|
2249
|
+
}, ["stop"]))
|
|
2250
|
+
}, null, 12, el)
|
|
2251
|
+
], 2)
|
|
2252
|
+
], 32)) : A("", !0)
|
|
2253
|
+
]),
|
|
2254
|
+
_: 1
|
|
2255
|
+
})
|
|
2256
|
+
])) : A("", !0)
|
|
2257
|
+
], 2));
|
|
2258
|
+
}
|
|
2259
|
+
}), nl = /* @__PURE__ */ we(tl, [["__scopeId", "data-v-bb70f12d"]]), ll = /* @__PURE__ */ me({
|
|
2260
|
+
__name: "ydropdown",
|
|
2261
|
+
props: {
|
|
2262
|
+
trigger: { default: "hover" },
|
|
2263
|
+
placement: { default: "bottom" },
|
|
2264
|
+
disabled: { type: Boolean, default: !1 }
|
|
2265
|
+
},
|
|
2266
|
+
setup(e) {
|
|
2267
|
+
const m = e, t = R(!1), l = R();
|
|
2268
|
+
let c = null;
|
|
2269
|
+
const s = O(() => `y-dropdown__menu--${m.placement}`), k = () => {
|
|
2270
|
+
console.log("显示下拉菜单", t.value), !m.disabled && (c && (clearTimeout(c), c = null), t.value = !0, console.log("设置 visible 为 true", t.value), fe(() => {
|
|
2271
|
+
L();
|
|
2272
|
+
}));
|
|
2273
|
+
}, C = () => {
|
|
2274
|
+
console.log("隐藏下拉菜单"), c = setTimeout(() => {
|
|
2275
|
+
t.value = !1, console.log("设置 visible 为 false", t.value);
|
|
2276
|
+
}, 150);
|
|
2277
|
+
}, L = () => {
|
|
2278
|
+
if (!l.value) return;
|
|
2279
|
+
const d = l.value.querySelector(".y-dropdown__trigger"), u = l.value.querySelector(".y-dropdown__menu");
|
|
2280
|
+
if (!d || !u) return;
|
|
2281
|
+
const K = d.getBoundingClientRect(), j = u.getBoundingClientRect(), U = window.innerWidth, N = window.innerHeight;
|
|
2282
|
+
u.style.top = "", u.style.left = "", u.style.right = "", u.style.bottom = "", u.style.transform = "";
|
|
2283
|
+
let $ = 0, V = 0;
|
|
2284
|
+
switch (m.placement) {
|
|
2285
|
+
case "bottom":
|
|
2286
|
+
$ = K.height + 4, V = 0;
|
|
2287
|
+
break;
|
|
2288
|
+
case "top":
|
|
2289
|
+
$ = -(j.height + 4), V = 0;
|
|
2290
|
+
break;
|
|
2291
|
+
case "right":
|
|
2292
|
+
$ = 0, V = K.width + 4;
|
|
2293
|
+
break;
|
|
2294
|
+
case "left":
|
|
2295
|
+
$ = 0, V = -(j.width + 4);
|
|
2296
|
+
break;
|
|
2297
|
+
}
|
|
2298
|
+
let H = K.top + $, T = K.left + V;
|
|
2299
|
+
if (m.placement === "bottom" || m.placement === "top") {
|
|
2300
|
+
const q = j.width || 260;
|
|
2301
|
+
T + q > U - 10 && (T = U - q - 10), T < 10 && (T = 10);
|
|
2302
|
+
}
|
|
2303
|
+
if (m.placement === "left" || m.placement === "right") {
|
|
2304
|
+
const q = j.height || 200;
|
|
2305
|
+
H + q > N - 10 && (H = N - q - 10), H < 10 && (H = 10);
|
|
2306
|
+
}
|
|
2307
|
+
u.style.top = `${H}px`, u.style.left = `${T}px`;
|
|
2308
|
+
}, I = (d) => {
|
|
2309
|
+
m.trigger === "click" && l.value && !l.value.contains(d.target) && (t.value = !1);
|
|
2310
|
+
}, h = () => {
|
|
2311
|
+
t.value && L();
|
|
2312
|
+
};
|
|
2313
|
+
return _e(() => {
|
|
2314
|
+
m.trigger === "click" && document.addEventListener("click", I), window.addEventListener("resize", h), window.addEventListener("scroll", h);
|
|
2315
|
+
}), Be(() => {
|
|
2316
|
+
m.trigger === "click" && document.removeEventListener("click", I), c && clearTimeout(c), window.removeEventListener("resize", h), window.removeEventListener("scroll", h);
|
|
2317
|
+
}), (d, u) => (a(), i("div", {
|
|
2318
|
+
class: "y-dropdown",
|
|
2319
|
+
ref_key: "dropdownRef",
|
|
2320
|
+
ref: l
|
|
2321
|
+
}, [
|
|
2322
|
+
n("div", {
|
|
2323
|
+
class: "y-dropdown__trigger",
|
|
2324
|
+
onMouseenter: k,
|
|
2325
|
+
onMouseleave: C
|
|
2326
|
+
}, [
|
|
2327
|
+
ue(d.$slots, "trigger", {}, () => [
|
|
2328
|
+
u[0] || (u[0] = n("button", { class: "y-dropdown__button" }, " 下拉菜单 ", -1))
|
|
2329
|
+
], !0)
|
|
2330
|
+
], 32),
|
|
2331
|
+
de(ke, {
|
|
2332
|
+
name: "dropdown-fade",
|
|
2333
|
+
appear: ""
|
|
2334
|
+
}, {
|
|
2335
|
+
default: he(() => [
|
|
2336
|
+
Ee(n("div", {
|
|
2337
|
+
class: z(["y-dropdown__menu", s.value]),
|
|
2338
|
+
onMouseenter: k,
|
|
2339
|
+
onMouseleave: C
|
|
2340
|
+
}, [
|
|
2341
|
+
ue(d.$slots, "default", {}, () => [
|
|
2342
|
+
u[1] || (u[1] = n("div", { class: "y-dropdown__item" }, "选项 1", -1)),
|
|
2343
|
+
u[2] || (u[2] = n("div", { class: "y-dropdown__item" }, "选项 2", -1)),
|
|
2344
|
+
u[3] || (u[3] = n("div", { class: "y-dropdown__item" }, "选项 3", -1))
|
|
2345
|
+
], !0)
|
|
2346
|
+
], 34), [
|
|
2347
|
+
[Ke, t.value]
|
|
2348
|
+
])
|
|
2349
|
+
]),
|
|
2350
|
+
_: 3
|
|
2351
|
+
})
|
|
2352
|
+
], 512));
|
|
2353
|
+
}
|
|
2354
|
+
}), ol = /* @__PURE__ */ we(ll, [["__scopeId", "data-v-ed80047f"]]), al = ["aria-hidden"], sl = ["onKeydown"], il = {
|
|
2355
|
+
key: 0,
|
|
2356
|
+
class: "y-drawer-header"
|
|
2357
|
+
}, rl = { class: "y-drawer-title" }, ul = { class: "y-drawer-body" }, dl = {
|
|
2358
|
+
key: 1,
|
|
2359
|
+
class: "y-drawer-footer"
|
|
2360
|
+
}, cl = /* @__PURE__ */ me({
|
|
2361
|
+
__name: "ydrawer",
|
|
2362
|
+
props: {
|
|
2363
|
+
modelValue: { type: Boolean, default: !1 },
|
|
2364
|
+
placement: { default: "right" },
|
|
2365
|
+
width: { default: "420px" },
|
|
2366
|
+
height: { default: "60vh" },
|
|
2367
|
+
title: { default: "" },
|
|
2368
|
+
closable: { type: Boolean, default: !0 },
|
|
2369
|
+
maskClosable: { type: Boolean, default: !0 },
|
|
2370
|
+
zIndex: { default: 3e3 },
|
|
2371
|
+
showHeader: { type: Boolean, default: !0 }
|
|
2372
|
+
},
|
|
2373
|
+
emits: ["update:modelValue", "open", "close"],
|
|
2374
|
+
setup(e, { emit: m }) {
|
|
2375
|
+
const t = e, l = m, c = O({
|
|
2376
|
+
get: () => t.modelValue,
|
|
2377
|
+
set: (K) => l("update:modelValue", K)
|
|
2378
|
+
}), s = R(null), k = O(() => t.placement === "right" ? "drawer-slide-right" : "drawer-slide-bottom"), C = O(() => t.placement === "right" ? "rounded-left" : "rounded-top"), L = O(() => {
|
|
2379
|
+
const K = {};
|
|
2380
|
+
return t.placement === "right" ? (K.width = typeof t.width == "number" ? `${t.width}px` : String(t.width), K.height = "100%", K.right = "0", K.top = "0") : (K.height = typeof t.height == "number" ? `${t.height}px` : String(t.height), K.width = "100%", K.bottom = "0", K.left = "0"), K;
|
|
2381
|
+
});
|
|
2382
|
+
function I() {
|
|
2383
|
+
t.maskClosable && h();
|
|
2384
|
+
}
|
|
2385
|
+
function h() {
|
|
2386
|
+
c.value && (c.value = !1, l("close"));
|
|
2387
|
+
}
|
|
2388
|
+
function d() {
|
|
2389
|
+
t.closable && h();
|
|
2390
|
+
}
|
|
2391
|
+
function u(K) {
|
|
2392
|
+
K.key === "Escape" && d();
|
|
2393
|
+
}
|
|
2394
|
+
return oe(() => t.modelValue, (K) => {
|
|
2395
|
+
K ? (l("open"), requestAnimationFrame(() => {
|
|
2396
|
+
var j;
|
|
2397
|
+
return (j = s.value) == null ? void 0 : j.focus();
|
|
2398
|
+
}), document.addEventListener("keydown", u), document.body.style.overflow = "hidden") : (document.removeEventListener("keydown", u), document.body.style.overflow = "");
|
|
2399
|
+
}), _e(() => {
|
|
2400
|
+
t.modelValue && (document.addEventListener("keydown", u), document.body.style.overflow = "hidden");
|
|
2401
|
+
}), Be(() => {
|
|
2402
|
+
document.removeEventListener("keydown", u), document.body.style.overflow = "";
|
|
2403
|
+
}), (K, j) => (a(), Le(Ve, { to: "body" }, [
|
|
2404
|
+
Ee(n("div", {
|
|
2405
|
+
class: "y-drawer-root",
|
|
2406
|
+
role: "dialog",
|
|
2407
|
+
"aria-modal": !0,
|
|
2408
|
+
"aria-hidden": !c.value,
|
|
2409
|
+
style: ye({ zIndex: String(e.zIndex) })
|
|
2410
|
+
}, [
|
|
2411
|
+
n("div", {
|
|
2412
|
+
class: "y-drawer-mask",
|
|
2413
|
+
onClick: I
|
|
2414
|
+
}),
|
|
2415
|
+
de(ke, { name: k.value }, {
|
|
2416
|
+
default: he(() => [
|
|
2417
|
+
Ee(n("div", {
|
|
2418
|
+
ref_key: "panelRef",
|
|
2419
|
+
ref: s,
|
|
2420
|
+
class: z(["y-drawer-panel", [
|
|
2421
|
+
`is-${e.placement}`,
|
|
2422
|
+
C.value
|
|
2423
|
+
]]),
|
|
2424
|
+
style: ye(L.value),
|
|
2425
|
+
onKeydown: be(Q(d, ["prevent", "stop"]), ["esc"]),
|
|
2426
|
+
tabindex: "-1"
|
|
2427
|
+
}, [
|
|
2428
|
+
e.showHeader ? (a(), i("div", il, [
|
|
2429
|
+
n("div", rl, G(e.title), 1),
|
|
2430
|
+
e.closable ? (a(), i("button", {
|
|
2431
|
+
key: 0,
|
|
2432
|
+
type: "button",
|
|
2433
|
+
class: "y-drawer-close",
|
|
2434
|
+
"aria-label": "Close",
|
|
2435
|
+
onClick: h
|
|
2436
|
+
}, " ✕ ")) : A("", !0)
|
|
2437
|
+
])) : A("", !0),
|
|
2438
|
+
n("div", ul, [
|
|
2439
|
+
ue(K.$slots, "default", {}, void 0, !0)
|
|
2440
|
+
]),
|
|
2441
|
+
K.$slots.footer ? (a(), i("div", dl, [
|
|
2442
|
+
ue(K.$slots, "footer", {}, void 0, !0)
|
|
2443
|
+
])) : A("", !0)
|
|
2444
|
+
], 46, sl), [
|
|
2445
|
+
[Ke, c.value]
|
|
2446
|
+
])
|
|
2447
|
+
]),
|
|
2448
|
+
_: 3
|
|
2449
|
+
}, 8, ["name"])
|
|
2450
|
+
], 12, al), [
|
|
2451
|
+
[Ke, c.value]
|
|
2452
|
+
])
|
|
2453
|
+
]));
|
|
2454
|
+
}
|
|
2455
|
+
}), fl = /* @__PURE__ */ we(cl, [["__scopeId", "data-v-b2797950"]]), vl = { class: "ytree__container" }, hl = ["data-level", "onClick", "onContextmenu"], pl = ["onClick"], gl = {
|
|
2456
|
+
key: 1,
|
|
2457
|
+
class: "w-[16px]"
|
|
2458
|
+
}, yl = ["onClick"], ml = {
|
|
2459
|
+
key: 0,
|
|
2460
|
+
width: "12",
|
|
2461
|
+
height: "12",
|
|
2462
|
+
viewBox: "0 0 12 12",
|
|
2463
|
+
fill: "none"
|
|
2464
|
+
}, wl = {
|
|
2465
|
+
key: 1,
|
|
2466
|
+
width: "12",
|
|
2467
|
+
height: "12",
|
|
2468
|
+
viewBox: "0 0 12 12",
|
|
2469
|
+
fill: "none"
|
|
2470
|
+
}, bl = ["src", "alt"], kl = { class: "ytree-node__custom-content" }, xl = {
|
|
2471
|
+
key: 0,
|
|
2472
|
+
class: "ytree-node__children"
|
|
2473
|
+
}, Dl = ["data-level", "onClick", "onContextmenu"], $l = ["onClick"], Cl = {
|
|
2474
|
+
key: 1,
|
|
2475
|
+
class: "w-[16px]"
|
|
2476
|
+
}, _l = ["onClick"], Sl = {
|
|
2477
|
+
key: 0,
|
|
2478
|
+
width: "12",
|
|
2479
|
+
height: "12",
|
|
2480
|
+
viewBox: "0 0 12 12",
|
|
2481
|
+
fill: "none"
|
|
2482
|
+
}, Ml = {
|
|
2483
|
+
key: 1,
|
|
2484
|
+
width: "12",
|
|
2485
|
+
height: "12",
|
|
2486
|
+
viewBox: "0 0 12 12",
|
|
2487
|
+
fill: "none"
|
|
2488
|
+
}, Ll = ["src", "alt"], Il = { class: "ytree-node__custom-content" }, El = {
|
|
2489
|
+
key: 0,
|
|
2490
|
+
class: "ytree-node__children"
|
|
2491
|
+
}, Bl = ["data-level", "onClick", "onContextmenu"], Tl = ["onClick"], zl = {
|
|
2492
|
+
key: 1,
|
|
2493
|
+
class: "w-[16px]"
|
|
2494
|
+
}, Kl = ["onClick"], Hl = {
|
|
2495
|
+
key: 0,
|
|
2496
|
+
width: "12",
|
|
2497
|
+
height: "12",
|
|
2498
|
+
viewBox: "0 0 12 12",
|
|
2499
|
+
fill: "none"
|
|
2500
|
+
}, Rl = {
|
|
2501
|
+
key: 1,
|
|
2502
|
+
width: "12",
|
|
2503
|
+
height: "12",
|
|
2504
|
+
viewBox: "0 0 12 12",
|
|
2505
|
+
fill: "none"
|
|
2506
|
+
}, Vl = ["src", "alt"], Al = { class: "ytree-node__custom-content" }, Fl = {
|
|
2507
|
+
key: 0,
|
|
2508
|
+
class: "ytree-node__children"
|
|
2509
|
+
}, Wl = ["data-level", "onClick", "onContextmenu"], Nl = ["onClick"], Pl = {
|
|
2510
|
+
key: 1,
|
|
2511
|
+
class: "w-[16px]"
|
|
2512
|
+
}, Yl = ["onClick"], jl = {
|
|
2513
|
+
key: 0,
|
|
2514
|
+
width: "12",
|
|
2515
|
+
height: "12",
|
|
2516
|
+
viewBox: "0 0 12 12",
|
|
2517
|
+
fill: "none"
|
|
2518
|
+
}, Ol = {
|
|
2519
|
+
key: 1,
|
|
2520
|
+
width: "12",
|
|
2521
|
+
height: "12",
|
|
2522
|
+
viewBox: "0 0 12 12",
|
|
2523
|
+
fill: "none"
|
|
2524
|
+
}, Ul = ["src", "alt"], ql = { class: "ytree-node__custom-content" }, Zl = {
|
|
2525
|
+
key: 0,
|
|
2526
|
+
class: "ytree-node__children"
|
|
2527
|
+
}, Ql = ["data-level", "onClick", "onContextmenu"], Jl = ["onClick"], Xl = {
|
|
2528
|
+
key: 1,
|
|
2529
|
+
class: "w-[16px]"
|
|
2530
|
+
}, Gl = ["onClick"], eo = {
|
|
2531
|
+
key: 0,
|
|
2532
|
+
width: "12",
|
|
2533
|
+
height: "12",
|
|
2534
|
+
viewBox: "0 0 12 12",
|
|
2535
|
+
fill: "none"
|
|
2536
|
+
}, to = {
|
|
2537
|
+
key: 1,
|
|
2538
|
+
width: "12",
|
|
2539
|
+
height: "12",
|
|
2540
|
+
viewBox: "0 0 12 12",
|
|
2541
|
+
fill: "none"
|
|
2542
|
+
}, no = ["src", "alt"], lo = { class: "ytree-node__custom-content" }, oo = "https://image.nhdropshipping.com/fit-in/500x500/filters:format(webp)/media/2025/10/17/1979094146203385856/32.png", ao = "https://image.nhdropshipping.com/fit-in/500x500/filters:format(webp)/media/2025/10/17/1979095296159907840/32.png", so = /* @__PURE__ */ me({
|
|
2543
|
+
__name: "ytree",
|
|
2544
|
+
props: {
|
|
2545
|
+
data: { default: () => [] },
|
|
2546
|
+
emptyText: { default: "暂无数据" },
|
|
2547
|
+
nodeKey: { default: "id" },
|
|
2548
|
+
props: { default: () => ({
|
|
2549
|
+
children: "children",
|
|
2550
|
+
label: "label",
|
|
2551
|
+
disabled: "disabled",
|
|
2552
|
+
isLeaf: "isLeaf"
|
|
2553
|
+
}) },
|
|
2554
|
+
renderAfterExpand: { type: Boolean, default: !0 },
|
|
2555
|
+
defaultExpandAll: { type: Boolean, default: !1 },
|
|
2556
|
+
defaultExpandedKeys: { default: () => [] },
|
|
2557
|
+
defaultCheckedKeys: { default: () => [] },
|
|
2558
|
+
defaultSelectedKeys: { default: () => [] },
|
|
2559
|
+
checkStrictly: { type: Boolean, default: !1 },
|
|
2560
|
+
checkOnClickNode: { type: Boolean, default: !1 },
|
|
2561
|
+
checkDescendants: { type: Boolean, default: !0 },
|
|
2562
|
+
autoExpandParent: { type: Boolean, default: !0 },
|
|
2563
|
+
defaultChecked: { type: Boolean, default: !1 },
|
|
2564
|
+
filterNodeMethod: {},
|
|
2565
|
+
lazy: { type: Boolean, default: !1 },
|
|
2566
|
+
load: {},
|
|
2567
|
+
renderContent: {},
|
|
2568
|
+
highlightCurrent: { type: Boolean, default: !1 },
|
|
2569
|
+
expandOnClickNode: { type: Boolean, default: !0 },
|
|
2570
|
+
currentNodeKey: {},
|
|
2571
|
+
accordion: { type: Boolean, default: !1 },
|
|
2572
|
+
indent: { default: 18 },
|
|
2573
|
+
iconClass: { default: "" },
|
|
2574
|
+
showCheckbox: { type: Boolean, default: !1 },
|
|
2575
|
+
draggable: { type: Boolean, default: !1 },
|
|
2576
|
+
allowDrag: {},
|
|
2577
|
+
allowDrop: {},
|
|
2578
|
+
size: { default: "medium" },
|
|
2579
|
+
disabled: { type: Boolean, default: !1 },
|
|
2580
|
+
deptIconUrl: { default: "" },
|
|
2581
|
+
personIconUrl: { default: "" },
|
|
2582
|
+
buttonIconUrl: { default: "" },
|
|
2583
|
+
enableFourthLevelSpecialHandling: { type: Boolean, default: !1 },
|
|
2584
|
+
restrictAutoExpandFromLevel: { default: void 0 }
|
|
2585
|
+
},
|
|
2586
|
+
emits: ["node-click", "node-contextmenu", "check-change", "check", "current-change", "node-expand", "node-collapse", "node-drag-start", "node-drag-enter", "node-drag-leave", "node-drag-over", "node-drag-end", "node-drop", "checked-keys-change"],
|
|
2587
|
+
setup(e, { emit: m }) {
|
|
2588
|
+
const t = e, l = m, c = O(() => (console.log("ytree 组件接收到的数据:", t.data), t.data || [])), s = R({
|
|
2589
|
+
currentNode: null,
|
|
2590
|
+
currentKey: null,
|
|
2591
|
+
checkedKeys: /* @__PURE__ */ new Set(),
|
|
2592
|
+
expandedKeys: /* @__PURE__ */ new Set(),
|
|
2593
|
+
selectedKeys: /* @__PURE__ */ new Set()
|
|
2594
|
+
});
|
|
2595
|
+
nt("treeStore", s);
|
|
2596
|
+
const k = O(() => t.restrictAutoExpandFromLevel && t.restrictAutoExpandFromLevel > 0 ? t.restrictAutoExpandFromLevel : void 0);
|
|
2597
|
+
function C(y) {
|
|
2598
|
+
return y[t.nodeKey] || y.id || Math.random();
|
|
2599
|
+
}
|
|
2600
|
+
function L(y) {
|
|
2601
|
+
var g;
|
|
2602
|
+
return ((g = t.props) != null && g.label ? y[t.props.label] : void 0) || y.label || "";
|
|
2603
|
+
}
|
|
2604
|
+
function I(y) {
|
|
2605
|
+
var g;
|
|
2606
|
+
return !!((g = y == null ? void 0 : y.data) != null && g.isEmployee);
|
|
2607
|
+
}
|
|
2608
|
+
function h(y) {
|
|
2609
|
+
var w;
|
|
2610
|
+
const g = t.deptIconUrl || oo, v = t.personIconUrl || ao, f = t.buttonIconUrl || "";
|
|
2611
|
+
return (w = y == null ? void 0 : y.data) != null && w.isButton && f ? f : I(y) ? v : g;
|
|
2612
|
+
}
|
|
2613
|
+
function d(y) {
|
|
2614
|
+
var v;
|
|
2615
|
+
const g = ((v = t.props) != null && v.children ? y[t.props.children] : void 0) || y.children;
|
|
2616
|
+
return g && g.length > 0;
|
|
2617
|
+
}
|
|
2618
|
+
function u(y) {
|
|
2619
|
+
var g;
|
|
2620
|
+
return ((g = t.props) != null && g.children ? y[t.props.children] : void 0) || y.children || [];
|
|
2621
|
+
}
|
|
2622
|
+
function K(y, g, v = 1) {
|
|
2623
|
+
if (y === g)
|
|
2624
|
+
return v;
|
|
2625
|
+
const f = u(y);
|
|
2626
|
+
for (const w of f) {
|
|
2627
|
+
const b = K(w, g, v + 1);
|
|
2628
|
+
if (b > 0)
|
|
2629
|
+
return b;
|
|
2630
|
+
}
|
|
2631
|
+
return 0;
|
|
2632
|
+
}
|
|
2633
|
+
function j(y) {
|
|
2634
|
+
const g = C(y);
|
|
2635
|
+
return s.value.expandedKeys.has(g);
|
|
2636
|
+
}
|
|
2637
|
+
function U(y) {
|
|
2638
|
+
const g = C(y);
|
|
2639
|
+
if (s.value.checkedKeys.has(g)) {
|
|
2640
|
+
if (d(y)) {
|
|
2641
|
+
const f = u(y), w = f.filter((S) => U(S)), b = f.filter(
|
|
2642
|
+
(S) => N(S)
|
|
2643
|
+
);
|
|
2644
|
+
return w.length === f.length && b.length === 0;
|
|
2645
|
+
}
|
|
2646
|
+
return !0;
|
|
2647
|
+
}
|
|
2648
|
+
if (d(y)) {
|
|
2649
|
+
const f = u(y);
|
|
2650
|
+
return f.some(
|
|
2651
|
+
(b) => N(b)
|
|
2652
|
+
) ? !1 : f.length > 0 && f.every((b) => U(b));
|
|
2653
|
+
}
|
|
2654
|
+
return !1;
|
|
2655
|
+
}
|
|
2656
|
+
function N(y) {
|
|
2657
|
+
if (!d(y)) return !1;
|
|
2658
|
+
const g = u(y), v = g.filter((w) => U(w)), f = g.filter(
|
|
2659
|
+
(w) => N(w)
|
|
2660
|
+
);
|
|
2661
|
+
return v.length === g.length ? !1 : v.length > 0 || f.length > 0;
|
|
2662
|
+
}
|
|
2663
|
+
function $(y) {
|
|
2664
|
+
const g = C(y);
|
|
2665
|
+
return s.value.currentKey === g;
|
|
2666
|
+
}
|
|
2667
|
+
function V(y) {
|
|
2668
|
+
if (t.disabled) return;
|
|
2669
|
+
const g = C(y), f = !s.value.checkedKeys.has(g), w = new Set(s.value.expandedKeys);
|
|
2670
|
+
f ? s.value.checkedKeys.add(g) : s.value.checkedKeys.delete(g);
|
|
2671
|
+
function b(S, W) {
|
|
2672
|
+
S.forEach((p) => {
|
|
2673
|
+
const D = C(p);
|
|
2674
|
+
W ? s.value.checkedKeys.add(D) : s.value.checkedKeys.delete(D), d(p) && b(u(p), W);
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
b(u(y), f), f && H(), q(), s.value.expandedKeys = w, l("check-change", y, f, !1), l("check", y, f, !1), l("checked-keys-change", Array.from(s.value.checkedKeys));
|
|
2678
|
+
}
|
|
2679
|
+
function H(y) {
|
|
2680
|
+
k.value && console.log(
|
|
2681
|
+
`已启用从第${k.value}级开始不默认展开的限制(不主动收起已展开节点)`
|
|
2682
|
+
);
|
|
2683
|
+
}
|
|
2684
|
+
function T(y) {
|
|
2685
|
+
const g = C(y);
|
|
2686
|
+
s.value.expandedKeys.has(g) ? (s.value.expandedKeys.delete(g), l("node-collapse", y, y, null)) : (s.value.expandedKeys.add(g), l("node-expand", y, y, null));
|
|
2687
|
+
}
|
|
2688
|
+
function q() {
|
|
2689
|
+
const y = [];
|
|
2690
|
+
function g(f) {
|
|
2691
|
+
f.forEach((w) => {
|
|
2692
|
+
y.push(w), d(w) && g(u(w));
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
g(c.value);
|
|
2696
|
+
function v(f) {
|
|
2697
|
+
if (d(f)) {
|
|
2698
|
+
const w = u(f), b = C(f), S = w.filter((p) => U(p)), W = w.filter(
|
|
2699
|
+
(p) => N(p)
|
|
2700
|
+
);
|
|
2701
|
+
S.length === w.length && W.length === 0 || S.length > 0 || W.length > 0 ? s.value.checkedKeys.add(b) : s.value.checkedKeys.delete(b);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
for (let f = y.length - 1; f >= 0; f--)
|
|
2705
|
+
v(y[f]);
|
|
2706
|
+
}
|
|
2707
|
+
function te(y, g, v) {
|
|
2708
|
+
t.disabled || (s.value.currentNode = y, s.value.currentKey = C(y), t.showCheckbox && V(y), l("node-click", y, g, v));
|
|
2709
|
+
}
|
|
2710
|
+
function X(y, g, v, f) {
|
|
2711
|
+
t.disabled || l("node-contextmenu", y, g, v, f);
|
|
2712
|
+
}
|
|
2713
|
+
oe(
|
|
2714
|
+
() => t.defaultExpandedKeys,
|
|
2715
|
+
(y) => {
|
|
2716
|
+
if (y) {
|
|
2717
|
+
const g = k.value;
|
|
2718
|
+
if (g) {
|
|
2719
|
+
let v = function(S, W, p = 1) {
|
|
2720
|
+
for (const D of W) {
|
|
2721
|
+
if (C(D) === S) return p;
|
|
2722
|
+
if (d(D)) {
|
|
2723
|
+
const F = v(S, u(D), p + 1);
|
|
2724
|
+
if (F > 0) return F;
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
return 0;
|
|
2728
|
+
}, f = function(S, W, p) {
|
|
2729
|
+
S.forEach((D) => {
|
|
2730
|
+
W < p && d(D) ? (b.add(C(D)), f(u(D), W + 1, p)) : W < p && d(D);
|
|
2731
|
+
});
|
|
2732
|
+
};
|
|
2733
|
+
const w = (y || []).filter((S) => {
|
|
2734
|
+
const W = v(S, c.value, 1);
|
|
2735
|
+
return W > 0 && W < g;
|
|
2736
|
+
}), b = new Set(w);
|
|
2737
|
+
f(c.value, 1, g), s.value.expandedKeys.forEach((S) => {
|
|
2738
|
+
v(S, c.value, 1) >= g && b.add(S);
|
|
2739
|
+
}), s.value.expandedKeys = b;
|
|
2740
|
+
} else
|
|
2741
|
+
s.value.expandedKeys = new Set(y);
|
|
2742
|
+
}
|
|
2743
|
+
},
|
|
2744
|
+
{ immediate: !0 }
|
|
2745
|
+
);
|
|
2746
|
+
function pe() {
|
|
2747
|
+
if (t.defaultExpandAll) {
|
|
2748
|
+
let y = function(f, w = 1) {
|
|
2749
|
+
f.forEach((b) => {
|
|
2750
|
+
if (!d(b)) return;
|
|
2751
|
+
const S = u(b);
|
|
2752
|
+
if (v) {
|
|
2753
|
+
if (w >= v) return;
|
|
2754
|
+
w + 1 === v || g.add(C(b)), y(S, w + 1);
|
|
2755
|
+
} else
|
|
2756
|
+
g.add(C(b)), y(S, w + 1);
|
|
2757
|
+
});
|
|
2758
|
+
};
|
|
2759
|
+
const g = /* @__PURE__ */ new Set(), v = k.value;
|
|
2760
|
+
y(c.value, 1), s.value.expandedKeys = g;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
function ae() {
|
|
2764
|
+
if (t.defaultCheckedKeys && t.defaultCheckedKeys.length > 0) {
|
|
2765
|
+
let y = function(w, b = []) {
|
|
2766
|
+
w.forEach((S) => {
|
|
2767
|
+
const W = C(S), p = [...b, W];
|
|
2768
|
+
g.has(W) && b.forEach((D) => v.add(D)), d(S) && y(u(S), p);
|
|
2769
|
+
});
|
|
2770
|
+
};
|
|
2771
|
+
const g = new Set(t.defaultCheckedKeys), v = /* @__PURE__ */ new Set();
|
|
2772
|
+
y(c.value);
|
|
2773
|
+
const f = k.value;
|
|
2774
|
+
if (f) {
|
|
2775
|
+
console.log(
|
|
2776
|
+
`已启用从第${f}级开始不默认展开:保持当前展开状态不变`
|
|
2777
|
+
);
|
|
2778
|
+
return;
|
|
2779
|
+
}
|
|
2780
|
+
s.value.expandedKeys = v;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
return oe(() => t.defaultExpandAll, pe, { immediate: !0 }), oe(() => c.value, pe, { deep: !0 }), oe(
|
|
2784
|
+
() => t.defaultCheckedKeys,
|
|
2785
|
+
(y) => {
|
|
2786
|
+
y ? (s.value.checkedKeys = new Set(y), t.enableFourthLevelSpecialHandling ? console.log("权限树模式:跳过自动展开逻辑,保持当前展开状态") : ae()) : s.value.checkedKeys.clear();
|
|
2787
|
+
},
|
|
2788
|
+
{ immediate: !0 }
|
|
2789
|
+
), oe(
|
|
2790
|
+
() => t.defaultSelectedKeys,
|
|
2791
|
+
(y) => {
|
|
2792
|
+
y && (s.value.selectedKeys = new Set(y));
|
|
2793
|
+
},
|
|
2794
|
+
{ immediate: !0 }
|
|
2795
|
+
), (y, g) => (a(), i("div", {
|
|
2796
|
+
class: z(["ytree", [`ytree--${e.size}`, { "ytree--disabled": e.disabled }]])
|
|
2797
|
+
}, [
|
|
2798
|
+
n("div", vl, [
|
|
2799
|
+
(a(!0), i(re, null, ve(c.value, (v) => (a(), i("div", {
|
|
2800
|
+
key: C(v),
|
|
2801
|
+
class: z(["ytree-node", { "ytree-node--current": $(v) }])
|
|
2802
|
+
}, [
|
|
2803
|
+
n("div", {
|
|
2804
|
+
class: "ytree-node__content",
|
|
2805
|
+
style: { paddingLeft: "8px" },
|
|
2806
|
+
"data-level": K(v, v),
|
|
2807
|
+
onClick: (f) => te(v, v, null),
|
|
2808
|
+
onContextmenu: (f) => X(f, v, v, null)
|
|
2809
|
+
}, [
|
|
2810
|
+
d(v) ? (a(), i("span", {
|
|
2811
|
+
key: 0,
|
|
2812
|
+
class: z(["ytree-node__expand-icon", { "is-expanded": j(v) }]),
|
|
2813
|
+
onClick: Q((f) => T(v), ["stop"])
|
|
2814
|
+
}, [...g[0] || (g[0] = [
|
|
2815
|
+
n("svg", {
|
|
2816
|
+
width: "12",
|
|
2817
|
+
height: "12",
|
|
2818
|
+
viewBox: "0 0 12 12",
|
|
2819
|
+
fill: "none"
|
|
2820
|
+
}, [
|
|
2821
|
+
n("path", {
|
|
2822
|
+
d: "M4.5 3L7.5 6L4.5 9",
|
|
2823
|
+
stroke: "currentColor",
|
|
2824
|
+
"stroke-width": "1.5",
|
|
2825
|
+
"stroke-linecap": "round",
|
|
2826
|
+
"stroke-linejoin": "round"
|
|
2827
|
+
})
|
|
2828
|
+
], -1)
|
|
2829
|
+
])], 10, pl)) : (a(), i("span", gl)),
|
|
2830
|
+
e.showCheckbox ? (a(), i("span", {
|
|
2831
|
+
key: 2,
|
|
2832
|
+
class: z(["ytree-node__checkbox", {
|
|
2833
|
+
"is-checked": U(v),
|
|
2834
|
+
"is-indeterminate": N(v)
|
|
2835
|
+
}]),
|
|
2836
|
+
onClick: Q((f) => V(v), ["stop"])
|
|
2837
|
+
}, [
|
|
2838
|
+
U(v) ? (a(), i("svg", ml, [...g[1] || (g[1] = [
|
|
2839
|
+
n("path", {
|
|
2840
|
+
d: "M2 6L4.5 8.5L10 3",
|
|
2841
|
+
stroke: "currentColor",
|
|
2842
|
+
"stroke-width": "1.5",
|
|
2843
|
+
"stroke-linecap": "round",
|
|
2844
|
+
"stroke-linejoin": "round"
|
|
2845
|
+
}, null, -1)
|
|
2846
|
+
])])) : N(v) ? (a(), i("svg", wl, [...g[2] || (g[2] = [
|
|
2847
|
+
n("path", {
|
|
2848
|
+
d: "M2 6L10 6",
|
|
2849
|
+
stroke: "currentColor",
|
|
2850
|
+
"stroke-width": "1.5",
|
|
2851
|
+
"stroke-linecap": "round"
|
|
2852
|
+
}, null, -1)
|
|
2853
|
+
])])) : A("", !0)
|
|
2854
|
+
], 10, yl)) : A("", !0),
|
|
2855
|
+
e.iconClass ? (a(), i("span", {
|
|
2856
|
+
key: 3,
|
|
2857
|
+
class: z(["ytree-node__icon", e.iconClass])
|
|
2858
|
+
}, null, 2)) : A("", !0),
|
|
2859
|
+
n("img", {
|
|
2860
|
+
class: "ytree-node__avatar",
|
|
2861
|
+
src: h(v),
|
|
2862
|
+
alt: I(v) ? "person" : "dept"
|
|
2863
|
+
}, null, 8, bl),
|
|
2864
|
+
n("span", {
|
|
2865
|
+
class: z(["ytree-node__label", { "is-employee": I(v) }])
|
|
2866
|
+
}, G(L(v)), 3),
|
|
2867
|
+
n("div", kl, [
|
|
2868
|
+
ue(y.$slots, "node-content", {
|
|
2869
|
+
node: v,
|
|
2870
|
+
isCurrent: $(v),
|
|
2871
|
+
isExpanded: j(v),
|
|
2872
|
+
hasChildren: d(v)
|
|
2873
|
+
}, void 0, !0)
|
|
2874
|
+
])
|
|
2875
|
+
], 40, hl),
|
|
2876
|
+
de(ke, { name: "ytree-node" }, {
|
|
2877
|
+
default: he(() => [
|
|
2878
|
+
d(v) && j(v) ? (a(), i("div", xl, [
|
|
2879
|
+
(a(!0), i(re, null, ve(u(v), (f) => (a(), i("div", {
|
|
2880
|
+
key: C(f),
|
|
2881
|
+
class: z(["ytree-node", { "ytree-node--current": $(f) }])
|
|
2882
|
+
}, [
|
|
2883
|
+
n("div", {
|
|
2884
|
+
class: "ytree-node__content",
|
|
2885
|
+
style: { paddingLeft: "22px" },
|
|
2886
|
+
"data-level": K(v, f),
|
|
2887
|
+
onClick: (w) => te(f, f, null),
|
|
2888
|
+
onContextmenu: (w) => X(w, f, f, null)
|
|
2889
|
+
}, [
|
|
2890
|
+
d(f) ? (a(), i("span", {
|
|
2891
|
+
key: 0,
|
|
2892
|
+
class: z(["ytree-node__expand-icon", { "is-expanded": j(f) }]),
|
|
2893
|
+
onClick: Q((w) => T(f), ["stop"])
|
|
2894
|
+
}, [...g[3] || (g[3] = [
|
|
2895
|
+
n("svg", {
|
|
2896
|
+
width: "12",
|
|
2897
|
+
height: "12",
|
|
2898
|
+
viewBox: "0 0 12 12",
|
|
2899
|
+
fill: "none"
|
|
2900
|
+
}, [
|
|
2901
|
+
n("path", {
|
|
2902
|
+
d: "M4.5 3L7.5 6L4.5 9",
|
|
2903
|
+
stroke: "currentColor",
|
|
2904
|
+
"stroke-width": "1.5",
|
|
2905
|
+
"stroke-linecap": "round",
|
|
2906
|
+
"stroke-linejoin": "round"
|
|
2907
|
+
})
|
|
2908
|
+
], -1)
|
|
2909
|
+
])], 10, $l)) : (a(), i("span", Cl)),
|
|
2910
|
+
e.showCheckbox ? (a(), i("span", {
|
|
2911
|
+
key: 2,
|
|
2912
|
+
class: z(["ytree-node__checkbox", {
|
|
2913
|
+
"is-checked": U(f),
|
|
2914
|
+
"is-indeterminate": N(f)
|
|
2915
|
+
}]),
|
|
2916
|
+
onClick: Q((w) => V(f), ["stop"])
|
|
2917
|
+
}, [
|
|
2918
|
+
U(f) ? (a(), i("svg", Sl, [...g[4] || (g[4] = [
|
|
2919
|
+
n("path", {
|
|
2920
|
+
d: "M2 6L4.5 8.5L10 3",
|
|
2921
|
+
stroke: "currentColor",
|
|
2922
|
+
"stroke-width": "1.5",
|
|
2923
|
+
"stroke-linecap": "round",
|
|
2924
|
+
"stroke-linejoin": "round"
|
|
2925
|
+
}, null, -1)
|
|
2926
|
+
])])) : N(f) ? (a(), i("svg", Ml, [...g[5] || (g[5] = [
|
|
2927
|
+
n("path", {
|
|
2928
|
+
d: "M2 6L10 6",
|
|
2929
|
+
stroke: "currentColor",
|
|
2930
|
+
"stroke-width": "1.5",
|
|
2931
|
+
"stroke-linecap": "round"
|
|
2932
|
+
}, null, -1)
|
|
2933
|
+
])])) : A("", !0)
|
|
2934
|
+
], 10, _l)) : A("", !0),
|
|
2935
|
+
e.iconClass ? (a(), i("span", {
|
|
2936
|
+
key: 3,
|
|
2937
|
+
class: z(["ytree-node__icon", e.iconClass])
|
|
2938
|
+
}, null, 2)) : A("", !0),
|
|
2939
|
+
n("img", {
|
|
2940
|
+
class: "ytree-node__avatar",
|
|
2941
|
+
src: h(f),
|
|
2942
|
+
alt: I(f) ? "person" : "dept"
|
|
2943
|
+
}, null, 8, Ll),
|
|
2944
|
+
n("span", {
|
|
2945
|
+
class: z(["ytree-node__label", { "is-employee": I(f) }])
|
|
2946
|
+
}, G(L(f)), 3),
|
|
2947
|
+
n("div", Il, [
|
|
2948
|
+
ue(y.$slots, "node-content", {
|
|
2949
|
+
node: f,
|
|
2950
|
+
isCurrent: $(f),
|
|
2951
|
+
isExpanded: j(f),
|
|
2952
|
+
hasChildren: d(f)
|
|
2953
|
+
}, void 0, !0)
|
|
2954
|
+
])
|
|
2955
|
+
], 40, Dl),
|
|
2956
|
+
de(ke, { name: "ytree-node" }, {
|
|
2957
|
+
default: he(() => [
|
|
2958
|
+
d(f) && j(f) ? (a(), i("div", El, [
|
|
2959
|
+
(a(!0), i(re, null, ve(u(f), (w) => (a(), i("div", {
|
|
2960
|
+
key: C(w),
|
|
2961
|
+
class: z(["ytree-node", {
|
|
2962
|
+
"ytree-node--current": $(w)
|
|
2963
|
+
}])
|
|
2964
|
+
}, [
|
|
2965
|
+
n("div", {
|
|
2966
|
+
class: "ytree-node__content",
|
|
2967
|
+
style: { paddingLeft: "38px" },
|
|
2968
|
+
"data-level": K(v, w),
|
|
2969
|
+
onClick: (b) => te(w, w, null),
|
|
2970
|
+
onContextmenu: (b) => X(
|
|
2971
|
+
b,
|
|
2972
|
+
w,
|
|
2973
|
+
w,
|
|
2974
|
+
null
|
|
2975
|
+
)
|
|
2976
|
+
}, [
|
|
2977
|
+
d(w) ? (a(), i("span", {
|
|
2978
|
+
key: 0,
|
|
2979
|
+
class: z(["ytree-node__expand-icon", { "is-expanded": j(w) }]),
|
|
2980
|
+
onClick: Q((b) => T(w), ["stop"])
|
|
2981
|
+
}, [...g[6] || (g[6] = [
|
|
2982
|
+
n("svg", {
|
|
2983
|
+
width: "12",
|
|
2984
|
+
height: "12",
|
|
2985
|
+
viewBox: "0 0 12 12",
|
|
2986
|
+
fill: "none"
|
|
2987
|
+
}, [
|
|
2988
|
+
n("path", {
|
|
2989
|
+
d: "M4.5 3L7.5 6L4.5 9",
|
|
2990
|
+
stroke: "currentColor",
|
|
2991
|
+
"stroke-width": "1.5",
|
|
2992
|
+
"stroke-linecap": "round",
|
|
2993
|
+
"stroke-linejoin": "round"
|
|
2994
|
+
})
|
|
2995
|
+
], -1)
|
|
2996
|
+
])], 10, Tl)) : (a(), i("span", zl)),
|
|
2997
|
+
e.showCheckbox ? (a(), i("span", {
|
|
2998
|
+
key: 2,
|
|
2999
|
+
class: z(["ytree-node__checkbox", {
|
|
3000
|
+
"is-checked": U(w),
|
|
3001
|
+
"is-indeterminate": N(w)
|
|
3002
|
+
}]),
|
|
3003
|
+
onClick: Q((b) => V(w), ["stop"])
|
|
3004
|
+
}, [
|
|
3005
|
+
U(w) ? (a(), i("svg", Hl, [...g[7] || (g[7] = [
|
|
3006
|
+
n("path", {
|
|
3007
|
+
d: "M2 6L4.5 8.5L10 3",
|
|
3008
|
+
stroke: "currentColor",
|
|
3009
|
+
"stroke-width": "1.5",
|
|
3010
|
+
"stroke-linecap": "round",
|
|
3011
|
+
"stroke-linejoin": "round"
|
|
3012
|
+
}, null, -1)
|
|
3013
|
+
])])) : N(w) ? (a(), i("svg", Rl, [...g[8] || (g[8] = [
|
|
3014
|
+
n("path", {
|
|
3015
|
+
d: "M2 6L10 6",
|
|
3016
|
+
stroke: "currentColor",
|
|
3017
|
+
"stroke-width": "1.5",
|
|
3018
|
+
"stroke-linecap": "round"
|
|
3019
|
+
}, null, -1)
|
|
3020
|
+
])])) : A("", !0)
|
|
3021
|
+
], 10, Kl)) : A("", !0),
|
|
3022
|
+
e.iconClass ? (a(), i("span", {
|
|
3023
|
+
key: 3,
|
|
3024
|
+
class: z(["ytree-node__icon", e.iconClass])
|
|
3025
|
+
}, null, 2)) : A("", !0),
|
|
3026
|
+
n("img", {
|
|
3027
|
+
class: "ytree-node__avatar",
|
|
3028
|
+
src: h(w),
|
|
3029
|
+
alt: I(w) ? "person" : "dept"
|
|
3030
|
+
}, null, 8, Vl),
|
|
3031
|
+
n("span", {
|
|
3032
|
+
class: z(["ytree-node__label", { "is-employee": I(w) }])
|
|
3033
|
+
}, G(L(w)), 3),
|
|
3034
|
+
n("div", Al, [
|
|
3035
|
+
ue(y.$slots, "node-content", {
|
|
3036
|
+
node: w,
|
|
3037
|
+
isCurrent: $(w),
|
|
3038
|
+
isExpanded: j(w),
|
|
3039
|
+
hasChildren: d(w)
|
|
3040
|
+
}, void 0, !0)
|
|
3041
|
+
])
|
|
3042
|
+
], 40, Bl),
|
|
3043
|
+
de(ke, { name: "ytree-node" }, {
|
|
3044
|
+
default: he(() => [
|
|
3045
|
+
d(w) && j(w) ? (a(), i("div", Fl, [
|
|
3046
|
+
(a(!0), i(re, null, ve(u(w), (b) => (a(), i("div", {
|
|
3047
|
+
key: C(b),
|
|
3048
|
+
class: z(["ytree-node", {
|
|
3049
|
+
"ytree-node--current": $(b)
|
|
3050
|
+
}])
|
|
3051
|
+
}, [
|
|
3052
|
+
n("div", {
|
|
3053
|
+
class: "ytree-node__content",
|
|
3054
|
+
style: {
|
|
3055
|
+
paddingLeft: "54px"
|
|
3056
|
+
},
|
|
3057
|
+
"data-level": K(v, b),
|
|
3058
|
+
onClick: (S) => te(
|
|
3059
|
+
b,
|
|
3060
|
+
b,
|
|
3061
|
+
null
|
|
3062
|
+
),
|
|
3063
|
+
onContextmenu: (S) => X(
|
|
3064
|
+
S,
|
|
3065
|
+
b,
|
|
3066
|
+
b,
|
|
3067
|
+
null
|
|
3068
|
+
)
|
|
3069
|
+
}, [
|
|
3070
|
+
d(b) ? (a(), i("span", {
|
|
3071
|
+
key: 0,
|
|
3072
|
+
class: z(["ytree-node__expand-icon", {
|
|
3073
|
+
"is-expanded": j(b)
|
|
3074
|
+
}]),
|
|
3075
|
+
onClick: Q((S) => T(b), ["stop"])
|
|
3076
|
+
}, [...g[9] || (g[9] = [
|
|
3077
|
+
n("svg", {
|
|
3078
|
+
width: "12",
|
|
3079
|
+
height: "12",
|
|
3080
|
+
viewBox: "0 0 12 12",
|
|
3081
|
+
fill: "none"
|
|
3082
|
+
}, [
|
|
3083
|
+
n("path", {
|
|
3084
|
+
d: "M4.5 3L7.5 6L4.5 9",
|
|
3085
|
+
stroke: "currentColor",
|
|
3086
|
+
"stroke-width": "1.5",
|
|
3087
|
+
"stroke-linecap": "round",
|
|
3088
|
+
"stroke-linejoin": "round"
|
|
3089
|
+
})
|
|
3090
|
+
], -1)
|
|
3091
|
+
])], 10, Nl)) : (a(), i("span", Pl)),
|
|
3092
|
+
e.showCheckbox ? (a(), i("span", {
|
|
3093
|
+
key: 2,
|
|
3094
|
+
class: z(["ytree-node__checkbox", {
|
|
3095
|
+
"is-checked": U(b),
|
|
3096
|
+
"is-indeterminate": N(b)
|
|
3097
|
+
}]),
|
|
3098
|
+
onClick: Q((S) => V(b), ["stop"])
|
|
3099
|
+
}, [
|
|
3100
|
+
U(b) ? (a(), i("svg", jl, [...g[10] || (g[10] = [
|
|
3101
|
+
n("path", {
|
|
3102
|
+
d: "M2 6L4.5 8.5L10 3",
|
|
3103
|
+
stroke: "currentColor",
|
|
3104
|
+
"stroke-width": "1.5",
|
|
3105
|
+
"stroke-linecap": "round",
|
|
3106
|
+
"stroke-linejoin": "round"
|
|
3107
|
+
}, null, -1)
|
|
3108
|
+
])])) : N(b) ? (a(), i("svg", Ol, [...g[11] || (g[11] = [
|
|
3109
|
+
n("path", {
|
|
3110
|
+
d: "M2 6L10 6",
|
|
3111
|
+
stroke: "currentColor",
|
|
3112
|
+
"stroke-width": "1.5",
|
|
3113
|
+
"stroke-linecap": "round"
|
|
3114
|
+
}, null, -1)
|
|
3115
|
+
])])) : A("", !0)
|
|
3116
|
+
], 10, Yl)) : A("", !0),
|
|
3117
|
+
e.iconClass ? (a(), i("span", {
|
|
3118
|
+
key: 3,
|
|
3119
|
+
class: z(["ytree-node__icon", e.iconClass])
|
|
3120
|
+
}, null, 2)) : A("", !0),
|
|
3121
|
+
n("img", {
|
|
3122
|
+
class: "ytree-node__avatar",
|
|
3123
|
+
src: h(b),
|
|
3124
|
+
alt: I(b) ? "person" : "dept"
|
|
3125
|
+
}, null, 8, Ul),
|
|
3126
|
+
n("span", {
|
|
3127
|
+
class: z(["ytree-node__label", {
|
|
3128
|
+
"is-employee": I(b)
|
|
3129
|
+
}])
|
|
3130
|
+
}, G(L(b)), 3),
|
|
3131
|
+
n("div", ql, [
|
|
3132
|
+
ue(y.$slots, "node-content", {
|
|
3133
|
+
node: b,
|
|
3134
|
+
isCurrent: $(b),
|
|
3135
|
+
isExpanded: j(b),
|
|
3136
|
+
hasChildren: d(b)
|
|
3137
|
+
}, void 0, !0)
|
|
3138
|
+
])
|
|
3139
|
+
], 40, Wl),
|
|
3140
|
+
de(ke, { name: "ytree-node" }, {
|
|
3141
|
+
default: he(() => [
|
|
3142
|
+
d(b) && j(b) ? (a(), i("div", Zl, [
|
|
3143
|
+
(a(!0), i(re, null, ve(u(
|
|
3144
|
+
b
|
|
3145
|
+
), (S) => (a(), i("div", {
|
|
3146
|
+
key: C(S),
|
|
3147
|
+
class: z(["ytree-node", {
|
|
3148
|
+
"ytree-node--current": $(S)
|
|
3149
|
+
}])
|
|
3150
|
+
}, [
|
|
3151
|
+
n("div", {
|
|
3152
|
+
class: "ytree-node__content",
|
|
3153
|
+
style: {
|
|
3154
|
+
paddingLeft: "70px"
|
|
3155
|
+
},
|
|
3156
|
+
"data-level": K(v, S),
|
|
3157
|
+
onClick: (W) => te(
|
|
3158
|
+
S,
|
|
3159
|
+
S,
|
|
3160
|
+
null
|
|
3161
|
+
),
|
|
3162
|
+
onContextmenu: (W) => X(
|
|
3163
|
+
W,
|
|
3164
|
+
S,
|
|
3165
|
+
S,
|
|
3166
|
+
null
|
|
3167
|
+
)
|
|
3168
|
+
}, [
|
|
3169
|
+
d(S) ? (a(), i("span", {
|
|
3170
|
+
key: 0,
|
|
3171
|
+
class: z(["ytree-node__expand-icon", {
|
|
3172
|
+
"is-expanded": j(S)
|
|
3173
|
+
}]),
|
|
3174
|
+
onClick: Q((W) => T(S), ["stop"])
|
|
3175
|
+
}, [...g[12] || (g[12] = [
|
|
3176
|
+
n("svg", {
|
|
3177
|
+
width: "12",
|
|
3178
|
+
height: "12",
|
|
3179
|
+
viewBox: "0 0 12 12",
|
|
3180
|
+
fill: "none"
|
|
3181
|
+
}, [
|
|
3182
|
+
n("path", {
|
|
3183
|
+
d: "M4.5 3L7.5 6L4.5 9",
|
|
3184
|
+
stroke: "currentColor",
|
|
3185
|
+
"stroke-width": "1.5",
|
|
3186
|
+
"stroke-linecap": "round",
|
|
3187
|
+
"stroke-linejoin": "round"
|
|
3188
|
+
})
|
|
3189
|
+
], -1)
|
|
3190
|
+
])], 10, Jl)) : (a(), i("span", Xl)),
|
|
3191
|
+
e.showCheckbox ? (a(), i("span", {
|
|
3192
|
+
key: 2,
|
|
3193
|
+
class: z(["ytree-node__checkbox", {
|
|
3194
|
+
"is-checked": U(S),
|
|
3195
|
+
"is-indeterminate": N(
|
|
3196
|
+
S
|
|
3197
|
+
)
|
|
3198
|
+
}]),
|
|
3199
|
+
onClick: Q((W) => V(S), ["stop"])
|
|
3200
|
+
}, [
|
|
3201
|
+
U(S) ? (a(), i("svg", eo, [...g[13] || (g[13] = [
|
|
3202
|
+
n("path", {
|
|
3203
|
+
d: "M2 6L4.5 8.5L10 3",
|
|
3204
|
+
stroke: "currentColor",
|
|
3205
|
+
"stroke-width": "1.5",
|
|
3206
|
+
"stroke-linecap": "round",
|
|
3207
|
+
"stroke-linejoin": "round"
|
|
3208
|
+
}, null, -1)
|
|
3209
|
+
])])) : N(
|
|
3210
|
+
S
|
|
3211
|
+
) ? (a(), i("svg", to, [...g[14] || (g[14] = [
|
|
3212
|
+
n("path", {
|
|
3213
|
+
d: "M2 6L10 6",
|
|
3214
|
+
stroke: "currentColor",
|
|
3215
|
+
"stroke-width": "1.5",
|
|
3216
|
+
"stroke-linecap": "round"
|
|
3217
|
+
}, null, -1)
|
|
3218
|
+
])])) : A("", !0)
|
|
3219
|
+
], 10, Gl)) : A("", !0),
|
|
3220
|
+
e.iconClass ? (a(), i("span", {
|
|
3221
|
+
key: 3,
|
|
3222
|
+
class: z(["ytree-node__icon", e.iconClass])
|
|
3223
|
+
}, null, 2)) : A("", !0),
|
|
3224
|
+
n("img", {
|
|
3225
|
+
class: "ytree-node__avatar",
|
|
3226
|
+
src: h(S),
|
|
3227
|
+
alt: I(S) ? "person" : "dept"
|
|
3228
|
+
}, null, 8, no),
|
|
3229
|
+
n("span", {
|
|
3230
|
+
class: z(["ytree-node__label", {
|
|
3231
|
+
"is-employee": I(S)
|
|
3232
|
+
}])
|
|
3233
|
+
}, G(L(S)), 3),
|
|
3234
|
+
n("div", lo, [
|
|
3235
|
+
ue(y.$slots, "node-content", {
|
|
3236
|
+
node: S,
|
|
3237
|
+
isCurrent: $(S),
|
|
3238
|
+
isExpanded: j(S),
|
|
3239
|
+
hasChildren: d(S)
|
|
3240
|
+
}, void 0, !0)
|
|
3241
|
+
])
|
|
3242
|
+
], 40, Ql)
|
|
3243
|
+
], 2))), 128))
|
|
3244
|
+
])) : A("", !0)
|
|
3245
|
+
]),
|
|
3246
|
+
_: 2
|
|
3247
|
+
}, 1024)
|
|
3248
|
+
], 2))), 128))
|
|
3249
|
+
])) : A("", !0)
|
|
3250
|
+
]),
|
|
3251
|
+
_: 2
|
|
3252
|
+
}, 1024)
|
|
3253
|
+
], 2))), 128))
|
|
3254
|
+
])) : A("", !0)
|
|
3255
|
+
]),
|
|
3256
|
+
_: 2
|
|
3257
|
+
}, 1024)
|
|
3258
|
+
], 2))), 128))
|
|
3259
|
+
])) : A("", !0)
|
|
3260
|
+
]),
|
|
3261
|
+
_: 2
|
|
3262
|
+
}, 1024)
|
|
3263
|
+
], 2))), 128))
|
|
3264
|
+
])
|
|
3265
|
+
], 2));
|
|
3266
|
+
}
|
|
3267
|
+
}), io = /* @__PURE__ */ we(so, [["__scopeId", "data-v-7362dfbe"]]), ro = { class: "w-full" }, uo = { class: "bg-white rounded-[10px] p-4 mb-2 md:p-[6px] sm:p-[10px] shadow-[0rem_0.3125rem_0.3125rem_-0.15625rem_rgba(0,0,0,0.03),0rem_0.1875rem_0.1875rem_-0.09375rem_rgba(0,0,0,0.02),0rem_0.125rem_0.125rem_-0.0625rem_rgba(0,0,0,0.02),0rem_0.0625rem_0.0625rem_-0.03125rem_rgba(0,0,0,0.03),0rem_0.03125rem_0.03125rem_0rem_rgba(0,0,0,0.04),0rem_0rem_0rem_0.0625rem_rgba(0,0,0,0.06)]" }, co = { class: "w-full" }, fo = { class: "flex flex-wrap gap-3 items-center mb-3 last:mb-0 lg:gap-[10px] sm:gap-2" }, vo = { class: "flex items-center gap-2 ml-2" }, ho = { class: "text-[13px] font-medium text-gray-700 whitespace-nowrap min-w-fit flex-shrink-0" }, po = {
|
|
3268
|
+
key: 0,
|
|
3269
|
+
class: "flex items-center ml-0"
|
|
3270
|
+
}, go = { class: "flex items-center" }, yo = { class: "flex gap-2 items-center flex-wrap" }, mo = /* @__PURE__ */ me({
|
|
3271
|
+
__name: "QueryEncapsulation",
|
|
3272
|
+
props: {
|
|
3273
|
+
fields: {},
|
|
3274
|
+
maxVisibleFields: { default: 5 },
|
|
3275
|
+
loading: { type: Boolean, default: !1 },
|
|
3276
|
+
modelValue: { default: () => ({}) }
|
|
3277
|
+
},
|
|
3278
|
+
emits: ["update:modelValue", "search", "reset", "field-change"],
|
|
3279
|
+
setup(e, { emit: m }) {
|
|
3280
|
+
const t = e, l = m, c = R(!1), s = lt({}), k = O(() => t.fields.filter(($) => !$.hidden)), C = O(() => c.value ? k.value : k.value.slice(0, t.maxVisibleFields)), L = O(() => k.value.length > t.maxVisibleFields);
|
|
3281
|
+
function I($) {
|
|
3282
|
+
switch ($) {
|
|
3283
|
+
case "select":
|
|
3284
|
+
return Ye;
|
|
3285
|
+
case "date":
|
|
3286
|
+
case "daterange":
|
|
3287
|
+
return Je;
|
|
3288
|
+
case "input":
|
|
3289
|
+
default:
|
|
3290
|
+
return Ze;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
function h($) {
|
|
3294
|
+
l("field-change", $, s[$.key]), l("update:modelValue", { ...s });
|
|
3295
|
+
}
|
|
3296
|
+
function d() {
|
|
3297
|
+
const $ = j(s), V = U($);
|
|
3298
|
+
l("search", { data: V });
|
|
3299
|
+
}
|
|
3300
|
+
function u() {
|
|
3301
|
+
Object.keys(s).forEach(($) => {
|
|
3302
|
+
const V = t.fields.find((H) => H.key === $);
|
|
3303
|
+
(V == null ? void 0 : V.type) === "daterange" ? s[$] = { startDate: null, endDate: null } : (V == null ? void 0 : V.type) === "date" ? s[$] = null : s[$] = "";
|
|
3304
|
+
}), l("reset"), l("update:modelValue", { ...s });
|
|
3305
|
+
}
|
|
3306
|
+
function K() {
|
|
3307
|
+
c.value = !c.value;
|
|
3308
|
+
}
|
|
3309
|
+
function j($) {
|
|
3310
|
+
const V = {};
|
|
3311
|
+
return Object.keys($).forEach((H) => {
|
|
3312
|
+
const T = $[H], q = t.fields.find((te) => te.key === H);
|
|
3313
|
+
T != null && T !== "" && (typeof T == "object" && T.startDate && T.endDate ? T.startDate && T.endDate && (V[H] = T) : q && (q.type === "date" || q.type === "daterange") ? T !== 0 && (V[H] = T) : V[H] = T);
|
|
3314
|
+
}), V;
|
|
3315
|
+
}
|
|
3316
|
+
function U($) {
|
|
3317
|
+
const V = {};
|
|
3318
|
+
return Object.keys($).forEach((H) => {
|
|
3319
|
+
const T = $[H], q = t.fields.find((te) => te.key === H);
|
|
3320
|
+
if (q)
|
|
3321
|
+
if (q.type === "daterange" && typeof T == "object") {
|
|
3322
|
+
const te = q.startKey || `${H}Start`, X = q.endKey || `${H}End`;
|
|
3323
|
+
T.startDate && T.endDate && T.startDate !== 0 && T.endDate !== 0 && (q.format === "timestamp" ? (V[te] = new Date(T.startDate).getTime(), V[X] = new Date(T.endDate).getTime()) : (V[te] = T.startDate, V[X] = T.endDate));
|
|
3324
|
+
} else q.type === "date" && T && T !== 0 && q.format === "timestamp" ? V[H] = new Date(T).getTime() : V[H] = T;
|
|
3325
|
+
else
|
|
3326
|
+
V[H] = T;
|
|
3327
|
+
}), V;
|
|
3328
|
+
}
|
|
3329
|
+
function N() {
|
|
3330
|
+
t.fields.forEach(($) => {
|
|
3331
|
+
var V, H, T;
|
|
3332
|
+
s[$.key] === void 0 && ($.type === "daterange" ? s[$.key] = ((V = t.modelValue) == null ? void 0 : V[$.key]) || {
|
|
3333
|
+
startDate: null,
|
|
3334
|
+
endDate: null
|
|
3335
|
+
} : $.type === "date" ? s[$.key] = ((H = t.modelValue) == null ? void 0 : H[$.key]) || null : s[$.key] = ((T = t.modelValue) == null ? void 0 : T[$.key]) || "");
|
|
3336
|
+
});
|
|
3337
|
+
}
|
|
3338
|
+
return oe(
|
|
3339
|
+
() => t.modelValue,
|
|
3340
|
+
($) => {
|
|
3341
|
+
$ && Object.assign(s, $);
|
|
3342
|
+
},
|
|
3343
|
+
{ deep: !0, immediate: !0 }
|
|
3344
|
+
), _e(() => {
|
|
3345
|
+
N();
|
|
3346
|
+
}), ($, V) => (a(), i("div", ro, [
|
|
3347
|
+
n("div", uo, [
|
|
3348
|
+
n("div", co, [
|
|
3349
|
+
n("div", fo, [
|
|
3350
|
+
de(ot, {
|
|
3351
|
+
name: "qf",
|
|
3352
|
+
tag: "div",
|
|
3353
|
+
class: "contents"
|
|
3354
|
+
}, {
|
|
3355
|
+
default: he(() => [
|
|
3356
|
+
(a(!0), i(re, null, ve(C.value, (H) => (a(), i("div", {
|
|
3357
|
+
key: H.key,
|
|
3358
|
+
class: "flex items-center transition-all duration-300"
|
|
3359
|
+
}, [
|
|
3360
|
+
n("div", vo, [
|
|
3361
|
+
n("label", ho, G(H.label), 1),
|
|
3362
|
+
(a(), Le(at(I(H.type)), {
|
|
3363
|
+
modelValue: s[H.key],
|
|
3364
|
+
"onUpdate:modelValue": (T) => s[H.key] = T,
|
|
3365
|
+
placeholder: H.placeholder || `请输入${H.label}`,
|
|
3366
|
+
options: H.options,
|
|
3367
|
+
clearable: H.clearable !== !1,
|
|
3368
|
+
size: H.size || "small",
|
|
3369
|
+
width: H.width || "180px",
|
|
3370
|
+
format: H.format || "timestamp",
|
|
3371
|
+
"include-time": H.includeTime || !1,
|
|
3372
|
+
filterable: H.filterable === !0,
|
|
3373
|
+
onInput: (T) => h(H),
|
|
3374
|
+
onChange: (T) => h(H)
|
|
3375
|
+
}, null, 40, ["modelValue", "onUpdate:modelValue", "placeholder", "options", "clearable", "size", "width", "format", "include-time", "filterable", "onInput", "onChange"]))
|
|
3376
|
+
])
|
|
3377
|
+
]))), 128))
|
|
3378
|
+
]),
|
|
3379
|
+
_: 1
|
|
3380
|
+
}),
|
|
3381
|
+
L.value ? (a(), i("div", po, [
|
|
3382
|
+
de(Re, {
|
|
3383
|
+
variant: "secondary",
|
|
3384
|
+
size: "small",
|
|
3385
|
+
onClick: K
|
|
3386
|
+
}, {
|
|
3387
|
+
default: he(() => [
|
|
3388
|
+
De(G(c.value ? "收起" : "展开") + " ", 1),
|
|
3389
|
+
n("span", {
|
|
3390
|
+
class: z(["inline-block ml-1 transition-transform duration-300 text-[10px]", { "rotate-180": c.value }])
|
|
3391
|
+
}, "▼", 2)
|
|
3392
|
+
]),
|
|
3393
|
+
_: 1
|
|
3394
|
+
})
|
|
3395
|
+
])) : A("", !0),
|
|
3396
|
+
n("div", go, [
|
|
3397
|
+
n("div", yo, [
|
|
3398
|
+
de(Re, {
|
|
3399
|
+
variant: "primary",
|
|
3400
|
+
size: "small",
|
|
3401
|
+
onClick: d,
|
|
3402
|
+
loading: e.loading
|
|
3403
|
+
}, {
|
|
3404
|
+
default: he(() => [...V[0] || (V[0] = [
|
|
3405
|
+
De(" 搜索 ", -1)
|
|
3406
|
+
])]),
|
|
3407
|
+
_: 1
|
|
3408
|
+
}, 8, ["loading"]),
|
|
3409
|
+
de(Re, {
|
|
3410
|
+
variant: "secondary",
|
|
3411
|
+
size: "small",
|
|
3412
|
+
onClick: u,
|
|
3413
|
+
loading: e.loading
|
|
3414
|
+
}, {
|
|
3415
|
+
default: he(() => [...V[1] || (V[1] = [
|
|
3416
|
+
De(" 重置 ", -1)
|
|
3417
|
+
])]),
|
|
3418
|
+
_: 1
|
|
3419
|
+
}, 8, ["loading"]),
|
|
3420
|
+
ue($.$slots, "extra-actions", {}, void 0, !0)
|
|
3421
|
+
])
|
|
3422
|
+
])
|
|
3423
|
+
])
|
|
3424
|
+
])
|
|
3425
|
+
])
|
|
3426
|
+
]));
|
|
3427
|
+
}
|
|
3428
|
+
}), wo = /* @__PURE__ */ we(mo, [["__scopeId", "data-v-592844b2"]]), bo = {
|
|
3429
|
+
class: "y-msg__icon",
|
|
3430
|
+
"aria-hidden": "true"
|
|
3431
|
+
}, ko = {
|
|
3432
|
+
key: 0,
|
|
3433
|
+
width: "16",
|
|
3434
|
+
height: "16",
|
|
3435
|
+
viewBox: "0 0 24 24",
|
|
3436
|
+
fill: "none"
|
|
3437
|
+
}, xo = {
|
|
3438
|
+
key: 1,
|
|
3439
|
+
width: "16",
|
|
3440
|
+
height: "16",
|
|
3441
|
+
viewBox: "0 0 24 24",
|
|
3442
|
+
fill: "none"
|
|
3443
|
+
}, Do = {
|
|
3444
|
+
key: 2,
|
|
3445
|
+
width: "16",
|
|
3446
|
+
height: "16",
|
|
3447
|
+
viewBox: "0 0 24 24",
|
|
3448
|
+
fill: "none"
|
|
3449
|
+
}, $o = ["textContent"], Co = /* @__PURE__ */ me({
|
|
3450
|
+
__name: "ymessageToast",
|
|
3451
|
+
props: {
|
|
3452
|
+
id: {},
|
|
3453
|
+
type: { default: "success" },
|
|
3454
|
+
message: {},
|
|
3455
|
+
duration: { default: 3e3 },
|
|
3456
|
+
offset: {},
|
|
3457
|
+
zIndex: {},
|
|
3458
|
+
closable: { type: Boolean, default: !1 },
|
|
3459
|
+
onClose: {}
|
|
3460
|
+
},
|
|
3461
|
+
setup(e) {
|
|
3462
|
+
const m = e, t = R(!1);
|
|
3463
|
+
let l;
|
|
3464
|
+
_e(() => {
|
|
3465
|
+
requestAnimationFrame(() => {
|
|
3466
|
+
t.value = !0, m.duration && m.duration > 0 && (l = window.setTimeout(() => c(), m.duration));
|
|
3467
|
+
});
|
|
3468
|
+
}), st(() => {
|
|
3469
|
+
l && window.clearTimeout(l);
|
|
3470
|
+
});
|
|
3471
|
+
function c() {
|
|
3472
|
+
t.value = !1;
|
|
3473
|
+
}
|
|
3474
|
+
function s() {
|
|
3475
|
+
var k;
|
|
3476
|
+
(k = m.onClose) == null || k.call(m, m.id);
|
|
3477
|
+
}
|
|
3478
|
+
return (k, C) => (a(), Le(ke, {
|
|
3479
|
+
name: "y-msg-fade",
|
|
3480
|
+
onAfterLeave: s
|
|
3481
|
+
}, {
|
|
3482
|
+
default: he(() => [
|
|
3483
|
+
Ee(n("div", {
|
|
3484
|
+
class: z(["y-msg", [`y-msg--${e.type}`]]),
|
|
3485
|
+
style: ye({ zIndex: e.zIndex }),
|
|
3486
|
+
role: "status",
|
|
3487
|
+
"aria-live": "polite"
|
|
3488
|
+
}, [
|
|
3489
|
+
n("span", bo, [
|
|
3490
|
+
e.type === "success" ? (a(), i("svg", ko, [...C[0] || (C[0] = [
|
|
3491
|
+
n("path", {
|
|
3492
|
+
d: "M20 6L9 17l-5-5",
|
|
3493
|
+
stroke: "currentColor",
|
|
3494
|
+
"stroke-width": "2",
|
|
3495
|
+
"stroke-linecap": "round",
|
|
3496
|
+
"stroke-linejoin": "round"
|
|
3497
|
+
}, null, -1)
|
|
3498
|
+
])])) : e.type === "warning" ? (a(), i("svg", xo, [...C[1] || (C[1] = [
|
|
3499
|
+
n("path", {
|
|
3500
|
+
d: "M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z",
|
|
3501
|
+
stroke: "currentColor",
|
|
3502
|
+
"stroke-width": "2",
|
|
3503
|
+
"stroke-linecap": "round",
|
|
3504
|
+
"stroke-linejoin": "round"
|
|
3505
|
+
}, null, -1)
|
|
3506
|
+
])])) : (a(), i("svg", Do, [...C[2] || (C[2] = [
|
|
3507
|
+
n("path", {
|
|
3508
|
+
d: "M12 9v4m0 4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z",
|
|
3509
|
+
stroke: "currentColor",
|
|
3510
|
+
"stroke-width": "2",
|
|
3511
|
+
"stroke-linecap": "round",
|
|
3512
|
+
"stroke-linejoin": "round"
|
|
3513
|
+
}, null, -1)
|
|
3514
|
+
])]))
|
|
3515
|
+
]),
|
|
3516
|
+
n("div", {
|
|
3517
|
+
class: "y-msg__content",
|
|
3518
|
+
textContent: G(e.message)
|
|
3519
|
+
}, null, 8, $o),
|
|
3520
|
+
e.closable ? (a(), i("button", {
|
|
3521
|
+
key: 0,
|
|
3522
|
+
class: "y-msg__close",
|
|
3523
|
+
type: "button",
|
|
3524
|
+
onClick: c
|
|
3525
|
+
}, "✕")) : A("", !0)
|
|
3526
|
+
], 6), [
|
|
3527
|
+
[Ke, t.value]
|
|
3528
|
+
])
|
|
3529
|
+
]),
|
|
3530
|
+
_: 1
|
|
3531
|
+
}));
|
|
3532
|
+
}
|
|
3533
|
+
}), _o = /* @__PURE__ */ we(Co, [["__scopeId", "data-v-60a4b340"]]);
|
|
3534
|
+
let So = 1;
|
|
3535
|
+
const Pe = 12, Me = [];
|
|
3536
|
+
function Mo() {
|
|
3537
|
+
let e = 20;
|
|
3538
|
+
return Me.forEach((m) => {
|
|
3539
|
+
e += m.height + Pe;
|
|
3540
|
+
}), e;
|
|
3541
|
+
}
|
|
3542
|
+
function Oe(e) {
|
|
3543
|
+
const m = Me.findIndex((s) => s.id === e);
|
|
3544
|
+
if (m === -1) return;
|
|
3545
|
+
const { el: t } = Me[m], l = t.firstElementChild;
|
|
3546
|
+
if (l) {
|
|
3547
|
+
const s = window.getComputedStyle(l).top;
|
|
3548
|
+
l.style.top = s, l.classList.add("is-leaving"), l.style.willChange = "opacity, transform";
|
|
3549
|
+
}
|
|
3550
|
+
Me[m].leaving = !0, Fe(), setTimeout(() => {
|
|
3551
|
+
qe(null, t), t.parentNode && t.parentNode.removeChild(t);
|
|
3552
|
+
const s = Me.findIndex((k) => k.id === e);
|
|
3553
|
+
s !== -1 && Me.splice(s, 1), Fe();
|
|
3554
|
+
}, 260);
|
|
3555
|
+
}
|
|
3556
|
+
function Ne(e) {
|
|
3557
|
+
var s;
|
|
3558
|
+
const m = So++, t = document.createElement("div");
|
|
3559
|
+
document.body.appendChild(t);
|
|
3560
|
+
const l = de(_o, {
|
|
3561
|
+
id: m,
|
|
3562
|
+
type: e.type || "success",
|
|
3563
|
+
message: e.message,
|
|
3564
|
+
duration: e.duration ?? 2500,
|
|
3565
|
+
offset: Mo(),
|
|
3566
|
+
zIndex: 3e3 + m,
|
|
3567
|
+
closable: e.closable ?? !1,
|
|
3568
|
+
onClose: (k) => Oe(k)
|
|
3569
|
+
});
|
|
3570
|
+
qe(l, t);
|
|
3571
|
+
const c = ((s = t.firstElementChild) == null ? void 0 : s.offsetHeight) || 0;
|
|
3572
|
+
return Me.push({ id: m, el: t, vm: l, height: c, leaving: !1 }), Fe(), requestAnimationFrame(() => {
|
|
3573
|
+
const k = t.firstElementChild;
|
|
3574
|
+
if (!k) return;
|
|
3575
|
+
const C = k.offsetHeight || c || 0, L = Me.find((I) => I.id === m);
|
|
3576
|
+
L && (L.height = C, Fe());
|
|
3577
|
+
}), { close: () => Oe(m) };
|
|
3578
|
+
}
|
|
3579
|
+
const Io = {
|
|
3580
|
+
success(e, m = {}) {
|
|
3581
|
+
return Ne({ ...m, type: "success", message: e });
|
|
3582
|
+
},
|
|
3583
|
+
warning(e, m = {}) {
|
|
3584
|
+
return Ne({ ...m, type: "warning", message: e });
|
|
3585
|
+
},
|
|
3586
|
+
error(e, m = {}) {
|
|
3587
|
+
return Ne({ ...m, type: "error", message: e });
|
|
3588
|
+
}
|
|
3589
|
+
};
|
|
3590
|
+
function Fe() {
|
|
3591
|
+
let e = 20;
|
|
3592
|
+
Me.forEach((m) => {
|
|
3593
|
+
const t = m.el.firstElementChild;
|
|
3594
|
+
if (!t) return;
|
|
3595
|
+
const l = e;
|
|
3596
|
+
if (t.style.transform = `translate(-50%, ${l}px)`, t.style.top || (t.style.top = "0px"), !m.leaving)
|
|
3597
|
+
e += (t.offsetHeight || m.height) + Pe;
|
|
3598
|
+
else {
|
|
3599
|
+
const c = t.offsetHeight || m.height;
|
|
3600
|
+
e += c + Pe;
|
|
3601
|
+
}
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
const Ue = {
|
|
3605
|
+
YButton: Re,
|
|
3606
|
+
YInput: Ze,
|
|
3607
|
+
YTable: Nt,
|
|
3608
|
+
YSelect: Ye,
|
|
3609
|
+
YPagination: Qe,
|
|
3610
|
+
YBadge: nn,
|
|
3611
|
+
YDialog: cn,
|
|
3612
|
+
YPopover: hn,
|
|
3613
|
+
YTime: Je,
|
|
3614
|
+
YSwitch: Xn,
|
|
3615
|
+
YImage: nl,
|
|
3616
|
+
YDropdown: ol,
|
|
3617
|
+
YDrawer: fl,
|
|
3618
|
+
YTree: io,
|
|
3619
|
+
QueryEncapsulation: wo
|
|
3620
|
+
}, Eo = {
|
|
3621
|
+
install(e) {
|
|
3622
|
+
Object.keys(Ue).forEach((m) => {
|
|
3623
|
+
e.component(m, Ue[m]);
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3627
|
+
export {
|
|
3628
|
+
wo as QueryEncapsulation,
|
|
3629
|
+
nn as YBadge,
|
|
3630
|
+
Re as YButton,
|
|
3631
|
+
cn as YDialog,
|
|
3632
|
+
fl as YDrawer,
|
|
3633
|
+
ol as YDropdown,
|
|
3634
|
+
nl as YImage,
|
|
3635
|
+
Ze as YInput,
|
|
3636
|
+
Io as YMessage,
|
|
3637
|
+
Qe as YPagination,
|
|
3638
|
+
hn as YPopover,
|
|
3639
|
+
Ye as YSelect,
|
|
3640
|
+
Xn as YSwitch,
|
|
3641
|
+
Nt as YTable,
|
|
3642
|
+
Je as YTime,
|
|
3643
|
+
io as YTree,
|
|
3644
|
+
Eo as default
|
|
3645
|
+
};
|
|
3646
|
+
//# sourceMappingURL=index.esm.js.map
|