@coderlt/form-designer
Version:
基于vue3的设计器,可视化开发页面表单
1,433 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-623661f0.js";
import { E as St } from "./index-40ecdea1.js";
import { b as Ii, e as Di, a as Oi, c as Ai, d as xi } from "./index-40ecdea1.js";
import { E as Ri, c as Fi } from "./index-b497329b.js";
import { a3 as Bt, a4 as _a, a5 as Ae, a6 as $e, a7 as pe, a8 as ja, a9 as Pt, aa as Ce, ab as We, ac as Nn, ad as _n, ae as _t, af as Tn, ag as be, ah as Ne, ai as ye, aj as gt, ak as Mn, al as Xa, am as Qt, an as kt, ao as Ga, ap as ga, aq as Ot, ar as In, as as Ta, at as Dn, au as Ie, av as Xe, aw as ya, ax as At, ay as ia, az as On, aA as An, aB as ua, aC as ut, aD as Ma, aE as ka, aF as xn, aG as ea, aH as Za, aI as Rt, aJ as ca, aK as Ft, aL as xe, aM as lt, aN as Bn, aO as Rn, aP as wa, aQ as Fn, aR as Ln } from "./index-74b7090f.js";
import { aX as Ki, aY as Yi, b3 as zi, b4 as Hi, bd as Wi, be as Ui, bi as qi, bp as ji, aW as Xi, aS as Gi, aV as Zi, aT as Ji, bf as Qi, bg as eu, bl as tu, aU as au, b1 as nu, aZ as lu, b2 as su, a$ as ou, b0 as ru, a_ as iu, b5 as uu, bm as cu, b8 as du, b9 as fu, ba as vu, bb as pu, b6 as mu, b7 as hu, bc as bu, bn as gu, bq as yu, bj as ku, bk as wu, bo as Cu, bh as Su } from "./index-74b7090f.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-a537a859.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-a537a859.js";
import { E as Jn } from "./index-d95626dd.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-d95626dd.js";
import { E as Qn } from "./index-5fb26e87.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-5fb26e87.js";
import { u as Re, i as Da } from "./index-450daacc.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-450daacc.js";
import { i as wt } from "./isEqual-10a53e21.js";
import { s as el } from "./focus-trap-fb4432a9.js";
import { u as Wc } from "./focus-trap-fb4432a9.js";
import { b as tl, a as al } from "./_flatRest-cdc31ace.js";
import { c as an } from "./cloneDeep-873180b8.js";
import { u as Mt, a as Sa } from "./use-form-item-18802e58.js";
import { d as Yt } from "./debounce-89797f0d.js";
import { E as qc, c as jc } from "./index-7109ba55.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-e19ced52.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-3c0fdba0.js";
import { E as vd, i as pd, a as md } from "./index-cb4e0513.js";
import { E as bd, R as gd, a as yd, r as kd } from "./index-2fb4faf2.js";
import { r as Cd } from "./constants-669e1a5f.js";
import "./index-2b6651fc.js";
import "./hasIn-61ab08dc.js";
import "./_baseIsEqual-ee7e3824.js";
import "./_overRest-b6d63194.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) !==