epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
5,828 lines • 200 kB
JavaScript
import { e as Sn, f as ce, r as Pn, c as Vn, a as $n, b as En } from "./weekYear-84bbb159.js";
import { E as ui, t as ci, a as di, n as fi, b as vi, c as pi, g as mi, m as hi, o as bi, q as gi, r as yi, s as ki, p as wi, u as Ci, f as Si, l as Pi, j as Vi, k as $i, h as Ei, i as Ni, d as _i, e as Ti } from "./index-ef10270f.js";
import { E as St } from "./index-d07ec27c.js";
import { b as Ii, e as Di, a as Oi, c as Ai, d as xi } from "./index-d07ec27c.js";
import { E as Ri, c as Fi } from "./index-36c09168.js";
import { a2 as Bt, a3 as _a, a4 as Ae, a5 as $e, a6 as pe, a7 as ja, a8 as Pt, a9 as Ce, aa as We, ab as Nn, ac as _n, ad as _t, ae as Tn, af as be, ag as Ne, ah as ye, ai as gt, aj as Mn, ak as Xa, al as Qt, am as kt, an as Ga, ao as ga, ap as Ot, aq as In, ar as Ta, as as Dn, at as Ie, au as Xe, av as ya, aw as At, ax as ia, ay as On, az as An, aA as ua, aB as ut, aC as Ma, aD as ka, aE as xn, aF as ea, aG as Za, aH as Rt, aI as ca, aJ as Ft, aK as xe, aL as lt, aM as Bn, aN as Rn, aO as wa, aP as Fn, aQ as Ln } from "./index-97ce4605.js";
import { aW as Ki, aX as Yi, b2 as zi, b3 as Hi, bc as Wi, bd as Ui, bh as qi, bo as ji, aV as Xi, aR as Gi, aU as Zi, aS as Ji, be as Qi, bf as eu, bk as tu, aT as au, b0 as nu, aY as lu, b1 as su, a_ as ou, a$ as ru, aZ as iu, b4 as uu, bl as cu, b7 as du, b8 as fu, b9 as vu, ba as pu, b5 as mu, b6 as hu, bb as bu, bm as gu, bp as yu, bi as ku, bj as wu, bn as Cu, bg as Su } from "./index-97ce4605.js";
import { defineComponent as ke, useAttrs as ta, inject as Ge, ref as Y, computed as C, watch as ge, nextTick as Pe, unref as e, provide as Vt, openBlock as k, createBlock as re, mergeProps as Ja, withCtx as le, normalizeClass as b, normalizeStyle as Oe, withModifiers as Me, resolveDynamicComponent as bt, createCommentVNode as se, createElementBlock as B, createElementVNode as W, renderSlot as $t, toDisplayString as me, onMounted as st, Fragment as we, renderList as Ee, createTextVNode as et, withDirectives as De, createVNode as q, Transition as Kn, h as Qa, resolveComponent as je, getCurrentInstance as pt, reactive as Tt, onBeforeUpdate as Yn, withKeys as Fe, vModelText as zn, isRef as Hn, vShow as it, shallowRef as da, watchEffect as Wn, useSlots as en, toRef as Et, onUpdated as Un, toRefs as fa } from "vue";
import { E as Lt, a as nt, b as Ca, u as qn, t as jn, c as Ia, C as Kt, i as Xn, T as Gn, d as tn, e as Zn } from "./index-7fa6e505.js";
import { B as Vu, H as $u, v as Eu, o as Nu, s as _u, q as Tu, I as Mu, $ as Iu, G as Du, P as Ou, n as Au, U as xu, f as Bu, g as Ru, m as Fu, j as Lu, k as Ku, l as Yu, p as zu, h as Hu, w as Wu, r as Uu, A as qu, x as ju, y as Xu, D as Gu, F as Zu, J as Ju, z as Qu, K as ec, R as tc, a2 as ac, Z as nc, _ as lc, S as sc, a3 as oc, a0 as rc, a1 as ic, V as uc, X as cc, Y as dc, W as fc, L as vc, M as pc, N as mc, O as hc, Q as bc } from "./index-7fa6e505.js";
import { E as Jn } from "./index-2314d161.js";
import { f as yc, g as kc, b as wc, e as Cc, c as Sc, a as Pc, d as Vc } from "./index-2314d161.js";
import { E as Qn } from "./index-258e6c5b.js";
import { g as Ec, h as Nc, e as _c, r as Tc, c as Mc, f as Ic, d as Dc, a as Oc, b as Ac } from "./index-258e6c5b.js";
import { u as Re, i as Da } from "./index-da336cb2.js";
import { b as Bc, a as Rc, d as Fc, l as Lc, t as Kc, c as Yc, z as zc } from "./index-da336cb2.js";
import { i as wt } from "./isEqual-eac09a18.js";
import { s as el } from "./focus-trap-06d2e133.js";
import { u as Wc } from "./focus-trap-06d2e133.js";
import { b as tl, a as al } from "./_flatRest-fa7c8eb8.js";
import { c as an } from "./cloneDeep-aa0cb853.js";
import { u as Mt, a as Sa } from "./use-form-item-5dfea179.js";
import { d as Yt } from "./debounce-30ba20d9.js";
import { E as qc, c as jc } from "./index-d6f3776f.js";
import { i as vt } from "./isNil-8ef0e4b6.js";
import { c as Gc, p as Zc, u as Jc, a as Qc } from "./use-global-config-0bac757e.js";
import { g as mt, c as Pa } from "./_commonjsHelpers-c5d32002.js";
import { E as td, e as ad, d as nd, b as ld, a as sd, o as od, c as rd, u as id, f as ud, g as cd, h as dd } from "./index-ba3992dc.js";
import { E as vd, i as pd, a as md } from "./index-551fcfc8.js";
import { E as bd, R as gd, a as yd, r as kd } from "./index-2a40683a.js";
import { r as Cd } from "./constants-669e1a5f.js";
import "./index-2b6651fc.js";
import "./hasIn-b4ac620c.js";
import "./_baseIsEqual-2f2ed312.js";
import "./_overRest-dc82ce77.js";
const nn = (t) => !t.getAttribute("aria-owns"), ln = (t, n, l) => {
const { parentNode: a } = t;
if (!a)
return null;
const s = a.querySelectorAll(l), o = Array.prototype.indexOf.call(s, t);
return s[o + n] || null;
}, Ut = (t) => {
t && (t.focus(), !nn(t) && t.click());
}, Va = (t) => {
let n, l;
return t.type === "touchend" ? (l = t.changedTouches[0].clientY, n = t.changedTouches[0].clientX) : t.type.startsWith("touch") ? (l = t.touches[0].clientY, n = t.touches[0].clientX) : (l = t.clientY, n = t.clientX), {
clientX: n,
clientY: l
};
};
var nl = 1 / 0;
function ll(t) {
var n = t == null ? 0 : t.length;
return n ? tl(t, nl) : [];
}
const sl = [
"year",
"month",
"date",
"dates",
"week",
"datetime",
"datetimerange",
"daterange",
"monthrange"
], Oa = (t) => [...new Set(t)], ct = (t) => !t && t !== 0 ? [] : Array.isArray(t) ? t : [t];
var ol = Sn();
const rl = /* @__PURE__ */ mt(ol), Aa = ["hours", "minutes", "seconds"], xa = "HH:mm:ss", yt = "YYYY-MM-DD", il = {
date: yt,
dates: yt,
week: "gggg[w]ww",
year: "YYYY",
month: "YYYY-MM",
datetime: `${yt} ${xa}`,
monthrange: "YYYY-MM",
daterange: yt,
datetimerange: `${yt} ${xa}`
}, aa = (t, n) => [
t > 0 ? t - 1 : void 0,
t,
t < n ? t + 1 : void 0
], sn = (t) => Array.from(Array.from({ length: t }).keys()), on = (t) => t.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim(), rn = (t) => t.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim(), Ba = function(t, n) {
const l = _a(t), a = _a(n);
return l && a ? t.getTime() === n.getTime() : !l && !a ? t === n : !1;
}, Ra = function(t, n) {
const l = Ae(t), a = Ae(n);
return l && a ? t.length !== n.length ? !1 : t.every((s, o) => Ba(s, n[o])) : !l && !a ? Ba(t, n) : !1;
}, Fa = function(t, n, l) {
const a = Bt(n) || n === "x" ? ce(t).locale(l) : ce(t, n).locale(l);
return a.isValid() ? a : void 0;
}, La = function(t, n, l) {
return Bt(n) ? t : n === "x" ? +t : ce(t).locale(l).format(n);
}, na = (t, n) => {
var l;
const a = [], s = n == null ? void 0 : n();
for (let o = 0; o < t; o++)
a.push((l = s == null ? void 0 : s.includes(o)) != null ? l : !1);
return a;
}, un = $e({
disabledHours: {
type: pe(Function)
},
disabledMinutes: {
type: pe(Function)
},
disabledSeconds: {
type: pe(Function)
}
}), ul = $e({
visible: Boolean,
actualVisible: {
type: Boolean,
default: void 0
},
format: {
type: String,
default: ""
}
}), cn = $e({
id: {
type: pe([Array, String])
},
name: {
type: pe([Array, String]),
default: ""
},
popperClass: {
type: String,
default: ""
},
format: String,
valueFormat: String,
type: {
type: String,
default: ""
},
clearable: {
type: Boolean,
default: !0
},
clearIcon: {
type: pe([String, Object]),
default: ja
},
editable: {
type: Boolean,
default: !0
},
prefixIcon: {
type: pe([String, Object]),
default: ""
},
size: Pt,
readonly: {
type: Boolean,
default: !1
},
disabled: {
type: Boolean,
default: !1
},
placeholder: {
type: String,
default: ""
},
popperOptions: {
type: pe(Object),
default: () => ({})
},
modelValue: {
type: pe([Date, Array, String, Number]),
default: ""
},
rangeSeparator: {
type: String,
default: "-"
},
startPlaceholder: String,
endPlaceholder: String,
defaultValue: {
type: pe([Date, Array])
},
defaultTime: {
type: pe([Date, Array])
},
isRange: {
type: Boolean,
default: !1
},
...un,
disabledDate: {
type: Function
},
cellClassName: {
type: Function
},
shortcuts: {
type: Array,
default: () => []
},
arrowControl: {
type: Boolean,
default: !1
},
label: {
type: String,
default: void 0
},
tabindex: {
type: pe([String, Number]),
default: 0
},
validateEvent: {
type: Boolean,
default: !0
},
unlinkPanels: Boolean
}), cl = ["id", "name", "placeholder", "value", "disabled", "readonly"], dl = ["id", "name", "placeholder", "value", "disabled", "readonly"], fl = ke({
name: "Picker"
}), vl = /* @__PURE__ */ ke({
...fl,
props: cn,
emits: [
"update:modelValue",
"change",
"focus",
"blur",
"calendar-change",
"panel-change",
"visible-change",
"keydown"
],
setup(t, { expose: n, emit: l }) {
const a = t, s = ta(), { lang: o } = Re(), r = Ce("date"), d = Ce("input"), u = Ce("range"), { form: g, formItem: P } = Mt(), S = Ge("ElPopperOptions", {}), _ = Y(), m = Y(), h = Y(!1), w = Y(!1), $ = Y(null);
let j = !1, E = !1;
const p = C(() => [
r.b("editor"),
r.bm("editor", a.type),
d.e("wrapper"),
r.is("disabled", c.value),
r.is("active", h.value),
u.b("editor"),
Ye ? u.bm("editor", Ye.value) : "",
s.class
]), A = C(() => [
d.e("icon"),
u.e("close-icon"),
fe.value ? "" : u.e("close-icon--hidden")
]);
ge(h, (i) => {
i ? Pe(() => {
i && ($.value = a.modelValue);
}) : (de.value = null, Pe(() => {
R(a.modelValue);
}));
});
const R = (i, U) => {
(U || !Ra(i, $.value)) && (l("change", i), a.validateEvent && (P == null || P.validate("change").catch((oe) => We(oe))));
}, O = (i) => {
if (!Ra(a.modelValue, i)) {
let U;
Ae(i) ? U = i.map((oe) => La(oe, a.valueFormat, o.value)) : i && (U = La(i, a.valueFormat, o.value)), l("update:modelValue", i && U, o.value);
}
}, te = (i) => {
l("keydown", i);
}, V = C(() => {
if (m.value) {
const i = Ke.value ? m.value : m.value.$el;
return Array.from(i.querySelectorAll("input"));
}
return [];
}), Q = (i, U, oe) => {
const Ve = V.value;
Ve.length && (!oe || oe === "min" ? (Ve[0].setSelectionRange(i, U), Ve[0].focus()) : oe === "max" && (Ve[1].setSelectionRange(i, U), Ve[1].focus()));
}, ne = () => {
F(!0, !0), Pe(() => {
E = !1;
});
}, G = (i = "", U = !1) => {
U || (E = !0), h.value = U;
let oe;
Ae(i) ? oe = i.map((Ve) => Ve.toDate()) : oe = i && i.toDate(), de.value = null, O(oe);
}, z = () => {
w.value = !0;
}, f = () => {
l("visible-change", !0);
}, T = (i) => {
(i == null ? void 0 : i.key) === ye.esc && F(!0, !0);
}, X = () => {
w.value = !1, h.value = !1, E = !1, l("visible-change", !1);
}, ae = () => {
h.value = !0;
}, K = () => {
h.value = !1;
}, F = (i = !0, U = !1) => {
E = U;
const [oe, Ve] = e(V);
let Qe = oe;
!i && Ke.value && (Qe = Ve), Qe && Qe.focus();
}, v = (i) => {
a.readonly || c.value || h.value || E || (h.value = !0, l("focus", i));
};
let M;
const x = (i) => {
const U = async () => {
setTimeout(() => {
var oe;
M === U && (!((oe = _.value) != null && oe.isFocusInsideContent() && !j) && V.value.filter((Ve) => Ve.contains(document.activeElement)).length === 0 && (ot(), h.value = !1, l("blur", i), a.validateEvent && (P == null || P.validate("blur").catch((Ve) => We(Ve)))), j = !1);
}, 0);
};
M = U, U();
}, c = C(() => a.disabled || (g == null ? void 0 : g.disabled)), D = C(() => {
let i;
if (_e.value ? y.value.getDefaultValue && (i = y.value.getDefaultValue()) : Ae(a.modelValue) ? i = a.modelValue.map((U) => Fa(U, a.valueFormat, o.value)) : i = Fa(a.modelValue, a.valueFormat, o.value), y.value.getRangeAvailableTime) {
const U = y.value.getRangeAvailableTime(i);
wt(U, i) || (i = U, O(Ae(i) ? i.map((oe) => oe.toDate()) : i.toDate()));
}
return Ae(i) && i.some((U) => !U) && (i = []), i;
}), Z = C(() => {
if (!y.value.panelReady)
return "";
const i = Ue(D.value);
return Ae(de.value) ? [
de.value[0] || i && i[0] || "",
de.value[1] || i && i[1] || ""
] : de.value !== null ? de.value : !ee.value && _e.value || !h.value && _e.value ? "" : i ? he.value ? i.join(", ") : i : "";
}), ie = C(() => a.type.includes("time")), ee = C(() => a.type.startsWith("time")), he = C(() => a.type === "dates"), ve = C(() => a.prefixIcon || (ie.value ? Nn : _n)), fe = Y(!1), ue = (i) => {
a.readonly || c.value || fe.value && (i.stopPropagation(), ne(), O(null), R(null, !0), fe.value = !1, h.value = !1, y.value.handleClear && y.value.handleClear());
}, _e = C(() => {
const { modelValue: i } = a;
return !i || Ae(i) && !i.filter(Boolean).length;
}), Te = async (i) => {
var U;
a.readonly || c.value || (((U = i.target) == null ? void 0 : U.tagName) !== "INPUT" || V.value.includes(document.activeElement)) && (h.value = !0);
}, Le = () => {
a.readonly || c.value || !_e.value && a.clearable && (fe.value = !0);
}, Be = () => {
fe.value = !1;
}, Ze = (i) => {
var U;
a.readonly || c.value || (((U = i.touches[0].target) == null ? void 0 : U.tagName) !== "INPUT" || V.value.includes(document.activeElement)) && (h.value = !0);
}, Ke = C(() => a.type.includes("range")), Ye = _t(), dt = C(() => {
var i, U;
return (U = (i = e(_)) == null ? void 0 : i.popperRef) == null ? void 0 : U.contentRef;
}), ze = C(() => {
var i;
return e(Ke) ? e(m) : (i = e(m)) == null ? void 0 : i.$el;
});
Tn(ze, (i) => {
const U = e(dt), oe = e(ze);
U && (i.target === U || i.composedPath().includes(U)) || i.target === oe || i.composedPath().includes(oe) || (h.value = !1);
});
const de = Y(null), ot = () => {
if (de.value) {
const i = tt(Z.value);
i && He(i) && (O(Ae(i) ? i.map((U) => U.toDate()) : i.toDate()), de.value = null);
}
de.value === "" && (O(null), R(null), de.value = null);
}, tt = (i) => i ? y.value.parseUserInput(i) : null, Ue = (i) => i ? y.value.formatToString(i) : null, He = (i) => y.value.isValidValue(i), qe = async (i) => {
if (a.readonly || c.value)
return;
const { code: U } = i;
if (te(i), U === ye.esc) {
h.value === !0 && (h.value = !1, i.preventDefault(), i.stopPropagation());
return;
}
if (U === ye.down && (y.value.handleFocusPicker && (i.preventDefault(), i.stopPropagation()), h.value === !1 && (h.value = !0, await Pe()), y.value.handleFocusPicker)) {
y.value.handleFocusPicker();
return;
}
if (U === ye.tab) {
j = !0;
return;
}
if (U === ye.enter || U === ye.numpadEnter) {
(de.value === null || de.value === "" || He(tt(Z.value))) && (ot(), h.value = !1), i.stopPropagation();
return;
}
if (de.value) {
i.stopPropagation();
return;
}
y.value.handleKeydownInput && y.value.handleKeydownInput(i);
}, ft = (i) => {
de.value = i, h.value || (h.value = !0);
}, rt = (i) => {
const U = i.target;
de.value ? de.value = [U.value, de.value[1]] : de.value = [U.value, null];
}, Je = (i) => {
const U = i.target;
de.value ? de.value = [de.value[0], U.value] : de.value = [null, U.value];
}, I = () => {
var i;
const U = de.value, oe = tt(U && U[0]), Ve = e(D);
if (oe && oe.isValid()) {
de.value = [
Ue(oe),
((i = Z.value) == null ? void 0 : i[1]) || null
];
const Qe = [oe, Ve && (Ve[1] || null)];
He(Qe) && (O(Qe), de.value = null);
}
}, J = () => {
var i;
const U = e(de), oe = tt(U && U[1]), Ve = e(D);
if (oe && oe.isValid()) {
de.value = [
((i = e(Z)) == null ? void 0 : i[0]) || null,
Ue(oe)
];
const Qe = [Ve && Ve[0], oe];
He(Qe) && (O(Qe), de.value = null);
}
}, y = Y({}), L = (i) => {
y.value[i[0]] = i[1], y.value.panelReady = !0;
}, N = (i) => {
l("calendar-change", i);
}, H = (i, U, oe) => {
l("panel-change", i, U, oe);
};
return Vt("EP_PICKER_BASE", {
props: a
}), n({
focus: F,
handleFocusInput: v,
handleBlurInput: x,
handleOpen: ae,
handleClose: K,
onPick: G
}), (i, U) => (k(), re(e(Lt), Ja({
ref_key: "refPopper",
ref: _,
visible: h.value,
effect: "light",
pure: "",
trigger: "click"
}, i.$attrs, {
role: "dialog",
teleported: "",
transition: `${e(r).namespace.value}-zoom-in-top`,
"popper-class": [`${e(r).namespace.value}-picker__popper`, i.popperClass],
"popper-options": e(S),
"fallback-placements": ["bottom", "top", "right", "left"],
"gpu-acceleration": !1,
"stop-popper-mouse-event": !1,
"hide-after": 0,
persistent: "",
onBeforeShow: z,
onShow: f,
onHide: X
}), {
default: le(() => [
e(Ke) ? (k(), B("div", {
key: 1,
ref_key: "inputRef",
ref: m,
class: b(e(p)),
style: Oe(i.$attrs.style),
onClick: v,
onMouseenter: Le,
onMouseleave: Be,
onTouchstart: Ze,
onKeydown: qe
}, [
e(ve) ? (k(), re(e(be), {
key: 0,
class: b([e(d).e("icon"), e(u).e("icon")]),
onMousedown: Me(Te, ["prevent"]),
onTouchstart: Ze
}, {
default: le(() => [
(k(), re(bt(e(ve))))
]),
_: 1
}, 8, ["class", "onMousedown"])) : se("v-if", !0),
W("input", {
id: i.id && i.id[0],
autocomplete: "off",
name: i.name && i.name[0],
placeholder: i.startPlaceholder,
value: e(Z) && e(Z)[0],
disabled: e(c),
readonly: !i.editable || i.readonly,
class: b(e(u).b("input")),
onMousedown: Te,
onInput: rt,
onChange: I,
onFocus: v,
onBlur: x
}, null, 42, cl),
$t(i.$slots, "range-separator", {}, () => [
W("span", {
class: b(e(u).b("separator"))
}, me(i.rangeSeparator), 3)
]),
W("input", {
id: i.id && i.id[1],
autocomplete: "off",
name: i.name && i.name[1],
placeholder: i.endPlaceholder,
value: e(Z) && e(Z)[1],
disabled: e(c),
readonly: !i.editable || i.readonly,
class: b(e(u).b("input")),
onMousedown: Te,
onFocus: v,
onBlur: x,
onInput: Je,
onChange: J
}, null, 42, dl),
i.clearIcon ? (k(), re(e(be), {
key: 1,
class: b(e(A)),
onClick: ue
}, {
default: le(() => [
(k(), re(bt(i.clearIcon)))
]),
_: 1
}, 8, ["class"])) : se("v-if", !0)
], 38)) : (k(), re(e(nt), {
key: 0,
id: i.id,
ref_key: "inputRef",
ref: m,
"container-role": "combobox",
"model-value": e(Z),
name: i.name,
size: e(Ye),
disabled: e(c),
placeholder: i.placeholder,
class: b([e(r).b("editor"), e(r).bm("editor", i.type), i.$attrs.class]),
style: Oe(i.$attrs.style),
readonly: !i.editable || i.readonly || e(he) || i.type === "week",
label: i.label,
tabindex: i.tabindex,
"validate-event": !1,
onInput: ft,
onFocus: v,
onBlur: x,
onKeydown: qe,
onChange: ot,
onMousedown: Te,
onMouseenter: Le,
onMouseleave: Be,
onTouchstart: Ze,
onClick: U[0] || (U[0] = Me(() => {
}, ["stop"]))
}, {
prefix: le(() => [
e(ve) ? (k(), re(e(be), {
key: 0,
class: b(e(d).e("icon")),
onMousedown: Me(Te, ["prevent"]),
onTouchstart: Ze
}, {
default: le(() => [
(k(), re(bt(e(ve))))
]),
_: 1
}, 8, ["class", "onMousedown"])) : se("v-if", !0)
]),
suffix: le(() => [
fe.value && i.clearIcon ? (k(), re(e(be), {
key: 0,
class: b(`${e(d).e("icon")} clear-icon`),
onClick: Me(ue, ["stop"])
}, {
default: le(() => [
(k(), re(bt(i.clearIcon)))
]),
_: 1
}, 8, ["class", "onClick"])) : se("v-if", !0)
]),
_: 1
}, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"]))
]),
content: le(() => [
$t(i.$slots, "default", {
visible: h.value,
actualVisible: w.value,
parsedValue: e(D),
format: i.format,
unlinkPanels: i.unlinkPanels,
type: i.type,
defaultValue: i.defaultValue,
onPick: G,
onSelectRange: Q,
onSetPickerOption: L,
onCalendarChange: N,
onPanelChange: H,
onKeydown: T,
onMousedown: U[1] || (U[1] = Me(() => {
}, ["stop"]))
})
]),
_: 3
}, 16, ["visible", "transition", "popper-class", "popper-options"]));
}
});
var pl = /* @__PURE__ */ Ne(vl, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
const ml = $e({
...ul,
datetimeRole: String,
parsedValue: {
type: pe(Object)
}
}), hl = ({
getAvailableHours: t,
getAvailableMinutes: n,
getAvailableSeconds: l
}) => {
const a = (r, d, u, g) => {
const P = {
hour: t,
minute: n,
second: l
};
let S = r;
return ["hour", "minute", "second"].forEach((_) => {
if (P[_]) {
let m;
const h = P[_];
switch (_) {
case "minute": {
m = h(S.hour(), d, g);
break;
}
case "second": {
m = h(S.hour(), S.minute(), d, g);
break;
}
default: {
m = h(d, g);
break;
}
}
if (m != null && m.length && !m.includes(S[_]())) {
const w = u ? 0 : m.length - 1;
S = S[_](m[w]);
}
}
}), S;
}, s = {};
return {
timePickerOptions: s,
getAvailableTime: a,
onSetOption: ([r, d]) => {
s[r] = d;
}
};
}, la = (t) => {
const n = (a, s) => a || s, l = (a) => a !== !0;
return t.map(n).filter(l);
}, dn = (t, n, l) => ({
getHoursList: (r, d) => na(24, t && (() => t == null ? void 0 : t(r, d))),
getMinutesList: (r, d, u) => na(60, n && (() => n == null ? void 0 : n(r, d, u))),
getSecondsList: (r, d, u, g) => na(60, l && (() => l == null ? void 0 : l(r, d, u, g)))
}), bl = (t, n, l) => {
const { getHoursList: a, getMinutesList: s, getSecondsList: o } = dn(t, n, l);
return {
getAvailableHours: (g, P) => la(a(g, P)),
getAvailableMinutes: (g, P, S) => la(s(g, P, S)),
getAvailableSeconds: (g, P, S, _) => la(o(g, P, S, _))
};
}, gl = (t) => {
const n = Y(t.parsedValue);
return ge(() => t.visible, (l) => {
l || (n.value = t.parsedValue);
}), n;
}, yl = 100, kl = 600, Jt = {
beforeMount(t, n) {
const l = n.value, { interval: a = yl, delay: s = kl } = gt(l) ? {} : l;
let o, r;
const d = () => gt(l) ? l() : l.handler(), u = () => {
r && (clearTimeout(r), r = void 0), o && (clearInterval(o), o = void 0);
};
t.addEventListener("mousedown", (g) => {
g.button === 0 && (u(), d(), document.addEventListener("mouseup", () => u(), {
once: !0
}), r = setTimeout(() => {
o = setInterval(() => {
d();
}, a);
}, s));
});
}
}, wl = $e({
role: {
type: String,
required: !0
},
spinnerDate: {
type: pe(Object),
required: !0
},
showSeconds: {
type: Boolean,
default: !0
},
arrowControl: Boolean,
amPmMode: {
type: pe(String),
default: ""
},
...un
}), Cl = ["onClick"], Sl = ["onMouseenter"], Pl = /* @__PURE__ */ ke({
__name: "basic-time-spinner",
props: wl,
emits: ["change", "select-range", "set-option"],
setup(t, { emit: n }) {
const l = t, a = Ce("time"), { getHoursList: s, getMinutesList: o, getSecondsList: r } = dn(l.disabledHours, l.disabledMinutes, l.disabledSeconds);
let d = !1;
const u = Y(), g = Y(), P = Y(), S = Y(), _ = {
hours: g,
minutes: P,
seconds: S
}, m = C(() => l.showSeconds ? Aa : Aa.slice(0, 2)), h = C(() => {
const { spinnerDate: v } = l, M = v.hour(), x = v.minute(), c = v.second();
return { hours: M, minutes: x, seconds: c };
}), w = C(() => {
const { hours: v, minutes: M } = e(h);
return {
hours: s(l.role),
minutes: o(v, l.role),
seconds: r(v, M, l.role)
};
}), $ = C(() => {
const { hours: v, minutes: M, seconds: x } = e(h);
return {
hours: aa(v, 23),
minutes: aa(M, 59),
seconds: aa(x, 59)
};
}), j = Yt((v) => {
d = !1, A(v);
}, 200), E = (v) => {
if (!!!l.amPmMode)
return "";
const x = l.amPmMode === "A";
let c = v < 12 ? " am" : " pm";
return x && (c = c.toUpperCase()), c;
}, p = (v) => {
let M;
switch (v) {
case "hours":
M = [0, 2];
break;
case "minutes":
M = [3, 5];
break;
case "seconds":
M = [6, 8];
break;
}
const [x, c] = M;
n("select-range", x, c), u.value = v;
}, A = (v) => {
te(v, e(h)[v]);
}, R = () => {
A("hours"), A("minutes"), A("seconds");
}, O = (v) => v.querySelector(`.${a.namespace.value}-scrollbar__wrap`), te = (v, M) => {
if (l.arrowControl)
return;
const x = e(_[v]);
x && x.$el && (O(x.$el).scrollTop = Math.max(0, M * V(v)));
}, V = (v) => {
const M = e(_[v]), x = M == null ? void 0 : M.$el.querySelector("li");
return x && Number.parseFloat(Mn(x, "height")) || 0;
}, Q = () => {
G(1);
}, ne = () => {
G(-1);
}, G = (v) => {
u.value || p("hours");
const M = u.value, x = e(h)[M], c = u.value === "hours" ? 24 : 60, D = z(M, x, v, c);
f(M, D), te(M, D), Pe(() => p(M));
}, z = (v, M, x, c) => {
let D = (M + x + c) % c;
const Z = e(w)[v];
for (; Z[D] && D !== M; )
D = (D + x + c) % c;
return D;
}, f = (v, M) => {
if (e(w)[v][M])
return;
const { hours: D, minutes: Z, seconds: ie } = e(h);
let ee;
switch (v) {
case "hours":
ee = l.spinnerDate.hour(M).minute(Z).second(ie);
break;
case "minutes":
ee = l.spinnerDate.hour(D).minute(M).second(ie);
break;
case "seconds":
ee = l.spinnerDate.hour(D).minute(Z).second(M);
break;
}
n("change", ee);
}, T = (v, { value: M, disabled: x }) => {
x || (f(v, M), p(v), te(v, M));
}, X = (v) => {
d = !0, j(v);
const M = Math.min(Math.round((O(e(_[v]).$el).scrollTop - (ae(v) * 0.5 - 10) / V(v) + 3) / V(v)), v === "hours" ? 23 : 59);
f(v, M);
}, ae = (v) => e(_[v]).$el.offsetHeight, K = () => {
const v = (M) => {
const x = e(_[M]);
x && x.$el && (O(x.$el).onscroll = () => {
X(M);
});
};
v("hours"), v("minutes"), v("seconds");
};
st(() => {
Pe(() => {
!l.arrowControl && K(), R(), l.role === "start" && p("hours");
});
});
const F = (v, M) => {
_[M].value = v;
};
return n("set-option", [`${l.role}_scrollDown`, G]), n("set-option", [`${l.role}_emitSelectRange`, p]), ge(() => l.spinnerDate, () => {
d || R();
}), (v, M) => (k(), B("div", {
class: b([e(a).b("spinner"), { "has-seconds": v.showSeconds }])
}, [
v.arrowControl ? se("v-if", !0) : (k(!0), B(we, { key: 0 }, Ee(e(m), (x) => (k(), re(e(Ca), {
key: x,
ref_for: !0,
ref: (c) => F(c, x),
class: b(e(a).be("spinner", "wrapper")),
"wrap-style": "max-height: inherit;",
"view-class": e(a).be("spinner", "list"),
noresize: "",
tag: "ul",
onMouseenter: (c) => p(x),
onMousemove: (c) => A(x)
}, {
default: le(() => [
(k(!0), B(we, null, Ee(e(w)[x], (c, D) => (k(), B("li", {
key: D,
class: b([
e(a).be("spinner", "item"),
e(a).is("active", D === e(h)[x]),
e(a).is("disabled", c)
]),
onClick: (Z) => T(x, { value: D, disabled: c })
}, [
x === "hours" ? (k(), B(we, { key: 0 }, [
et(me(("0" + (v.amPmMode ? D % 12 || 12 : D)).slice(-2)) + me(E(D)), 1)
], 64)) : (k(), B(we, { key: 1 }, [
et(me(("0" + D).slice(-2)), 1)
], 64))
], 10, Cl))), 128))
]),
_: 2
}, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]))), 128)),
v.arrowControl ? (k(!0), B(we, { key: 1 }, Ee(e(m), (x) => (k(), B("div", {
key: x,
class: b([e(a).be("spinner", "wrapper"), e(a).is("arrow")]),
onMouseenter: (c) => p(x)
}, [
De((k(), re(e(be), {
class: b(["arrow-up", e(a).be("spinner", "arrow")])
}, {
default: le(() => [
q(e(Xa))
]),
_: 1
}, 8, ["class"])), [
[e(Jt), ne]
]),
De((k(), re(e(be), {
class: b(["arrow-down", e(a).be("spinner", "arrow")])
}, {
default: le(() => [
q(e(Qt))
]),
_: 1
}, 8, ["class"])), [
[e(Jt), Q]
]),
W("ul", {
class: b(e(a).be("spinner", "list"))
}, [
(k(!0), B(we, null, Ee(e($)[x], (c, D) => (k(), B("li", {
key: D,
class: b([
e(a).be("spinner", "item"),
e(a).is("active", c === e(h)[x]),
e(a).is("disabled", e(w)[x][c])
])
}, [
typeof c == "number" ? (k(), B(we, { key: 0 }, [
x === "hours" ? (k(), B(we, { key: 0 }, [
et(me(("0" + (v.amPmMode ? c % 12 || 12 : c)).slice(-2)) + me(E(c)), 1)
], 64)) : (k(), B(we, { key: 1 }, [
et(me(("0" + c).slice(-2)), 1)
], 64))
], 64)) : se("v-if", !0)
], 2))), 128))
], 2)
], 42, Sl))), 128)) : se("v-if", !0)
], 2));
}
});
var Vl = /* @__PURE__ */ Ne(Pl, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
const $l = /* @__PURE__ */ ke({
__name: "panel-time-pick",
props: ml,
emits: ["pick", "select-range", "set-picker-option"],
setup(t, { emit: n }) {
const l = t, a = Ge("EP_PICKER_BASE"), {
arrowControl: s,
disabledHours: o,
disabledMinutes: r,
disabledSeconds: d,
defaultValue: u
} = a.props, { getAvailableHours: g, getAvailableMinutes: P, getAvailableSeconds: S } = bl(o, r, d), _ = Ce("time"), { t: m, lang: h } = Re(), w = Y([0, 2]), $ = gl(l), j = C(() => kt(l.actualVisible) ? `${_.namespace.value}-zoom-in-top` : ""), E = C(() => l.format.includes("ss")), p = C(() => l.format.includes("A") ? "A" : l.format.includes("a") ? "a" : ""), A = (F) => {
const v = ce(F).locale(h.value), M = T(v);
return v.isSame(M);
}, R = () => {
n("pick", $.value, !1);
}, O = (F = !1, v = !1) => {
v || n("pick", l.parsedValue, F);
}, te = (F) => {
if (!l.visible)
return;
const v = T(F).millisecond(0);
n("pick", v, !0);
}, V = (F, v) => {
n("select-range", F, v), w.value = [F, v];
}, Q = (F) => {
const v = [0, 3].concat(E.value ? [6] : []), M = ["hours", "minutes"].concat(E.value ? ["seconds"] : []), c = (v.indexOf(w.value[0]) + F + v.length) % v.length;
G.start_emitSelectRange(M[c]);
}, ne = (F) => {
const v = F.code, { left: M, right: x, up: c, down: D } = ye;
if ([M, x].includes(v)) {
Q(v === M ? -1 : 1), F.preventDefault();
return;
}
if ([c, D].includes(v)) {
const Z = v === c ? -1 : 1;
G.start_scrollDown(Z), F.preventDefault();
return;
}
}, { timePickerOptions: G, onSetOption: z, getAvailableTime: f } = hl({
getAvailableHours: g,
getAvailableMinutes: P,
getAvailableSeconds: S
}), T = (F) => f(F, l.datetimeRole || "", !0), X = (F) => F ? ce(F, l.format).locale(h.value) : null, ae = (F) => F ? F.format(l.format) : null, K = () => ce(u).locale(h.value);
return n("set-picker-option", ["isValidValue", A]), n("set-picker-option", ["formatToString", ae]), n("set-picker-option", ["parseUserInput", X]), n("set-picker-option", ["handleKeydownInput", ne]), n("set-picker-option", ["getRangeAvailableTime", T]), n("set-picker-option", ["getDefaultValue", K]), (F, v) => (k(), re(Kn, { name: e(j) }, {
default: le(() => [
F.actualVisible || F.visible ? (k(), B("div", {
key: 0,
class: b(e(_).b("panel"))
}, [
W("div", {
class: b([e(_).be("panel", "content"), { "has-seconds": e(E) }])
}, [
q(Vl, {
ref: "spinner",
role: F.datetimeRole || "start",
"arrow-control": e(s),
"show-seconds": e(E),
"am-pm-mode": e(p),
"spinner-date": F.parsedValue,
"disabled-hours": e(o),
"disabled-minutes": e(r),
"disabled-seconds": e(d),
onChange: te,
onSetOption: e(z),
onSelectRange: V
}, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
], 2),
W("div", {
class: b(e(_).be("panel", "footer"))
}, [
W("button", {
type: "button",
class: b([e(_).be("panel", "btn"), "cancel"]),
onClick: R
}, me(e(m)("el.datepicker.cancel")), 3),
W("button", {
type: "button",
class: b([e(_).be("panel", "btn"), "confirm"]),
onClick: v[0] || (v[0] = (M) => O())
}, me(e(m)("el.datepicker.confirm")), 3)
], 2)
], 2)) : se("v-if", !0)
]),
_: 1
}, 8, ["name"]));
}
});
var va = /* @__PURE__ */ Ne($l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]), El = Pn();
const Nl = /* @__PURE__ */ mt(El);
var _l = ke({
name: "NodeContent",
setup() {
return {
ns: Ce("cascader-node")
};
},
render() {
const { ns: t } = this, { node: n, panel: l } = this.$parent, { data: a, label: s } = n, { renderLabelFn: o } = l;
return Qa("span", { class: t.e("label") }, o ? o({ node: n, data: a }) : s);
}
});
const $a = Symbol(), Tl = ke({
name: "ElCascaderNode",
components: {
ElCheckbox: Jn,
ElRadio: Qn,
NodeContent: _l,
ElIcon: be,
Check: Ga,
Loading: ga,
ArrowRight: Ot
},
props: {
node: {
type: Object,
required: !0
},
menuId: String
},
emits: ["expand"],
setup(t, { emit: n }) {
const l = Ge($a), a = Ce("cascader-node"), s = C(() => l.isHoverMenu), o = C(() => l.config.multiple), r = C(() => l.config.checkStrictly), d = C(() => {
var O;
return (O = l.checkedNodes[0]) == null ? void 0 : O.uid;
}), u = C(() => t.node.isDisabled), g = C(() => t.node.isLeaf), P = C(() => r.value && !g.value || !u.value), S = C(() => m(l.expandingNode)), _ = C(() => r.value && l.checkedNodes.some(m)), m = (O) => {
var te;
const { level: V, uid: Q } = t.node;
return ((te = O == null ? void 0 : O.pathNodes[V - 1]) == null ? void 0 : te.uid) === Q;
}, h = () => {
S.value || l.expandNode(t.node);
}, w = (O) => {
const { node: te } = t;
O !== te.checked && l.handleCheckChange(te, O);
}, $ = () => {
l.lazyLoad(t.node, () => {
g.value || h();
});
}, j = (O) => {
s.value && (E(), !g.value && n("expand", O));
}, E = () => {
const { node: O } = t;
!P.value || O.loading || (O.loaded ? h() : $());
}, p = () => {
s.value && !g.value || (g.value && !u.value && !r.value && !o.value ? R(!0) : E());
}, A = (O) => {
r.value ? (w(O), t.node.loaded && h()) : R(O);
}, R = (O) => {
t.node.loaded ? (w(O), !r.value && h()) : $();
};
return {
panel: l,
isHoverMenu: s,
multiple: o,
checkStrictly: r,
checkedNodeId: d,
isDisabled: u,
isLeaf: g,
expandable: P,
inExpandingPath: S,
inCheckedPath: _,
ns: a,
handleHoverExpand: j,
handleExpand: E,
handleClick: p,
handleCheck: R,
handleSelectCheck: A
};
}
}), Ml = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"], Il = /* @__PURE__ */ W("span", null, null, -1);
function Dl(t, n, l, a, s, o) {
const r = je("el-checkbox"), d = je("el-radio"), u = je("check"), g = je("el-icon"), P = je("node-content"), S = je("loading"), _ = je("arrow-right");
return k(), B("li", {
id: `${t.menuId}-${t.node.uid}`,
role: "menuitem",
"aria-haspopup": !t.isLeaf,
"aria-owns": t.isLeaf ? null : t.menuId,
"aria-expanded": t.inExpandingPath,
tabindex: t.expandable ? -1 : void 0,
class: b([
t.ns.b(),
t.ns.is("selectable", t.checkStrictly),
t.ns.is("active", t.node.checked),
t.ns.is("disabled", !t.expandable),
t.inExpandingPath && "in-active-path",
t.inCheckedPath && "in-checked-path"
]),
onMouseenter: n[2] || (n[2] = (...m) => t.handleHoverExpand && t.handleHoverExpand(...m)),
onFocus: n[3] || (n[3] = (...m) => t.handleHoverExpand && t.handleHoverExpand(...m)),
onClick: n[4] || (n[4] = (...m) => t.handleClick && t.handleClick(...m))
}, [
se(" prefix "),
t.multiple ? (k(), re(r, {
key: 0,
"model-value": t.node.checked,
indeterminate: t.node.indeterminate,
disabled: t.isDisabled,
onClick: n[0] || (n[0] = Me(() => {
}, ["stop"])),
"onUpdate:modelValue": t.handleSelectCheck
}, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : t.checkStrictly ? (k(), re(d, {
key: 1,
"model-value": t.checkedNodeId,
label: t.node.uid,
disabled: t.isDisabled,
"onUpdate:modelValue": t.handleSelectCheck,
onClick: n[1] || (n[1] = Me(() => {
}, ["stop"]))
}, {
default: le(() => [
se(`
Add an empty element to avoid render label,
do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485
`),
Il
]),
_: 1
}, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : t.isLeaf && t.node.checked ? (k(), re(g, {
key: 2,
class: b(t.ns.e("prefix"))
}, {
default: le(() => [
q(u)
]),
_: 1
}, 8, ["class"])) : se("v-if", !0),
se(" content "),
q(P),
se(" postfix "),
t.isLeaf ? se("v-if", !0) : (k(), B(we, { key: 3 }, [
t.node.loading ? (k(), re(g, {
key: 0,
class: b([t.ns.is("loading"), t.ns.e("postfix")])
}, {
default: le(() => [
q(S)
]),
_: 1
}, 8, ["class"])) : (k(), re(g, {
key: 1,
class: b(["arrow-right", t.ns.e("postfix")])
}, {
default: le(() => [
q(_)
]),
_: 1
}, 8, ["class"]))
], 64))
], 42, Ml);
}
var Ol = /* @__PURE__ */ Ne(Tl, [["render", Dl], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
const Al = ke({
name: "ElCascaderMenu",
components: {
Loading: ga,
ElIcon: be,
ElScrollbar: Ca,
ElCascaderNode: Ol
},
props: {
nodes: {
type: Array,
required: !0
},
index: {
type: Number,
required: !0
}
},
setup(t) {
const n = pt(), l = Ce("cascader-menu"), { t: a } = Re(), s = In();
let o = null, r = null;
const d = Ge($a), u = Y(null), g = C(() => !t.nodes.length), P = C(() => !d.initialLoaded), S = C(() => `cascader-menu-${s}-${t.index}`), _ = ($) => {
o = $.target;
}, m = ($) => {
if (!(!d.isHoverMenu || !o || !u.value))
if (o.contains($.target)) {
h();
const j = n.vnode.el, { left: E } = j.getBoundingClientRect(), { offsetWidth: p, offsetHeight: A } = j, R = $.clientX - E, O = o.offsetTop, te = O + o.offsetHeight;
u.value.innerHTML = `
<path style="pointer-events: auto;" fill="transparent" d="M${R} ${O} L${p} 0 V${O} Z" />
<path style="pointer-events: auto;" fill="transparent" d="M${R} ${te} L${p} ${A} V${te} Z" />
`;
} else
r || (r = window.setTimeout(w, d.config.hoverThreshold));
}, h = () => {
r && (clearTimeout(r), r = null);
}, w = () => {
u.value && (u.value.innerHTML = "", h());
};
return {
ns: l,
panel: d,
hoverZone: u,
isEmpty: g,
isLoading: P,
menuId: S,
t: a,
handleExpand: _,
handleMouseMove: m,
clearHoverZone: w
};
}
});
function xl(t, n, l, a, s, o) {
const r = je("el-cascader-node"), d = je("loading"), u = je("el-icon"), g = je("el-scrollbar");
return k(), re(g, {
key: t.menuId,
tag: "ul",
role: "menu",
class: b(t.ns.b()),
"wrap-class": t.ns.e("wrap"),
"view-class": [t.ns.e("list"), t.ns.is("empty", t.isEmpty)],
onMousemove: t.handleMouseMove,
onMouseleave: t.clearHoverZone
}, {
default: le(() => {
var P;
return [
(k(!0), B(we, null, Ee(t.nodes, (S) => (k(), re(r, {
key: S.uid,
node: S,
"menu-id": t.menuId,
onExpand: t.handleExpand
}, null, 8, ["node", "menu-id", "onExpand"]))), 128)),
t.isLoading ? (k(), B("div", {
key: 0,
class: b(t.ns.e("empty-text"))
}, [
q(u, {
size: "14",
class: b(t.ns.is("loading"))
}, {
default: le(() => [
q(d)
]),
_: 1
}, 8, ["class"]),
et(" " + me(t.t("el.cascader.loading")), 1)
], 2)) : t.isEmpty ? (k(), B("div", {
key: 1,
class: b(t.ns.e("empty-text"))
}, me(t.t("el.cascader.noData")), 3)) : (P = t.panel) != null && P.isHoverMenu ? (k(), B("svg", {
key: 2,
ref: "hoverZone",
class: b(t.ns.e("hover-zone"))
}, null, 2)) : se("v-if", !0)
];
}),
_: 1
}, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
}
var Bl = /* @__PURE__ */ Ne(Al, [["render", xl], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
let Rl = 0;
const Fl = (t) => {
const n = [t];
let { parent: l } = t;
for (; l; )
n.unshift(l), l = l.parent;
return n;
};
class Nt {
constructor(n, l, a, s = !1) {
this.data = n, this.config = l, this.parent = a, this.root = s, this.uid = Rl++, this.checked = !1, this.indeterminate = !1, this.loading = !1;
const { value: o, label: r, children: d } = l, u = n[d], g = Fl(this);
this.level = s ? 0 : a ? a.level + 1 : 1, this.value = n[o], this.label = n[r], this.pathNodes = g, this.pathValues = g.map((P) => P.value), this.pathLabels = g.map((P) => P.label), this.childrenData = u, this.children = (u || []).map((P) => new Nt(P, l, this)), this.loaded = !l.lazy || this.isLeaf || !Bt(u);
}
get isDisabled() {
const { data: n, parent: l, config: a } = this, { disabled: s, checkStrictly: o } = a;
return (gt(s) ? s(n, this) : !!n[s]) || !o && (l == null ? void 0 : l.isDisabled);
}
get isLeaf() {
const { data: n, config: l, childrenData: a, loaded: s } = this, { lazy: o, leaf: r } = l, d = gt(r) ? r(n, this) : n[r];
return kt(d) ? o && !s ? !1 : !(Array.isArray(a) && a.length) : !!d;
}
get valueByOption() {
return this.config.emitPath ? this.pathValues : this.value;
}
appendChild(n) {
const { childrenData: l, children: a } = this, s = new Nt(n, this.config, this);
return Array.isArray(l) ? l.push(n) : this.childrenData = [n], a.push(s), s;
}
calcText(n, l) {
const a = n ? this.pathLabels.join(l) : this.label;
return this.text = a, a;
}
broadcast(n, ...l) {
const a = `onParent${Ta(n)}`;
this.children.forEach((s) => {
s && (s.broadcast(n, ...l), s[a] && s[a](...l));
});
}
emit(n, ...l) {
const { parent: a } = this, s = `onChild${Ta(n)}`;
a && (a[s] && a[s](...l), a.emit(n, ...l));
}
onParentCheck(n) {
this.isDisabled || this.setCheckState(n);
}
onChildCheck() {
const { children: n } = this, l = n.filter((s) => !s.isDisabled), a = l.length ? l.every((s) => s.checked) : !1;
this.setCheckState(a);
}
setCheckState(n) {
const l = this.children.length, a = this.children.reduce((s, o) => {
const r = o.checked ? 1 : o.indeterminate ? 0.5 : 0;
return s + r;
}, 0);
this.checked = this.loaded && this.children.filter((s) => !s.isDisabled).every((s) => s.loaded && s.checked) && n, this.indeterminate = this.loaded && a !== l && a > 0;
}
doCheck(n) {
if (this.checked === n)
return;
const { checkStrictly: l, multiple: a } = this.config;
l || !a ? this.checked = n : (this.broadcast("check", n), this.setCheckState(n), this.emit("check"));
}
}
const pa = (t, n) => t.reduce((l, a) => (a.isLeaf ? l.push(a) : (!n && l.push(a), l = l.concat(pa(a.children, n))), l), []);
class Ka {
constructor(n, l) {
this.config = l;
const a = (n || []).map((s) => new Nt(s, this.config));
this.nodes = a, this.allNodes = pa(a, !1), this.leafNodes = pa(a, !0);
}
getNodes() {
return this.nodes;
}
getFlattedNodes(n) {
return n ? this.leafNodes : this.allNodes;
}
appendNode(n, l) {
const a = l ? l.appendChild(n) : new Nt(n, this.config);
l || this.nodes.push(a), this.allNodes.push(a), a.isLeaf && this.leafNodes.push(a);
}
appendNodes(n, l) {
n.forEach((a) => this.appendNode(a, l));
}
getNodeByValue(n, l = !1) {
return !n && n !== 0 ? null : this.getFlattedNodes(l).find((s) => wt(s.value, n) || wt(s.pathValues, n)) || null;
}
getSameNode(n) {
return n && this.getFlattedNodes(!1).find(({ value: a, level: s }) => wt(n.value, a) && n.level === s) || null;
}
}
const fn = $e({
modelValue: {
type: pe([Number, String, Array])
},
options: {
type: pe(Array),
default: () => []
},
props: {
type: pe(Object),
default: () => ({})
}
}), Ll = {
expandTrigger: "click",
multiple: !1,
checkStrictly: !1,
emitPath: !0,
lazy: !1,
lazyLoad: Dn,
value: "value",
label: "label",
children: "children",
leaf: "leaf",
disabled: "disabled",
hoverThreshold: 500
}, Kl = (t) => C(() => ({
...Ll,
...t.props
})), Ya = (t) => {
if (!t)
return 0;
const n = t.id.split("-");
return Number(n[n.length - 2]);
}, Yl = (t) => {
if (!t)
return;
const n = t.querySelector("input");
n ? n.click() : nn(t) && t.click();
}, zl = (t, n) => {
const l = n.slice(0), a = l.map((o) => o.uid), s = t.reduce((o, r) => {
const d = a.indexOf(r.uid);
return d > -1 && (o.push(r), l.splice(d, 1), a.splice(d, 1)), o;
}, []);
return s.push(...l), s;
}, Hl = ke({
name: "ElCascaderPanel",
components: {
ElCascaderMenu: Bl
},
props: {
...fn,
border: {
type: Boolean,
default: !0
},
renderLabel: Function
},
emits: [Ie, Xe, "close", "expand-change"],
setup(t, { emit: n, slots: l }) {
let a = !1;
const s = Ce("cascader"), o = Kl(t);
let r = null;
const d = Y(!0), u = Y([]), g = Y(null), P = Y([]), S = Y(null), _ = Y([]), m = C(() => o.value.expandTrigger === "hover"), h = C(() => t.renderLabel || l.default), w = () => {
const { options: z } = t, f = o.value;
a = !1, r = new Ka(z, f), P.value = [r.getNodes()], f.lazy && Bt(t.options) ? (d.value = !1, $(void 0, (T) => {
T && (r = new Ka(T, f), P.value = [r.getNodes()]), d.value = !0, V(!1, !0);
})) : V(!1, !0);
}, $ = (z, f) => {
const T = o.value;
z = z || new Nt({}, T, void 0, !0), z.loading = !0;
const X = (ae) => {
const K = z, F = K.root ? null : K;
ae && (r == null || r.appendNodes(ae, F)), K.loading = !1, K.loaded = !0, K.childrenData = K.childrenData || [], f && f(ae);
};
T.lazyLoad(z, X);
}, j = (z, f) => {
var T;
const { level: X } = z, ae = P.value.slice(0, X);
let K;
z.isLeaf ? K = z.pathNodes[X - 2] : (K = z, ae.push(z.children)), ((T = S.value) == null ? void 0 : T.uid) !== (K == null ? void 0 : K.uid) && (S.value = z, P.value = ae, !f && n("expand-change", (z == null ? void 0 : z.pathValues) || []));
}, E = (z, f, T = !0) => {
const { checkStrictly: X, multiple: ae } = o.value, K = _.value[0];
a = !0, !ae && (K == null || K.doCheck(!1)), z.doCheck(f), te(), T && !ae && !X && n("close"), !T && !ae && !X && p(z);
}, p = (z) => {
z && (z = z.parent, p(z), z && j(z));
}, A = (z) => r == null ? void 0 : r.getFlattedNodes(z), R = (z) => {
var f;
return (f = A(z)) == null ? void 0 : f.filter((T) => T.checked !== !1);
}, O = () => {
_.value.forEach((z) => z.doCheck(!1)), te(), P.value = P.value.slice(0, 1), S.value = null, n("expand-change", []);
}, te = () => {
var z;
const { checkStrictly: f, multiple: T } = o.value, X = _.value, ae = R(!f), K = zl(X, ae), F = K.map((v) => v.valueByOption);
_.value = K, g.value = T ? F : (z = F[0]) != null ? z : null;
}, V = (z = !1, f = !1) => {
const { modelValue: T } = t, { lazy: X, multiple: ae, checkStrictly: K } = o.value, F = !K;
if (!(!d.value || a || !f && wt(T, g.value)))
if (X && !z) {
const M = Oa(ll(ct(T))).map((x) => r == null ? void 0 : r.getNodeByValue(x)).filter((x) => !!x && !x.loaded && !x.loading);
M.length ? M.forEach((x) => {
$(x, () => V(!1, f));
}) : V(!0, f);
} else {
const v = ae ? ct(T) : [T], M = Oa(v.map((x) => r == null ? void 0 : r.getNodeByValue(x, F)));
Q(M, f), g.value = an(T);
}
}, Q = (z, f = !0) => {
const { checkStrictly: T } = o.value, X = _.value, ae = z.filter((v) => !!v && (T || v.isLeaf)), K = r == null ? void 0 : r.getSameNode(S.value), F = f && K || ae[0];
F ? F.pathNodes.forEach((v) => j(v, !0)) : S.value = null, X.forEach((v) => v.doCheck(!1)), ae.forEach((v) => v.doCheck(!0)), _.value = ae, Pe(ne);
}, ne = () => {
ya && u.value.forEach((z) => {
const f = z == null ? void 0 : z.$el;
if (f) {
const T = f.querySelector(`.${s.namespace.value}-scrollbar__wrap`), X = f.querySelector(`.${s.b("node")}.${s.is("active")}`) || f.querySelector(`.${s.b("node")}.in-active-path`);
el(T, X);
}
});
}, G = (z) => {
const f = z.target, { code: T } = z;
switch (T) {
case ye.up:
case ye.down: {
z.preventDefault();
const X = T === ye.up ? -1 : 1;
Ut(ln(f, X, `.${s.b("node")}[tabindex="-1"]`));
break;
}
case ye.left: {
z.preventDefault();
const X = u.value[Ya(f) - 1], ae = X == null ? void 0 : X.$el.querySelector(`.${s.b("node")}[aria-expanded="true"]`);
Ut(ae);
break;
}
case ye.right: {
z.preventDefault();
const X = u.value[Ya(f) + 1], ae = X == null ? void 0 : X.$el.querySelector(`.${s.b("node")}[tabindex="-1"]`);
Ut(ae);
break;
}
case ye.enter:
Yl(f);
break;
}
};
return Vt($a, Tt({
config: o,
expandingNode: S,
checkedNodes: _,
isHoverMenu: m,
initialLoaded: d,
renderLabelFn: h,
lazyLoad: $,
expandNode: j,
handleCheckChange: E
})), ge([o, () => t.options], w, {
deep: !0,
immediate: !0
}), ge(() => t.modelValue, () => {
a = !1, V();
}, {
deep: !0
}), ge(() => g.value, (z) => {
wt(z, t.modelValue) || (n(Ie, z), n(Xe, z));
}), Yn(() => u.value = []), st(() => !Bt(t.modelValue) && V()), {
ns: s,
menuList: u,
menus: P,
checkedNodes: _,
handleKeyDown: G,
handleCheckChange: E,
getFlattedNodes: A,
getCheckedNodes: R,
clearCheckedNodes: O,
calculateCheckedValue: te,
scrollToExpandingNode: ne
};
}
});
function Wl(t, n, l, a, s, o) {
const r = je("el-cascader-menu");
return k(), B("div", {
class: b([t.ns.b("panel"), t.ns.is("bordered", t.border)]),
onKeydown: n[0] || (n[0] = (...d) => t.handleKeyDown && t.handleKeyDown(...d))
}, [
(k(!0), B(we, null, Ee(t.menus, (d, u) => (k(), re(r, {
key: u,
ref_for: !0,
ref: (g) => t.menuList[u] = g,
index: u,
nodes: [...d]
}, null, 8, ["index", "nodes"]))), 128))
], 34);
}
var qt = /* @__PURE__ */ Ne(Hl, [["render", Wl], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
qt.install = (t) => {
t.component(qt.name, qt);
};
const Ul = qt, ql = $e({
...fn,
size: Pt,
placeholder: String,
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
filterMethod: {
type: pe(Function),
default: (t, n) => t.text.includes(n)
},
separator: {
type: String,
default: " / "
},
showAllLevels: {
type: Boolean,
default: !0
},
collapseTags: Boolean,
collapseTagsTooltip: {
type: Boolean,
default: !1
},
debounce: {
type: Number,
default: 300
},
beforeFilter: {
type: pe(Function),
default: () => !0
},
popperClass: {
type: String,
default: ""
},
teleported: qn.teleported,
tagType: { ...jn.type, default: "info" },
validateEvent: {
type: Boolean,
default: !0
}
}), jl = {
[Ie]: (t) => !!t || t === null,
[Xe]: (t) => !!t || t === null,
focus: (t) => t instanceof FocusEvent,
blur: (t) => t instanceof FocusEvent,
visibleChange: (t) => At(t),
expandChange: (t) => !!t,
removeTag: (t) => !!t
}, Xl = { key: 0 }, Gl = ["placeholder", "onKeydown"], Zl = ["onClick"], Jl = "ElCascader", Ql = ke({
name: Jl
}), es = /* @__PURE__ */ ke({
...Ql,
props: ql,
emits: jl,
setup(t, { expose: n, emit: l }) {
const a = t, s = {
modifiers: [
{
name: "arrowPosition",
enabled: !0,
phase: "main",
fn: ({ state: y }) => {
const { modifiersData: L, placement: N } = y;
["right", "left", "bottom", "top"].includes(N) || (L.arrow.x = 35);
},
requires: ["arrow"]
}
]
}, o = ta();
let r = 0, d = 0;
const u = Ce("cascader"), g = Ce("input"), { t: P } = Re(), { form: S, formItem: _ } = Mt(), m = Y(null), h = Y(null), w = Y(null), $ = Y(null), j = Y(null), E = Y(!1), p = Y(!1), A = Y(!1), R = Y(!1), O = Y(""), te = Y(""), V = Y([]), Q = Y([]), ne = Y([]), G = Y(!1), z = C(() => o.style), f = C(() => a.disabled || (S == null ? void 0 : S.disabled)), T = C(() => a.placeholder || P("el.cascader.placeholder")), X = C(() => te.value || V.value.length > 0 || G.value ? "" : T.value), ae = _t(), K = C(() => ["small"].includes(ae.value) ? "small" : "default"), F = C(() => !!a.props.multiple), v = C(() => !a.filterable || F.value), M = C(() => F.value ? te.value : O.value), x = C(() => {
var y;
return ((y = $.value) == null ? void 0 : y.checkedNodes) || [];
}), c = C(() => !a.clearable || f.value || A.value || !p.value ? !1 : !!x.value.length), D = C(() => {
const { showAllLevels: y, separator: L } = a, N = x.value;
return N.length ? F.value ? "" : N[0].calcText(y, L) : "";
}), Z = C({
get() {
return an(a.modelValue);
},
set(y) {
l(Ie, y), l(Xe, y), a.validateEvent && (_ == null || _.validate("change").catch((L) => We(L)));
}
}), ie = C(() => [
u.b(),
u.m(ae.value),
u.is("disabled", f.value),
o.class
]), ee = C(() => [
g.e("icon"),
"icon-arrow-down",
u.is("reverse", E.value)
]), he = C(() => u.is("focus", E.value || R.value)), ve = C(() => {
var y, L;
return (L = (y = m.value) == null ? void 0 : y.popperRef) == null ? void 0 : L.contentRef;
}), fe = (y) => {
var L, N, H;
f.value || (y = y ?? !E.value, y !== E.value && (E.value = y, (N = (L = h.value) == null ? void 0 : L.input) == null || N.setAttribute("aria-expanded", `${y}`), y ? (ue(), Pe((H = $.value) == null ? void 0 : H.scrollToExpandingNode)) : a.filterable && Ue(), l("visibleChange", y)));
}, ue = () => {
Pe(() => {
var y;
(y = m.value) == null || y.updatePopper();
});
}, _e = () => {
A.value = !1;
}, Te = (y) => {
const { showAllLevels: L, separator: N } = a;
return {
node: y,
key: y.uid,
text: y.calcText(L, N),
hitState: !1,
closable: !f.value && !y.isDisabled,
isCollapseTag: !1
};
}, Le = (y) => {
var L;
const N = y.node;
N.doCheck(!1), (L = $.value) == null || L.calculateCheckedValue(), l("removeTag", N.valueByOption);
}, Be = () => {
if (!F.value)
return;
const y = x.value, L = [], N = [];
if (y.forEach((H) => N.push(Te(H))), Q.value = N, y.length) {
const [H, ...i] = y, U = i.length;
L.push(Te(H)), U && (a.collapseTags ? L.push({
key: -1,
text: `+ ${U}`,
closable: !1,
isCollapseTag: !0
}) : i.forEach((oe) => L.push(Te(oe))));
}
V.value = L;
}, Ze = () => {
var y, L;
const { filterMethod: N, showAllLevels: H, separator: i } = a, U = (L = (y = $.value) == null ? void 0 : y.getFlattedNodes(!a.props.checkStrictly)) == null ? void 0 : L.filter((oe) => oe.isDisabled ? !1 : (oe.calcText(H, i), N(oe, M.value)));
F.value && (V.value.forEach((oe) => {
oe.hitState = !1;
}), Q.value.forEach((oe) => {
oe.hitState = !1;
})), A.value = !0, ne.value = U, ue();
}, Ke = () => {
var y;
let L;
A.value && j.value ? L = j.value.$el.querySelector(`.${u.e("suggestion-item")}`) : L = (y = $.value) == null ? void 0 : y.$el.querySelector(`.${u.b("node")}[tabindex="-1"]`), L && (L.focus(), !A.value && L.click());
}, Ye = () => {
var y, L;
const N = (y = h.value) == null ? void 0 : y.input, H = w.value, i = (L = j.value) == null ? void 0 : L.$el;
if (!(!ya || !N)) {
if (i) {
const U = i.querySelector(`.${u.e("suggestion-list")}`);
U.style.minWidth = `${N.offsetWidth}px`;
}
if (H) {
const { offsetHeight: U } = H, oe = V.value.length > 0 ? `${Math.max(U + 6, r)}px` : `${r}px`;
N.style.height = oe, ue();
}
}
}, dt = (y) => {
var L;
return (L = $.value) == null ? void 0 : L.getCheckedNodes(y);
}, ze = (y) => {
ue(), l("expandChange", y);
}, de = (y) => {
var L;
const N = (L = y.target) == null ? void 0 : L.value;
if (y.type === "compositionend")
G.value = !1, Pe(() => J(N));
else {
const H = N[N.length - 1] || "";
G.value = !Xn(H);
}
}, ot = (y) => {
if (!G.value)
switch (y.code) {
case ye.enter:
fe();
break;
case ye.down:
fe(!0), Pe(Ke), y.preventDefault();
break;
case ye.esc:
E.value === !0 && (y.preventDefault(), y.stopPropagation(), fe(!1));
break;
case ye.tab:
fe(!1);
break;
}
}, tt = () => {
var y;
(y = $.value) == null || y.clearCheckedNodes(), !E.value && a.filterable && Ue(), fe(!1);
}, Ue = () => {
const { value: y } = D;
O.value = y, te.value = y;
}, He = (y) => {
var L, N;
const { checked: H } = y;
F.value ? (L = $.value) == null || L.handleCheckChange(y, !H, !1) : (!H && ((N = $.value) == null || N.handleCheckChange(y, !0, !1)), fe(!1));
}, qe = (y) => {
const L = y.target, { code: N } = y;
switch (N) {
case ye.up:
case ye.down: {
const H = N === ye.up ? -1 : 1;
Ut(ln(L, H, `.${u.e("suggestion-item")}[tabindex="-1"]`));
break;
}
case ye.enter:
L.click();
break;
}
}, ft = () => {
const y = V.value, L = y[y.length - 1];
d = te.value ? 0 : d + 1, !(!L || !d || a.collapseTags && y.length > 1) && (L.hitState ? Le(L) : L.hitState = !0);
}, rt = (y) => {
const L = y.target, N = u.e("search-input");
L.className === N && (R.value = !0), l("focus", y);
}, Je = (y) => {
R.value = !1, l("blur", y);
}, I = Yt(() => {
const { value: y } = M;
if (!y)
return;
const L = a.beforeFilter(y);
ia(L) ? L.then(Ze).catch(() => {
}) : L !== !1 ? Ze() : _e();
}, a.debounce), J = (y, L) => {
!E.value && fe(!0), !(L != null && L.isComposing) && (y ? I() : _e());
};
return ge(A, ue), ge([x, f], Be), ge(V, () => {
Pe(() => Ye());
}), ge(D, Ue, { immediate: !0 }), st(() => {
const y = h.value.input, L = Number.parseFloat(On(g.cssVarName("input-height"), y).value) - 2;
r = y.offsetHeight || L, An(y, Ye);
}), n({
getCheckedNodes: dt,
cascaderPanelRef: $,
togglePopperVisible: fe,
contentRef: ve
}), (y, L) => (k(), re(e(Lt), {
ref_key: "tooltipRef",
ref: m,
visible: E.value,
teleported: y.teleported,
"popper-class": [e(u).e("dropdown"), y.popperClass],
"popper-options": s,
"fallback-placements": [
"bottom-start",
"bottom",
"top-start",
"top",
"right",
"left"
],
"stop-popper-mouse-event": !1,
"gpu-acceleration": !1,
placement: "bottom-start",
transition: `${e(u).namespace.value}-zoom-in-top`,
effect: "light",
pure: "",
persistent: "",
onHide: _e
}, {
default: le(() => [
De((k(), B("div", {
class: b(e(ie)),
style: Oe(e(z)),
onClick: L[5] || (L[5] = () => fe(e(v) ? void 0 : !0)),
onKeydown: ot,
onMouseenter: L[6] || (L[6] = (N) => p.value = !0),
onMouseleave: L[7] || (L[7] = (N) => p.value = !1)
}, [
q(e(nt), {
ref_key: "input",
ref: h,
modelValue: O.value,
"onUpdate:modelValue": L[1] || (L[1] = (N) => O.value = N),
placeholder: e(X),
readonly: e(v),
disabled: e(f),
"validate-event": !1,
size: e(ae),
class: b(e(he)),
tabindex: e(F) && y.filterable && !e(f) ? -1 : void 0,
onCompositionstart: de,
onCompositionupdate: de,
onCompositionend: de,
onFocus: rt,
onBlur: Je,
onInput: J
}, {
suffix: le(() => [
e(c) ? (k(), re(e(be), {
key: "clear",
class: b([e(g).e("icon"), "icon-circle-close"]),
onClick: Me(tt, ["stop"])
}, {
default: le(() => [
q(e(ja))
]),
_: 1
}, 8, ["class", "onClick"])) : (k(), re(e(be), {
key: "arrow-down",
class: b(e(ee)),
onClick: L[0] || (L[0] = Me((N) => fe(), ["stop"]))
}, {
default: le(() => [
q(e(Qt))
]),
_: 1
}, 8, ["class"]))
]),
_: 1
}, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]),
e(F) ? (k(), B("div", {
key: 0,
ref_key: "tagWrapper",
ref: w,
class: b(e(u).e("tags"))
}, [
(k(!0), B(we, null, Ee(V.value, (N) => (k(), re(e(Ia), {
key: N.key,
type: y.tagType,
size: e(K),
hit: N.hitState,
closable: N.closable,
"disable-transitions": "",
onClose: (H) => Le(N)
}, {
default: le(() => [
N.isCollapseTag === !1 ? (k(), B("span", Xl, me(N.text), 1)) : (k(), re(e(Lt), {
key: 1,
disabled: E.value || !y.collapseTagsTooltip,
"fallback-placements": ["bottom", "top", "right", "left"],
placement: "bottom",
effect: "light"
}, {
default: le(() => [
W("span", null, me(N.text), 1)
]),
content: le(() => [
W("div", {
class: b(e(u).e("collapse-tags"))
}, [
(k(!0), B(we, null, Ee(Q.value.slice(1), (H, i) => (k(), B("div", {
key: i,
class: b(e(u).e("collapse-tag"))
}, [
(k(), re(e(Ia), {
key: H.key,
class: "in-tooltip",
type: y.tagType,
size: e(K),
hit: H.hitState,
closable: H.closable,
"disable-transitions": "",
onClose: (U) => Le(H)
}, {
default: le(() => [
W("span", null, me(H.text), 1)
]),
_: 2
}, 1032, ["type", "size", "hit", "closable", "onClose"]))
], 2))), 128))
], 2)
]),
_: 2
}, 1032, ["disabled"]))
]),
_: 2
}, 1032, ["type", "size", "hit", "closable", "onClose"]))), 128)),
y.filterable && !e(f) ? De((k(), B("input", {
key: 0,
"onUpdate:modelValue": L[2] || (L[2] = (N) => te.value = N),
type: "text",
class: b(e(u).e("search-input")),
placeholder: e(D) ? "" : e(T),
onInput: L[3] || (L[3] = (N) => J(te.value, N)),
onClick: L[4] || (L[4] = Me((N) => fe(!0), ["stop"])),
onKeydown: Fe(ft, ["delete"]),
onCompositionstart: de,
onCompositionupdate: de,
onCompositionend: de,
onFocus: rt,
onBlur: Je
}, null, 42, Gl)), [
[zn, te.value]
]) : se("v-if", !0)
], 2)) : se("v-if", !0)
], 38)), [
[e(Kt), () => fe(!1), e(ve)]
])
]),
content: le(() => [
De(q(e(Ul), {
ref_key: "cascaderPanelRef",
ref: $,
modelValue: e(Z),
"onUpdate:modelValue": L[8] || (L[8] = (N) => Hn(Z) ? Z.value = N : null),
options: y.options,
props: a.props,
border: !1,
"render-label": y.$slots.default,
onExpandChange: ze,
onClose: L[9] || (L[9] = (N) => y.$nextTick(() => fe(!1)))
}, null, 8, ["modelValue", "options", "props", "render-label"]), [
[it, !A.value]
]),
y.filterable ? De((k(), re(e(Ca), {
key: 0,
ref_key: "suggestionPanel",
ref: j,
tag: "ul",
class: b(e(u).e("suggestion-panel")),
"view-class": e(u).e("suggestion-list"),
onKeydown: qe
}, {
default: le(() => [
ne.value.length ? (k(!0), B(we, { key: 0 }, Ee(ne.value, (N) => (k(), B("li", {
key: N.uid,
class: b([
e(u).e("suggestion-item"),
e(u).is("checked", N.checked)
]),
tabindex: -1,
onClick: (H) => He(N)
}, [
W("span", null, me(N.text), 1),
N.checked ? (k(), re(e(be), { key: 0 }, {
default: le(() => [
q(e(Ga))
]),
_: 1
})) : se("v-if", !0)
], 10, Zl))), 128)) : $t(y.$slots, "empty", { key: 1 }, () => [
W("li", {
class: b(e(u).e("empty-text"))
}, me(e(P)("el.cascader.noMatch")), 3)
])
]),
_: 3
}, 8, ["class", "view-class"])), [
[it, A.value]
]) : se("v-if", !0)
]),
_: 3
}, 8, ["visible", "teleported", "popper-class", "transition"]));
}
});
var jt = /* @__PURE__ */ Ne(es, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/cascader.vue"]]);
jt.install = (t) => {
t.component(jt.name, jt);
};
const ts = jt, ai = ts, as = $e({
color: {
type: pe(Object),
required: !0
},
vertical: {
type: Boolean,
default: !1
}
});
let sa = !1;
function zt(t, n) {
if (!ya)
return;
const l = function(o) {
var r;
(r = n.drag) == null || r.call(n, o);
}, a = function(o) {
var r;
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", a), document.removeEventListener("touchmove", l), document.removeEventListener("touchend", a), document.onselectstart = null, document.ondragstart = null, sa = !1, (r = n.end) == null || r.call(n, o);
}, s = function(o) {
var r;
sa || (o.preventDefault(), document.onselectstart = () => !1, document.ondragstart = () => !1, document.addEventListener("mousemove", l), document.addEventListener("mouseup", a), document.addEventListener("touchmove", l), document.addEventListener("touchend", a), sa = !0, (r = n.start) == null || r.call(n, o));
};
t.addEventListener("mousedown", s), t.addEventListener("touchstart", s);
}
const ns = (t) => {
const n = pt(), l = da(), a = da();
function s(r) {
r.target !== l.value && o(r);
}
function o(r) {
if (!a.value || !l.value)
return;
const u = n.vnode.el.getBoundingClientRect(), { clientX: g, clientY: P } = Va(r);
if (t.vertical) {
let S = P - u.top;
S = Math.max(l.value.offsetHeight / 2, S), S = Math.min(S, u.height - l.value.offsetHeight / 2), t.color.set("alpha", Math.round((S - l.value.offsetHeight / 2) / (u.height - l.value.offsetHeight) * 100));
} else {
let S = g - u.left;
S = Math.max(l.value.offsetWidth / 2, S), S = Math.min(S, u.width - l.value.offsetWidth / 2), t.color.set("alpha", Math.round((S - l.value.offsetWidth / 2) / (u.width - l.value.offsetWidth) * 100));
}
}
return {
thumb: l,
bar: a,
handleDrag: o,
handleClick: s
};
}, ls = (t, {
bar: n,
thumb: l,
handleDrag: a
}) => {
const s = pt(), o = Ce("color-alpha-slider"), r = Y(0), d = Y(0), u = Y();
function g() {
if (!l.value || t.vertical)
return 0;
const E = s.vnode.el, p = t.color.get("alpha");
return E ? Math.round(p * (E.offsetWidth - l.value.offsetWidth / 2) / 100) : 0;
}
function P() {
if (!l.value)
return 0;
const E = s.vnode.el;
if (!t.vertical)
return 0;
const p = t.color.get("alpha");
return E ? Math.round(p * (E.offsetHeight - l.value.offsetHeight / 2) / 100) : 0;
}
function S() {
if (t.color && t.color.value) {
const { r: E, g: p, b: A } = t.color.toRgb();
return `linear-gradient(to right, rgba(${E}, ${p}, ${A}, 0) 0%, rgba(${E}, ${p}, ${A}, 1) 100%)`;
}
return "";
}
function _() {
r.value = g(), d.value = P(), u.value = S();
}
st(() => {
if (!n.value || !l.value)
return;
const E = {
drag: (p) => {
a(p);
},
end: (p) => {
a(p);
}
};
zt(n.value, E), zt(l.value, E), _();
}), ge(() => t.color.get("alpha"), () => _()), ge(() => t.color.value, () => _());
const m = C(() => [o.b(), o.is("vertical", t.vertical)]), h = C(() => o.e("bar")), w = C(() => o.e("thumb")), $ = C(() => ({ background: u.value })), j = C(() => ({
left: ua(r.value),
top: ua(d.value)
}));
return { rootKls: m, barKls: h, barStyle: $, thumbKls: w, thumbStyle: j, update: _ };
}, ss = "ElColorAlphaSlider", os = ke({
name: ss
}), rs = /* @__PURE__ */ ke({
...os,
props: as,
setup(t, { expose: n }) {
const l = t, { bar: a, thumb: s, handleDrag: o, handleClick: r } = ns(l), { rootKls: d, barKls: u, barStyle: g, thumbKls: P, thumbStyle: S, update: _ } = ls(l, {
bar: a,
thumb: s,
handleDrag: o
});
return n({
update: _,
bar: a,
thumb: s
}), (m, h) => (k(), B("div", {
class: b(e(d))
}, [
W("div", {
ref_key: "bar",
ref: a,
class: b(e(u)),
style: Oe(e(g)),
onClick: h[0] || (h[0] = (...w) => e(r) && e(r)(...w))
}, null, 6),
W("div", {
ref_key: "thumb",
ref: s,
class: b(e(P)),
style: Oe(e(S))
}, null, 6)
], 2));
}
});
var is = /* @__PURE__ */ Ne(rs, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/alpha-slider.vue"]]);
const us = ke({
name: "ElColorHueSlider",
props: {
color: {
type: Object,
required: !0
},
vertical: Boolean
},
setup(t) {
const n = Ce("color-hue-slider"), l = pt(), a = Y(), s = Y(), o = Y(0), r = Y(0), d = C(() => t.color.get("hue"));
ge(() => d.value, () => {
_();
});
function u(m) {
m.target !== a.value && g(m);
}
function g(m) {
if (!s.value || !a.value)
return;
const w = l.vnode.el.getBoundingClientRect(), { clientX: $, clientY: j } = Va(m);
let E;
if (t.vertical) {
let p = j - w.top;
p = Math.min(p, w.height - a.value.offsetHeight / 2), p = Math.max(a.value.offsetHeight / 2, p), E = Math.round((p - a.value.offsetHeight / 2) / (w.height - a.value.offsetHeight) * 360);
} else {
let p = $ - w.left;
p = Math.min(p, w.width - a.value.offsetWidth / 2), p = Math.max(a.value.offsetWidth / 2, p), E = Math.round((p - a.value.offsetWidth / 2) / (w.width - a.value.offsetWidth) * 360);
}
t.color.set("hue", E);
}
function P() {
if (!a.value)
return 0;
const m = l.vnode.el;
if (t.vertical)
return 0;
const h = t.color.get("hue");
return m ? Math.round(h * (m.offsetWidth - a.value.offsetWidth / 2) / 360) : 0;
}
function S() {
if (!a.value)
return 0;
const m = l.vnode.el;
if (!t.vertical)
return 0;
const h = t.color.get("hue");
return m ? Math.round(h * (m.offsetHeight - a.value.offsetHeight / 2) / 360) : 0;
}
function _() {
o.value = P(), r.value = S();
}
return st(() => {
if (!s.value || !a.value)
return;
const m = {
drag: (h) => {
g(h);
},
end: (h) => {
g(h);
}
};
zt(s.value, m), zt(a.value, m), _();
}), {
bar: s,
thumb: a,
thumbLeft: o,
thumbTop: r,
hueValue: d,
handleClick: u,
update: _,
ns: n
};
}
});
function cs(t, n, l, a, s, o) {
return k(), B("div", {
class: b([t.ns.b(), t.ns.is("vertical", t.vertical)])
}, [
W("div", {
ref: "bar",
class: b(t.ns.e("bar")),
onClick: n[0] || (n[0] = (...r) => t.handleClick && t.handleClick(...r))
}, null, 2),
W("div", {
ref: "thumb",
class: b(t.ns.e("thumb")),
style: Oe({
left: t.thumbLeft + "px",
top: t.thumbTop + "px"
})
}, null, 6)
], 2);
}
var ds = /* @__PURE__ */ Ne(us, [["render", cs], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/hue-slider.vue"]]);
const fs = $e({
modelValue: String,
id: String,
showAlpha: Boolean,
colorFormat: String,
disabled: Boolean,
size: Pt,
popperClass: {
type: String,
default: ""
},
label: {
type: String,
default: void 0
},
tabindex: {
type: [String, Number],
default: 0
},
predefine: {
type: pe(Array)
},
validateEvent: {
type: Boolean,
default: !0
}
}), vs = {
[Ie]: (t) => ut(t) || vt(t),
[Xe]: (t) => ut(t) || vt(t),
activeChange: (t) => ut(t) || vt(t)
}, vn = Symbol("colorPickerContextKey"), za = function(t, n, l) {
return [
t,
n * l / ((t = (2 - n) * l) < 1 ? t : 2 - t) || 0,
t / 2
];
}, ps = function(t) {
return typeof t == "string" && t.includes(".") && Number.parseFloat(t) === 1;
}, ms = function(t) {
return typeof t == "string" && t.includes("%");
}, Ct = function(t, n) {
ps(t) && (t = "100%");
const l = ms(t);
return t = Math.min(n, Math.max(0, Number.parseFloat(`${t}`))), l && (t = Number.parseInt(`${t * n}`, 10) / 100), Math.abs(t - n) < 1e-6 ? 1 : t % n / Number.parseFloat(n);
}, Ha = {
10: "A",
11: "B",
12: "C",
13: "D",
14: "E",
15: "F"
}, Xt = (t) => {
t = Math.min(Math.round(t), 255);
const n = Math.floor(t / 16), l = t % 16;
return `${Ha[n] || n}${Ha[l] || l}`;
}, Wa = function({ r: t, g: n, b: l }) {
return Number.isNaN(+t) || Number.isNaN(+n) || Number.isNaN(+l) ? "" : `#${Xt(t)}${Xt(n)}${Xt(l)}`;
}, oa = {
A: 10,
B: 11,
C: 12,
D: 13,
E: 14,
F: 15
}, ht = function(t) {
return t.length === 2 ? (oa[t[0].toUpperCase()] || +t[0]) * 16 + (oa[t[1].toUpperCase()] || +t[1]) : oa[t[1].toUpperCase()] || +t[1];
}, hs = function(t, n, l) {
n = n / 100, l = l / 100;
let a = n;
const s = Math.max(l, 0.01);
l *= 2, n *= l <= 1 ? l : 2 - l, a *= s <= 1 ? s : 2 - s;
const o = (l + n) / 2, r = l === 0 ? 2 * a / (s + a) : 2 * n / (l + n);
return {
h: t,
s: r * 100,
v: o * 100
};
}, Ua = (t, n, l) => {
t = Ct(t, 255), n = Ct(n, 255), l = Ct(l, 255);
const a = Math.max(t, n, l), s = Math.min(t, n, l);
let o;
const r = a, d = a - s, u = a === 0 ? 0 : d / a;
if (a === s)
o = 0;
else {
switch (a) {
case t: {
o = (n - l) / d + (n < l ? 6 : 0);
break;
}
case n: {
o = (l - t) / d + 2;
break;
}
case l: {
o = (t - n) / d + 4;
break;
}
}
o /= 6;
}
return { h: o * 360, s: u * 100, v: r * 100 };
}, Dt = function(t, n, l) {
t = Ct(t, 360) * 6, n = Ct(n, 100), l = Ct(l, 100);
const a = Math.floor(t), s = t - a, o = l * (1 - n), r = l * (1 - s * n), d = l * (1 - (1 - s) * n), u = a % 6, g = [l, r, o, o, d, l][u], P = [d, l, l, r, o, o][u], S = [o, o, d, l, l, r][u];
return {
r: Math.round(g * 255),
g: Math.round(P * 255),
b: Math.round(S * 255)
};
};
class xt {
constructor(n = {}) {
this._hue = 0, this._saturation = 100, this._value = 100, this._alpha = 100, this.enableAlpha = !1, this.format = "hex", this.value = "";
for (const l in n)
Ma(n, l) && (this[l] = n[l]);
n.value ? this.fromString(n.value) : this.doOnChange();
}
set(n, l) {
if (arguments.length === 1 && typeof n == "object") {
for (const a in n)
Ma(n, a) && this.set(a, n[a]);
return;
}
this[`_${n}`] = l, this.doOnChange();
}
get(n) {
return n === "alpha" ? Math.floor(this[`_${n}`]) : this[`_${n}`];
}
toRgb() {
return Dt(this._hue, this._saturation, this._value);
}
fromString(n) {
if (!n) {
this._hue = 0, this._saturation = 100, this._value = 100, this.doOnChange();
return;
}
const l = (a, s, o) => {
this._hue = Math.max(0, Math.min(360, a)), this._saturation = Math.max(0, Math.min(100, s)), this._value = Math.max(0, Math.min(100, o)), this.doOnChange();
};
if (n.includes("hsl")) {
const a = n.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((s) => s !== "").map((s, o) => o > 2 ? Number.parseFloat(s) : Number.parseInt(s, 10));
if (a.length === 4 ? this._alpha = Number.parseFloat(a[3]) * 100 : a.length === 3 && (this._alpha = 100), a.length >= 3) {
const { h: s, s: o, v: r } = hs(a[0], a[1], a[2]);
l(s, o, r);
}
} else if (n.includes("hsv")) {
const a = n.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((s) => s !== "").map((s, o) => o > 2 ? Number.parseFloat(s) : Number.parseInt(s, 10));
a.length === 4 ? this._alpha = Number.parseFloat(a[3]) * 100 : a.length === 3 && (this._alpha = 100), a.length >= 3 && l(a[0], a[1], a[2]);
} else if (n.includes("rgb")) {
const a = n.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((s) => s !== "").map((s, o) => o > 2 ? Number.parseFloat(s) : Number.parseInt(s, 10));
if (a.length === 4 ? this._alpha = Number.parseFloat(a[3]) * 100 : a.length === 3 && (this._alpha = 100), a.length >= 3) {
const { h: s, s: o, v: r } = Ua(a[0], a[1], a[2]);
l(s, o, r);
}
} else if (n.includes("#")) {
const a = n.replace("#", "").trim();
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(a))
return;
let s, o, r;
a.length === 3 ? (s = ht(a[0] + a[0]), o = ht(a[1] + a[1]), r = ht(a[2] + a[2])) : (a.length === 6 || a.length === 8) && (s = ht(a.slice(0, 2)), o = ht(a.slice(2, 4)), r = ht(a.slice(4, 6))), a.length === 8 ? this._alpha = ht(a.slice(6)) / 255 * 100 : (a.length === 3 || a.length === 6) && (this._alpha = 100);
const { h: d, s: u, v: g } = Ua(s, o, r);
l(d, u, g);
}
}
compare(n) {
return Math.abs(n._hue - this._hue) < 2 && Math.abs(n._saturation - this._saturation) < 1 && Math.abs(n._value - this._value) < 1 && Math.abs(n._alpha - this._alpha) < 1;
}
doOnChange() {
const { _hue: n, _saturation: l, _value: a, _alpha: s, format: o } = this;
if (this.enableAlpha)
switch (o) {
case "hsl": {
const r = za(n, l / 100, a / 100);
this.value = `hsla(${n}, ${Math.round(r[1] * 100)}%, ${Math.round(r[2] * 100)}%, ${this.get("alpha") / 100})`;
break;
}
case "hsv": {
this.value = `hsva(${n}, ${Math.round(l)}%, ${Math.round(a)}%, ${this.get("alpha") / 100})`;
break;
}
case "hex": {
this.value = `${Wa(Dt(n, l, a))}${Xt(s * 255 / 100)}`;
break;
}
default: {
const { r, g: d, b: u } = Dt(n, l, a);
this.value = `rgba(${r}, ${d}, ${u}, ${this.get("alpha") / 100})`;
}
}
else
switch (o) {
case "hsl": {
const r = za(n, l / 100, a / 100);
this.value = `hsl(${n}, ${Math.round(r[1] * 100)}%, ${Math.round(r[2] * 100)}%)`;
break;
}
case "hsv": {
this.value = `hsv(${n}, ${Math.round(l)}%, ${Math.round(a)}%)`;
break;
}
case "rgb": {
const { r, g: d, b: u } = Dt(n, l, a);
this.value = `rgb(${r}, ${d}, ${u})`;
break;
}
default:
this.value = Wa(Dt(n, l, a));
}
}
}
const bs = ke({
props: {
colors: {
type: Array,
required: !0
},
color: {
type: Object,
required: !0
}
},
setup(t) {
const n = Ce("color-predefine"), { currentColor: l } = Ge(vn), a = Y(o(t.colors, t.color));
ge(() => l.value, (r) => {
const d = new xt();
d.fromString(r), a.value.forEach((u) => {
u.selected = d.compare(u);
});
}), Wn(() => {
a.value = o(t.colors, t.color);
});
function s(r) {
t.color.fromString(t.colors[r]);
}
function o(r, d) {
return r.map((u) => {
const g = new xt();
return g.enableAlpha = !0, g.format = "rgba", g.fromString(u), g.selected = g.value === d.value, g;
});
}
return {
rgbaColors: a,
handleSelect: s,
ns: n
};
}
}), gs = ["onClick"];
function ys(t, n, l, a, s, o) {
return k(), B("div", {
class: b(t.ns.b())
}, [
W("div", {
class: b(t.ns.e("colors"))
}, [
(k(!0), B(we, null, Ee(t.rgbaColors, (r, d) => (k(), B("div", {
key: t.colors[d],
class: b([
t.ns.e("color-selector"),
t.ns.is("alpha", r._alpha < 100),
{ selected: r.selected }
]),
onClick: (u) => t.handleSelect(d)
}, [
W("div", {
style: Oe({ backgroundColor: r.value })
}, null, 4)
], 10, gs))), 128))
], 2)
], 2);
}
var ks = /* @__PURE__ */ Ne(bs, [["render", ys], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/predefine.vue"]]);
const ws = ke({
name: "ElSlPanel",
props: {
color: {
type: Object,
required: !0
}
},
setup(t) {
const n = Ce("color-svpanel"), l = pt(), a = Y(0), s = Y(0), o = Y("hsl(0, 100%, 50%)"), r = C(() => {
const g = t.color.get("hue"), P = t.color.get("value");
return { hue: g, value: P };
});
function d() {
const g = t.color.get("saturation"), P = t.color.get("value"), S = l.vnode.el, { clientWidth: _, clientHeight: m } = S;
s.value = g * _ / 100, a.value = (100 - P) * m / 100, o.value = `hsl(${t.color.get("hue")}, 100%, 50%)`;
}
function u(g) {
const S = l.vnode.el.getBoundingClientRect(), { clientX: _, clientY: m } = Va(g);
let h = _ - S.left, w = m - S.top;
h = Math.max(0, h), h = Math.min(h, S.width), w = Math.max(0, w), w = Math.min(w, S.height), s.value = h, a.value = w, t.color.set({
saturation: h / S.width * 100,
value: 100 - w / S.height * 100
});
}
return ge(() => r.value, () => {
d();
}), st(() => {
zt(l.vnode.el, {
drag: (g) => {
u(g);
},
end: (g) => {
u(g);
}
}), d();
}), {
cursorTop: a,
cursorLeft: s,
background: o,
colorValue: r,
handleDrag: u,
update: d,
ns: n
};
}
}), Cs = /* @__PURE__ */ W("div", null, null, -1), Ss = [
Cs
];
function Ps(t, n, l, a, s, o) {
return k(), B("div", {
class: b(t.ns.b()),
style: Oe({
backgroundColor: t.background
})
}, [
W("div", {
class: b(t.ns.e("white"))
}, null, 2),
W("div", {
class: b(t.ns.e("black"))
}, null, 2),
W("div", {
class: b(t.ns.e("cursor")),
style: Oe({
top: t.cursorTop + "px",
left: t.cursorLeft + "px"
})
}, Ss, 6)
], 6);
}
var Vs = /* @__PURE__ */ Ne(ws, [["render", Ps], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/sv-panel.vue"]]);
const $s = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"], Es = ke({
name: "ElColorPicker"
}), Ns = /* @__PURE__ */ ke({
...Es,
props: fs,
emits: vs,
setup(t, { expose: n, emit: l }) {
const a = t, { t: s } = Re(), o = Ce("color"), { formItem: r } = Mt(), d = _t(), u = ka(), { inputId: g, isLabeledByFormItem: P } = Sa(a, {
formItemContext: r
}), S = Y(), _ = Y(), m = Y(), h = Y();
let w = !0;
const $ = Tt(new xt({
enableAlpha: a.showAlpha,
format: a.colorFormat || "",
value: a.modelValue
})), j = Y(!1), E = Y(!1), p = Y(""), A = C(() => !a.modelValue && !E.value ? "transparent" : Q($, a.showAlpha)), R = C(() => !a.modelValue && !E.value ? "" : $.value), O = C(() => P.value ? void 0 : a.label || s("el.colorpicker.defaultLabel")), te = C(() => P.value ? r == null ? void 0 : r.labelId : void 0), V = C(() => [
o.b("picker"),
o.is("disabled", u.value),
o.bm("picker", d.value)
]);
function Q(v, M) {
if (!(v instanceof xt))
throw new TypeError("color should be instance of _color Class");
const { r: x, g: c, b: D } = v.toRgb();
return M ? `rgba(${x}, ${c}, ${D}, ${v.get("alpha") / 100})` : `rgb(${x}, ${c}, ${D})`;
}
function ne(v) {
j.value = v;
}
const G = Yt(ne, 100);
function z() {
u.value || ne(!0);
}
function f() {
G(!1), T();
}
function T() {
Pe(() => {
a.modelValue ? $.fromString(a.modelValue) : ($.value = "", Pe(() => {
E.value = !1;
}));
});
}
function X() {
u.value || G(!j.value);
}
function ae() {
$.fromString(p.value);
}
function K() {
const v = $.value;
l(Ie, v), l("change", v), a.validateEvent && (r == null || r.validate("change").catch((M) => We(M))), G(!1), Pe(() => {
const M = new xt({
enableAlpha: a.showAlpha,
format: a.colorFormat || "",
value: a.modelValue
});
$.compare(M) || T();
});
}
function F() {
G(!1), l(Ie, null), l("change", null), a.modelValue !== null && a.validateEvent && (r == null || r.validate("change").catch((v) => We(v))), T();
}
return st(() => {
a.modelValue && (p.value = R.value);
}), ge(() => a.modelValue, (v) => {
v ? v && v !== $.value && (w = !1, $.fromString(v)) : E.value = !1;
}), ge(() => R.value, (v) => {
p.value = v, w && l("activeChange", v), w = !0;
}), ge(() => $.value, () => {
!a.modelValue && !E.value && (E.value = !0);
}), ge(() => j.value, () => {
Pe(() => {
var v, M, x;
(v = S.value) == null || v.update(), (M = _.value) == null || M.update(), (x = m.value) == null || x.update();
});
}), Vt(vn, {
currentColor: R
}), n({
color: $,
show: z,
hide: f
}), (v, M) => (k(), re(e(Lt), {
ref_key: "popper",
ref: h,
visible: j.value,
"show-arrow": !1,
"fallback-placements": ["bottom", "top", "right", "left"],
offset: 0,
"gpu-acceleration": !1,
"popper-class": [e(o).be("picker", "panel"), e(o).b("dropdown"), v.popperClass],
"stop-popper-mouse-event": !1,
effect: "light",
trigger: "click",
transition: `${e(o).namespace.value}-zoom-in-top`,
persistent: ""
}, {
content: le(() => [
De((k(), B("div", null, [
W("div", {
class: b(e(o).be("dropdown", "main-wrapper"))
}, [
q(ds, {
ref_key: "hue",
ref: S,
class: "hue-slider",
color: e($),
vertical: ""
}, null, 8, ["color"]),
q(Vs, {
ref_key: "sv",
ref: _,
color: e($)
}, null, 8, ["color"])
], 2),
v.showAlpha ? (k(), re(is, {
key: 0,
ref_key: "alpha",
ref: m,
color: e($)
}, null, 8, ["color"])) : se("v-if", !0),
v.predefine ? (k(), re(ks, {
key: 1,
ref: "predefine",
color: e($),
colors: v.predefine
}, null, 8, ["color", "colors"])) : se("v-if", !0),
W("div", {
class: b(e(o).be("dropdown", "btns"))
}, [
W("span", {
class: b(e(o).be("dropdown", "value"))
}, [
q(e(nt), {
modelValue: p.value,
"onUpdate:modelValue": M[0] || (M[0] = (x) => p.value = x),
"validate-event": !1,
size: "small",
onKeyup: Fe(ae, ["enter"]),
onBlur: ae
}, null, 8, ["modelValue", "onKeyup"])
], 2),
q(e(St), {
class: b(e(o).be("dropdown", "link-btn")),
text: "",
size: "small",
onClick: F
}, {
default: le(() => [
et(me(e(s)("el.colorpicker.clear")), 1)
]),
_: 1
}, 8, ["class"]),
q(e(St), {
plain: "",
size: "small",
class: b(e(o).be("dropdown", "btn")),
onClick: K
}, {
default: le(() => [
et(me(e(s)("el.colorpicker.confirm")), 1)
]),
_: 1
}, 8, ["class"])
], 2)
])), [
[e(Kt), f]
])
]),
default: le(() => [
W("div", {
id: e(g),
class: b(e(V)),
role: "button",
"aria-label": e(O),
"aria-labelledby": e(te),
"aria-description": e(s)("el.colorpicker.description", { color: v.modelValue || "" }),
tabindex: v.tabindex,
onKeydown: Fe(X, ["enter"])
}, [
e(u) ? (k(), B("div", {
key: 0,
class: b(e(o).be("picker", "mask"))
}, null, 2)) : se("v-if", !0),
W("div", {
class: b(e(o).be("picker", "trigger")),
onClick: X
}, [
W("span", {
class: b([e(o).be("picker", "color"), e(o).is("alpha", v.showAlpha)])
}, [
W("span", {
class: b(e(o).be("picker", "color-inner")),
style: Oe({
backgroundColor: e(A)
})
}, [
De(q(e(be), {
class: b([e(o).be("picker", "icon"), e(o).is("icon-arrow-down")])
}, {
default: le(() => [
q(e(Qt))
]),
_: 1
}, 8, ["class"]), [
[it, v.modelValue || E.value]
]),
!v.modelValue && !E.value ? (k(), re(e(be), {
key: 0,
class: b([e(o).be("picker", "empty"), e(o).is("icon-close")])
}, {
default: le(() => [
q(e(xn))
]),
_: 1
}, 8, ["class"])) : se("v-if", !0)
], 6)
], 2)
], 2)
], 42, $s)
]),
_: 1
}, 8, ["visible", "popper-class", "transition"]));
}
});
var _s = /* @__PURE__ */ Ne(Ns, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/color-picker.vue"]]);
const ni = ea(_s);
var Ts = Vn();
const Ms = /* @__PURE__ */ mt(Ts);
var Is = $n();
const Ds = /* @__PURE__ */ mt(Is);
var Os = En();
const As = /* @__PURE__ */ mt(Os);
var pn = { exports: {} };
(function(t, n) {
(function(l, a) {
t.exports = a();
})(Pa, function() {
return function(l, a, s) {
a.prototype.dayOfYear = function(o) {
var r = Math.round((s(this).startOf("day") - s(this).startOf("year")) / 864e5) + 1;
return o == null ? r : this.add(o - r, "day");
};
};
});
})(pn);
var xs = pn.exports;
const Bs = /* @__PURE__ */ mt(xs);
var mn = { exports: {} };
(function(t, n) {
(function(l, a) {
t.exports = a();
})(Pa, function() {
return function(l, a) {
a.prototype.isSameOrAfter = function(s, o) {
return this.isSame(s, o) || this.isAfter(s, o);
};
};
});
})(mn);
var Rs = mn.exports;
const Fs = /* @__PURE__ */ mt(Rs);
var hn = { exports: {} };
(function(t, n) {
(function(l, a) {
t.exports = a();
})(Pa, function() {
return function(l, a) {
a.prototype.isSameOrBefore = function(s, o) {
return this.isSame(s, o) || this.isBefore(s, o);
};
};
});
})(hn);
var Ls = hn.exports;
const Ks = /* @__PURE__ */ mt(Ls), Ea = Symbol(), Ys = $e({
...cn,
type: {
type: pe(String),
default: "date"
}
}), zs = ["date", "dates", "year", "month", "week", "range"], Na = $e({
disabledDate: {
type: pe(Function)
},
date: {
type: pe(Object),
required: !0
},
minDate: {
type: pe(Object)
},
maxDate: {
type: pe(Object)
},
parsedValue: {
type: pe([Object, Array])
},
rangeState: {
type: pe(Object),
default: () => ({
endDate: null,
selecting: !1
})
}
}), bn = $e({
type: {
type: pe(String),
required: !0,
values: sl
}
}), gn = $e({
unlinkPanels: Boolean,
parsedValue: {
type: pe(Array)
}
}), yn = (t) => ({
type: String,
values: zs,
default: t
}), Hs = $e({
...bn,
parsedValue: {
type: pe([Object, Array])
},
visible: {
type: Boolean
},
format: {
type: String,
default: ""
}
}), Ws = $e({
...Na,
cellClassName: {
type: pe(Function)
},
showWeekNumber: Boolean,
selectionMode: yn("date")
}), ma = (t) => {
if (!Ae(t))
return !1;
const [n, l] = t;
return ce.isDayjs(n) && ce.isDayjs(l) && n.isSameOrBefore(l);
}, kn = (t, { lang: n, unit: l, unlinkPanels: a }) => {
let s;
if (Ae(t)) {
let [o, r] = t.map((d) => ce(d).locale(n));
return a || (r = o.add(1, l)), [o, r];
} else
t ? s = ce(t) : s = ce();
return s = s.locale(n), [s, s.add(1, l)];
}, Us = (t, n, {
columnIndexOffset: l,
startDate: a,
nextEndDate: s,
now: o,
unit: r,
relativeDateGetter: d,
setCellMetadata: u,
setRowMetadata: g
}) => {
for (let P = 0; P < t.row; P++) {
const S = n[P];
for (let _ = 0; _ < t.column; _++) {
let m = S[_ + l];
m || (m = {
row: P,
column: _,
type: "normal",
inRange: !1,
start: !1,
end: !1
});
const h = P * t.column + _, w = d(h);
m.dayjs = w, m.date = w.toDate(), m.timestamp = w.valueOf(), m.type = "normal", m.inRange = !!(a && w.isSameOrAfter(a, r) && s && w.isSameOrBefore(s, r)) || !!(a && w.isSameOrBefore(a, r) && s && w.isSameOrAfter(s, r)), a != null && a.isSameOrAfter(s) ? (m.start = !!s && w.isSame(s, r), m.end = a && w.isSame(a, r)) : (m.start = !!a && w.isSame(a, r), m.end = !!s && w.isSame(s, r)), w.isSame(o, r) && (m.type = "today"), u == null || u(m, { rowIndex: P, columnIndex: _ }), S[_ + l] = m;
}
g == null || g(S);
}
}, qs = $e({
cell: {
type: pe(Object)
}
});
var js = ke({
name: "ElDatePickerCell",
props: qs,
setup(t) {
const n = Ce("date-table-cell"), {
slots: l
} = Ge(Ea);
return () => {
const {
cell: a
} = t;
if (l.default) {
const s = l.default(a).filter((o) => o.patchFlag !== -2 && o.type.toString() !== "Symbol(Comment)");
if (s.length)
return s;
}
return q("div", {
class: n.b()
}, [q("span", {
class: n.e("text")
}, [a == null ? void 0 : a.text])]);
};
}
});
const Xs = ["aria-label", "onMousedown"], Gs = {
key: 0,
scope: "col"
}, Zs = ["aria-label"], Js = ["aria-current", "aria-selected", "tabindex"], Qs = /* @__PURE__ */ ke({
__name: "basic-date-table",
props: Ws,
emits: ["changerange", "pick", "select"],
setup(t, { expose: n, emit: l }) {
const a = t, s = Ce("date-table"), { t: o, lang: r } = Re(), d = Y(), u = Y(), g = Y(), P = Y(), S = Y([[], [], [], [], [], []]);
let _ = !1;
const m = a.date.$locale().weekStart || 7, h = a.date.locale("en").localeData().weekdaysShort().map((c) => c.toLowerCase()), w = C(() => m > 3 ? 7 - m : -m), $ = C(() => {
const c = a.date.startOf("month");
return c.subtract(c.day() || 7, "day");
}), j = C(() => h.concat(h).slice(m, m + 7)), E = C(() => al(V.value).some((c) => c.isCurrent)), p = C(() => {
const c = a.date.startOf("month"), D = c.day() || 7, Z = c.daysInMonth(), ie = c.subtract(1, "month").daysInMonth();
return {
startOfMonthDay: D,
dateCountOfMonth: Z,
dateCountOfLastMonth: ie
};
}), A = C(() => a.selectionMode === "dates" ? ct(a.parsedValue) : []), R = (c, {
count: D,
rowIndex: Z,
columnIndex: ie
}) => {
const { startOfMonthDay: ee, dateCountOfMonth: he, dateCountOfLastMonth: ve } = e(p), fe = e(w);
if (Z >= 0 && Z <= 1) {
const ue = ee + fe < 0 ? 7 + ee + fe : ee + fe;
if (ie + Z * 7 >= ue)
return c.text = D, !0;
c.text = ve - (ue - ie % 7) + 1 + Z * 7, c.type = "prev-month";
} else
return D <= he ? c.text = D : (c.text = D - he, c.type = "next-month"), !0;
return !1;
}, O = (c, {
columnIndex: D,
rowIndex: Z
}, ie) => {
const { disabledDate: ee, cellClassName: he } = a, ve = e(A), fe = R(c, { count: ie, rowIndex: Z, columnIndex: D }), ue = c.dayjs.toDate();
return c.selected = ve.find((_e) => _e.valueOf() === c.dayjs.valueOf()), c.isSelected = !!c.selected, c.isCurrent = G(c), c.disabled = ee == null ? void 0 : ee(ue), c.customClass = he == null ? void 0 : he(ue), fe;
}, te = (c) => {
if (a.selectionMode === "week") {
const [D, Z] = a.showWeekNumber ? [1, 7] : [0, 6], ie = x(c[D + 1]);
c[D].inRange = ie, c[D].start = ie, c[Z].inRange = ie, c[Z].end = ie;
}
}, V = C(() => {
const { minDate: c, maxDate: D, rangeState: Z, showWeekNumber: ie } = a, ee = w.value, he = S.value, ve = "day";
let fe = 1;
if (ie)
for (let ue = 0; ue < 6; ue++)
he[ue][0] || (he[ue][0] = {
type: "week",
text: $.value.add(ue * 7 + 1, ve).week()
});
return Us({ row: 6, column: 7 }, he, {
startDate: c,
columnIndexOffset: ie ? 1 : 0,
nextEndDate: Z.endDate || D || Z.selecting && c || null,
now: ce().locale(e(r)).startOf(ve),
unit: ve,
relativeDateGetter: (ue) => $.value.add(ue - ee, ve),
setCellMetadata: (...ue) => {
O(...ue, fe) && (fe += 1);
},
setRowMetadata: te
}), he;
});
ge(() => a.date, async () => {
var c, D;
(c = d.value) != null && c.contains(document.activeElement) && (await Pe(), (D = u.value) == null || D.focus());
});
const Q = async () => {
var c;
(c = u.value) == null || c.focus();
}, ne = (c = "") => ["normal", "today"].includes(c), G = (c) => a.selectionMode === "date" && ne(c.type) && z(c, a.parsedValue), z = (c, D) => D ? ce(D).locale(r.value).isSame(a.date.date(Number(c.text)), "day") : !1, f = (c) => {
const D = [];
return ne(c.type) && !c.disabled ? (D.push("available"), c.type === "today" && D.push("today")) : D.push(c.type), G(c) && D.push("current"), c.inRange && (ne(c.type) || a.selectionMode === "week") && (D.push("in-range"), c.start && D.push("start-date"), c.end && D.push("end-date")), c.disabled && D.push("disabled"), c.selected && D.push("selected"), c.customClass && D.push(c.customClass), D.join(" ");
}, T = (c, D) => {
const Z = c * 7 + (D - (a.showWeekNumber ? 1 : 0)) - w.value;
return $.value.add(Z, "day");
}, X = (c) => {
var D;
if (!a.rangeState.selecting)
return;
let Z = c.target;
if (Z.tagName === "SPAN" && (Z = (D = Z.parentNode) == null ? void 0 : D.parentNode), Z.tagName === "DIV" && (Z = Z.parentNode), Z.tagName !== "TD")
return;
const ie = Z.parentNode.rowIndex - 1, ee = Z.cellIndex;
V.value[ie][ee].disabled || (ie !== g.value || ee !== P.value) && (g.value = ie, P.value = ee, l("changerange", {
selecting: !0,
endDate: T(ie, ee)
}));
}, ae = (c) => !E.value && (c == null ? void 0 : c.text) === 1 && c.type === "normal" || c.isCurrent, K = (c) => {
_ || E.value || a.selectionMode !== "date" || M(c, !0);
}, F = (c) => {
c.target.closest("td") && (_ = !0);
}, v = (c) => {
c.target.closest("td") && (_ = !1);
}, M = (c, D = !1) => {
const Z = c.target.closest("td");
if (!Z)
return;
const ie = Z.parentNode.rowIndex - 1, ee = Z.cellIndex, he = V.value[ie][ee];
if (he.disabled || he.type === "week")
return;
const ve = T(ie, ee);
if (a.selectionMode === "range")
!a.rangeState.selecting || !a.minDate ? (l("pick", { minDate: ve, maxDate: null }), l("select", !0)) : (ve >= a.minDate ? l("pick", { minDate: a.minDate, maxDate: ve }) : l("pick", { minDate: ve, maxDate: a.minDate }), l("select", !1));
else if (a.selectionMode === "date")
l("pick", ve, D);
else if (a.selectionMode === "week") {
const fe = ve.week(), ue = `${ve.year()}w${fe}`;
l("pick", {
year: ve.year(),
week: fe,
value: ue,
date: ve.startOf("week")
});
} else if (a.selectionMode === "dates") {
const fe = he.selected ? ct(a.parsedValue).filter((ue) => (ue == null ? void 0 : ue.valueOf()) !== ve.valueOf()) : ct(a.parsedValue).concat([ve]);
l("pick", fe);
}
}, x = (c) => {
if (a.selectionMode !== "week")
return !1;
let D = a.date.startOf("day");
if (c.type === "prev-month" && (D = D.subtract(1, "month")), c.type === "next-month" && (D = D.add(1, "month")), D = D.date(Number.parseInt(c.text, 10)), a.parsedValue && !Array.isArray(a.parsedValue)) {
const Z = (a.parsedValue.day() - m + 7) % 7 - 1;
return a.parsedValue.subtract(Z, "day").isSame(D, "day");
}
return !1;
};
return n({
focus: Q
}), (c, D) => (k(), B("table", {
role: "grid",
"aria-label": e(o)("el.datepicker.dateTablePrompt"),
cellspacing: "0",
cellpadding: "0",
class: b([e(s).b(), { "is-week-mode": c.selectionMode === "week" }]),
onClick: M,
onMousemove: X,
onMousedown: Me(F, ["prevent"]),
onMouseup: v
}, [
W("tbody", {
ref_key: "tbodyRef",
ref: d
}, [
W("tr", null, [
c.showWeekNumber ? (k(), B("th", Gs, me(e(o)("el.datepicker.week")), 1)) : se("v-if", !0),
(k(!0), B(we, null, Ee(e(j), (Z, ie) => (k(), B("th", {
key: ie,
scope: "col",
"aria-label": e(o)("el.datepicker.weeksFull." + Z)
}, me(e(o)("el.datepicker.weeks." + Z)), 9, Zs))), 128))
]),
(k(!0), B(we, null, Ee(e(V), (Z, ie) => (k(), B("tr", {
key: ie,
class: b([e(s).e("row"), { current: x(Z[1]) }])
}, [
(k(!0), B(we, null, Ee(Z, (ee, he) => (k(), B("td", {
key: `${ie}.${he}`,
ref_for: !0,
ref: (ve) => ae(ee) && (u.value = ve),
class: b(f(ee)),
"aria-current": ee.isCurrent ? "date" : void 0,
"aria-selected": ee.isCurrent,
tabindex: ae(ee) ? 0 : -1,
onFocus: K
}, [
q(e(js), { cell: ee }, null, 8, ["cell"])
], 42, Js))), 128))
], 2))), 128))
], 512)
], 42, Xs));
}
});
var ha = /* @__PURE__ */ Ne(Qs, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
const eo = $e({
...Na,
selectionMode: yn("month")
}), to = ["aria-label"], ao = ["aria-selected", "aria-label", "tabindex", "onKeydown"], no = { class: "cell" }, lo = /* @__PURE__ */ ke({
__name: "basic-month-table",
props: eo,
emits: ["changerange", "pick", "select"],
setup(t, { expose: n, emit: l }) {
const a = t, s = (A, R, O) => {
const te = ce().locale(O).startOf("month").month(R).year(A), V = te.daysInMonth();
return sn(V).map((Q) => te.add(Q, "day").toDate());
}, o = Ce("month-table"), { t: r, lang: d } = Re(), u = Y(), g = Y(), P = Y(a.date.locale("en").localeData().monthsShort().map((A) => A.toLowerCase())), S = Y([
[],
[],
[]
]), _ = Y(), m = Y(), h = C(() => {
var A, R;
const O = S.value, te = ce().locale(d.value).startOf("month");
for (let V = 0; V < 3; V++) {
const Q = O[V];
for (let ne = 0; ne < 4; ne++) {
const G = Q[ne] || (Q[ne] = {
row: V,
column: ne,
type: "normal",
inRange: !1,
start: !1,
end: !1,
text: -1,
disabled: !1
});
G.type = "normal";
const z = V * 4 + ne, f = a.date.startOf("year").month(z), T = a.rangeState.endDate || a.maxDate || a.rangeState.selecting && a.minDate || null;
G.inRange = !!(a.minDate && f.isSameOrAfter(a.minDate, "month") && T && f.isSameOrBefore(T, "month")) || !!(a.minDate && f.isSameOrBefore(a.minDate, "month") && T && f.isSameOrAfter(T, "month")), (A = a.minDate) != null && A.isSameOrAfter(T) ? (G.start = !!(T && f.isSame(T, "month")), G.end = a.minDate && f.isSame(a.minDate, "month")) : (G.start = !!(a.minDate && f.isSame(a.minDate, "month")), G.end = !!(T && f.isSame(T, "month"))), te.isSame(f) && (G.type = "today"), G.text = z, G.disabled = ((R = a.disabledDate) == null ? void 0 : R.call(a, f.toDate())) || !1;
}
}
return O;
}), w = () => {
var A;
(A = g.value) == null || A.focus();
}, $ = (A) => {
const R = {}, O = a.date.year(), te = /* @__PURE__ */ new Date(), V = A.text;
return R.disabled = a.disabledDate ? s(O, V, d.value).every(a.disabledDate) : !1, R.current = ct(a.parsedValue).findIndex((Q) => ce.isDayjs(Q) && Q.year() === O && Q.month() === V) >= 0, R.today = te.getFullYear() === O && te.getMonth() === V, A.inRange && (R["in-range"] = !0, A.start && (R["start-date"] = !0), A.end && (R["end-date"] = !0)), R;
}, j = (A) => {
const R = a.date.year(), O = A.text;
return ct(a.date).findIndex((te) => te.year() === R && te.month() === O) >= 0;
}, E = (A) => {
var R;
if (!a.rangeState.selecting)
return;
let O = A.target;
if (O.tagName === "A" && (O = (R = O.parentNode) == null ? void 0 : R.parentNode), O.tagName === "DIV" && (O = O.parentNode), O.tagName !== "TD")
return;
const te = O.parentNode.rowIndex, V = O.cellIndex;
h.value[te][V].disabled || (te !== _.value || V !== m.value) && (_.value = te, m.value = V, l("changerange", {
selecting: !0,
endDate: a.date.startOf("year").month(te * 4 + V)
}));
}, p = (A) => {
var R;
const O = (R = A.target) == null ? void 0 : R.closest("td");
if ((O == null ? void 0 : O.tagName) !== "TD" || Za(O, "disabled"))
return;
const te = O.cellIndex, Q = O.parentNode.rowIndex * 4 + te, ne = a.date.startOf("year").month(Q);
a.selectionMode === "range" ? a.rangeState.selecting ? (a.minDate && ne >= a.minDate ? l("pick", { minDate: a.minDate, maxDate: ne }) : l("pick", { minDate: ne, maxDate: a.minDate }), l("select", !1)) : (l("pick", { minDate: ne, maxDate: null }), l("select", !0)) : l("pick", Q);
};
return ge(() => a.date, async () => {
var A, R;
(A = u.value) != null && A.contains(document.activeElement) && (await Pe(), (R = g.value) == null || R.focus());
}), n({
focus: w
}), (A, R) => (k(), B("table", {
role: "grid",
"aria-label": e(r)("el.datepicker.monthTablePrompt"),
class: b(e(o).b()),
onClick: p,
onMousemove: E
}, [
W("tbody", {
ref_key: "tbodyRef",
ref: u
}, [
(k(!0), B(we, null, Ee(e(h), (O, te) => (k(), B("tr", { key: te }, [
(k(!0), B(we, null, Ee(O, (V, Q) => (k(), B("td", {
key: Q,
ref_for: !0,
ref: (ne) => j(V) && (g.value = ne),
class: b($(V)),
"aria-selected": `${j(V)}`,
"aria-label": e(r)(`el.datepicker.month${+V.text + 1}`),
tabindex: j(V) ? 0 : -1,
onKeydown: [
Fe(Me(p, ["prevent", "stop"]), ["space"]),
Fe(Me(p, ["prevent", "stop"]), ["enter"])
]
}, [
W("div", null, [
W("span", no, me(e(r)("el.datepicker.months." + P.value[V.text])), 1)
])
], 42, ao))), 128))
]))), 128))
], 512)
], 42, to));
}
});
var ba = /* @__PURE__ */ Ne(lo, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
const { date: so, disabledDate: oo, parsedValue: ro } = Na, io = $e({
date: so,
disabledDate: oo,
parsedValue: ro
}), uo = ["aria-label"], co = ["aria-selected", "tabindex", "onKeydown"], fo = { class: "cell" }, vo = { key: 1 }, po = /* @__PURE__ */ ke({
__name: "basic-year-table",
props: io,
emits: ["pick"],
setup(t, { expose: n, emit: l }) {
const a = t, s = (w, $) => {
const j = ce(String(w)).locale($).startOf("year"), p = j.endOf("year").dayOfYear();
return sn(p).map((A) => j.add(A, "day").toDate());
}, o = Ce("year-table"), { t: r, lang: d } = Re(), u = Y(), g = Y(), P = C(() => Math.floor(a.date.year() / 10) * 10), S = () => {
var w;
(w = g.value) == null || w.focus();
}, _ = (w) => {
const $ = {}, j = ce().locale(d.value);
return $.disabled = a.disabledDate ? s(w, d.value).every(a.disabledDate) : !1, $.current = ct(a.parsedValue).findIndex((E) => E.year() === w) >= 0, $.today = j.year() === w, $;
}, m = (w) => w === P.value && a.date.year() < P.value && a.date.year() > P.value + 9 || ct(a.date).findIndex(($) => $.year() === w) >= 0, h = (w) => {
const j = w.target.closest("td");
if (j && j.textContent) {
if (Za(j, "disabled"))
return;
const E = j.textContent || j.innerText;
l("pick", Number(E));
}
};
return ge(() => a.date, async () => {
var w, $;
(w = u.value) != null && w.contains(document.activeElement) && (await Pe(), ($ = g.value) == null || $.focus());
}), n({
focus: S
}), (w, $) => (k(), B("table", {
role: "grid",
"aria-label": e(r)("el.datepicker.yearTablePrompt"),
class: b(e(o).b()),
onClick: h
}, [
W("tbody", {
ref_key: "tbodyRef",
ref: u
}, [
(k(), B(we, null, Ee(3, (j, E) => W("tr", { key: E }, [
(k(), B(we, null, Ee(4, (p, A) => (k(), B(we, {
key: E + "_" + A
}, [
E * 4 + A < 10 ? (k(), B("td", {
key: 0,
ref_for: !0,
ref: (R) => m(e(P) + E * 4 + A) && (g.value = R),
class: b(["available", _(e(P) + E * 4 + A)]),
"aria-selected": `${m(e(P) + E * 4 + A)}`,
tabindex: m(e(P) + E * 4 + A) ? 0 : -1,
onKeydown: [
Fe(Me(h, ["prevent", "stop"]), ["space"]),
Fe(Me(h, ["prevent", "stop"]), ["enter"])
]
}, [
W("span", fo, me(e(P) + E * 4 + A), 1)
], 42, co)) : (k(), B("td", vo))
], 64))), 64))
])), 64))
], 512)
], 10, uo));
}
});
var mo = /* @__PURE__ */ Ne(po, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
const ho = ["onClick"], bo = ["aria-label"], go = ["aria-label"], yo = ["aria-label"], ko = ["aria-label"], wo = /* @__PURE__ */ ke({
__name: "panel-date-pick",
props: Hs,
emits: ["pick", "set-picker-option", "panel-change"],
setup(t, { emit: n }) {
const l = t, a = (I, J, y) => !0, s = Ce("picker-panel"), o = Ce("date-picker"), r = ta(), d = en(), { t: u, lang: g } = Re(), P = Ge("EP_PICKER_BASE"), S = Ge(Gn), { shortcuts: _, disabledDate: m, cellClassName: h, defaultTime: w, arrowControl: $ } = P.props, j = Et(P.props, "defaultValue"), E = Y(), p = Y(ce().locale(g.value)), A = Y(!1), R = C(() => ce(w).locale(g.value)), O = C(() => p.value.month()), te = C(() => p.value.year()), V = Y([]), Q = Y(null), ne = Y(null), G = (I) => V.value.length > 0 ? a(I, V.value, l.format || "HH:mm:ss") : !0, z = (I) => w && !Te.value && !A.value ? R.value.year(I.year()).month(I.month()).date(I.date()) : ee.value ? I.millisecond(0) : I.startOf("day"), f = (I, ...J) => {
if (!I)
n("pick", I, ...J);
else if (Ae(I)) {
const y = I.map(z);
n("pick", y, ...J);
} else
n("pick", z(I), ...J);
Q.value = null, ne.value = null, A.value = !1;
}, T = (I, J) => {
if (M.value === "date") {
I = I;
let y = l.parsedValue ? l.parsedValue.year(I.year()).month(I.month()).date(I.date()) : I;
G(y) || (y = V.value[0][0].year(I.year()).month(I.month()).date(I.date())), p.value = y, f(y, ee.value || J);
} else
M.value === "week" ? f(I.date) : M.value === "dates" && f(I, !0);
}, X = (I) => {
const J = I ? "add" : "subtract";
p.value = p.value[J](1, "month"), Je("month");
}, ae = (I) => {
const J = p.value, y = I ? "add" : "subtract";
p.value = K.value === "year" ? J[y](10, "year") : J[y](1, "year"), Je("year");
}, K = Y("date"), F = C(() => {
const I = u("el.datepicker.year");
if (K.value === "year") {
const J = Math.floor(te.value / 10) * 10;
return I ? `${J} ${I} - ${J + 9} ${I}` : `${J} - ${J + 9}`;
}
return `${te.value} ${I}`;
}), v = (I) => {
const J = gt(I.value) ? I.value() : I.value;
if (J) {
f(ce(J).locale(g.value));
return;
}
I.onClick && I.onClick({
attrs: r,
slots: d,
emit: n
});
}, M = C(() => {
const { type: I } = l;
return ["week", "month", "year", "dates"].includes(I) ? I : "date";
}), x = C(() => M.value === "date" ? K.value : M.value), c = C(() => !!_.length), D = async (I) => {
p.value = p.value.startOf("month").month(I), M.value === "month" ? f(p.value, !1) : (K.value = "date", ["month", "year", "date", "week"].includes(M.value) && (f(p.value, !0), await Pe(), qe())), Je("month");
}, Z = async (I) => {
M.value === "year" ? (p.value = p.value.startOf("year").year(I), f(p.value, !1)) : (p.value = p.value.year(I), K.value = "month", ["month", "year", "date", "week"].includes(M.value) && (f(p.value, !0), await Pe(), qe())), Je("year");
}, ie = async (I) => {
K.value = I, await Pe(), qe();
}, ee = C(() => l.type === "datetime" || l.type === "datetimerange"), he = C(() => ee.value || M.value === "dates"), ve = () => {
if (M.value === "dates")
f(l.parsedValue);
else {
let I = l.parsedValue;
if (!I) {
const J = ce(w).locale(g.value), y = He();
I = J.year(y.year()).month(y.month()).date(y.date());
}
p.value = I, f(I);
}
}, fe = () => {
const J = ce().locale(g.value).toDate();
A.value = !0, (!m || !m(J)) && G(J) && (p.value = ce().locale(g.value), f(p.value));
}, ue = C(() => rn(l.format)), _e = C(() => on(l.format)), Te = C(() => {
if (ne.value)
return ne.value;
if (!(!l.parsedValue && !j.value))
return (l.parsedValue || p.value).format(ue.value);
}), Le = C(() => {
if (Q.value)
return Q.value;
if (!(!l.parsedValue && !j.value))
return (l.parsedValue || p.value).format(_e.value);
}), Be = Y(!1), Ze = () => {
Be.value = !0;
}, Ke = () => {
Be.value = !1;
}, Ye = (I) => ({
hour: I.hour(),
minute: I.minute(),
second: I.second(),
year: I.year(),
month: I.month(),
date: I.date()
}), dt = (I, J, y) => {
const { hour: L, minute: N, second: H } = Ye(I), i = l.parsedValue ? l.parsedValue.hour(L).minute(N).second(H) : I;
p.value = i, f(p.value, !0), y || (Be.value = J);
}, ze = (I) => {
const J = ce(I, ue.value).locale(g.value);
if (J.isValid() && G(J)) {
const { year: y, month: L, date: N } = Ye(p.value);
p.value = J.year(y).month(L).date(N), ne.value = null, Be.value = !1, f(p.value, !0);
}
}, de = (I) => {
const J = ce(I, _e.value).locale(g.value);
if (J.isValid()) {
if (m && m(J.toDate()))
return;
const { hour: y, minute: L, second: N } = Ye(p.value);
p.value = J.hour(y).minute(L).second(N), Q.value = null, f(p.value, !0);
}
}, ot = (I) => ce.isDayjs(I) && I.isValid() && (m ? !m(I.toDate()) : !0), tt = (I) => M.value === "dates" ? I.map((J) => J.format(l.format)) : I.format(l.format), Ue = (I) => ce(I, l.format).locale(g.value), He = () => {
const I = ce(j.value).locale(g.value);
if (!j.value) {
const J = R.value;
return ce().hour(J.hour()).minute(J.minute()).second(J.second()).locale(g.value);
}
return I;
}, qe = async () => {
var I;
["week", "month", "year", "date"].includes(M.value) && ((I = E.value) == null || I.focus(), M.value === "week" && rt(ye.down));
}, ft = (I) => {
const { code: J } = I;
[
ye.up,
ye.down,
ye.left,
ye.right,
ye.home,
ye.end,
ye.pageUp,
ye.pageDown
].includes(J) && (rt(J), I.stopPropagation(), I.preventDefault()), [ye.enter, ye.space, ye.numpadEnter].includes(J) && Q.value === null && ne.value === null && (I.preventDefault(), f(p.value, !1));
}, rt = (I) => {
var J;
const { up: y, down: L, left: N, right: H, home: i, end: U, pageUp: oe, pageDown: Ve } = ye, Qe = {
year: {
[y]: -4,
[L]: 4,
[N]: -1,
[H]: 1,
offset: (Se, at) => Se.setFullYear(Se.getFullYear() + at)
},
month: {
[y]: -4,
[L]: 4,
[N]: -1,
[H]: 1,
offset: (Se, at) => Se.setMonth(Se.getMonth() + at)
},
week: {
[y]: -1,
[L]: 1,
[N]: -1,
[H]: 1,
offset: (Se, at) => Se.setDate(Se.getDate() + at * 7)
},
date: {
[y]: -7,
[L]: 7,
[N]: -1,
[H]: 1,
[i]: (Se) => -Se.getDay(),
[U]: (Se) => -Se.getDay() + 6,
[oe]: (Se) => -new Date(Se.getFullYear(), Se.getMonth(), 0).getDate(),
[Ve]: (Se) => new Date(Se.getFullYear(), Se.getMonth() + 1, 0).getDate(),
offset: (Se, at) => Se.setDate(Se.getDate() + at)
}
}, It = p.value.toDate();
for (; Math.abs(p.value.diff(It, "year", !0)) < 1; ) {
const Se = Qe[x.value];
if (!Se)
return;
if (Se.offset(It, gt(Se[I]) ? Se[I](It) : (J = Se[I]) != null ? J : 0), m && m(It))
break;
const at = ce(It).locale(g.value);
p.value = at, n("pick", at, !0);
break;
}
}, Je = (I) => {
n("panel-change", p.value.toDate(), I, K.value);
};
return ge(() => M.value, (I) => {
if (["month", "year"].includes(I)) {
K.value = I;
return;
}
K.value = "date";
}, { immediate: !0 }), ge(() => K.value, () => {
S == null || S.updatePopper();
}), ge(() => j.value, (I) => {
I && (p.value = He());
}, { immediate: !0 }), ge(() => l.parsedValue, (I) => {
if (I) {
if (M.value === "dates" || Array.isArray(I))
return;
p.value = I;
} else
p.value = He();
}, { immediate: !0 }), n("set-picker-option", ["isValidValue", ot]), n("set-picker-option", ["formatToString", tt]), n("set-picker-option", ["parseUserInput", Ue]), n("set-picker-option", ["handleFocusPicker", qe]), (I, J) => (k(), B("div", {
class: b([
e(s).b(),
e(o).b(),
{
"has-sidebar": I.$slots.sidebar || e(c),
"has-time": e(ee)
}
])
}, [
W("div", {
class: b(e(s).e("body-wrapper"))
}, [
$t(I.$slots, "sidebar", {
class: b(e(s).e("sidebar"))
}),
e(c) ? (k(), B("div", {
key: 0,
class: b(e(s).e("sidebar"))
}, [
(k(!0), B(we, null, Ee(e(_), (y, L) => (k(), B("button", {
key: L,
type: "button",
class: b(e(s).e("shortcut")),
onClick: (N) => v(y)
}, me(y.text), 11, ho))), 128))
], 2)) : se("v-if", !0),
W("div", {
class: b(e(s).e("body"))
}, [
e(ee) ? (k(), B("div", {
key: 0,
class: b(e(o).e("time-header"))
}, [
W("span", {
class: b(e(o).e("editor-wrap"))
}, [
q(e(nt), {
placeholder: e(u)("el.datepicker.selectDate"),
"model-value": e(Le),
size: "small",
"validate-event": !1,
onInput: J[0] || (J[0] = (y) => Q.value = y),
onChange: de
}, null, 8, ["placeholder", "model-value"])
], 2),
De((k(), B("span", {
class: b(e(o).e("editor-wrap"))
}, [
q(e(nt), {
placeholder: e(u)("el.datepicker.selectTime"),
"model-value": e(Te),
size: "small",
"validate-event": !1,
onFocus: Ze,
onInput: J[1] || (J[1] = (y) => ne.value = y),
onChange: ze
}, null, 8, ["placeholder", "model-value"]),
q(e(va), {
visible: Be.value,
format: e(ue),
"time-arrow-control": e($),
"parsed-value": p.value,
onPick: dt
}, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
], 2)), [
[e(Kt), Ke]
])
], 2)) : se("v-if", !0),
De(W("div", {
class: b([
e(o).e("header"),
(K.value === "year" || K.value === "month") && e(o).e("header--bordered")
])
}, [
W("span", {
class: b(e(o).e("prev-btn"))
}, [
W("button", {
type: "button",
"aria-label": e(u)("el.datepicker.prevYear"),
class: b(["d-arrow-left", e(s).e("icon-btn")]),
onClick: J[2] || (J[2] = (y) => ae(!1))
}, [
q(e(be), null, {
default: le(() => [
q(e(Rt))
]),
_: 1
})
], 10, bo),
De(W("button", {
type: "button",
"aria-label": e(u)("el.datepicker.prevMonth"),
class: b([e(s).e("icon-btn"), "arrow-left"]),
onClick: J[3] || (J[3] = (y) => X(!1))
}, [
q(e(be), null, {
default: le(() => [
q(e(ca))
]),
_: 1
})
], 10, go), [
[it, K.value === "date"]
])
], 2),
W("span", {
role: "button",
class: b(e(o).e("header-label")),
"aria-live": "polite",
tabindex: "0",
onKeydown: J[4] || (J[4] = Fe((y) => ie("year"), ["enter"])),
onClick: J[5] || (J[5] = (y) => ie("year"))
}, me(e(F)), 35),
De(W("span", {
role: "button",
"aria-live": "polite",
tabindex: "0",
class: b([
e(o).e("header-label"),
{ active: K.value === "month" }
]),
onKeydown: J[6] || (J[6] = Fe((y) => ie("month"), ["enter"])),
onClick: J[7] || (J[7] = (y) => ie("month"))
}, me(e(u)(`el.datepicker.month${e(O) + 1}`)), 35), [
[it, K.value === "date"]
]),
W("span", {
class: b(e(o).e("next-btn"))
}, [
De(W("button", {
type: "button",
"aria-label": e(u)("el.datepicker.nextMonth"),
class: b([e(s).e("icon-btn"), "arrow-right"]),
onClick: J[8] || (J[8] = (y) => X(!0))
}, [
q(e(be), null, {
default: le(() => [
q(e(Ot))
]),
_: 1
})
], 10, yo), [
[it, K.value === "date"]
]),
W("button", {
type: "button",
"aria-label": e(u)("el.datepicker.nextYear"),
class: b([e(s).e("icon-btn"), "d-arrow-right"]),
onClick: J[9] || (J[9] = (y) => ae(!0))
}, [
q(e(be), null, {
default: le(() => [
q(e(Ft))
]),
_: 1
})
], 10, ko)
], 2)
], 2), [
[it, K.value !== "time"]
]),
W("div", {
class: b(e(s).e("content")),
onKeydown: ft
}, [
K.value === "date" ? (k(), re(ha, {
key: 0,
ref_key: "currentViewRef",
ref: E,
"selection-mode": e(M),
date: p.value,
"parsed-value": I.parsedValue,
"disabled-date": e(m),
"cell-class-name": e(h),
onPick: T
}, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : se("v-if", !0),
K.value === "year" ? (k(), re(mo, {
key: 1,
ref_key: "currentViewRef",
ref: E,
date: p.value,
"disabled-date": e(m),
"parsed-value": I.parsedValue,
onPick: Z
}, null, 8, ["date", "disabled-date", "parsed-value"])) : se("v-if", !0),
K.value === "month" ? (k(), re(ba, {
key: 2,
ref_key: "currentViewRef",
ref: E,
date: p.value,
"parsed-value": I.parsedValue,
"disabled-date": e(m),
onPick: D
}, null, 8, ["date", "parsed-value", "disabled-date"])) : se("v-if", !0)
], 34)
], 2)
], 2),
De(W("div", {
class: b(e(s).e("footer"))
}, [
De(q(e(St), {
text: "",
size: "small",
class: b(e(s).e("link-btn")),
onClick: fe
}, {
default: le(() => [
et(me(e(u)("el.datepicker.now")), 1)
]),
_: 1
}, 8, ["class"]), [
[it, e(M) !== "dates"]
]),
q(e(St), {
plain: "",
size: "small",
class: b(e(s).e("link-btn")),
onClick: ve
}, {
default: le(() => [
et(me(e(u)("el.datepicker.confirm")), 1)
]),
_: 1
}, 8, ["class"])
], 2), [
[it, e(he) && K.value === "date"]
])
], 2));
}
});
var Co = /* @__PURE__ */ Ne(wo, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
const So = $e({
...bn,
...gn
}), Po = (t) => {
const { emit: n } = pt(), l = ta(), a = en();
return (o) => {
const r = gt(o.value) ? o.value() : o.value;
if (r) {
n("pick", [
ce(r[0]).locale(t.value),
ce(r[1]).locale(t.value)
]);
return;
}
o.onClick && o.onClick({
attrs: l,
slots: a,
emit: n
});
};
}, wn = (t, {
defaultValue: n,
leftDate: l,
rightDate: a,
unit: s,
onParsedValueChanged: o
}) => {
const { emit: r } = pt(), { pickerNs: d } = Ge(Ea), u = Ce("date-range-picker"), { t: g, lang: P } = Re(), S = Po(P), _ = Y(), m = Y(), h = Y({
endDate: null,
selecting: !1
}), w = (p) => {
h.value = p;
}, $ = (p = !1) => {
const A = e(_), R = e(m);
ma([A, R]) && r("pick", [A, R], p);
}, j = (p) => {
h.value.selecting = p, p || (h.value.endDate = null);
}, E = () => {
const [p, A] = kn(e(n), {
lang: e(P),
unit: s,
unlinkPanels: t.unlinkPanels
});
_.value = void 0, m.value = void 0, l.value = p, a.value = A;
};
return ge(n, (p) => {
p && E();
}, { immediate: !0 }), ge(() => t.parsedValue, (p) => {
if (Ae(p) && p.length === 2) {
const [A, R] = p;
_.value = A, l.value = A, m.value = R, o(e(_), e(m));
} else
E();
}, { immediate: !0 }), {
minDate: _,
maxDate: m,
rangeState: h,
lang: P,
ppNs: d,
drpNs: u,
handleChangeRange: w,
handleRangeConfirm: $,
handleShortcutClick: S,
onSelect: j,
t: g
};
}, Vo = ["onClick"], $o = ["disabled"], Eo = ["disabled"], No = ["disabled"], _o = ["disabled"], Ht = "month", To = /* @__PURE__ */ ke({
__name: "panel-date-range",
props: So,
emits: [
"pick",
"set-picker-option",
"calendar-change",
"panel-change"
],
setup(t, { emit: n }) {
const l = t, a = Ge("EP_PICKER_BASE"), {
disabledDate: s,
cellClassName: o,
format: r,
defaultTime: d,
arrowControl: u,
clearable: g
} = a.props, P = Et(a.props, "shortcuts"), S = Et(a.props, "defaultValue"), { lang: _ } = Re(), m = Y(ce().locale(_.value)), h = Y(ce().locale(_.value).add(1, Ht)), {
minDate: w,
maxDate: $,
rangeState: j,
ppNs: E,
drpNs: p,
handleChangeRange: A,
handleRangeConfirm: R,
handleShortcutClick: O,
onSelect: te,
t: V
} = wn(l, {
defaultValue: S,
leftDate: m,
rightDate: h,
unit: Ht,
onParsedValueChanged: L
}), Q = Y({
min: null,
max: null
}), ne = Y({
min: null,
max: null
}), G = C(() => `${m.value.year()} ${V("el.datepicker.year")} ${V(`el.datepicker.month${m.value.month() + 1}`)}`), z = C(() => `${h.value.year()} ${V("el.datepicker.year")} ${V(`el.datepicker.month${h.value.month() + 1}`)}`), f = C(() => m.value.year()), T = C(() => m.value.month()), X = C(() => h.value.year()), ae = C(() => h.value.month()), K = C(() => !!P.value.length), F = C(() => Q.value.min !== null ? Q.value.min : w.value ? w.value.format(D.value) : ""), v = C(() => Q.value.max !== null ? Q.value.max : $.value || w.value ? ($.value || w.value).format(D.value) : ""), M = C(() => ne.value.min !== null ? ne.value.min : w.value ? w.value.format(c.value) : ""), x = C(() => ne.value.max !== null ? ne.value.max : $.value || w.value ? ($.value || w.value).format(c.value) : ""), c = C(() => rn(r)), D = C(() => on(r)), Z = () => {
m.value = m.value.subtract(1, "year"), l.unlinkPanels || (h.value = m.value.add(1, "month")), Te("year");
}, ie = () => {
m.value = m.value.subtract(1, "month"), l.unlinkPanels || (h.value = m.value.add(1, "month")), Te("month");
}, ee = () => {
l.unlinkPanels ? h.value = h.value.add(1, "year") : (m.value = m.value.add(1, "year"), h.value = m.value.add(1, "month")), Te("year");
}, he = () => {
l.unlinkPanels ? h.value = h.value.add(1, "month") : (m.value = m.value.add(1, "month"), h.value = m.value.add(1, "month")), Te("month");
}, ve = () => {
m.value = m.value.add(1, "year"), Te("year");
}, fe = () => {
m.value = m.value.add(1, "month"), Te("month");
}, ue = () => {
h.value = h.value.subtract(1, "year"), Te("year");
}, _e = () => {
h.value = h.value.subtract(1, "month"), Te("month");
}, Te = (N) => {
n("panel-change", [m.value.toDate(), h.value.toDate()], N);
}, Le = C(() => {
const N = (T.value + 1) % 12, H = T.value + 1 >= 12 ? 1 : 0;
return l.unlinkPanels && new Date(f.value + H, N) < new Date(X.value, ae.value);
}), Be = C(() => l.unlinkPanels && X.value * 12 + ae.value - (f.value * 12 + T.value + 1) >= 12), Ze = C(() => !(w.value && $.value && !j.value.selecting && ma([w.value, $.value]))), Ke = C(() => l.type === "datetime" || l.type === "datetimerange"), Ye = (N, H) => {
if (N)
return d ? ce(d[H] || d).locale(_.value).year(N.year()).month(N.month()).date(N.date()) : N;
}, dt = (N, H = !0) => {
const i = N.minDate, U = N.maxDate, oe = Ye(i, 0), Ve = Ye(U, 1);
$.value === Ve && w.value === oe || (n("calendar-change", [i.toDate(), U && U.toDate()]), $.value = Ve, w.value = oe, !(!H || Ke.value) && R());
}, ze = Y(!1), de = Y(!1), ot = () => {
ze.value = !1;
}, tt = () => {
de.value = !1;
}, Ue = (N, H) => {
Q.value[H] = N;
const i = ce(N, D.value).locale(_.value);
if (i.isValid()) {
if (s && s(i.toDate()))
return;
H === "min" ? (m.value = i, w.value = (w.value || m.value).year(i.year()).month(i.month()).date(i.date()), !l.unlinkPanels && (!$.value || $.value.isBefore(w.value)) && (h.value = i.add(1, "month"), $.value = w.value.add(1, "month"))) : (h.value = i, $.value = ($.value || h.value).year(i.year()).month(i.month()).date(i.date()), !l.unlinkPanels && (!w.value || w.value.isAfter($.value)) && (m.value = i.subtract(1, "month"), w.value = $.value.subtract(1, "month")));
}
}, He = (N, H) => {
Q.value[H] = null;
}, qe = (N, H) => {
ne.value[H] = N;
const i = ce(N, c.value).locale(_.value);
i.isValid() && (H === "min" ? (ze.value = !0, w.value = (w.value || m.value).hour(i.hour()).minute(i.minute()).second(i.second()), (!$.value || $.value.isBefore(w.value)) && ($.value = w.value)) : (de.value = !0, $.value = ($.value || h.value).hour(i.hour()).minute(i.minute()).second(i.second()), h.value = $.value, $.value && $.value.isBefore(w.value) && (w.value = $.value)));
}, ft = (N, H) => {
ne.value[H] = null, H === "min" ? (m.value = w.value, ze.value = !1) : (h.value = $.value, de.value = !1);
}, rt = (N, H, i) => {
ne.value.min || (N && (m.value = N, w.value = (w.value || m.value).hour(N.hour()).minute(N.minute()).second(N.second())), i || (ze.value = H), (!$.value || $.value.isBefore(w.value)) && ($.value = w.value, h.value = N));
}, Je = (N, H, i) => {
ne.value.max || (N && (h.value = N, $.value = ($.value || h.value).hour(N.hour()).minute(N.minute()).second(N.second())), i || (de.value = H), $.value && $.value.isBefore(w.value) && (w.value = $.value));
}, I = () => {
m.value = kn(e(S), {
lang: e(_),
unit: "month",
unlinkPanels: l.unlinkPanels
})[0], h.value = m.value.add(1, "month"), n("pick", null);
}, J = (N) => Ae(N) ? N.map((H) => H.format(r)) : N.format(r), y = (N) => Ae(N) ? N.map((H) => ce(H, r).locale(_.value)) : ce(N, r).locale(_.value);
function L(N, H) {
if (l.unlinkPanels && H) {
const i = (N == null ? void 0 : N.year()) || 0, U = (N == null ? void 0 : N.month()) || 0, oe = H.year(), Ve = H.month();
h.value = i === oe && U === Ve ? H.add(1, Ht) : H;
} else
h.value = m.value.add(1, Ht), H && (h.value = h.value.hour(H.hour()).minute(H.minute()).second(H.second()));
}
return n("set-picker-option", ["isValidValue", ma]), n("set-picker-option", ["parseUserInput", y]), n("set-picker-option", ["formatToString", J]), n("set-picker-option", ["handleClear", I]), (N, H) => (k(), B("div", {
class: b([
e(E).b(),
e(p).b(),
{
"has-sidebar": N.$slots.sidebar || e(K),
"has-time": e(Ke)
}
])
}, [
W("div", {
class: b(e(E).e("body-wrapper"))
}, [
$t(N.$slots, "sidebar", {
class: b(e(E).e("sidebar"))
}),
e(K) ? (k(), B("div", {
key: 0,
class: b(e(E).e("sidebar"))
}, [
(k(!0), B(we, null, Ee(e(P), (i, U) => (k(), B("button", {
key: U,
type: "button",
class: b(e(E).e("shortcut")),
onClick: (oe) => e(O)(i)
}, me(i.text), 11, Vo))), 128))
], 2)) : se("v-if", !0),
W("div", {
class: b(e(E).e("body"))
}, [
e(Ke) ? (k(), B("div", {
key: 0,
class: b(e(p).e("time-header"))
}, [
W("span", {
class: b(e(p).e("editors-wrap"))
}, [
W("span", {
class: b(e(p).e("time-picker-wrap"))
}, [
q(e(nt), {
size: "small",
disabled: e(j).selecting,
placeholder: e(V)("el.datepicker.startDate"),
class: b(e(p).e("editor")),
"model-value": e(F),
"validate-event": !1,
onInput: H[0] || (H[0] = (i) => Ue(i, "min")),
onChange: H[1] || (H[1] = (i) => He(i, "min"))
}, null, 8, ["disabled", "placeholder", "class", "model-value"])
], 2),
De((k(), B("span", {
class: b(e(p).e("time-picker-wrap"))
}, [
q(e(nt), {
size: "small",
class: b(e(p).e("editor")),
disabled: e(j).selecting,
placeholder: e(V)("el.datepicker.startTime"),
"model-value": e(M),
"validate-event": !1,
onFocus: H[2] || (H[2] = (i) => ze.value = !0),
onInput: H[3] || (H[3] = (i) => qe(i, "min")),
onChange: H[4] || (H[4] = (i) => ft(i, "min"))
}, null, 8, ["class", "disabled", "placeholder", "model-value"]),
q(e(va), {
visible: ze.value,
format: e(c),
"datetime-role": "start",
"time-arrow-control": e(u),
"parsed-value": m.value,
onPick: rt
}, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
], 2)), [
[e(Kt), ot]
])
], 2),
W("span", null, [
q(e(be), null, {
default: le(() => [
q(e(Ot))
]),
_: 1
})
]),
W("span", {
class: b([e(p).e("editors-wrap"), "is-right"])
}, [
W("span", {
class: b(e(p).e("time-picker-wrap"))
}, [
q(e(nt), {
size: "small",
class: b(e(p).e("editor")),
disabled: e(j).selecting,
placeholder: e(V)("el.datepicker.endDate"),
"model-value": e(v),
readonly: !e(w),
"validate-event": !1,
onInput: H[5] || (H[5] = (i) => Ue(i, "max")),
onChange: H[6] || (H[6] = (i) => He(i, "max"))
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
], 2),
De((k(), B("span", {
class: b(e(p).e("time-picker-wrap"))
}, [
q(e(nt), {
size: "small",
class: b(e(p).e("editor")),
disabled: e(j).selecting,
placeholder: e(V)("el.datepicker.endTime"),
"model-value": e(x),
readonly: !e(w),
"validate-event": !1,
onFocus: H[7] || (H[7] = (i) => e(w) && (de.value = !0)),
onInput: H[8] || (H[8] = (i) => qe(i, "max")),
onChange: H[9] || (H[9] = (i) => ft(i, "max"))
}, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
q(e(va), {
"datetime-role": "end",
visible: de.value,
format: e(c),
"time-arrow-control": e(u),
"parsed-value": h.value,
onPick: Je
}, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
], 2)), [
[e(Kt), tt]
])
], 2)
], 2)) : se("v-if", !0),
W("div", {
class: b([[e(E).e("content"), e(p).e("content")], "is-left"])
}, [
W("div", {
class: b(e(p).e("header"))
}, [
W("button", {
type: "button",
class: b([e(E).e("icon-btn"), "d-arrow-left"]),
onClick: Z
}, [
q(e(be), null, {
default: le(() => [
q(e(Rt))
]),
_: 1
})
], 2),
W("button", {
type: "button",
class: b([e(E).e("icon-btn"), "arrow-left"]),
onClick: ie
}, [
q(e(be), null, {
default: le(() => [
q(e(ca))
]),
_: 1
})
], 2),
N.unlinkPanels ? (k(), B("button", {
key: 0,
type: "button",
disabled: !e(Be),
class: b([[e(E).e("icon-btn"), { "is-disabled": !e(Be) }], "d-arrow-right"]),
onClick: ve
}, [
q(e(be), null, {
default: le(() => [
q(e(Ft))
]),
_: 1
})
], 10, $o)) : se("v-if", !0),
N.unlinkPanels ? (k(), B("button", {
key: 1,
type: "button",
disabled: !e(Le),
class: b([[
e(E).e("icon-btn"),
{ "is-disabled": !e(Le) }
], "arrow-right"]),
onClick: fe
}, [
q(e(be), null, {
default: le(() => [
q(e(Ot))
]),
_: 1
})
], 10, Eo)) : se("v-if", !0),
W("div", null, me(e(G)), 1)
], 2),
q(ha, {
"selection-mode": "range",
date: m.value,
"min-date": e(w),
"max-date": e($),
"range-state": e(j),
"disabled-date": e(s),
"cell-class-name": e(o),
onChangerange: e(A),
onPick: dt,
onSelect: e(te)
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
], 2),
W("div", {
class: b([[e(E).e("content"), e(p).e("content")], "is-right"])
}, [
W("div", {
class: b(e(p).e("header"))
}, [
N.unlinkPanels ? (k(), B("button", {
key: 0,
type: "button",
disabled: !e(Be),
class: b([[e(E).e("icon-btn"), { "is-disabled": !e(Be) }], "d-arrow-left"]),
onClick: ue
}, [
q(e(be), null, {
default: le(() => [
q(e(Rt))
]),
_: 1
})
], 10, No)) : se("v-if", !0),
N.unlinkPanels ? (k(), B("button", {
key: 1,
type: "button",
disabled: !e(Le),
class: b([[
e(E).e("icon-btn"),
{ "is-disabled": !e(Le) }
], "arrow-left"]),
onClick: _e
}, [
q(e(be), null, {
default: le(() => [
q(e(ca))
]),
_: 1
})
], 10, _o)) : se("v-if", !0),
W("button", {
type: "button",
class: b([e(E).e("icon-btn"), "d-arrow-right"]),
onClick: ee
}, [
q(e(be), null, {
default: le(() => [
q(e(Ft))
]),
_: 1
})
], 2),
W("button", {
type: "button",
class: b([e(E).e("icon-btn"), "arrow-right"]),
onClick: he
}, [
q(e(be), null, {
default: le(() => [
q(e(Ot))
]),
_: 1
})
], 2),
W("div", null, me(e(z)), 1)
], 2),
q(ha, {
"selection-mode": "range",
date: h.value,
"min-date": e(w),
"max-date": e($),
"range-state": e(j),
"disabled-date": e(s),
"cell-class-name": e(o),
onChangerange: e(A),
onPick: dt,
onSelect: e(te)
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
], 2)
], 2)
], 2),
e(Ke) ? (k(), B("div", {
key: 0,
class: b(e(E).e("footer"))
}, [
e(g) ? (k(), re(e(St), {
key: 0,
text: "",
size: "small",
class: b(e(E).e("link-btn")),
onClick: I
}, {
default: le(() => [
et(me(e(V)("el.datepicker.clear")), 1)
]),
_: 1
}, 8, ["class"])) : se("v-if", !0),
q(e(St), {
plain: "",
size: "small",
class: b(e(E).e("link-btn")),
disabled: e(Ze),
onClick: H[10] || (H[10] = (i) => e(R)(!1))
}, {
default: le(() => [
et(me(e(V)("el.datepicker.confirm")), 1)
]),
_: 1
}, 8, ["class", "disabled"])
], 2)) : se("v-if", !0)
], 2));
}
});
var Mo = /* @__PURE__ */ Ne(To, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
const Io = $e({
...gn
}), Do = ["pick", "set-picker-option"], Oo = ({
unlinkPanels: t,
leftDate: n,
rightDate: l
}) => {
const { t: a } = Re(), s = () => {
n.value = n.value.subtract(1, "year"), t.value || (l.value = l.value.subtract(1, "year"));
}, o = () => {
t.value || (n.value = n.value.add(1, "year")), l.value = l.value.add(1, "year");
}, r = () => {
n.value = n.value.add(1, "year");
}, d = () => {
l.value = l.value.subtract(1, "year");
}, u = C(() => `${n.value.year()} ${a("el.datepicker.year")}`), g = C(() => `${l.value.year()} ${a("el.datepicker.year")}`), P = C(() => n.value.year()), S = C(() => l.value.year() === n.value.year() ? n.value.year() + 1 : l.value.year());
return {
leftPrevYear: s,
rightNextYear: o,
leftNextYear: r,
rightPrevYear: d,
leftLabel: u,
rightLabel: g,
leftYear: P,
rightYear: S
};
}, Ao = ["onClick"], xo = ["disabled"], Bo = ["disabled"], Wt = "year", Ro = ke({
name: "DatePickerMonthRange"
}), Fo = /* @__PURE__ */ ke({
...Ro,
props: Io,
emits: Do,
setup(t, { emit: n }) {
const l = t, { lang: a } = Re(), s = Ge("EP_PICKER_BASE"), { shortcuts: o, disabledDate: r, format: d } = s.props, u = Et(s.props, "defaultValue"), g = Y(ce().locale(a.value)), P = Y(ce().locale(a.value).add(1, Wt)), {
minDate: S,
maxDate: _,
rangeState: m,
ppNs: h,
drpNs: w,
handleChangeRange: $,
handleRangeConfirm: j,
handleShortcutClick: E,
onSelect: p
} = wn(l, {
defaultValue: u,
leftDate: g,
rightDate: P,
unit: Wt,
onParsedValueChanged: ae
}), A = C(() => !!o.length), {
leftPrevYear: R,
rightNextYear: O,
leftNextYear: te,
rightPrevYear: V,
leftLabel: Q,
rightLabel: ne,
leftYear: G,
rightYear: z
} = Oo({
unlinkPanels: Et(l, "unlinkPanels"),
leftDate: g,
rightDate: P
}), f = C(() => l.unlinkPanels && z.value > G.value + 1), T = (K, F = !0) => {
const v = K.minDate, M = K.maxDate;
_.value === M && S.value === v || (_.value = M, S.value = v, F && j());
}, X = (K) => K.map((F) => F.format(d));
function ae(K, F) {
if (l.unlinkPanels && F) {
const v = (K == null ? void 0 : K.year()) || 0, M = F.year();
P.value = v === M ? F.add(1, Wt) : F;
} else
P.value = g.value.add(1, Wt);
}
return n("set-picker-option", ["formatToString", X]), (K, F) => (k(), B("div", {
class: b([
e(h).b(),
e(w).b(),
{
"has-sidebar": !!K.$slots.sidebar || e(A)
}
])
}, [
W("div", {
class: b(e(h).e("body-wrapper"))
}, [
$t(K.$slots, "sidebar", {
class: b(e(h).e("sidebar"))
}),
e(A) ? (k(), B("div", {
key: 0,
class: b(e(h).e("sidebar"))
}, [
(k(!0), B(we, null, Ee(e(o), (v, M) => (k(), B("button", {
key: M,
type: "button",
class: b(e(h).e("shortcut")),
onClick: (x) => e(E)(v)
}, me(v.text), 11, Ao))), 128))
], 2)) : se("v-if", !0),
W("div", {
class: b(e(h).e("body"))
}, [
W("div", {
class: b([[e(h).e("content"), e(w).e("content")], "is-left"])
}, [
W("div", {
class: b(e(w).e("header"))
}, [
W("button", {
type: "button",
class: b([e(h).e("icon-btn"), "d-arrow-left"]),
onClick: F[0] || (F[0] = (...v) => e(R) && e(R)(...v))
}, [
q(e(be), null, {
default: le(() => [
q(e(Rt))
]),
_: 1
})
], 2),
K.unlinkPanels ? (k(), B("button", {
key: 0,
type: "button",
disabled: !e(f),
class: b([[
e(h).e("icon-btn"),
{ [e(h).is("disabled")]: !e(f) }
], "d-arrow-right"]),
onClick: F[1] || (F[1] = (...v) => e(te) && e(te)(...v))
}, [
q(e(be), null, {
default: le(() => [
q(e(Ft))
]),
_: 1
})
], 10, xo)) : se("v-if", !0),
W("div", null, me(e(Q)), 1)
], 2),
q(ba, {
"selection-mode": "range",
date: g.value,
"min-date": e(S),
"max-date": e(_),
"range-state": e(m),
"disabled-date": e(r),
onChangerange: e($),
onPick: T,
onSelect: e(p)
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
], 2),
W("div", {
class: b([[e(h).e("content"), e(w).e("content")], "is-right"])
}, [
W("div", {
class: b(e(w).e("header"))
}, [
K.unlinkPanels ? (k(), B("button", {
key: 0,
type: "button",
disabled: !e(f),
class: b([[e(h).e("icon-btn"), { "is-disabled": !e(f) }], "d-arrow-left"]),
onClick: F[2] || (F[2] = (...v) => e(V) && e(V)(...v))
}, [
q(e(be), null, {
default: le(() => [
q(e(Rt))
]),
_: 1
})
], 10, Bo)) : se("v-if", !0),
W("button", {
type: "button",
class: b([e(h).e("icon-btn"), "d-arrow-right"]),
onClick: F[3] || (F[3] = (...v) => e(O) && e(O)(...v))
}, [
q(e(be), null, {
default: le(() => [
q(e(Ft))
]),
_: 1
})
], 2),
W("div", null, me(e(ne)), 1)
], 2),
q(ba, {
"selection-mode": "range",
date: P.value,
"min-date": e(S),
"max-date": e(_),
"range-state": e(m),
"disabled-date": e(r),
onChangerange: e($),
onPick: T,
onSelect: e(p)
}, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
], 2)
], 2)
], 2)
], 2));
}
});
var Lo = /* @__PURE__ */ Ne(Fo, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
const Ko = function(t) {
switch (t) {
case "daterange":
case "datetimerange":
return Mo;
case "monthrange":
return Lo;
default:
return Co;
}
};
ce.extend(Nl);
ce.extend(Ms);
ce.extend(rl);
ce.extend(Ds);
ce.extend(As);
ce.extend(Bs);
ce.extend(Fs);
ce.extend(Ks);
var Yo = ke({
name: "ElDatePicker",
install: null,
props: Ys,
emits: ["update:modelValue"],
setup(t, {
expose: n,
emit: l,
slots: a
}) {
const s = Ce("picker-panel");
Vt("ElPopperOptions", Tt(Et(t, "popperOptions"))), Vt(Ea, {
slots: a,
pickerNs: s
});
const o = Y();
n({
focus: (u = !0) => {
var g;
(g = o.value) == null || g.focus(u);
},
handleOpen: () => {
var u;
(u = o.value) == null || u.handleOpen();
},
handleClose: () => {
var u;
(u = o.value) == null || u.handleClose();
}
});
const d = (u) => {
l("update:modelValue", u);
};
return () => {
var u;
const g = (u = t.format) != null ? u : il[t.type] || yt, P = Ko(t.type);
return q(pl, Ja(t, {
format: g,
type: t.type,
ref: o,
"onUpdate:modelValue": d
}), {
default: (S) => q(P, S, null),
"range-separator": a["range-separator"]
});
};
}
});
const Gt = Yo;
Gt.install = (t) => {
t.component(Gt.name, Gt);
};
const li = Gt, zo = $e({
id: {
type: String,
default: void 0
},
step: {
type: Number,
default: 1
},
stepStrictly: Boolean,
max: {
type: Number,
default: Number.POSITIVE_INFINITY
},
min: {
type: Number,
default: Number.NEGATIVE_INFINITY
},
modelValue: Number,
readonly: Boolean,
disabled: Boolean,
size: Pt,
controls: {
type: Boolean,
default: !0
},
controlsPosition: {
type: String,
default: "",
values: ["", "right"]
},
valueOnClear: {
type: [String, Number, null],
validator: (t) => t === null || xe(t) || ["min", "max"].includes(t),
default: null
},
name: String,
label: String,
placeholder: String,
precision: {
type: Number,
validator: (t) => t >= 0 && t === Number.parseInt(`${t}`, 10)
},
validateEvent: {
type: Boolean,
default: !0
}
}), Ho = {
[Xe]: (t, n) => n !== t,
blur: (t) => t instanceof FocusEvent,
focus: (t) => t instanceof FocusEvent,
[lt]: (t) => xe(t) || vt(t),
[Ie]: (t) => xe(t) || vt(t)
}, Wo = ["aria-label", "onKeydown"], Uo = ["aria-label", "onKeydown"], qo = ke({
name: "ElInputNumber"
}), jo = /* @__PURE__ */ ke({
...qo,
props: zo,
emits: Ho,
setup(t, { expose: n, emit: l }) {
const a = t, { t: s } = Re(), o = Ce("input-number"), r = Y(), d = Tt({
currentValue: a.modelValue,
userInput: null
}), { formItem: u } = Mt(), g = C(() => xe(a.modelValue) && a.modelValue <= a.min), P = C(() => xe(a.modelValue) && a.modelValue >= a.max), S = C(() => {
const f = j(a.step);
return kt(a.precision) ? Math.max(j(a.modelValue), f) : (f > a.precision && We("InputNumber", "precision should not be less than the decimal places of step"), a.precision);
}), _ = C(() => a.controls && a.controlsPosition === "right"), m = _t(), h = ka(), w = C(() => {
if (d.userInput !== null)
return d.userInput;
let f = d.currentValue;
if (vt(f))
return "";
if (xe(f)) {
if (Number.isNaN(f))
return "";
kt(a.precision) || (f = f.toFixed(a.precision));
}
return f;
}), $ = (f, T) => {
if (kt(T) && (T = S.value), T === 0)
return Math.round(f);
let X = String(f);
const ae = X.indexOf(".");
if (ae === -1 || !X.replace(".", "").split("")[ae + T])
return f;
const v = X.length;
return X.charAt(v - 1) === "5" && (X = `${X.slice(0, Math.max(0, v - 1))}6`), Number.parseFloat(Number(X).toFixed(T));
}, j = (f) => {
if (vt(f))
return 0;
const T = f.toString(), X = T.indexOf(".");
let ae = 0;
return X !== -1 && (ae = T.length - X - 1), ae;
}, E = (f, T = 1) => xe(f) ? $(f + a.step * T) : d.currentValue, p = () => {
if (a.readonly || h.value || P.value)
return;
const f = Number(w.value) || 0, T = E(f);
O(T), l(lt, d.currentValue);
}, A = () => {
if (a.readonly || h.value || g.value)
return;
const f = Number(w.value) || 0, T = E(f, -1);
O(T), l(lt, d.currentValue);
}, R = (f, T) => {
const { max: X, min: ae, step: K, precision: F, stepStrictly: v, valueOnClear: M } = a;
X < ae && wa("InputNumber", "min should not be greater than max.");
let x = Number(f);
if (vt(f) || Number.isNaN(x))
return null;
if (f === "") {
if (M === null)
return null;
x = ut(M) ? { min: ae, max: X }[M] : M;
}
return v && (x = $(Math.round(x / K) * K, F)), kt(F) || (x = $(x, F)), (x > X || x < ae) && (x = x > X ? X : ae, T && l(Ie, x)), x;
}, O = (f, T = !0) => {
var X;
const ae = d.currentValue, K = R(f);
if (!T) {
l(Ie, K);
return;
}
ae !== K && (d.userInput = null, l(Ie, K), l(Xe, K, ae), a.validateEvent && ((X = u == null ? void 0 : u.validate) == null || X.call(u, "change").catch((F) => We(F))), d.currentValue = K);
}, te = (f) => {
d.userInput = f;
const T = f === "" ? null : Number(f);
l(lt, T), O(T, !1);
}, V = (f) => {
const T = f !== "" ? Number(f) : "";
(xe(T) && !Number.isNaN(T) || f === "") && O(T), d.userInput = null;
}, Q = () => {
var f, T;
(T = (f = r.value) == null ? void 0 : f.focus) == null || T.call(f);
}, ne = () => {
var f, T;
(T = (f = r.value) == null ? void 0 : f.blur) == null || T.call(f);
}, G = (f) => {
l("focus", f);
}, z = (f) => {
var T;
l("blur", f), a.validateEvent && ((T = u == null ? void 0 : u.validate) == null || T.call(u, "blur").catch((X) => We(X)));
};
return ge(() => a.modelValue, (f) => {
const T = R(d.userInput), X = R(f, !0);
!xe(T) && (!T || T !== X) && (d.currentValue = X, d.userInput = null);
}, { immediate: !0 }), st(() => {
var f;
const { min: T, max: X, modelValue: ae } = a, K = (f = r.value) == null ? void 0 : f.input;
if (K.setAttribute("role", "spinbutton"), Number.isFinite(X) ? K.setAttribute("aria-valuemax", String(X)) : K.removeAttribute("aria-valuemax"), Number.isFinite(T) ? K.setAttribute("aria-valuemin", String(T)) : K.removeAttribute("aria-valuemin"), K.setAttribute("aria-valuenow", String(d.currentValue)), K.setAttribute("aria-disabled", String(h.value)), !xe(ae) && ae != null) {
let F = Number(ae);
Number.isNaN(F) && (F = null), l(Ie, F);
}
}), Un(() => {
var f;
const T = (f = r.value) == null ? void 0 : f.input;
T == null || T.setAttribute("aria-valuenow", `${d.currentValue}`);
}), n({
focus: Q,
blur: ne
}), (f, T) => (k(), B("div", {
class: b([
e(o).b(),
e(o).m(e(m)),
e(o).is("disabled", e(h)),
e(o).is("without-controls", !f.controls),
e(o).is("controls-right", e(_))
]),
onDragstart: T[1] || (T[1] = Me(() => {
}, ["prevent"]))
}, [
f.controls ? De((k(), B("span", {
key: 0,
role: "button",
"aria-label": e(s)("el.inputNumber.decrease"),
class: b([e(o).e("decrease"), e(o).is("disabled", e(g))]),
onKeydown: Fe(A, ["enter"])
}, [
q(e(be), null, {
default: le(() => [
e(_) ? (k(), re(e(Qt), { key: 0 })) : (k(), re(e(Bn), { key: 1 }))
]),
_: 1
})
], 42, Wo)), [
[e(Jt), A]
]) : se("v-if", !0),
f.controls ? De((k(), B("span", {
key: 1,
role: "button",
"aria-label": e(s)("el.inputNumber.increase"),
class: b([e(o).e("increase"), e(o).is("disabled", e(P))]),
onKeydown: Fe(p, ["enter"])
}, [
q(e(be), null, {
default: le(() => [
e(_) ? (k(), re(e(Xa), { key: 0 })) : (k(), re(e(Rn), { key: 1 }))
]),
_: 1
})
], 42, Uo)), [
[e(Jt), p]
]) : se("v-if", !0),
q(e(nt), {
id: f.id,
ref_key: "input",
ref: r,
type: "number",
step: f.step,
"model-value": e(w),
placeholder: f.placeholder,
readonly: f.readonly,
disabled: e(h),
size: e(m),
max: f.max,
min: f.min,
name: f.name,
label: f.label,
"validate-event": !1,
onWheel: T[0] || (T[0] = Me(() => {
}, ["prevent"])),
onKeydown: [
Fe(Me(p, ["prevent"]), ["up"]),
Fe(Me(A, ["prevent"]), ["down"])
],
onBlur: z,
onFocus: G,
onInput: te,
onChange: V
}, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
], 34));
}
});
var Xo = /* @__PURE__ */ Ne(jo, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
const Go = ea(Xo), Cn = Symbol("sliderContextKey"), Zo = $e({
modelValue: {
type: pe([Number, Array]),
default: 0
},
id: {
type: String,
default: void 0
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
showInput: Boolean,
showInputControls: {
type: Boolean,
default: !0
},
size: Pt,
inputSize: Pt,
showStops: Boolean,
showTooltip: {
type: Boolean,
default: !0
},
formatTooltip: {
type: pe(Function),
default: void 0
},
disabled: Boolean,
range: Boolean,
vertical: Boolean,
height: String,
debounce: {
type: Number,
default: 300
},
label: {
type: String,
default: void 0
},
rangeStartLabel: {
type: String,
default: void 0
},
rangeEndLabel: {
type: String,
default: void 0
},
formatValueText: {
type: pe(Function),
default: void 0
},
tooltipClass: {
type: String,
default: void 0
},
placement: {
type: String,
values: tn,
default: "top"
},
marks: {
type: pe(Object)
},
validateEvent: {
type: Boolean,
default: !0
}
}), ra = (t) => xe(t) || Ae(t) && t.every(xe), Jo = {
[Ie]: ra,
[lt]: ra,
[Xe]: ra
}, Qo = (t, n, l) => {
const a = Y();
return st(async () => {
t.range ? (Array.isArray(t.modelValue) ? (n.firstValue = Math.max(t.min, t.modelValue[0]), n.secondValue = Math.min(t.max, t.modelValue[1])) : (n.firstValue = t.min, n.secondValue = t.max), n.oldValue = [n.firstValue, n.secondValue]) : (typeof t.modelValue != "number" || Number.isNaN(t.modelValue) ? n.firstValue = t.min : n.firstValue = Math.min(t.max, Math.max(t.min, t.modelValue)), n.oldValue = n.firstValue), Fn(window, "resize", l), await Pe(), l();
}), {
sliderWrapper: a
};
}, er = (t) => C(() => t.marks ? Object.keys(t.marks).map(Number.parseFloat).sort((l, a) => l - a).filter((l) => l <= t.max && l >= t.min).map((l) => ({
point: l,
position: (l - t.min) * 100 / (t.max - t.min),
mark: t.marks[l]
})) : []), tr = (t, n, l) => {
const { form: a, formItem: s } = Mt(), o = da(), r = Y(), d = Y(), u = {
firstButton: r,
secondButton: d
}, g = C(() => t.disabled || (a == null ? void 0 : a.disabled) || !1), P = C(() => Math.min(n.firstValue, n.secondValue)), S = C(() => Math.max(n.firstValue, n.secondValue)), _ = C(() => t.range ? `${100 * (S.value - P.value) / (t.max - t.min)}%` : `${100 * (n.firstValue - t.min) / (t.max - t.min)}%`), m = C(() => t.range ? `${100 * (P.value - t.min) / (t.max - t.min)}%` : "0%"), h = C(() => t.vertical ? { height: t.height } : {}), w = C(() => t.vertical ? {
height: _.value,
bottom: m.value
} : {
width: _.value,
left: m.value
}), $ = () => {
o.value && (n.sliderSize = o.value[`client${t.vertical ? "Height" : "Width"}`]);
}, j = (G) => {
const z = t.min + G * (t.max - t.min) / 100;
if (!t.range)
return r;
let f;
return Math.abs(P.value - z) < Math.abs(S.value - z) ? f = n.firstValue < n.secondValue ? "firstButton" : "secondButton" : f = n.firstValue > n.secondValue ? "firstButton" : "secondButton", u[f];
}, E = (G) => {
const z = j(G);
return z.value.setPosition(G), z;
}, p = (G) => {
n.firstValue = G, R(t.range ? [P.value, S.value] : G);
}, A = (G) => {
n.secondValue = G, t.range && R([P.value, S.value]);
}, R = (G) => {
l(Ie, G), l(lt, G);
}, O = async () => {
await Pe(), l(Xe, t.range ? [P.value, S.value] : t.modelValue);
}, te = (G) => {
var z, f, T, X, ae, K;
if (g.value || n.dragging)
return;
$();
let F = 0;
if (t.vertical) {
const v = (T = (f = (z = G.touches) == null ? void 0 : z.item(0)) == null ? void 0 : f.clientY) != null ? T : G.clientY;
F = (o.value.getBoundingClientRect().bottom - v) / n.sliderSize * 100;
} else {
const v = (K = (ae = (X = G.touches) == null ? void 0 : X.item(0)) == null ? void 0 : ae.clientX) != null ? K : G.clientX, M = o.value.getBoundingClientRect().left;
F = (v - M) / n.sliderSize * 100;
}
if (!(F < 0 || F > 100))
return E(F);
};
return {
elFormItem: s,
slider: o,
firstButton: r,
secondButton: d,
sliderDisabled: g,
minValue: P,
maxValue: S,
runwayStyle: h,
barStyle: w,
resetSize: $,
setPosition: E,
emitChange: O,
onSliderWrapperPrevent: (G) => {
var z, f;
((z = u.firstButton.value) != null && z.dragging || (f = u.secondButton.value) != null && f.dragging) && G.preventDefault();
},
onSliderClick: (G) => {
te(G) && O();
},
onSliderDown: async (G) => {
const z = te(G);
z && (await Pe(), z.value.onButtonDown(G));
},
setFirstValue: p,
setSecondValue: A
};
}, { left: ar, down: nr, right: lr, up: sr, home: or, end: rr, pageUp: ir, pageDown: ur } = ye, cr = (t, n, l) => {
const a = Y(), s = Y(!1), o = C(() => n.value instanceof Function), r = C(() => o.value && n.value(t.modelValue) || t.modelValue), d = Yt(() => {
l.value && (s.value = !0);
}, 50), u = Yt(() => {
l.value && (s.value = !1);
}, 50);
return {
tooltip: a,
tooltipVisible: s,
formatValue: r,
displayTooltip: d,
hideTooltip: u
};
}, dr = (t, n, l) => {
const {
disabled: a,
min: s,
max: o,
step: r,
showTooltip: d,
precision: u,
sliderSize: g,
formatTooltip: P,
emitChange: S,
resetSize: _,
updateDragging: m
} = Ge(Cn), { tooltip: h, tooltipVisible: w, formatValue: $, displayTooltip: j, hideTooltip: E } = cr(t, P, d), p = Y(), A = C(() => `${(t.modelValue - s.value) / (o.value - s.value) * 100}%`), R = C(() => t.vertical ? { bottom: A.value } : { left: A.value }), O = () => {
n.hovering = !0, j();
}, te = () => {
n.hovering = !1, n.dragging || E();
}, V = (c) => {
a.value || (c.preventDefault(), F(c), window.addEventListener("mousemove", v), window.addEventListener("touchmove", v), window.addEventListener("mouseup", M), window.addEventListener("touchend", M), window.addEventListener("contextmenu", M), p.value.focus());
}, Q = (c) => {
a.value || (n.newPosition = Number.parseFloat(A.value) + c / (o.value - s.value) * 100, x(n.newPosition), S());
}, ne = () => {
Q(-r.value);
}, G = () => {
Q(r.value);
}, z = () => {
Q(-r.value * 4);
}, f = () => {
Q(r.value * 4);
}, T = () => {
a.value || (x(0), S());
}, X = () => {
a.value || (x(100), S());
}, ae = (c) => {
let D = !0;
[ar, nr].includes(c.key) ? ne() : [lr, sr].includes(c.key) ? G() : c.key === or ? T() : c.key === rr ? X() : c.key === ur ? z() : c.key === ir ? f() : D = !1, D && c.preventDefault();
}, K = (c) => {
let D, Z;
return c.type.startsWith("touch") ? (Z = c.touches[0].clientY, D = c.touches[0].clientX) : (Z = c.clientY, D = c.clientX), {
clientX: D,
clientY: Z
};
}, F = (c) => {
n.dragging = !0, n.isClick = !0;
const { clientX: D, clientY: Z } = K(c);
t.vertical ? n.startY = Z : n.startX = D, n.startPosition = Number.parseFloat(A.value), n.newPosition = n.startPosition;
}, v = (c) => {
if (n.dragging) {
n.isClick = !1, j(), _();
let D;
const { clientX: Z, clientY: ie } = K(c);
t.vertical ? (n.currentY = ie, D = (n.startY - n.currentY) / g.value * 100) : (n.currentX = Z, D = (n.currentX - n.startX) / g.value * 100), n.newPosition = n.startPosition + D, x(n.newPosition);
}
}, M = () => {
n.dragging && (setTimeout(() => {
n.dragging = !1, n.hovering || E(), n.isClick || x(n.newPosition), S();
}, 0), window.removeEventListener("mousemove", v), window.removeEventListener("touchmove", v), window.removeEventListener("mouseup", M), window.removeEventListener("touchend", M), window.removeEventListener("contextmenu", M));
}, x = async (c) => {
if (c === null || Number.isNaN(+c))
return;
c < 0 ? c = 0 : c > 100 && (c = 100);
const D = 100 / ((o.value - s.value) / r.value);
let ie = Math.round(c / D) * D * (o.value - s.value) * 0.01 + s.value;
ie = Number.parseFloat(ie.toFixed(u.value)), ie !== t.modelValue && l(Ie, ie), !n.dragging && t.modelValue !== n.oldValue && (n.oldValue = t.modelValue), await Pe(), n.dragging && j(), h.value.updatePopper();
};
return ge(() => n.dragging, (c) => {
m(c);
}), {
disabled: a,
button: p,
tooltip: h,
tooltipVisible: w,
showTooltip: d,
wrapperStyle: R,
formatValue: $,
handleMouseEnter: O,
handleMouseLeave: te,
onButtonDown: V,
onKeyDown: ae,
setPosition: x
};
}, fr = (t, n, l, a) => ({
stops: C(() => {
if (!t.showStops || t.min > t.max)
return [];
if (t.step === 0)
return We("ElSlider", "step should not be 0."), [];
const r = (t.max - t.min) / t.step, d = 100 * t.step / (t.max - t.min), u = Array.from({ length: r - 1 }).map((g, P) => (P + 1) * d);
return t.range ? u.filter((g) => g < 100 * (l.value - t.min) / (t.max - t.min) || g > 100 * (a.value - t.min) / (t.max - t.min)) : u.filter((g) => g > 100 * (n.firstValue - t.min) / (t.max - t.min));
}),
getStopStyle: (r) => t.vertical ? { bottom: `${r}%` } : { left: `${r}%` }
}), vr = (t, n, l, a, s, o) => {
const r = (g) => {
s(Ie, g), s(lt, g);
}, d = () => t.range ? ![l.value, a.value].every((g, P) => g === n.oldValue[P]) : t.modelValue !== n.oldValue, u = () => {
var g, P;
t.min > t.max && wa("Slider", "min should not be greater than max.");
const S = t.modelValue;
t.range && Array.isArray(S) ? S[1] < t.min ? r([t.min, t.min]) : S[0] > t.max ? r([t.max, t.max]) : S[0] < t.min ? r([t.min, S[1]]) : S[1] > t.max ? r([S[0], t.max]) : (n.firstValue = S[0], n.secondValue = S[1], d() && (t.validateEvent && ((g = o == null ? void 0 : o.validate) == null || g.call(o, "change").catch((_) => We(_))), n.oldValue = S.slice())) : !t.range && typeof S == "number" && !Number.isNaN(S) && (S < t.min ? r(t.min) : S > t.max ? r(t.max) : (n.firstValue = S, d() && (t.validateEvent && ((P = o == null ? void 0 : o.validate) == null || P.call(o, "change").catch((_) => We(_))), n.oldValue = S)));
};
u(), ge(() => n.dragging, (g) => {
g || u();
}), ge(() => t.modelValue, (g, P) => {
n.dragging || Array.isArray(g) && Array.isArray(P) && g.every((S, _) => S === P[_]) && n.firstValue === g[0] && n.secondValue === g[1] || u();
}, {
deep: !0
}), ge(() => [t.min, t.max], () => {
u();
});
}, pr = $e({
modelValue: {
type: Number,
default: 0
},
vertical: Boolean,
tooltipClass: String,
placement: {
type: String,
values: tn,
default: "top"
}
}), mr = {
[Ie]: (t) => xe(t)
}, hr = ["tabindex"], br = ke({
name: "ElSliderButton"
}), gr = /* @__PURE__ */ ke({
...br,
props: pr,
emits: mr,
setup(t, { expose: n, emit: l }) {
const a = t, s = Ce("slider"), o = Tt({
hovering: !1,
dragging: !1,
isClick: !1,
startX: 0,
currentX: 0,
startY: 0,
currentY: 0,
startPosition: 0,
newPosition: 0,
oldValue: a.modelValue
}), {
disabled: r,
button: d,
tooltip: u,
showTooltip: g,
tooltipVisible: P,
wrapperStyle: S,
formatValue: _,
handleMouseEnter: m,
handleMouseLeave: h,
onButtonDown: w,
onKeyDown: $,
setPosition: j
} = dr(a, o, l), { hovering: E, dragging: p } = fa(o);
return n({
onButtonDown: w,
onKeyDown: $,
setPosition: j,
hovering: E,
dragging: p
}), (A, R) => (k(), B("div", {
ref_key: "button",
ref: d,
class: b([e(s).e("button-wrapper"), { hover: e(E), dragging: e(p) }]),
style: Oe(e(S)),
tabindex: e(r) ? -1 : 0,
onMouseenter: R[0] || (R[0] = (...O) => e(m) && e(m)(...O)),
onMouseleave: R[1] || (R[1] = (...O) => e(h) && e(h)(...O)),
onMousedown: R[2] || (R[2] = (...O) => e(w) && e(w)(...O)),
onTouchstart: R[3] || (R[3] = (...O) => e(w) && e(w)(...O)),
onFocus: R[4] || (R[4] = (...O) => e(m) && e(m)(...O)),
onBlur: R[5] || (R[5] = (...O) => e(h) && e(h)(...O)),
onKeydown: R[6] || (R[6] = (...O) => e($) && e($)(...O))
}, [
q(e(Lt), {
ref_key: "tooltip",
ref: u,
visible: e(P),
placement: A.placement,
"fallback-placements": ["top", "bottom", "right", "left"],
"stop-popper-mouse-event": !1,
"popper-class": A.tooltipClass,
disabled: !e(g),
persistent: ""
}, {
content: le(() => [
W("span", null, me(e(_)), 1)
]),
default: le(() => [
W("div", {
class: b([e(s).e("button"), { hover: e(E), dragging: e(p) }])
}, null, 2)
]),
_: 1
}, 8, ["visible", "placement", "popper-class", "disabled"])
], 46, hr));
}
});
var qa = /* @__PURE__ */ Ne(gr, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
const yr = $e({
mark: {
type: pe([String, Object]),
default: void 0
}
});
var kr = ke({
name: "ElSliderMarker",
props: yr,
setup(t) {
const n = Ce("slider"), l = C(() => ut(t.mark) ? t.mark : t.mark.label), a = C(() => ut(t.mark) ? void 0 : t.mark.style);
return () => Qa("div", {
class: n.e("marks-text"),
style: a.value
}, l.value);
}
});
const wr = ["id", "role", "aria-label", "aria-labelledby"], Cr = { key: 1 }, Sr = ke({
name: "ElSlider"
}), Pr = /* @__PURE__ */ ke({
...Sr,
props: Zo,
emits: Jo,
setup(t, { expose: n, emit: l }) {
const a = t, s = Ce("slider"), { t: o } = Re(), r = Tt({
firstValue: 0,
secondValue: 0,
oldValue: 0,
dragging: !1,
sliderSize: 1
}), {
elFormItem: d,
slider: u,
firstButton: g,
secondButton: P,
sliderDisabled: S,
minValue: _,
maxValue: m,
runwayStyle: h,
barStyle: w,
resetSize: $,
emitChange: j,
onSliderWrapperPrevent: E,
onSliderClick: p,
onSliderDown: A,
setFirstValue: R,
setSecondValue: O
} = tr(a, r, l), { stops: te, getStopStyle: V } = fr(a, r, _, m), { inputId: Q, isLabeledByFormItem: ne } = Sa(a, {
formItemContext: d
}), G = _t(), z = C(() => a.inputSize || G.value), f = C(() => a.label || o("el.slider.defaultLabel", {
min: a.min,
max: a.max
})), T = C(() => a.range ? a.rangeStartLabel || o("el.slider.defaultRangeStartLabel") : f.value), X = C(() => a.formatValueText ? a.formatValueText(c.value) : `${c.value}`), ae = C(() => a.rangeEndLabel || o("el.slider.defaultRangeEndLabel")), K = C(() => a.formatValueText ? a.formatValueText(D.value) : `${D.value}`), F = C(() => [
s.b(),
s.m(G.value),
s.is("vertical", a.vertical),
{ [s.m("with-input")]: a.showInput }
]), v = er(a);
vr(a, r, _, m, l, d);
const M = C(() => {
const ee = [a.min, a.max, a.step].map((he) => {
const ve = `${he}`.split(".")[1];
return ve ? ve.length : 0;
});
return Math.max.apply(null, ee);
}), { sliderWrapper: x } = Qo(a, r, $), { firstValue: c, secondValue: D, sliderSize: Z } = fa(r), ie = (ee) => {
r.dragging = ee;
};
return Vt(Cn, {
...fa(a),
sliderSize: Z,
disabled: S,
precision: M,
emitChange: j,
resetSize: $,
updateDragging: ie
}), n({
onSliderClick: p
}), (ee, he) => {
var ve, fe;
return k(), B("div", {
id: ee.range ? e(Q) : void 0,
ref_key: "sliderWrapper",
ref: x,
class: b(e(F)),
role: ee.range ? "group" : void 0,
"aria-label": ee.range && !e(ne) ? e(f) : void 0,
"aria-labelledby": ee.range && e(ne) ? (ve = e(d)) == null ? void 0 : ve.labelId : void 0,
onTouchstart: he[2] || (he[2] = (...ue) => e(E) && e(E)(...ue)),
onTouchmove: he[3] || (he[3] = (...ue) => e(E) && e(E)(...ue))
}, [
W("div", {
ref_key: "slider",
ref: u,
class: b([
e(s).e("runway"),
{ "show-input": ee.showInput && !ee.range },
e(s).is("disabled", e(S))
]),
style: Oe(e(h)),
onMousedown: he[0] || (he[0] = (...ue) => e(A) && e(A)(...ue)),
onTouchstart: he[1] || (he[1] = (...ue) => e(A) && e(A)(...ue))
}, [
W("div", {
class: b(e(s).e("bar")),
style: Oe(e(w))
}, null, 6),
q(qa, {
id: ee.range ? void 0 : e(Q),
ref_key: "firstButton",
ref: g,
"model-value": e(c),
vertical: ee.vertical,
"tooltip-class": ee.tooltipClass,
placement: ee.placement,
role: "slider",
"aria-label": ee.range || !e(ne) ? e(T) : void 0,
"aria-labelledby": !ee.range && e(ne) ? (fe = e(d)) == null ? void 0 : fe.labelId : void 0,
"aria-valuemin": ee.min,
"aria-valuemax": ee.range ? e(D) : ee.max,
"aria-valuenow": e(c),
"aria-valuetext": e(X),
"aria-orientation": ee.vertical ? "vertical" : "horizontal",
"aria-disabled": e(S),
"onUpdate:modelValue": e(R)
}, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
ee.range ? (k(), re(qa, {
key: 0,
ref_key: "secondButton",
ref: P,
"model-value": e(D),
vertical: ee.vertical,
"tooltip-class": ee.tooltipClass,
placement: ee.placement,
role: "slider",
"aria-label": e(ae),
"aria-valuemin": e(c),
"aria-valuemax": ee.max,
"aria-valuenow": e(D),
"aria-valuetext": e(K),
"aria-orientation": ee.vertical ? "vertical" : "horizontal",
"aria-disabled": e(S),
"onUpdate:modelValue": e(O)
}, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : se("v-if", !0),
ee.showStops ? (k(), B("div", Cr, [
(k(!0), B(we, null, Ee(e(te), (ue, _e) => (k(), B("div", {
key: _e,
class: b(e(s).e("stop")),
style: Oe(e(V)(ue))
}, null, 6))), 128))
])) : se("v-if", !0),
e(v).length > 0 ? (k(), B(we, { key: 2 }, [
W("div", null, [
(k(!0), B(we, null, Ee(e(v), (ue, _e) => (k(), B("div", {
key: _e,
style: Oe(e(V)(ue.position)),
class: b([e(s).e("stop"), e(s).e("marks-stop")])
}, null, 6))), 128))
]),
W("div", {
class: b(e(s).e("marks"))
}, [
(k(!0), B(we, null, Ee(e(v), (ue, _e) => (k(), re(e(kr), {
key: _e,
mark: ue.mark,
style: Oe(e(V)(ue.position))
}, null, 8, ["mark", "style"]))), 128))
], 2)
], 64)) : se("v-if", !0)
], 38),
ee.showInput && !ee.range ? (k(), re(e(Go), {
key: 0,
ref: "input",
"model-value": e(c),
class: b(e(s).e("input")),
step: ee.step,
disabled: e(S),
controls: ee.showInputControls,
min: ee.min,
max: ee.max,
debounce: ee.debounce,
size: e(z),
"onUpdate:modelValue": e(R),
onChange: e(j)
}, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : se("v-if", !0)
], 42, wr);
};
}
});
var Vr = /* @__PURE__ */ Ne(Pr, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/slider.vue"]]);
const si = ea(Vr), $r = $e({
modelValue: {
type: [Boolean, String, Number],
default: !1
},
disabled: {
type: Boolean,
default: !1
},
loading: {
type: Boolean,
default: !1
},
size: {
type: String,
validator: Zn
},
width: {
type: [String, Number],
default: ""
},
inlinePrompt: {
type: Boolean,
default: !1
},
activeIcon: {
type: Da
},
inactiveIcon: {
type: Da
},
activeText: {
type: String,
default: ""
},
inactiveText: {
type: String,
default: ""
},
activeValue: {
type: [Boolean, String, Number],
default: !0
},
inactiveValue: {
type: [Boolean, String, Number],
default: !1
},
activeColor: {
type: String,
default: ""
},
inactiveColor: {
type: String,
default: ""
},
borderColor: {
type: String,
default: ""
},
name: {
type: String,
default: ""
},
validateEvent: {
type: Boolean,
default: !0
},
beforeChange: {
type: pe(Function)
},
id: String,
tabindex: {
type: [String, Number]
},
value: {
type: [Boolean, String, Number],
default: !1
}
}), Er = {
[Ie]: (t) => At(t) || ut(t) || xe(t),
[Xe]: (t) => At(t) || ut(t) || xe(t),
[lt]: (t) => At(t) || ut(t) || xe(t)
}, Nr = ["onClick"], _r = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"], Tr = ["aria-hidden"], Mr = ["aria-hidden"], Ir = ["aria-hidden"], Zt = "ElSwitch", Dr = ke({
name: Zt
}), Or = /* @__PURE__ */ ke({
...Dr,
props: $r,
emits: Er,
setup(t, { expose: n, emit: l }) {
const a = t, s = pt(), { formItem: o } = Mt(), r = _t(), d = Ce("switch");
((V) => {
V.forEach((Q) => {
Ln({
from: Q[0],
replacement: Q[1],
scope: Zt,
version: "2.3.0",
ref: "https://element-plus.org/en-US/component/switch.html#attributes",
type: "Attribute"
}, C(() => {
var ne;
return !!((ne = s.vnode.props) != null && ne[Q[2]]);
}));
});
})([
['"value"', '"model-value" or "v-model"', "value"],
['"active-color"', "CSS var `--el-switch-on-color`", "activeColor"],
['"inactive-color"', "CSS var `--el-switch-off-color`", "inactiveColor"],
['"border-color"', "CSS var `--el-switch-border-color`", "borderColor"]
]);
const { inputId: g } = Sa(a, {
formItemContext: o
}), P = ka(C(() => a.loading)), S = Y(a.modelValue !== !1), _ = Y(), m = Y(), h = C(() => [
d.b(),
d.m(r.value),
d.is("disabled", P.value),
d.is("checked", p.value)
]), w = C(() => [
d.e("label"),
d.em("label", "left"),
d.is("active", !p.value)
]), $ = C(() => [
d.e("label"),
d.em("label", "right"),
d.is("active", p.value)
]), j = C(() => ({
width: ua(a.width)
}));
ge(() => a.modelValue, () => {
S.value = !0;
}), ge(() => a.value, () => {
S.value = !1;
});
const E = C(() => S.value ? a.modelValue : a.value), p = C(() => E.value === a.activeValue);
[a.activeValue, a.inactiveValue].includes(E.value) || (l(Ie, a.inactiveValue), l(Xe, a.inactiveValue), l(lt, a.inactiveValue)), ge(p, (V) => {
var Q;
_.value.checked = V, a.validateEvent && ((Q = o == null ? void 0 : o.validate) == null || Q.call(o, "change").catch((ne) => We(ne)));
});
const A = () => {
const V = p.value ? a.inactiveValue : a.activeValue;
l(Ie, V), l(Xe, V), l(lt, V), Pe(() => {
_.value.checked = p.value;
});
}, R = () => {
if (P.value)
return;
const { beforeChange: V } = a;
if (!V) {
A();
return;
}
const Q = V();
[
ia(Q),
At(Q)
].includes(!0) || wa(Zt, "beforeChange must return type `Promise<boolean>` or `boolean`"), ia(Q) ? Q.then((G) => {
G && A();
}).catch((G) => {
We(Zt, `some error occurred: ${G}`);
}) : Q && A();
}, O = C(() => d.cssVarBlock({
...a.activeColor ? { "on-color": a.activeColor } : null,
...a.inactiveColor ? { "off-color": a.inactiveColor } : null,
...a.borderColor ? { "border-color": a.borderColor } : null
})), te = () => {
var V, Q;
(Q = (V = _.value) == null ? void 0 : V.focus) == null || Q.call(V);
};
return st(() => {
_.value.checked = p.value;
}), n({
focus: te,
checked: p
}), (V, Q) => (k(), B("div", {
class: b(e(h)),
style: Oe(e(O)),
onClick: Me(R, ["prevent"])
}, [
W("input", {
id: e(g),
ref_key: "input",
ref: _,
class: b(e(d).e("input")),
type: "checkbox",
role: "switch",
"aria-checked": e(p),
"aria-disabled": e(P),
name: V.name,
"true-value": V.activeValue,
"false-value": V.inactiveValue,
disabled: e(P),
tabindex: V.tabindex,
onChange: A,
onKeydown: Fe(R, ["enter"])
}, null, 42, _r),
!V.inlinePrompt && (V.inactiveIcon || V.inactiveText) ? (k(), B("span", {
key: 0,
class: b(e(w))
}, [
V.inactiveIcon ? (k(), re(e(be), { key: 0 }, {
default: le(() => [
(k(), re(bt(V.inactiveIcon)))
]),
_: 1
})) : se("v-if", !0),
!V.inactiveIcon && V.inactiveText ? (k(), B("span", {
key: 1,
"aria-hidden": e(p)
}, me(V.inactiveText), 9, Tr)) : se("v-if", !0)
], 2)) : se("v-if", !0),
W("span", {
ref_key: "core",
ref: m,
class: b(e(d).e("core")),
style: Oe(e(j))
}, [
V.inlinePrompt ? (k(), B("div", {
key: 0,
class: b(e(d).e("inner"))
}, [
V.activeIcon || V.inactiveIcon ? (k(), re(e(be), {
key: 0,
class: b(e(d).is("icon"))
}, {
default: le(() => [
(k(), re(bt(e(p) ? V.activeIcon : V.inactiveIcon)))
]),
_: 1
}, 8, ["class"])) : V.activeText || V.inactiveText ? (k(), B("span", {
key: 1,
class: b(e(d).is("text")),
"aria-hidden": !e(p)
}, me(e(p) ? V.activeText : V.inactiveText), 11, Mr)) : se("v-if", !0)
], 2)) : se("v-if", !0),
W("div", {
class: b(e(d).e("action"))
}, [
V.loading ? (k(), re(e(be), {
key: 0,
class: b(e(d).is("loading"))
}, {
default: le(() => [
q(e(ga))
]),
_: 1
}, 8, ["class"])) : se("v-if", !0)
], 2)
], 6),
!V.inlinePrompt && (V.activeIcon || V.activeText) ? (k(), B("span", {
key: 1,
class: b(e($))
}, [
V.activeIcon ? (k(), re(e(be), { key: 0 }, {
default: le(() => [
(k(), re(bt(V.activeIcon)))
]),
_: 1
})) : se("v-if", !0),
!V.activeIcon && V.activeText ? (k(), B("span", {
key: 1,
"aria-hidden": !e(p)
}, me(V.activeText), 9, Ir)) : se("v-if", !0)
], 2)) : se("v-if", !0)
], 14, Nr));
}
});
var Ar = /* @__PURE__ */ Ne(Or, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
const oi = ea(Ar);
export {
Vu as BAR_MAP,
$a as CASCADER_PANEL_INJECTION_KEY,
Xe as CHANGE_EVENT,
Kt as ClickOutside,
pl as CommonPicker,
fn as CommonProps,
yt as DEFAULT_FORMATS_DATE,
il as DEFAULT_FORMATS_DATEPICKER,
xa as DEFAULT_FORMATS_TIME,
Ll as DefaultProps,
ye as EVENT_CODE,
ui as ElBadge,
St as ElButton,
Ri as ElCard,
ai as ElCascader,
Jn as ElCheckbox,
yc as ElCheckboxButton,
kc as ElCheckboxGroup,
qc as ElCol,
Ki as ElCollapse,
Yi as ElCollapseItem,
ni as ElColorPicker,
li as ElDatePicker,
td as ElDialog,
zi as ElForm,
Hi as ElFormItem,
be as ElIcon,
vd as ElImageViewer,
nt as ElInput,
Go as ElInputNumber,
ci as ElMessage,
$u as ElOption,
ad as ElOverlay,
Eu as ElPopper,
Nu as ElPopperArrow,
_u as ElPopperContent,
Tu as ElPopperTrigger,
di as ElProgress,
Qn as ElRadio,
Ec as ElRadioButton,
Nc as ElRadioGroup,
bd as ElRow,
Ca as ElScrollbar,
Mu as ElSelect,
si as ElSlider,
oi as ElSwitch,
Wi as ElTabPane,
Ui as ElTabs,
Ia as ElTag,
Lt as ElTooltip,
fi as ElUpload,
Iu as FORWARD_REF_INJECTION_KEY,
Du as GAP,
qi as ID_INJECTION_KEY,
lt as INPUT_EVENT,
Ou as POPPER_CONTENT_INJECTION_KEY,
Au as POPPER_INJECTION_KEY,
Ea as ROOT_PICKER_INJECTION_KEY,
gd as RowAlign,
yd as RowJustify,
ji as SIZE_INJECTION_KEY,
Gn as TOOLTIP_INJECTION_KEY,
va as TimePickPanel,
Ie as UPDATE_MODEL_EVENT,
vi as badgeProps,
Bc as buildLocaleContext,
aa as buildTimeList,
Rc as buildTranslator,
Ii as buttonEmits,
Di as buttonGroupContextKey,
Oi as buttonNativeTypes,
Ai as buttonProps,
xi as buttonTypes,
Fi as cardProps,
jl as cascaderEmits,
ql as cascaderProps,
wc as checkboxEmits,
Cc as checkboxGroupContextKey,
Sc as checkboxGroupEmits,
Pc as checkboxGroupProps,
Vc as checkboxProps,
jc as colProps,
Xi as collapseContextKey,
Gi as collapseEmits,
Zi as collapseItemProps,
Ji as collapseProps,
vn as colorPickerContextKey,
vs as colorPickerEmits,
fs as colorPickerProps,
Qi as componentSizeMap,
eu as componentSizes,
Gc as configProviderContextKey,
pi as configProviderProps,
xu as createModelToggleComposable,
Ba as dateEquals,
sl as datePickTypes,
Ys as datePickerProps,
ce as dayjs,
Fc as defaultInitialZIndex,
tu as defaultNamespace,
nd as dialogEmits,
ld as dialogInjectionKey,
sd as dialogProps,
au as emitChangeFn,
on as extractDateFormat,
rn as extractTimeFormat,
nu as formContextKey,
lu as formEmits,
su as formItemContextKey,
ou as formItemProps,
ru as formItemValidateStates,
iu as formProps,
La as formatter,
mi as genFileId,
uu as iconProps,
pd as imageViewerEmits,
md as imageViewerProps,
Bu as inputEmits,
Ho as inputNumberEmits,
zo as inputNumberProps,
Ru as inputProps,
Lc as localeContextKey,
na as makeList,
hi as messageConfig,
bi as messageDefaults,
gi as messageEmits,
yi as messageProps,
ki as messageTypes,
cu as namespaceContextKey,
od as overlayEmits,
rd as overlayProps,
Fa as parseDate,
Fu as popperArrowProps,
Lu as popperContentEmits,
Ku as popperContentProps,
Yu as popperCoreConfigProps,
zu as popperProps,
Hu as popperTriggerProps,
wi as progressProps,
Zc as provideGlobalConfig,
_c as radioButtonProps,
Tc as radioEmits,
Mc as radioGroupEmits,
Ic as radioGroupKey,
Dc as radioGroupProps,
Oc as radioProps,
Ac as radioPropsBase,
sn as rangeArr,
Wu as renderThumbStyle,
Uu as roleTypes,
Cd as rowContextKey,
kd as rowProps,
qu as scrollbarContextKey,
ju as scrollbarEmits,
Xu as scrollbarProps,
Gu as selectGroupKey,
Zu as selectKey,
Cn as sliderContextKey,
Jo as sliderEmits,
Zo as sliderProps,
Er as switchEmits,
$r as switchProps,
du as tabBarProps,
fu as tabNavEmits,
vu as tabNavProps,
pu as tabPaneProps,
mu as tabsEmits,
hu as tabsProps,
bu as tabsRootContextKey,
Ju as tagEmits,
jn as tagProps,
Qu as thumbProps,
cn as timePickerDefaultProps,
Aa as timeUnits,
ec as tooltipEmits,
Kc as translate,
Ci as uploadBaseProps,
Si as uploadContentProps,
Pi as uploadContextKey,
Vi as uploadDraggerEmits,
$i as uploadDraggerProps,
Ei as uploadListEmits,
Ni as uploadListProps,
_i as uploadListTypes,
Ti as uploadProps,
tc as useAttrs,
Kl as useCascaderConfig,
ac as useCursor,
nc as useDelayedToggle,
lc as useDelayedToggleProps,
Ln as useDeprecated,
id as useDialog,
ud as useDraggable,
Wc as useEscapeKeydown,
sc as useFocus,
oc as useFocusController,
ka as useFormDisabled,
Mt as useFormItem,
Sa as useFormItemInputId,
_t as useFormSize,
rc as useForwardRef,
ic as useForwardRefDirective,
gu as useGetDerivedNamespace,
Jc as useGlobalComponentSettings,
Qc as useGlobalConfig,
yu as useGlobalSize,
ku as useId,
wu as useIdInjection,
Re as useLocale,
cd as useLockscreen,
Ce as useNamespace,
Cu as useOrderedChildren,
uc as usePopper,
cc as usePopperContainer,
dc as usePopperContainerId,
Su as useProp,
dd as useSameTarget,
Pt as useSizeProp,
fc as useTimeout,
qn as useTooltipContentProps,
vc as useTooltipModelToggle,
pc as useTooltipModelToggleEmits,
mc as useTooltipModelToggleProps,
hc as useTooltipProps,
bc as useTooltipTriggerProps,
Yc as useZIndex,
Jt as vRepeatClick,
Ra as valueEquals,
zc as zIndexContextKey
};