y-design-ssr
Version:
SSR component library of YUI with Vue3
4,771 lines • 124 kB
JavaScript
import { ref as L, reactive as F, getCurrentInstance as le, provide as _t, isVNode as Se, inject as zt, onUnmounted as we, computed as B, defineComponent as z, createVNode as f, watch as j, onMounted as Z, nextTick as ue, onBeforeUnmount as xe, onBeforeUpdate as st, onUpdated as yn, createTextVNode as bn, Fragment as He, createApp as Ce, h as Ve, Transition as We, withDirectives as te, vShow as ye, Teleport as ct, vModelText as Ot, mergeProps as Ie, vModelDynamic as Sn, resolveDirective as gt, watchEffect as wn, unref as pt } from "vue";
const xn = {
"pull-refresh": {
pulling: "下拉刷新...",
loosing: "释放刷新...",
loading: "数据加载中...",
success: "数据已更新",
failed: "数据跟新失败,请稍后再试"
},
"form-item": {
validateMessage: "请输入正确内容"
}
}, ht = L("zh-CN"), yt = F({
"zh-CN": xn
}), Mt = {
text() {
return yt[ht.value];
},
use(e, t) {
ht.value = e, this.add({ [e]: t });
},
add(e = {}) {
Object.assign(yt, e);
}
}, Pe = (e) => (t) => Object.prototype.toString.call(t) === `[object ${e}]`, Dt = Pe("Function"), Cn = Pe("String"), $n = Pe("Number"), kn = Pe("Object"), Tn = Pe("Promise"), Fe = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((o, n) => o + Fe(e, n), "") : Object.keys(t).reduce(
(o, n) => o + (t[n] ? Fe(e, n) : ""),
""
) : "", En = (e) => (t, o) => {
let n = t, a = o;
return n && typeof n != "string" && (a = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${Fe(n, a)}`;
}, Nn = () => (e, t) => t ? `${Fe(`y-${e}`, t)}` : `y-${e}`, O = (e) => {
const t = `y-${e}`;
return [t, En(t), Nn()];
}, At = (e) => Mt.text()[e];
var Rt = /* @__PURE__ */ ((e) => (e.Mini = "mini", e.Small = "small", e.Middle = "middle", e.Large = "large", e))(Rt || {}), dt = /* @__PURE__ */ ((e) => (e.Top = "top", e.Middle = "middle", e.Bottom = "bottom", e))(dt || {}), Qe = /* @__PURE__ */ ((e) => (e.Top = "top", e.Right = "right", e.Bottom = "bottom", e.Left = "left", e.Center = "center", e))(Qe || {}), Wt = /* @__PURE__ */ ((e) => (e.simple = "simple", e.multi = "multi", e))(Wt || {}), Ft = /* @__PURE__ */ ((e) => (e.Top = "top", e.TopStart = "top-start", e.TopEnd = "top-end", e.Right = "right", e.RightStart = "right-start", e.RightEnd = "right-end", e.Left = "left", e.LeftStart = "left-start", e.LeftEnd = "left-end", e.Bottom = "bottom", e.BottomStart = "bottom-start", e.BottomEnd = "bottom-end", e))(Ft || {}), Je = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(Je || {}), Re = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(Re || {}), Ht = /* @__PURE__ */ ((e) => (e.Start = "start", e.Center = "center", e.End = "end", e.SpaceBetween = "space-between", e.SpaceAround = "space-around", e))(Ht || {}), Y = /* @__PURE__ */ ((e) => (e.DEFUALT = "normal", e.PULLING = "pulling", e.LOOSING = "loosing", e.LOADING = "loading", e.SUCCESS = "success", e.FAILED = "failed", e))(Y || {}), be = /* @__PURE__ */ ((e) => (e.UP = "up", e.DOWN = "down", e))(be || {});
const R = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, bt = (e, t) => typeof e == "string" && e.includes("%") && e.includes("%") ? t * Number(e.replace(/%/g, "")) / 100 : Number(e), Bn = (e) => {
switch (e) {
case "top":
return "column-reverse";
case "bottom":
return "column";
case "left":
return "row-reverse";
case "right":
return "row";
default:
return "column";
}
}, Ln = (e) => {
const t = [], o = (n) => {
Array.isArray(n) && n.forEach((a) => {
var r;
Se(a) && (t.push(a), (r = a.component) != null && r.subTree && o(a.component.subTree.children), a.children && o(a.children));
});
};
return o(e), t;
}, Vn = (e, t) => {
const o = Ln(t.subTree.children);
e.sort((n, a) => o.indexOf(n.vnode) - o.indexOf(a.vnode));
}, fe = (e) => {
const t = le(), o = F([]);
return {
children: o,
initProvide: (a) => {
_t(e, {
addChild: (i) => {
i.proxy && (o.push(i), t && Vn(o, t));
},
removeChild: (i) => {
const m = o.indexOf(i);
o.splice(m, 1);
},
children: o,
...a
});
}
};
}, ce = (e) => {
const t = zt(e, null), o = le();
if (t && o) {
const { children: n, addChild: a, removeChild: r } = t;
return a(o), we(() => r(o)), {
index: B(() => n.indexOf(o)),
parent: t
};
}
return {
parent: null,
index: L(-1)
};
}, [In, Pn] = O("swipe-item"), Le = /* @__PURE__ */ z({
name: In,
props: {
clonenNode: {
type: Object,
default: null
},
index: {
type: Number,
default: -1
}
},
setup(e, {
slots: t
}) {
const o = le(), {
parent: n
} = ce(Xt);
!e.clonenNode && o && (n == null || n.children.push(o));
const a = B(() => e.clonenNode ? e.index : n == null ? void 0 : n.children.findIndex((l) => l.proxy === (o == null ? void 0 : o.proxy))), r = B(() => {
const l = `${(n == null ? void 0 : n.itemDetail.size) || 0}px`;
let i = "auto";
const m = `${(n == null ? void 0 : n.itemDetail.space) || 0}px`;
return n != null && n.props.autoHeight && (n == null ? void 0 : n.activeIndex) !== a.value && (i = "0"), n != null && n.props.vertical ? {
height: l,
width: i,
marginBottom: m
} : {
width: l,
height: i,
marginRight: m
};
});
return () => {
var i, m;
const l = ((i = n == null ? void 0 : n.itemShowedList) == null ? void 0 : i.list[a.value || 0]) || !1;
return f("div", {
class: Pn(),
style: r.value
}, [l ? e.clonenNode || ((m = t.default) == null ? void 0 : m.call(t)) : null]);
};
}
}), _n = {
autoplayTime: {
type: Number,
default: 0
},
duration: {
type: Number,
default: 300
},
initIndex: {
type: Number,
default: 0
},
loop: {
type: Boolean,
default: !0
},
dots: {
type: Boolean,
default: !0
},
dotsPosition: {
type: String,
default: null
},
dotsColor: {
type: String,
default: ""
},
lazy: {
type: Boolean,
default: !1
},
vertical: {
type: Boolean,
default: !1
},
autoHeight: {
type: Boolean,
default: !1
},
itemSize: {
type: [Number, String],
default: ""
},
itemSpace: {
type: [Number, String],
default: 0
},
minSwipeDistance: {
type: [Number, String],
default: "50%"
},
touchable: {
type: Boolean,
default: !0
},
isFollowHand: {
type: Boolean,
default: !0
},
align: {
type: String,
default: "center"
}
}, [Yt, Ye] = O("swipe"), Xt = Yt, jt = /* @__PURE__ */ z({
name: Yt,
components: {
YSwipeItem: Le
},
props: _n,
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
initProvide: a
} = fe(Xt), r = F([]), l = L(Number(e.initIndex)), i = F({
// 元素尺寸
size: 0,
// 间距
space: 0,
// 元素宽度比swipe小,占满整个视窗
isFillViewport: !1
}), m = F({
// 偏移量
offset: 0,
// 视窗大小
viewportSize: 0,
// 重复节点个数
cloneNodeCount: 0
}), g = L(), x = L(), c = () => {
const $ = r.length, _ = [];
for (let W = 0; W < $; W++)
_.push(!e.lazy);
return _;
}, h = () => {
if (!e.lazy)
return;
const $ = i.size + i.space, _ = r.length * $;
let W = -(m.offset + V.offset) - m.cloneNodeCount * $;
W < 0 && (W += _);
const G = W + m.viewportSize;
for (let X = 0; X < r.length; X++)
if (!s.list[X]) {
const J = $ * X, re = J + i.size;
(J >= W && J < G || re > W && re < G || J < W && re > G) && (s.list[X] = !0);
}
}, s = F({
list: c()
}), w = () => {
s.list = c(), h();
};
j(() => [...r], w);
const d = ($, _) => {
$ ? i.size = bt($, _) : i.size = _, i.space = Number(e.itemSpace) || 0, i.isFillViewport = i.size >= _, m.viewportSize = _, m.cloneNodeCount = p();
}, p = () => {
if (v.value) {
const $ = i.size + i.space;
if ($ === 0)
return 0;
const _ = m.viewportSize * 2 - $, W = Math.ceil(_ / $);
return Math.min(W, r.length - 1);
}
return 0;
}, S = () => {
if (!g.value)
return;
const {
width: $,
height: _
} = g.value.getBoundingClientRect();
e.vertical ? d(e.itemSize, _) : d(e.itemSize, $), l.value = l.value >= r.length ? r.length - 1 : l.value, l.value < 0 && (l.value = 0), u(l.value), w(), D();
};
Z(() => {
if (ue(S).catch(() => {
}), e.touchable && g.value) {
const $ = g.value;
$.addEventListener("touchstart", U, !1), $.addEventListener("mousedown", U, !1), $.addEventListener("touchmove", q, !1), $.addEventListener("mousemove", q, !1), $.addEventListener("touchend", I, !1), $.addEventListener("mouseup", I, !1), $.addEventListener("mouseleave", I, !1), $.addEventListener("touchcancel", I, !1);
}
window.addEventListener("resize", S, !1), window.addEventListener("orientationchange", S, !1);
}), xe(() => {
if (P(), e.touchable && g.value) {
const $ = g.value;
$.removeEventListener("touchstart", U, !1), $.removeEventListener("mousedown", U, !1), $.removeEventListener("mousemove", q, !1), $.removeEventListener("touchmove", q, !1), $.removeEventListener("mouseup", I, !1), $.removeEventListener("touchend", I, !1), $.removeEventListener("mouseleave", I, !1), $.removeEventListener("touchcancel", I, !1);
}
window.removeEventListener("resize", S, !1), window.removeEventListener("orientationchange", S, !1);
});
const k = B(() => {
let $ = 0;
switch (e.align) {
case Re.start:
$ = 0;
break;
case Re.center:
$ = (m.viewportSize - i.size) / 2;
break;
case Re.end:
$ = m.viewportSize - i.size;
break;
default:
$ = 0;
}
return $;
}), v = B(() => e.loop && r.length > 1), u = ($) => {
const _ = i.size + i.space;
v.value ? m.offset = -_ * ($ + m.cloneNodeCount) + k.value : (m.offset = -_ * $ + k.value, e.align !== "center" && ($ === 0 && (m.offset = 0), $ === r.length - 1 && (m.offset = -_ * $ + m.viewportSize - i.size)));
}, y = () => {
u(l.value), o("afterChange", l.value);
}, C = ($) => (r.length + $) % r.length, b = ($, _ = !0) => {
l.value = C($), u($), h(), o("change", l.value), _ ? (V.transitionEnabled = !0, x.value && x.value.addEventListener("transitionend", () => {
V.transitionEnabled = !1, y();
}, {
once: !0
})) : y();
}, T = ($ = !0) => {
b(l.value - 1, $);
}, N = ($ = !0) => {
b(l.value + 1, $);
};
let E = null;
const P = () => {
e.autoplayTime && E && clearInterval(E);
}, D = () => {
e.autoplayTime && r.length > 1 && (E && clearInterval(E), E = setInterval(() => {
N();
}, Number(e.autoplayTime)));
}, V = F({
// 拖拽中
isDragging: !1,
// 是否首次拖动
isFirstTouch: !0,
// 拖拽起始位置X
startX: 0,
// 拖拽起始位置Y
startY: 0,
// 拖拽距离
offset: 0,
// 开始拖动时间
startTime: /* @__PURE__ */ new Date(),
// 是否在执行动画
transitionEnabled: !1,
// 当前次拖拽不满足翻页条件
isDissatisfy: !1
}), U = ($) => {
if (V.transitionEnabled)
return;
let _ = 0, W = 0;
"touches" in $ ? (_ = $.touches[0].clientX, W = $.touches[0].clientY) : (_ = $.clientX, W = $.clientY), V.startX = _, V.startY = W, V.isDragging = !0, V.isFirstTouch = !0, V.startTime = /* @__PURE__ */ new Date(), P();
}, q = ($) => {
if (!V.isDragging)
return;
let _ = 0, W = 0;
"touches" in $ ? (_ = $.touches[0].clientX, W = $.touches[0].clientY) : (_ = $.clientX, W = $.clientY);
const G = _ - V.startX, X = W - V.startY;
if (V.isFirstTouch && (V.isFirstTouch = !1, Math.abs(G) < Math.abs(X) !== e.vertical)) {
V.isDragging = !1;
return;
}
$.preventDefault(), V.offset = e.vertical ? X : G, h(), o("dragging", {
percent: V.offset / (i.size + i.space),
offset: V.offset
}), V.isDissatisfy = !1;
}, I = () => {
if (!V.isDragging)
return;
V.isDragging = !1;
const _ = (/* @__PURE__ */ new Date()).getTime() - V.startTime.getTime();
H() && (Math.abs(V.offset) > A.value || Math.abs(V.offset) / _ > 0.5) ? (V.offset > 0 ? T() : N(), V.offset = 0, V.isDissatisfy = !1) : (V.offset = 0, V.isDissatisfy = !0), D();
}, A = B(() => bt(e.minSwipeDistance, i.size + i.space)), H = () => {
if (v.value)
return !0;
const $ = V.offset > 0 ? l.value - 1 : l.value + 1;
return $ >= 0 && $ < r.length;
}, se = B(() => {
const $ = V.isDragging && !e.isFollowHand ? m.offset : m.offset + V.offset, _ = {};
return e.vertical ? (_.transform = `translate3d(0, ${$}px, 0)`, _.transitionDuration = V.transitionEnabled || V.isDissatisfy ? `${e.duration}ms` : "0ms") : (_.transform = `translate3d(${$}px, 0, 0)`, _.transitionDuration = V.transitionEnabled || V.isDissatisfy ? `${e.duration}ms` : "0ms"), V.isDragging && (_.transition = "none"), e.vertical && (_.flexDirection = "column"), e.autoHeight && (_.display = "block", _.whiteSpace = "nowrap"), _;
}), Q = B(() => ["y-swipe__dots", `y-swipe__dots--${e.dotsPosition || (e.vertical ? Je.left : Je.bottom)}`]);
n({
moveTo: b,
next: N,
prev: T,
resize: S
});
const ae = F({
children: r,
activeIndex: l,
props: e,
itemDetail: i,
itemShowedList: s
});
a(ae);
const oe = () => e.dots ? f("div", {
class: Q.value
}, [r.map(($, _) => {
const W = Ye("dot", {
active: _ === l.value
});
return f("div", {
class: W,
style: {
backgroundColor: e.dotsColor
},
key: _
}, null);
})]) : null;
return () => {
var $;
return f("div", {
class: Ye(),
ref: g
}, [f("div", {
class: Ye("track"),
style: se.value,
ref: x
}, [Array(m.cloneNodeCount).fill("").map((_, W) => {
var J, re, $e;
const G = C(W - m.cloneNodeCount), X = ($e = (J = r[G]) == null ? void 0 : (re = J.slots).default) == null ? void 0 : $e.call(re);
return X ? f(Le, {
clonenNode: X,
index: G
}, null) : null;
}), ($ = t.default) == null ? void 0 : $.call(t), Array(m.cloneNodeCount).fill("").map((_, W) => {
var J, re, $e;
const G = C(W), X = ($e = (J = r[G]) == null ? void 0 : (re = J.slots).default) == null ? void 0 : $e.call(re);
return X ? f(Le, {
clonenNode: X,
index: G
}, null) : null;
})]), t.dots ? t.dots() : oe()]);
};
}
}), [zn, St] = O("tabs-title"), wt = /* @__PURE__ */ z({
name: zn,
props: {
active: {
type: Boolean,
default: !1
},
scrollable: {
type: Boolean,
default: !1
},
title: {
type: String,
default: null
},
titleSlot: {
type: Function,
default: null
},
disabled: {
type: Boolean,
default: !1
}
},
setup(e) {
const {
parent: t
} = ce(ft), o = B(() => [{
"y-el--clickable": !e.disabled
}, St({
scrollable: e.scrollable,
disabled: e.disabled
}), St(`${(t == null ? void 0 : t.props.size) || "middle"}`, {
active: e.active
}), t == null ? void 0 : t.props.titleClass, e.active ? t == null ? void 0 : t.props.titleActiveClass : ""]), n = B(() => ({
...t == null ? void 0 : t.props.titleStyle,
...e.active ? {
...t == null ? void 0 : t.props.titleActiveStyle
} : {}
}));
return () => {
const {
title: a,
titleSlot: r
} = e;
return f("div", {
class: o.value,
title: a,
style: n.value,
role: "presentation"
}, [r ? r() : a]);
};
}
}), Xe = null, On = {
initIndex: {
type: Number,
default: 0
},
initName: {
type: [Number, String],
default: null
},
duration: {
type: Number,
default: 300
},
lazy: {
type: Boolean,
default: !1
},
lineColor: {
type: String,
default: ""
},
lineWidth: {
type: [Number, String],
default: "12px"
},
lineHeight: {
type: [Number, String],
default: "3px"
},
titleWrapperClass: Xe,
titleScrollThreshold: {
type: Number,
default: 5
},
titleStyle: {
type: [Object],
default: null
},
titleClass: {
type: Xe,
default: null
},
titleActiveStyle: {
type: [Object],
default: null
},
titleActiveClass: {
type: Xe,
default: null
},
touchable: {
type: Boolean,
default: !0
},
changeWithAnimation: {
type: Boolean,
default: !1
},
size: {
type: String,
default: "large"
},
align: {
type: String,
default: "center"
}
};
var et = {}, Mn = {
get exports() {
return et;
},
set exports(e) {
et = e;
}
};
(function(e, t) {
(function() {
function o() {
var n = window, a = document;
if ("scrollBehavior" in a.documentElement.style && n.__forceSmoothScrollPolyfill__ !== !0)
return;
var r = n.HTMLElement || n.Element, l = 468, i = {
scroll: n.scroll || n.scrollTo,
scrollBy: n.scrollBy,
elementScroll: r.prototype.scroll || c,
scrollIntoView: r.prototype.scrollIntoView
}, m = n.performance && n.performance.now ? n.performance.now.bind(n.performance) : Date.now;
function g(u) {
var y = ["MSIE ", "Trident/", "Edge/"];
return new RegExp(y.join("|")).test(u);
}
var x = g(n.navigator.userAgent) ? 1 : 0;
function c(u, y) {
this.scrollLeft = u, this.scrollTop = y;
}
function h(u) {
return 0.5 * (1 - Math.cos(Math.PI * u));
}
function s(u) {
if (u === null || typeof u != "object" || u.behavior === void 0 || u.behavior === "auto" || u.behavior === "instant")
return !0;
if (typeof u == "object" && u.behavior === "smooth")
return !1;
throw new TypeError(
"behavior member of ScrollOptions " + u.behavior + " is not a valid value for enumeration ScrollBehavior."
);
}
function w(u, y) {
if (y === "Y")
return u.clientHeight + x < u.scrollHeight;
if (y === "X")
return u.clientWidth + x < u.scrollWidth;
}
function d(u, y) {
var C = n.getComputedStyle(u, null)["overflow" + y];
return C === "auto" || C === "scroll";
}
function p(u) {
var y = w(u, "Y") && d(u, "Y"), C = w(u, "X") && d(u, "X");
return y || C;
}
function S(u) {
for (; u !== a.body && p(u) === !1; )
u = u.parentNode || u.host;
return u;
}
function k(u) {
var y = m(), C, b, T, N = (y - u.startTime) / l;
N = N > 1 ? 1 : N, C = h(N), b = u.startX + (u.x - u.startX) * C, T = u.startY + (u.y - u.startY) * C, u.method.call(u.scrollable, b, T), (b !== u.x || T !== u.y) && n.requestAnimationFrame(k.bind(n, u));
}
function v(u, y, C) {
var b, T, N, E, P = m();
u === a.body ? (b = n, T = n.scrollX || n.pageXOffset, N = n.scrollY || n.pageYOffset, E = i.scroll) : (b = u, T = u.scrollLeft, N = u.scrollTop, E = c), k({
scrollable: b,
method: E,
startTime: P,
startX: T,
startY: N,
x: y,
y: C
});
}
n.scroll = n.scrollTo = function() {
if (arguments[0] !== void 0) {
if (s(arguments[0]) === !0) {
i.scroll.call(
n,
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] != "object" ? arguments[0] : n.scrollX || n.pageXOffset,
// use top prop, second argument if present or fallback to scrollY
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : n.scrollY || n.pageYOffset
);
return;
}
v.call(
n,
a.body,
arguments[0].left !== void 0 ? ~~arguments[0].left : n.scrollX || n.pageXOffset,
arguments[0].top !== void 0 ? ~~arguments[0].top : n.scrollY || n.pageYOffset
);
}
}, n.scrollBy = function() {
if (arguments[0] !== void 0) {
if (s(arguments[0])) {
i.scrollBy.call(
n,
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] != "object" ? arguments[0] : 0,
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : 0
);
return;
}
v.call(
n,
a.body,
~~arguments[0].left + (n.scrollX || n.pageXOffset),
~~arguments[0].top + (n.scrollY || n.pageYOffset)
);
}
}, r.prototype.scroll = r.prototype.scrollTo = function() {
if (arguments[0] !== void 0) {
if (s(arguments[0]) === !0) {
if (typeof arguments[0] == "number" && arguments[1] === void 0)
throw new SyntaxError("Value could not be converted");
i.elementScroll.call(
this,
// use left prop, first number argument or fallback to scrollLeft
arguments[0].left !== void 0 ? ~~arguments[0].left : typeof arguments[0] != "object" ? ~~arguments[0] : this.scrollLeft,
// use top prop, second argument or fallback to scrollTop
arguments[0].top !== void 0 ? ~~arguments[0].top : arguments[1] !== void 0 ? ~~arguments[1] : this.scrollTop
);
return;
}
var u = arguments[0].left, y = arguments[0].top;
v.call(
this,
this,
typeof u > "u" ? this.scrollLeft : ~~u,
typeof y > "u" ? this.scrollTop : ~~y
);
}
}, r.prototype.scrollBy = function() {
if (arguments[0] !== void 0) {
if (s(arguments[0]) === !0) {
i.elementScroll.call(
this,
arguments[0].left !== void 0 ? ~~arguments[0].left + this.scrollLeft : ~~arguments[0] + this.scrollLeft,
arguments[0].top !== void 0 ? ~~arguments[0].top + this.scrollTop : ~~arguments[1] + this.scrollTop
);
return;
}
this.scroll({
left: ~~arguments[0].left + this.scrollLeft,
top: ~~arguments[0].top + this.scrollTop,
behavior: arguments[0].behavior
});
}
}, r.prototype.scrollIntoView = function() {
if (s(arguments[0]) === !0) {
i.scrollIntoView.call(
this,
arguments[0] === void 0 ? !0 : arguments[0]
);
return;
}
var u = S(this), y = u.getBoundingClientRect(), C = this.getBoundingClientRect();
u !== a.body ? (v.call(
this,
u,
u.scrollLeft + C.left - y.left,
u.scrollTop + C.top - y.top
), n.getComputedStyle(u).position !== "fixed" && n.scrollBy({
left: y.left,
top: y.top,
behavior: "smooth"
})) : n.scrollBy({
left: C.left,
top: C.top,
behavior: "smooth"
});
};
}
e.exports = { polyfill: o };
})();
})(Mn);
function Dn(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
}
const [tt, je] = O("tabs"), ft = tt, An = /* @__PURE__ */ z({
name: tt,
components: {
YTabTitle: wt
},
props: On,
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
initProvide: a
} = fe(ft), r = L(!1), l = F([]), i = L(), m = B(() => l.length > e.titleScrollThreshold), g = (E) => l.findIndex((P) => (P.$props ? P.$props.name : "") === E), x = L(e.initName ? g(e.initName) : e.initIndex), c = (E) => {
x.value = E;
const P = i.value;
P && (P == null || P.moveTo(E, e.changeWithAnimation));
};
n({
scrollToByIndex: (E) => {
c(E);
},
scrollToByName: (E) => {
const P = g(E);
c(P);
}
});
const w = L([]), d = L(), p = (E) => (P) => {
w.value[E] = P;
}, S = (E) => {
const {
title: P,
name: D,
disabled: V
} = l[E].$props || {};
x.value !== E && (o(V ? "disabledClick" : "click", E, P, D), !V && c(E));
}, k = async () => {
await ue(() => {
if (!m.value || !d.value)
return;
const E = d.value;
if (!E || !w.value[x.value])
return;
const P = w.value[x.value].$el, D = P.offsetLeft - (E.offsetWidth - P.offsetWidth) / 2;
E.scrollTo({
left: D,
behavior: "smooth"
});
});
};
st(() => {
w.value = [];
});
const v = F({
transform: "translateX(50%)",
transition: "all 0ms ease-out"
}), u = async () => {
await ue(() => {
if (!w.value || w.value.length === 0)
return;
const E = x.value >= w.value.length ? 0 : x.value, P = w.value[E].$el, D = P.offsetLeft + P.offsetWidth / 2;
v.transform = `translateX(${D}px) translateX(-50%)`, r.value && (v.transition = `all ${e.duration}ms ease-out`), r.value = !0;
});
}, y = (E) => {
const {
title: P,
name: D
} = l[E].$props || {};
o("change", E, P, D), x.value = E;
}, C = (E) => {
const {
title: P,
name: D
} = l[E].$props || {};
o("afterChange", E, P, D), x.value = E;
}, b = F({
children: l,
activeIndex: x,
props: e
});
a(b);
const T = (E) => N(E) && /^\d+(\.\d+)?$/.test(E) ? `${E}px` : E, N = (E) => Object.prototype.toString.call(E) === "[object String]";
return Z(async () => {
et.polyfill(), await u();
}), j(() => x.value, async () => {
await u(), await k();
}), j(() => {
var E;
return (E = t.default) == null ? void 0 : E.length;
}, async () => {
await u();
}), () => {
let E;
return f("div", {
class: tt
}, [f("div", {
class: je("list")
}, [f("div", {
ref: d,
class: je("list-child-wrapper", {
scrollable: m.value,
[e.size]: e.size,
[e.align]: e.align
})
}, [l.length > 0 && l.map((P, D) => f(wt, {
title: P.title,
disabled: P.disabled,
"title-slot": P.$slots.title,
key: D,
ref: p(D),
active: x.value === D,
scrollable: m.value,
onClick: () => S(D)
}, null)), f("div", {
class: je("line"),
style: {
...v,
width: T(e.lineWidth),
height: T(e.lineHeight),
backgroundColor: e.lineColor
}
}, null)])]), t.default ? f(jt, {
ref: i,
dots: !1,
loop: !1,
initIndex: x.value,
lazy: e.lazy,
touchable: e.touchable,
duration: e.duration,
"is-follow-hand": e.changeWithAnimation,
onChange: y,
onAfterChange: C
}, Dn(E = t.default()) ? E : {
default: () => [E]
}) : null]);
};
}
});
function M(e) {
const t = e;
return t.install = (o) => {
const { name: n } = e;
n && o.component(n, e);
}, t;
}
const Rn = M(An);
function Wn(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
}
const [Fn] = O("tab"), Hn = /* @__PURE__ */ z({
name: Fn,
props: {
title: {
type: String,
default: ""
},
name: {
type: [String, Number],
default: ""
},
disabled: {
type: Boolean,
default: !1
}
},
setup(e, {
slots: t
}) {
const {
parent: o
} = ce(ft), n = le();
return n.proxy && (o == null || o.children.push(n.proxy)), xe(() => {
o && (o.children = o.children.filter((a) => a !== n.proxy));
}), () => {
let a;
return t.default ? f(Le, null, Wn(a = t.default()) ? a : {
default: () => [a]
}) : null;
};
}
}), Yn = M(Hn), xt = 10, Xn = (e, t) => e > t && e > xt ? "horizontal" : t > e && t > xt ? "vertical" : "", jn = (e, t) => Math.abs(e) > Math.abs(t) ? e > 0 ? "right" : "left" : t > 0 ? "bottom" : "top", Un = () => {
const e = L(0), t = L(0), o = L(0), n = L(0), a = L(0), r = L(0), l = L(""), i = L(""), m = () => l.value === "vertical", g = () => l.value === "horizontal", x = () => {
o.value = 0, n.value = 0, a.value = 0, r.value = 0, l.value = "", i.value = "";
};
return {
move: (s) => {
const w = s.touches[0];
o.value = w.clientX < 0 ? 0 : w.clientX - e.value, n.value = w.clientY - t.value, a.value = Math.abs(o.value), r.value = Math.abs(n.value), l.value || (l.value = Xn(a.value, r.value)), i.value = jn(o.value, n.value);
},
start: (s) => {
x(), e.value = s.touches[0].clientX, t.value = s.touches[0].clientY;
},
reset: x,
startX: e,
startY: t,
deltaX: o,
deltaY: n,
offsetX: a,
offsetY: r,
direction: l,
touchDirection: i,
isVertical: m,
isHorizontal: g
};
}, [qn, K] = O("slider"), Gn = /* @__PURE__ */ z({
name: qn,
props: {
modelValue: {
type: [Number, Array],
default: 0
},
activeColor: {
type: String,
default: ""
},
inactiveColor: {
type: String,
default: ""
},
max: {
type: Number,
default: 100
},
min: {
type: Number,
default: 0
},
buttonBgColor: {
type: [String, Array],
default: ""
},
barHeight: {
type: [String, Number],
default: "2px"
},
disabled: {
type: Boolean,
default: !1
},
showTooltip: {
type: Boolean,
default: !1
},
step: {
type: Number,
default: 1
},
gapColor: {
type: String,
default: ""
},
gapWidth: {
type: [String, Number],
default: "2px"
},
transitionTime: {
type: Number,
default: 200
}
},
emits: ["change", "drag-start", "drag-end", "update:modelValue"],
setup(e, {
emit: t,
slots: o
}) {
const n = L(), a = L(0), r = L(0), l = L(""), i = Un(), m = B(() => Array.isArray(e.modelValue)), g = (b) => {
const {
min: T,
max: N,
step: E
} = e, P = Math.max(T, Math.min(b, N));
return Math.round(P / E) * E;
}, x = (b) => {
if (b.stopPropagation(), e.disabled)
return;
const {
min: T,
modelValue: N
} = e, {
left: E,
width: P
} = n.value.getBoundingClientRect(), D = b.clientX - E, V = Math.floor(T + D / P * S.value);
if (m.value) {
const U = N[0], q = N[1], I = (U + q) / 2;
V <= I ? s([V, q]) : s([U, V]);
} else
s(V);
}, c = (b) => b[0] > b[1] ? [b[1], b[0]] : b, h = (b, T) => JSON.stringify(b) === JSON.stringify(T), s = (b, T) => {
let N = 0;
m.value ? N = c(b).map(g) : N = g(b), t("update:modelValue", N), typeof T > "u" && !h(a.value, r.value) && t("change", N);
}, w = B(() => {
const {
modelValue: b,
min: T
} = e;
let N = null;
return m.value ? N = Math.floor((g(b[1]) - g(b[0])) * 100 / S.value) : N = Math.floor((g(b) - T) * 100 / S.value), `${N}%`;
}), d = B(() => {
const {
modelValue: b,
min: T
} = e;
return m.value ? `${Math.floor((g(b[0]) - T) * 100 / S.value)}%` : "0%";
}), p = B(() => ({
left: w.value,
transition: l.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
})), S = B(() => e.max - e.min), k = (b) => {
e.disabled || (i.start(b), l.value = "startMove", r.value = e.modelValue, m.value ? a.value = [...r.value] : a.value = r.value);
}, v = (b, T) => {
if (e.disabled)
return;
i.move(b), l.value === "startMove" && t("drag-start"), l.value = "moving";
const {
width: N
} = n.value.getBoundingClientRect(), E = i.deltaX.value, P = Math.floor(E / N * S.value);
Array.isArray(a.value) && Array.isArray(r.value) ? T === "left" ? r.value[0] = a.value[0] + P : r.value[1] = a.value[1] + P : r.value = a.value + P, s(r.value, !0);
}, u = () => {
e.disabled || (l.value === "moving" && (s(r.value), t("drag-end")), l.value = "endMove");
}, y = (b) => {
let T = "", N = {}, E = 0, P = K("button-wrapper");
return b === 0 ? (T = "left", N = {
left: d.value,
backgroundColor: Array.isArray(e.buttonBgColor) ? e.buttonBgColor[0] : e.buttonBgColor
}, E = e.modelValue[b], P = K("button-wrapper", "left")) : b === 1 ? (T = "right", E = e.modelValue[b], N = {
left: `${parseInt(w.value) + parseInt(d.value)}%`,
backgroundColor: Array.isArray(e.buttonBgColor) ? e.buttonBgColor[1] : e.buttonBgColor
}, P = K("button-wrapper", "right")) : (E = e.modelValue, N = {
left: w.value,
backgroundColor: e.buttonBgColor
}), f("div", {
role: "slider",
"aria-valuemin": e.min,
"aria-valuemax": e.max,
"aria-valuenow": E,
class: P,
onTouchstart: k,
onTouchmove: (D) => v(D, T),
onTouchend: u,
style: {
...N,
transition: l.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
}
}, [o.button ? o.button() : f("div", {
class: K("inner-button"),
style: N
}, null)]);
}, C = B(() => Array((e.max - e.min) / e.step).fill({}).map((T, N) => ({
position: `${N * e.step}%`
})));
return () => {
var b;
return f("div", {
class: K()
}, [o.iconLeft && f("div", {
class: K("icon", {
left: !0
})
}, [o.iconLeft()]), f("div", {
role: "presentation",
ref: n,
class: K("wrapper-main", {
disabled: e.disabled
}),
style: {
background: e.inactiveColor,
height: R(e.barHeight)
},
onClick: x
}, [e.step !== 1 && f("div", {
class: K("dots")
}, [C.value.map((T) => f("div", {
class: K("dot"),
style: {
left: T.position,
background: e.gapColor,
width: R(e.gapWidth)
}
}, null))]), e.showTooltip && f("div", {
class: K("tooltip", {
wrapper: o.toolTip
}),
style: p.value
}, [((b = o.toolTip) == null ? void 0 : b.call(o)) || e.modelValue]), f("div", {
style: {
left: d.value,
width: w.value,
background: e.activeColor,
transition: l.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
},
class: K("inner")
}, null), m.value ? [y(0), y(1)] : y()]), o.iconRight && f("div", {
class: K("icon", {
right: !0
})
}, [o.iconRight()])]);
};
}
});
const Kn = M(Gn), [Zn, ge] = O("loading"), Qn = {
// Loading icon 的颜色
color: {
type: String,
default: ""
},
// 背景色
bgColor: {
type: String,
default: ""
},
bgBorderRadius: {
type: [Number, String],
default: "16px"
},
// 粗细
thick: {
type: [Number, String],
default: 8
},
// 方向
direction: {
type: String,
default: "forward"
},
// 大小
size: {
type: [Number, String],
default: "24px"
},
padding: {
type: [Number, String],
default: ""
},
// 文案
text: {
type: String,
default: ""
},
// 文案位置
textLocation: {
type: String,
default: "bottom"
},
// 文案大小
textSize: {
type: [Number, String],
default: ""
},
// 文案颜色
textColor: {
type: String,
default: ""
},
// 布局位置
position: {
type: String,
default: "relative"
}
}, mt = /* @__PURE__ */ z({
name: Zn,
props: Qn,
setup(e, {
slots: t
}) {
return () => {
var d, p;
const {
position: o,
textLocation: n,
bgColor: a,
bgBorderRadius: r,
size: l,
padding: i,
color: m,
thick: g,
direction: x,
text: c,
textColor: h,
textSize: s
} = e, w = ((d = t.default) == null ? void 0 : d.call(t)) || c;
return f("div", {
class: ge({
[o]: o !== "relative"
})
}, [f("div", {
class: ge("bg", {
[o]: o !== "relative"
}),
style: {
flexDirection: Bn(n),
backgroundColor: a,
borderRadius: R(r),
padding: R(i)
}
}, [f("span", {
class: ge("icon-wrapper"),
style: {
width: R(l),
height: R(l)
}
}, [((p = t.icon) == null ? void 0 : p.call(t)) || f("svg", {
class: ge("icon", {
[x]: x
}),
viewBox: "25 25 50 50"
}, [f("circle", {
class: ge("icon-circle"),
style: {
stroke: m,
strokeWidth: R(g)
},
cx: "50",
cy: "50",
r: "20",
fill: "none"
}, null)])]), w && f("span", {
class: ge("text", {
[n]: n
}),
style: {
color: h,
fontSize: R(s)
}
}, [w])])]);
};
}
}), [Jn, ie] = O("list"), el = /* @__PURE__ */ z({
name: Jn,
props: {
// 加载中 文案
loadingText: {
type: String,
default: "加载中..."
},
// 加载完成 文案
finishedText: {
type: String,
default: "没有更多了~"
},
// 加载失败 文案
errorText: {
type: String,
default: "请求失败,点击重新加载"
},
// 容器高度
height: {
type: [Number, String],
default: "auto"
},
// 唯一键名称
keyName: {
type: String,
default: "_index"
},
// 列表数组
dataSource: {
type: Array,
default: () => []
},
// 是否在初始化时立即执行滚动位置检查
immediateCheck: {
type: Boolean,
default: !0
},
// 滚动条与底部距离小于多少时触发加载
loadOffset: {
type: Number,
default: 300
},
// 是否使用虚拟列表
virtual: {
type: Boolean,
default: !1
},
// 缓冲区比例
bufferScale: {
type: Number,
default: 1
},
// 列表子项预估高度
itemHeight: {
type: [String, Number],
default: "80"
},
// 是否是不定高度子项
dynamicItemHeight: {
type: Boolean,
default: !1
}
},
emits: ["load"],
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const a = L(0), r = L(!1), l = L("normal"), i = L(), m = L(), g = L(), x = L([]), c = L(0), h = L(0), s = L([]), w = B(() => $n(e.height) ? `${e.height}px` : e.height), d = B(() => s.value.length ? s.value[s.value.length - 1].bottom : 0), p = B(() => {
if (e.virtual) {
const I = c.value - S.value, A = h.value + k.value;
return u.value.slice(I, A);
}
return u.value;
}), S = B(() => Math.min(c.value, e.bufferScale * v.value)), k = B(() => Math.min(e.dataSource.length - h.value, e.bufferScale * v.value)), v = B(() => Math.ceil(a.value / parseInt(String(e.itemHeight)))), u = B(() => e.dataSource.map((I, A) => (I[e.keyName] = A, I))), y = () => r.value ? document.documentElement.scrollTop || document.body.scrollTop : i.value.scrollTop, C = () => r.value ? document.documentElement.scrollHeight : i.value.scrollHeight, b = () => {
l.value !== "loading" && (l.value = "loading", o("load", (I) => {
if (l.value === "loading")
switch (I) {
case "error":
l.value = "error";
break;
case "finished":
l.value = "finished", e.virtual && N(), e.virtual && e.dynamicItemHeight && E();
break;
default:
l.value = "normal", e.virtual && (E(), e.dataSource.length < v.value + k.value && b());
}
}));
}, T = () => {
l.value === "normal" && C() - y() - a.value <= e.loadOffset && b();
}, N = () => {
s.value = u.value.map((I, A) => {
const H = parseInt(String(e.itemHeight));
return {
index: A,
height: H,
top: A * H,
bottom: (A + 1) * H
};
});
}, E = () => {
N();
for (let I = 1; I < s.value.length; I++)
s.value[I].top = s.value[I - 1].bottom, s.value[I].bottom = s.value[I].top + s.value[I].height;
}, P = (I, A) => {
let H = 0, se = I.length - 1, Q = -1;
for (; H <= se; ) {
const ae = Math.floor((H + se) / 2), oe = I[ae].bottom;
if (oe === A)
return ae + 1;
oe < A ? H = ae + 1 : oe > A && ((Q === -1 || Q > ae) && (Q = ae), se = ae - 1);
}
return Q;
}, D = (I) => P(s.value, I), V = () => {
if (T(), e.virtual) {
const I = y();
U(I);
}
}, U = (I) => {
if (!m.value)
return;
const A = I || 0;
if (e.dynamicItemHeight) {
c.value = D(A), h.value = c.value + v.value;
const H = s.value[c.value - S.value].top ? s.value[c.value - S.value].top : 0;
m.value.style.transform = `translate3d(0, ${H}px, 0)`;
} else {
c.value = Math.floor(A / parseInt(String(e.itemHeight))), h.value = c.value + v.value;
const H = c.value * parseInt(String(e.itemHeight)) - S.value * parseInt(String(e.itemHeight));
m.value.style.transform = `translate3d(0, ${H}px, 0)`;
}
}, q = () => {
if (!m.value || !g.value)
return;
const I = m.value.children;
I && I.length > 0 && [...I].forEach((A) => {
if (A instanceof HTMLDivElement) {
const H = A.getBoundingClientRect(), {
height: se
} = H, Q = Number(A.dataset.index), oe = s.value[Q].height - se;
if (oe) {
s.value[Q].bottom -= oe, s.value[Q].height = se;
for (let $ = Q + 1; $ < s.value.length; $++)
s.value[$].top = s.value[$ - 1].bottom, s.value[$].bottom -= oe;
}
}
});
};
return n({
...e,
checkIsScrollToBottom: T,
loadData: b
}), Z(() => {
e.height !== "auto" ? (r.value = !1, a.value = i.value.clientHeight) : e.height === "auto" && (r.value = !0, a.value = document.documentElement.clientHeight, document.addEventListener("scroll", V)), e.virtual && (N(), U()), e.immediateCheck && T();
}), yn(async () => {
var I, A;
if (e.virtual && e.dynamicItemHeight) {
if (await ue(), !((A = (I = m.value) == null ? void 0 : I.children) != null && A.length))
return;
q();
}
}), we(() => {
r.value && document.removeEventListener("scroll", V);
}), () => f("div", {
ref: i,
class: `${ie()} ${e.virtual ? ie({
virtual: !0
}) : ""}`,
style: {
height: w.value
},
onScroll: V
}, [e.virtual && f("div", {
ref: g,
class: ie("phantom"),
style: {
height: `${d.value}px`
}
}, null), f("div", {
ref: m,
class: ie("content")
}, [p.value.map((I) => {
var A;
return f("div", {
ref: x,
class: ie("item"),
"data-index": I._index
}, [(A = t.default) == null ? void 0 : A.call(t, {
item: I
})]);
})]), l.value === "loading" && f("div", {
class: ie({
loading: !0
})
}, [t.loading ? t.loading() : f(mt, {
"text-location": "right"
}, {
default: () => [bn("加载中...")]
})]), l.value === "finished" && f("div", {
class: ie({
finished: !0
})
}, [e.finishedText]), l.value === "error" && f("div", {
class: ie("error"),
role: "presentation",
onClick: b
}, [e.errorText]), l.value === "normal" && f("div", {
class: ie({
normal: !0
})
}, [t.normal ? t.normal() : null])]);
}
});
const tl = M(el);
const nl = M(jt);
const ll = M(Le), Ut = "y-form-item", al = () => {
const e = le(), t = L();
return {
filed: t,
initProvide: (n) => {
_t(Ut, {
setField: (r) => {
r != null && r.proxy && (t.value = r);
},
instance: e,
...n
});
}
};
}, me = () => {
const e = zt(Ut, null), t = le();
if (e && (t != null && t.proxy)) {
const { setField: o } = e, { resetValidation: n, change: a, validateWithTrigger: r } = e;
return j(
() => t.proxy.modelValue,
() => {
e.instance && e.instance.exposed && (n(), a(), r("onChange"));
}
), o(t), we(() => o(null)), {
parent: e
};
}
return {
parent: null
};
}, [ol, _e] = O("icon"), rl = (e) => new RegExp(/\.(https|png|jpg|gif|jpeg|webp|apng)$/).test(e.toLowerCase()), il = /* @__PURE__ */ z({
name: ol,
props: {
dot: {
type: Boolean,
default: !1
},
name: {
type: String,
default: ""
},
size: {
type: [Number, String],
default: ""
},
info: {
type: [Number, String],
default: ""
},
badge: {
type: [Number, String],
default: ""
},
color: {
type: String,
default: ""
},
subColor: {
type: String,
default: ""
},
subBg: {
type: String,
default: ""
},
classPrefix: {
type: String,
default: "y-icon"
},
/**
* @ignore
*/
tag: {
type: String,
default: "i"
}
},
emits: ["click"],
setup(e, {
slots: t,
emit: o
}) {
const n = rl(e.name), a = () => ({
fontSize: R(e.size),
color: e.color
}), r = (l) => {
o("click", l);
};
return () => {
const {
name: l,
classPrefix: i,
badge: m,
dot: g,
subColor: x,
subBg: c,
tag: h
} = e;
return f(h, {
class: `${i}${n ? "" : ` y-icon--${l}`}`,
style: a(),
onClick: r
}, {
default: () => {
var s;
return [n ? f("em", {
class: _e("node")
}, [f("img", {
class: _e("image"),
src: l,
alt: "icon"
}, null)]) : null, g ? f("em", {
class: _e("dot"),
style: {
backgroundColor: c
}
}, null) : null, m ? f("em", {
class: _e("badge"),
style: {
color: x,
backgroundColor: c
}
}, [m]) : null, ((s = t.default) == null ? void 0 : s.call(t)) || null];
}
});
};
}
});
const ve = M(il), ul = {
/**
* @ignore
*/
modelValue: {
type: Array,
default: () => []
},
/**
* 最多选中数目
*/
max: {
type: Number,
default: null
},
/**
* 最少选中数目
*/
min: {
type: Number,
default: null
},
/**
* 禁用
*/
disabled: {
type: Boolean,
default: null
},
/**
* 是否为方形
*/
square: {
type: Boolean,
default: null
},
/**
* 选中颜色
*/
checkedColor: {
type: String,
default: null
},
/**
* 水平排列
*/
horizontal: {
type: Boolean,
default: !1
}
}, [qt, sl] = O("checkbox-group"), Gt = qt, cl = /* @__PURE__ */ z({
name: qt,
props: ul,
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
initProvide: a
} = fe(Gt), r = F([]);
me();
const l = (g) => {
o("update:modelValue", g), o("change", g);
}, i = (g) => {
const x = [...e.modelValue], c = x.indexOf(g);
if (c >= 0) {
if (e.min !== null && x.length <= e.min)
return;
x.splice(c, 1), l(x);
} else {
if (e.max !== null && x.length >= e.max)
return;
l([...x, g]);
}
};
return n({
toggleAll: (g = null) => {
l(g === null ? e.modelValue.length === 0 ? r : [] : g ? r : []);
}
}), a({
props: e,
onItemChange: i,
allItemNames: r
}), () => {
var g;
return f("div", {
class: sl({
horizontal: e.horizontal
})
}, [(g = t.default) == null ? void 0 : g.call(t)]);
};
}
}), [dl, Ue] = O("checkbox"), fl = /* @__PURE__ */ z({
name: dl,
props: {
modelValue: {
type: Boolean,
default: !1
},
name: {
type: String,
default: null
},
disabled: {
type: Boolean,
default: !1
},
size: {
type: [String, Number],
default: "middle"
},
square: {
type: Boolean,
default: !0
},
checkedColor: {
type: String,
default: ""
}
},
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
parent: a
} = ce(Gt), r = a === null ? me().parent : null;
a && a.allItemNames.push(e.name);
const l = (d, p = null) => B(() => a && a.props[d] !== null ? a.props[d] : Object.keys(e).includes(d) ? e[d] : p), i = l("disabled"), m = l("square"), g = l("checkedColor"), x = l("horizontal", !1), c = B(() => a ? a.props.modelValue.includes(e.name) : e.modelValue), h = (d) => {
var p;
i.value || typeof d < "u" && c.value === d || ((p = a == null ? void 0 : a.onItemChange) == null || p.call(a, e.name), o("update:modelValue", !e.modelValue), o("change", !e.modelValue));
};
n({
toggle: h
});
const s = B(() => ["mini", "small", "middle", "large"].includes(e.size.toString() || (r == null ? void 0 : r.getProp("size"))) ? null : R(e.size)), w = B(() => {
const d = {};
return s.value && (d.width = s.value, d.height = s.value), c.value && g.value && (d.backgroundColor = g.value), d;
});
return xe(() => {
if (!a)
return;
const d = a.allItemNames.indexOf(e.name);
d >= 0 && a.allItemNames.splice(d, 1);
}), () => {
var p, S;
const {
size: d
} = e;
return f("div", {
class: Ue({
disabled: i.value,
checked: c.value,
horizontal: x.value,
[d]: ["mini", "small", "middle", "large"].includes(d.toString())
}),
onClick: () => h(),
role: "checkbox",
"aria-checked": c.value
}, [((p = t.icon) == null ? void 0 : p.call(t, {
checked: c.value
})) || f("div", {
class: Ue("icon", {
checked: c.value,
square: m.value
}),
style: w.value
}, [c.value ? f(ve, {
name: "done"
}, null) : null]), f("div", {
class: Ue("label")
}, [(S = t.default) == null ? void 0 : S.call(t)])]);
};
}
});
const ml = M(fl);
const vl = M(cl), [gl, Ct] = O("switch"), pl = /* @__PURE__ */ z({
name: gl,
props: {
size: {
type: [Number, String],
default: null
},
disabled: {
type: Boolean,
default: !1
},
readonly: {
type: Boolean,
default: !1
},
modelValue: {
type: Boolean,
default: !1
},
activeValue: {
type: Boolean,
default: !0
},
inactiveValue: {
type: Boolean,
default: !1
},
activeColor: {
type: String,
default: ""
},
inactiveColor: {
type: String,
default: ""
}
},
emits: ["change", "update:modelValue"],
setup(e, {
emit: t
}) {
const {
parent: o
} = me(), n = B(() => e.modelValue === e.activeValue), a = () => {
if (!e.disabled && !e.readonly) {
const l = n.value ? e.inactiveValue : e.activeValue;
t("update:modelValue", l), t("change", l);
}
}, r = B(() => {
switch (e.size || (o == null ? void 0 : o.getProp("size")) || "middle") {
case "large":
return "34px";
case "middle":
return "28px";
case "small":
return "24px";
default:
return R(e.size);
}
});
return () => {
const {
disabled: l,
activeColor: i,
inactiveColor: m
} = e;
return f("div", {
class: Ct("", {
on: n.value,
disabled: l
}),
style: {
fontSize: r.value,
backgroundColor: n.value ? i : m
},
"aria-checked": n.value,
onClick: a,
role: "switch"
}, [f("div", {
class: Ct("node", {
on: n.value,
disabled: l
})
}, null)]);
};
}
});
const hl = M(pl), yl = (e, t, o, n) => {
const a = Math.abs(e - o), r = Math.abs(t - n), l = Math.sqrt(a * a + r * r);
return 90 - Math.round(Math.asin(r / l) / Math.PI * 180);
}, bl = (e) => {
const t = e.currentTarget, o = e.target;
let n = !1;
if (t === o)
return n;
const a = (r) => {
r.offsetHeight !== r.scrollHeight && r.scrollTop !== 0 ? n = !0 : r.parentElement && r.parentElement !== t && a(r.parentElement);
};
return o && a(o), n;
}, [Sl, $t] = O("pull-refresh"), ke = At("pull-refresh"), wl = 30, kt = 0.5, xl = (e) => e < 60 ? 1 : 1 - (e - 60) / 600, Cl = /* @__PURE__ */ z({
name: Sl,
props: {
pullingText: {
type: String,
default: ke.pulling
},
loosingText: {
type: String,
default: ke.loosing
},
loadingText: {
type: String,
default: ke.loading
},
successText: {
type: String,
default: ke.success
},
failedText: {
type: String,
default: ke.failed
},
statusHeight: {
type: Number,
default: 60
},
disabled: {
type: Boolean,
default: !1
}
},
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const a = le();
let r = 0, l = 0, i = 0, m = null;
const g = L(0), x = L(0), c = L(Y.DEFUALT), h = B(() => {
var y;
const u = [...((y = a == null ? void 0 : a.proxy) == null ? void 0 : y.$el).childNodes];
return u == null ? void 0 : u.filter((C) => C.nodeType !== 3 || C.nodeValue !== "");
}), s = (v = "success") => {
c.value = v, setTimeout(() => {
g.value = 0;
}, 500), setTimeout(() => {
c.value = Y.DEFUALT;
}, 1e3);
}, w = () => {
g.value = e.statusHeight, x.value = kt, c.value = Y.LOADING, o("load", s);
}, d = (v) => {
r = v instanceof TouchEvent ? v.touches[0].pageX : v.pageX, l = v instanceof TouchEvent ? v.touches[0].pageY : v.pageY, h.value.length !== 2 || h.value[1].nodeType === 3 ? m = a == null ? void 0 : a.vnode.el : m = h.value[1], !e.disabled && !bl(v) && m.scrollTop === 0 && c.value === Y.DEFUALT && (c.value = Y.PULLING, g.value = 0, x.value = 0);
}, p = (v) => {
const u = v instanceof TouchEvent ? v.touches[0].pageX : v.pageX, y = v instanceof TouchEvent ? v.touches[0].pageY : v.pageY, C = yl(r, l, u, y);
i = y - l, (c.value === Y.PULLING || c.value === Y.LOOSING) && i > 0 && C < wl && (v.preventDefault(), g.value = i * xl(i), i > e.statusHeight && c.value === Y.PULLING && (c.value = Y.LOOSING));
}, S = (v) => {
c.value === Y.LOOSING ? (g.value = e.statusHeight, x.value = kt, c.value = Y.LOADING, o("load", s, v)) : c.value === Y.PULLING && (g.value = 0, c.value = Y.DEFUALT);
};
Z(() => {
const v = a == null ? void 0 : a.vnode.el;
v == null || v.addEventListener("touchstart", d, {
passive: !1
}), v == null || v.addEventListener("touchmove", p, {
passive: !1
}), v == null || v.addEventListener("touchend", S, {
passive: !1
}), v == null || v.addEventListener("mousedown", d, {
passive: !1
}), v == null || v.addEventListener("mousemove", p, {
passive: !1
}), v == null || v.addEventListener("mouseup", S, {
passive: !1
}), v == null || v.addEventListener("mouseout", S, {
passive: !1
});
}), we(() => {
const v = a == null ? void 0 : a.vnode.el;
v == null || v.removeEventListener("touchstart", d), v == null || v.removeEventListener("touchmove", p), v == null || v.removeEventListener("touchend", S), v == null || v.removeEventListener("mousedown", d), v == null || v.removeEventListener("mousemove", p), v == null || v.removeEventListener("mouseup", S), v == null || v.removeEventListener("mouseout", S);
});
const k = () => {
var v;
return c.value === Y.DEFUALT ? null : t[c.value] ? (v = t[c.value]) == null ? void 0 : v.call(t) : f("p", null, [e[`${c.value}Text`]]);
};
return n({
refresh: w
}), () => {
var b;
const {
statusHeight: v
} = e, u = g.value > v ? v : g.value, y = `all ${x.value}s ease 0s`, C = `translate3d(0, ${-g.value}px, 0)`;
return f("div", {
class: $t(),
style: {
WebkitTransform: `translate3d(0, ${g.value}px, 0)`,
transform: `translate3d(0, ${g.value}px, 0)`,
transition: y
}
}, [f("div", {
class: $t("status"),
style: {
height: `${u}px`,
WebkitTransform: `${C} scale(${u / v})`,
transform: `${C} scale(${u / v})`,
transition: y
}
}, [k()]), (b = t.default) == null ? void 0 : b.call(t)]);
};
}
});
const $l = M(Cl), [kl, pe, Tl] = O("cell"), El = /* @__PURE__ */ z({
name: kl,
props: {
tag: {
type: String,
default: "div"
},
title: {
type: [Number, String],
default: ""
},
label: {
type: [Number, String],
default: ""
},
value: {
type: [Number, String],
default: ""
},
size: {
type: String,
default: Rt.Middle
},
// 垂直对齐方式
vertical: {
type: String,
default: dt.Middle
},
// 是否有 border
border: {
type: Boolean,
default: !0
},
icon: {
type: String,
default: ""
},
// 点击态
clickable: {
type: Boolean,
default: !1
}
},
emits: ["click"],
setup(e, {
slots: t,
emit: o
}) {
const n = (a) => {
o("click", a);
};
return () => {
const {
tag: a,
vertical: r,
border: l,
size: i,
title: m,
icon: g,
label: x,
value: c,
clickable: h
} = e, s = a === "a" ? !0 : h;
return f(a, {
class: [pe({
[`is-${r}`]: r,
[i]: i,
hairline: l
}), Tl("el", {
clickable: s
})],
onClick: n
}, {
default: () => {
var w, d;
return [(w = t.left) == null ? void 0 : w.call(t), f("div", {
class: pe("center", {
"has-left": t.left
})
}, [t.center ? t.center() : [f("h4", {
class: pe("title")
}, [m]), f("p", {
class: pe("label")
}, [x])]]), t.default ? t.default() : f("div", {
class: pe("value")
}, [c]), ((d = t.right) == null ? void 0 : d.call(t)) || g && f(ve, {
name: g,
class: pe("icon")
}, null)];
}
});
};
}
});
const Kt = M(El), [Nl, Te, Bl] = O("button"), Ll = /* @__PURE__ */ z({
name: Nl,
props: {
// 标签
tag: {
type: String,
default: "button"
},
// 文案
text: {
type: String,
default: ""
},
// 类型
type: {
type: String,
default: "primary"
},
// 尺寸
size: {
type: String,
default: "middle"
},
// 不可以状态
disabled: {
type: Boolean,
default: !1
},
// 阴影
shadow: {
type: String,
default: ""
},
// 方形
square: {
type: Boolean,
default: !1
},
// 半圆弧
semicircle: {
type: Boolean,
default: !1
},
// 自定义圆角
radius: {
type: [Number, String],
default: ""
},
// 补充文案,双行显示
supplementText: {
type: String,
default: ""
},
// block 自动填满父布局
block: {
type: Boolean,
default: !1
},
// 危险按钮状态
danger: {
type: Boolean,
default: !1
}
},
emits: ["click"],
setup(e, {
slots: t,
emit: o
}) {
const n = (a) => {
o("click", a);
};
return () => {
let {
tag: a
} = e;
const {
radius: r,
type: l,
size: i,
disabled: m,
shadow: g,
block: x,
square: c,
semicircle: h,
danger: s,
text: w,
supplementText: d
} = e, p = t.default ? t.default() : w;
return a = l === "link" ? "a" : a, f(a, {
class: [Te([l, i, {
block: x,
square: c,
semicircle: h,
disabled: m && a === "a"
}, (l === "primary" || l === "secondary") && g ? `shadow_${g}` : "", s ? `${l}_danger` : "", m ? `${l}_disabled` : ""]), Bl("el", "clickable")],
style: {
borderRadius: R(r)
},
disabled: m,
onClick: n
}, {
default: () => {
var S, k;
return [f("div", {
class: Te("content")
}, [((S = t.leftIcon) == null ? void 0 : S.call(t)) || null, p && f(He, null, [d ? f("div", {
class: Te("text")
}, [f("p", null, [p]), f("p", {
class: Te("subtext")
}, [d])]) : f("span", {
class: Te("text")
}, [p])]), ((k = t.rightIcon) == null ? void 0 : k.call(t)) || null])];
}
});
};
}
});
const nt = M(Ll), Vl = {
position: "fixed"
};
let Ee = null;
const Zt = (e, t) => {
const n = Ce({
render: () => Ve(mt, { ...e }, { ...t })
}), a = document.createElement("div");
return n.mount(a);
}, Il = {
/**
* @description: show
* @param {LoadingPropsType} options
* @return {*}
*/
show: (e, t) => {
Ee || (Ee = Zt(
{
...Vl,
...e
},
t
)), document.body.appendChild(Ee.$el);
},
/**
* @description: hide
* @param {*}
* @return {*}
*/
hide: () => {
Ee && Ee.$el.remove();
}
}, Tt = (e, t) => {
t.value ? (e.classList.add("y-loading__wrap"), e.appendChild(e.instance.$el)) : (e.classList.remove("y-loading__wrap"), e.removeChild(e.instance.$el));
}, Pl = {
install: (e) => {
e.directive("loading", Qt), e.directive("loading-props", _l), e.directive("loading-slots", zl);
}
}, Qt = {
getSSRProps: (e) => ({ ...e }),
mounted: (e, t) => {
e.instance = Zt({ ...e.customProps }, { ...e.customSlots }), t.value && Tt(e, t);
},
updated: (e, t) => {
t.oldValue !== t.value && Tt(e, t);
},
unmounted: (e) => {
e.instance && e.instance.$el.remove();
}
}, _l = {
getSSRProps: (e) => ({ ...e }),
beforeMount: (e, t) => {
e.customProps = { ...t.value };
}
}, zl = {
getSSRProps: (e) => ({ ...e }),
beforeMount: (e, t) => {
e.customSlots = { ...t.value };
}
};
const Ol = M(mt), [Jt, Ml] = O("row"), en = Jt, Dl = /* @__PURE__ */ z({
name: Jt,
props: {
type: {
type: String,
default: ""
},
// 列元素之间的间距(单位为 px)
gutter: {
type: [Number, String],
default: 0
},
align: {
type: String,
default: dt.Top
},
justify: {
type: String,
default: Ht.Start
}
},
setup(e, {
slots: t
}) {
const {
children: o,
initProvide: n
} = fe(en), a = B(() => {
const l = [[]];
let i = 0;
return o.forEach((m, g) => {
var x;
i += Number((x = m.proxy) == null ? void 0 : x.span), i > 24 ? (l.push([g]), i -= 24) : l[l.length - 1].push(g);
}), l;
}), r = B(() => {
const l = Number(e.gutter), i = [];
return l && a.value.forEach((m) => {
const g = l * (m.length - 1) / m.length;
m.forEach((x, c) => {
if (c === 0)
i.push({
right: g,
left: 0
});
else {
const h = l - i[x - 1].right, s = g - h;
i.push({
left: h,
right: s
});
}
});
}), i;
});
return n({
spaceList: r
}), () => {
var g;
const {
type: l,
align: i,
justify: m
} = e;
return f("div", {
class: Ml({
[l]: l,
[`align-${i}`]: l && i,
[`justify-${m}`]: l && m
})
}, [(g = t.default) == null ? void 0 : g.call(t)]);
};
}
});
const Al = M(Dl), [Rl, Wl] = O("col"), Fl = /* @__PURE__ */ z({
name: Rl,
props: {
// 列数
span: {
type: [String, Number],
default: 0
},
// 栅格左侧的间隔格数
offset: {
type: [String, Number],
default: 0
}
},
setup(e, {
slots: t
}) {
const {
parent: o,
index: n
} = ce(en), a = B(() => {
if (!o)
return {};
const {
spaceList: r
} = o, l = r.value;
if (l.length === 0)
return {};
const {
left: i,
right: m
} = l[n.value] || {};
return {
paddingLeft: i ? `${i}px` : 0,
paddingRight: m ? `${m}px` : 0
};
});
return () => {
var i;
const {
span: r,
offset: l
} = e;
return f("div", {
style: a.value,
class: Wl({
[r]: r,
[`offset-${l}`]: l
})
}, [(i = t.default) == null ? void 0 : i.call(t)]);
};
}
});
const Hl = M(Fl), Et = F({}), tn = {
add(e, t) {
Object.assign(Et, { [e]: t });
},
use(e) {
return Et[e];
}
}, [Yl, Ne] = O("empty"), Xl = "https://imgservices-1252317822.image.myqcloud.com/image/20200820/q4wu13xxky.png", jl = /* @__PURE__ */ z({
name: Yl,
props: {
type: {
type: String,
default: ""
},
imgUrl: {
type: String,
default: ""
},
title: {
type: String,
default: ""
},
subTitle: {
type: String,
default: ""
}
},
setup(e, {
slots: t
}) {
return () => {
const {
type: o
} = e, n = tn.use(o), a = e.imgUrl || (n == null ? void 0 : n.imgUrl) || Xl, r = e.title || (n == null ? void 0 : n.title), l = e.subTitle || (n == null ? void 0 : n.subTitle), i = t.default || (n == null ? void 0 : n.slot), m = t.img || (n == null ? void 0 : n.imgSlot), g = t.titleIcon || (n == null ? void 0 : n.titleIconSlot);
return f("div", {
class: Ne()
}, [m ? m() : a && f("img", {
class: Ne("img"),
src: a,
alt: "状态"
}, null), f("h6", {
class: Ne("title")
}, [f("span", {
class: Ne("title-text", {
"has-icon": g
})
}, [r]), g == null ? void 0 : g()]), f("p", {
class: Ne("sub-title")
}, [l]), i == null ? void 0 : i()]);
};
}
});
const Ul = M(jl), [ql, de] = O("progress"), Gl = /* @__PURE__ */ z({
name: ql,
props: {
// 进度
percent: {
type: Number,
default: 0
},
// 轨道粗细
strokeWidth: {
type: [Number, String],
default: ""
},
// 圆角
radius: {
type: [Number, String],
default: ""
},
// 文案颜色
textColor: {
type: String,
default: ""
},
// 进度条颜色
color: {
type: String,
default: ""
},
// 轨道颜色
trackColor: {
type: String,
default: ""
},
// pivot颜色
pivotColor: {
type: String,
default: ""
},
// 展示默认pivot
defaultPivot: {
type: Boolean,
default: !1
},
// 里程碑模式
modeMilestone: {
type: Boolean,
default: !1
},
// 里程碑节点
mileages: {
type: Array,
default: () => [50, 100]
},
// 动画
animation: {
type: Boolean,
default: !1
},
// 动画时长
duration: {
type: Number,
default: 1500
},
// 动画调速
timing: {
type: String,
default: ""
},
// 单位
unit: {
type: String,
default: "%"
}
},
setup(e, {
slots: t
}) {
const o = L(null), n = L(null), a = L([]), r = F({
progressWidth: 0,
pivotContentWidth: 0,
mileageWidth: []
}), l = F({
number: 0,
oldPercent: 0,
timer: 0
});
Z(() => {
m(), e.animation && i(), window.addEventListener("resize", m);
}), st(() => {
a.value = [];
}), we(() => {
l.timer && cancelAnimationFrame(l.timer), window.removeEventListener("resize", m);
}), j(() => e.percent, () => {
i(), g();
});
const i = () => {
const {
duration: s,
percent: w
} = e, d = Math.abs(w - l.oldPercent) / (s / 16);
if (d === 0)
return;
let p = Number(l.oldPercent);
const S = () => {
w > l.oldPercent ? p += d : p -= d, w > l.oldPercent && p > w || w < l.oldPercent && p < w ? p = w : l.timer = requestAnimationFrame(S), l.oldPercent = p, l.number = parseInt(p.toString());
};
l.timer && cancelAnimationFrame(l.timer), l.timer = requestAnimationFrame(S);
};
j(() => e.mileages, () => x);
const m = () => {
g(), x();
}, g = () => {
ue(() => {
r.progressWidth = o.value && o.value.offsetWidth || 0, r.pivotContentWidth = n.value && n.value.offsetWidth || 0;
}).catch((s) => {
throw new Error(s);
});
}, x = () => {
ue(() => {
e.mileages.forEach((s, w) => {
r.mileageWidth[w] = a.value[w] && a.value[w].offsetWidth || 0;
});
}).catch((s) => {
throw new Error(s);
});
}, c = () => {
var S;
const {
mileages: s,
percent: w,
animation: d
} = e, p = [];
for (let k = 0; k < s.length; k++)
p[k] = f("div", {
ref: (v) => {
v && (a.value[k] = v);
},
class: [de("pivot-content", (d ? l.number : w) >= s[k] ? "arrive" : "no-arrive")],
key: `mileage${k}`,
style: {
left: `${(r.progressWidth - r.mileageWidth[k]) * s[k] / 100}px`
}
}, [((S = t.mileage) == null ? void 0 : S.call(t)) || f("div", {
class: de("pivot")
}, [`${s[k]}%`])]);
return p;
}, h = () => {
var k;
const {
defaultPivot: s,
textColor: w,
percent: d,
animation: p,
unit: S
} = e;
return f(He, null, [((k = t.pivot) == null ? void 0 : k.call(t)) || s && f("div", {
class: de("pivot"),
style: {
color: w
}
}, [p ? f("div", {
class: de("number")
}, [f("span", null, [l.number, S])]) : `${d}${S}`])]);
};
return () => {
const {
strokeWidth: s,
trackColor: w,
radius: d,
percent: p,
color: S,
animation: k,
duration: v,
timing: u,
defaultPivot: y,
pivotColor: C,
modeMilestone: b
} = e;
return f("div", {
class: de(),
ref: o,
style: {
height: R(s),
background: w,
borderRadius: R(d)
}
}, [f("span", {
class: de("portion", {
animation: k
}),
style: {
width: `${r.progressWidth * p / 100}px`,
background: S,
transitionDuration: `${v}ms`,
transitionTimingFunction: u
}
}, [f("div", {
ref: n,
class: de("pivot-content", {
animation: k
}),
style: {
left: `${(r.progressWidth - r.pivotContentWidth) * p / 100}px`,
background: y ? C || S : "none",
transitionDuration: `${v}ms`,
transitionTimingFunction: u
}
}, [h()])]), b && c()]);
};
}
});
const Kl = M(Gl), [Zl, ze, Ql] = O("toast"), Jl = {
// 主文案
title: {
type: String,
default: ""
},
// 副文案
message: {
type: String,
default: ""
},
// 显示位置
position: {
type: String,
default: "middle"
},
// 显示时长
duration: {
type: [Number, String],
default: 2e3
},
// 关闭时回调
onClose: {
type: Function,
required: !0
},
// 动画时长
animationDuration: {
type: [Number, String],
default: 300
}
}, nn = /* @__PURE__ */ z({
name: Zl,
props: Jl,
setup(e, {
slots: t
}) {
const o = F({
visible: !1
// 控制v-show
}), n = () => {
const a = setTimeout(() => {
o.visible = !1, clearTimeout(a);
}, Number(e.duration));
};
return Z(() => {
o.visible = !0, n();
}), () => {
const {
title: a,
message: r,
position: l,
animationDuration: i,
onClose: m
} = e;
return f(We, {
name: Ql("animation", "fade"),
onAfterLeave: m
}, {
default: () => {
var g;
return [te(f("div", {
class: ze({
[l]: !0
}),
style: {
animationDuration: typeof i == "number" ? `${i}ms` : i
}
}, [f("div", {
class: ze("content")
}, [((g = t.icon) == null ? void 0 : g.call(t)) || null, f("div", {
class: ze("text")
}, [a]), r && f("div", {
class: ze("message")
}, [r])])]), [[ye, o.visible]])];
}
});
};
}
});
let qe = Ce({}), ea = 0;
const ln = [], ta = (e, t) => {
const o = `toast${ea += 1}`;
qe = Ce({
render: () => Ve(
nn,
{ ...e, onClose: () => na(o, e.onClose) },
{ icon: () => Ve(ve, { ...t }) }
)
});
const a = document.createElement("div");
ln.push({ id: o, app: qe, el: a }), qe.mount(a), document.body.appendChild(a);
}, na = (e, t) => {
ln.forEach((o) => {
e === o.id && (o.app.unmount(), document.body.removeChild(o.el), t == null || t());
});
};
M(nn);
const [la, aa, oa] = O("mask"), ra = {
// 控制显示
modelValue: {
type: Boolean,
default: !1
},
// 层级
zIndex: {
type: [Number, String],
default: null
},
// 动画时长
duration: {
type: Number,
default: 300
},
// 自定义类名
customClass: {
type: String,
default: ""
},
// 自定义样式
customStyle: {
type: Object,
default: () => ({})
},
// 触摸滚动开关
lockScroll: {
type: Boolean,
default: !0
},
onAfterLeave: {
type: Function,
default: null
}
}, ee = F([]);
let Nt = 0;
const ia = /* @__PURE__ */ z({
name: la,
props: ra,
emits: ["update:modelValue"],
setup(e, {
slots: t
}) {
const o = L("");
Z(() => {
o.value = `mask${Nt}`, Nt += 1, n(e.modelValue, !0);
}), we(() => {
const l = ee.findIndex((i) => i._id === o.value);
l >= 0 && ee.splice(l, 1);
}), j(() => e.modelValue, (l) => {
n(l);
});
const n = (l, i) => {
l ? (ee.unshift({
_id: o.value,
_state: l
}), ee.length > 1 && (ee[1]._state = !1)) : i || (ee.splice(0, 1), ee.length > 0 && (ee[0]._state = !0));
}, a = () => {
let l = !1;
for (let i = 0; i < ee.length; i++)
ee[i]._id === o.value && (l = ee[i]._state);
return {
_state: l
};
}, r = (l) => {
const {
lockScroll: i
} = e;
i && (l.preventDefault(), l.stopPropagation());
};
return () => {
const {
customClass: l,
duration: i,
zIndex: m,
customStyle: g,
onAfterLeave: x
} = e, {
_state: c
} = a();
return f(We, {
name: oa("animation", "fade"),
onAfterLeave: x
}, {
default: () => {
var h;
return [te(f("div", {
style: {
animationDuration: `${i}ms`,
zIndex: m,
...g
},
class: [aa(), l],
onTouchmove: r
}, [(h = t.default) == null ? void 0 : h.call(t)]), [[ye, c]])];
}
});
};
}
});
const lt = M(ia), [ua, Bt, Lt] = O("popup"), sa = {
// 控制显示
modelValue: {
type: Boolean,
default: !1
},
// 位置
position: {
type: String,
default: "center"
},
// 圆角
borderRadius: {
type: [Number, String],
default: ""
},
// 自定义类名
customClass: {
type: String,
default: ""
},
// 自定义属性
customStyle: {
type: Object,
default: () => ({})
},
// 自定义类名
maskCustomClass: {
type: String,
default: ""
},
// 自定义属性
maskCustomStyle: {
type: Object,
default: () => ({})
},
// 插入对象
teleport: {
type: String,
default: "body"
},
// 动画时长
duration: {
type: Number,
default: 300
},
// 点击遮罩是否关闭
isCloseOnClickMask: {
type: Boolean,
default: !0
},
onAfterLeave: {
type: Function,
default: null
},
lockScroll: {
type: Boolean,
default: !0
},
zIndex: {
type: Number,
default: 100
}
}, ca = /* @__PURE__ */ z({
name: ua,
props: sa,
emits: ["clickMask", "update:modelValue"],
setup(e, {
slots: t,
emit: o
}) {
const n = B(() => {
const {
position: l,
borderRadius: i,
customStyle: m,
duration: g,
zIndex: x
} = e, c = R(i);
let h = "0";
switch (l) {
case "top":
h = ` 0 0 ${c} ${c}`;
break;
case "bottom":
h = `${c} ${c} 0 0`;
break;
case "left":
h = `0 ${c} ${c} 0`;
break;
case "right":
h = `${c} 0 0 ${c}`;
break;
default:
h = `${c}`;
}
return {
borderRadius: h,
animationDuration: `${g}ms`,
...m,
zIndex: x + 1
};
}), a = (l) => {
o("clickMask", l), e.isCloseOnClickMask && (r.value = !1);
}, r = B({
get: () => e.modelValue,
set: (l) => o("update:modelValue", l)
});
return j(() => r.value, (l, i) => {
l !== i && (l && e.lockScroll ? document.body.style.overflow = "hidden" : document.body.style.overflow = "");
}), () => {
const {
teleport: l,
position: i,
customClass: m,
duration: g,
onAfterLeave: x,
lockScroll: c,
zIndex: h,
maskCustomClass: s,
maskCustomStyle: w
} = e;
return l ? f(ct, {
to: l
}, {
default: () => [f(lt, {
modelValue: r.value,
"onUpdate:modelValue": (d) => r.value = d,
duration: g,
lockScroll: c,
onClick: a,
onAfterLeave: x,
zIndex: h,
customClass: s,
customStyle: w
}, null), f(We, {
name: Lt("animation", `slide-${i}`)
}, {
default: () => {
var d;
return [te(f("div", {
style: n.value,
class: [Bt("content", {
[i]: i
}), m]
}, [((d = t.default) == null ? void 0 : d.call(t)) || null]), [[ye, r.value]])];
}
})]
}) : f(He, null, [f(lt, {
modelValue: r.value,
"onUpdate:modelValue": (d) => r.value = d,
duration: g,
lockScroll: c,
onClick: a,
onAfterLeave: x,
zIndex: h,
customClass: s,
customStyle: w
}, null), f(We, {
name: Lt("animation", `slide-${i}`)
}, {
default: () => {
var d;
return [te(f("div", {
style: n.value,
class: [Bt("content", {
[i]: i
}), m]
}, [((d = t.default) == null ? void 0 : d.call(t)) || null]), [[ye, r.value]])];
}
})]);
};
}
});
const vt = M(ca), [da, Oe, Vt] = O("stepper"), fa = /* @__PURE__ */ z({
name: da,
props: {
modelValue: {
type: [Number, String],
default: null
},
placeholder: {
type: String,
default: ""
},
min: {
type: Number,
default: 1
},
step: {
type: Number,
default: 1
},
integer: {
type: Boolean,
default: !1
},
max: {
type: Number,
default: Number.MAX_SAFE_INTEGER
},
disabled: {
type: Boolean,
default: !1
},
disableInput: {
type: Boolean,
default: !1
},
inputWidth: {
type: [Number, String],
default: ""
},
size: {
type: String,
default: null
}
},
emits: ["change", "blur", "subtract", "addit", "foucs", "update:modelValue"],
setup(e, {
slots: t,
emit: o
}) {
const {
parent: n
} = me(), a = L(e.modelValue), r = B(() => e.size || (n == null ? void 0 : n.getProp("size"))), l = B(() => e.modelValue <= e.min || e.disabled), i = B(() => e.modelValue >= e.max || e.disabled), m = (d) => {
let p = e.integer;
return d.toString().replace(/([^0-9\.\-])/g, "").replace(/\./g, (S) => p ? "" : (p = !0, S)).replace(/\-/g, (S, k) => k === 0 ? "-" : "");
}, g = (d) => {
const p = m(d);
a.value = p, o("update:modelValue", p), o("change", p);
};
j(() => e.modelValue, (d) => {
a.value = d;
});
const x = (d) => o("focus", d), c = (d) => {
const {
value: p
} = d.target;
g(p);
}, h = (d) => {
const {
value: p
} = d.target, S = Number(m(p));
if (S && S < e.min ? g(e.min) : S && S > e.max ? g(e.max) : S && g(S), n) {
const {
validateWithTrigger: k
} = n;
k("onBlur");
}
o("blur", d);
}, s = () => {
const d = Number(e.modelValue) - e.step;
g(d), o("subtract", d);
}, w = () => {
const d = Number(e.modelValue) + e.step;
g(d), o("addit", d);
};
return () => {
const {
min: d,
max: p,
inputWidth: S,
placeholder: k,
disabled: v,
disableInput: u
} = e;
return f("div", {
class: Oe({
[r.value]: r.value
})
}, [t.subtraction ? t.subtraction() : f("button", {
type: "button",
disabled: l.value,
class: [Oe("subtraction"), Vt("el", {
clickable: !l.value
})],
onClick: s
}, null), te(f("input", {
type: "text",
class: Oe("input", {
"only-disable": u
}),
style: {
width: R(S)
},
"onUpdate:modelValue": (y) => a.value = y,
role: "spinbutton",
inputmode: "decimal",
"aria-min": d,
"aria-max": p,
"aria-valuenow": a.value,
onInput: c,
onBlur: h,
onFocus: x,
placeholder: k,
disabled: v || u
}, null), [[Ot, a.value]]), t.addition ? t.addition() : f("button", {
type: "button",
disabled: i.value,
class: [Oe("addition"), Vt("el", {
clickable: !i.value
})],
onClick: w
}, null)]);
};
}
});
const ma = M(fa), an = {
size: {
type: String,
default: null
},
border: {
type: Boolean,
default: !0
},
labelWidth: {
type: [Number, String],
default: null
},
colon: {
// 是否有 ":"
type: Boolean,
default: !1
},
labelAlign: {
type: String,
default: null
},
showError: {
type: Boolean,
default: !0
},
showErrorMessage: {
type: Boolean,
default: !0
},
errorMessageAlign: {
type: String,
default: null
},
rules: {
type: [Object, Array],
default: null
}
}, [on, va] = O("form"), rn = on, ga = /* @__PURE__ */ z({
name: on,
props: {
...an,
validateFirst: {
// 是否在某一项校验不通过时停止校验
type: Boolean,
default: !1
},
scrollToError: {
type: Boolean,
default: !0
},
validateTrigger: {
type: String,
default: "onBlur"
},
enterable: {
// 回车可以submit
type: Boolean,
default: !0
}
},
emits: ["change", "submit", "failed"],
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
initProvide: a,
children: r
} = fe(rn), l = () => {
const p = {};
return r.forEach((S) => {
const k = S.exposed;
p[S.props.prop] = k.formValue;
}), p;
}, i = (p) => {
const S = r.filter((k) => k.props.prop === p);
return new Promise((k, v) => {
if (S.length === 0)
v(new Error('【YUI】form method "validateField": no field, please check your param: "propName"!'));
else {
const u = S[0].exposed;
u == null || u.validate().then((y) => {
y ? v(y) : k();
});
}
});
}, m = async () => {
const p = [];
if (await r.reduce((S, k) => S.then(() => {
if (!p.length) {
const v = k.exposed;
return v == null ? void 0 : v.validate().then((u) => {
u && p.push(u);
});
}
return null;
}), Promise.resolve()), p.length)
throw p;
}, g = async () => {
const S = (await Promise.all(r.map((k) => k.exposed.validate()))).filter((k) => k);
if (S.length)
throw S;
}, x = (p) => p ? i(p) : e.validateFirst ? m() : g(), c = (p, S) => {
const k = r.find((u) => u.props.prop === p);
(k == null ? void 0 : k.vnode.el).scrollIntoView(S);
}, h = () => {
const p = l();
x().then(() => {
o("submit", p);
}).catch((S) => {
o("failed", {
values: p,
errors: S
}), Array.isArray(S) && e.scrollToError && c(S == null ? void 0 : S[0].name);
});
}, s = (p) => {
p.preventDefault(), h();
}, w = () => {
o("change", l());
}, d = (p) => {
r.forEach((S) => {
var k;
if (!p || S.props.prop === p) {
const v = S.exposed;
(k = v.resetValidation) == null || k.call(v);
}
});
};
return a({
props: e,
change: w
}), n({
submit: h,
scrollToField: c,
validate: x,
change: w,
resetValidation: d
}), () => {
var p;
return f("form", {
onSubmit: s,
class: [va()]
}, [(p = t.default) == null ? void 0 : p.call(t)]);
};
}
});
const pa = M(ga), un = "form-item", [ha, Me, ya] = O(un), ba = At(un), Sa = /* @__PURE__ */ z({
name: ha,
props: {
...an,
label: {
type: [Number, String],
default: ""
},
icon: {
type: String,
default: ""
},
prop: {
// form 收集数据的标示
type: String,
default: ""
}
},
setup(e, {
slots: t,
expose: o
}) {
const {
parent: n
} = ce(rn), {
initProvide: a,
filed: r
} = al(), l = L(!1), i = L(ba.validateMessage), m = (u) => {
if (e[u] && e[u] !== null)
return e[u];
const y = n && n.props;
return y && y[u] || null;
}, g = B(() => {
const u = n && n.props.rules, y = e.rules || (u == null ? void 0 : u[e.prop]);
return kn(y) ? [y] : y;
}), x = B(() => g.value && g.value.some((u) => u.required)), c = B(() => r.value ? r.value.proxy.modelValue : null), h = B(() => m("showError") && l.value), s = (u, y) => !(y.required && (r.value && r.value.exposed && typeof r.value.exposed.isRequired < "u" && !r.value.exposed.isRequired || !(Array.isArray(u) ? u.length : u)) || y.pattern && Cn(u) && !y.pattern.test(u)), w = (u, y) => {
const {
message: C
} = y;
return Dt(C) ? C(u, y) : C;
}, d = (u) => u.reduce((y, C) => y.then(() => {
if (l.value)
return null;
const b = C.formatter ? C.formatter(c.value, C) : c.value;
if (!s(b, C))
return l.value = !0, i.value = w(b, C), null;
if (C.validator) {
const T = C.validator(b, C);
return typeof T == "boolean" ? (T || (l.value = !0, i.value = w(b, C)), Promise.resolve(T)) : T.then((N) => (N || (l.value = !0, i.value = w(b, C)), N));
}
return null;
}), Promise.resolve()), p = async (u) => {
const y = u || g.value;
return y ? (await d(y), l.value ? {
name: e.prop,
message: i.value
} : null) : Promise.resolve();
}, S = (u) => {
var y;
if (n && g.value) {
const C = ((y = n.props) == null ? void 0 : y.validateTrigger) === u, b = g.value.filter((T) => T.trigger ? T.trigger === u : C);
return p(b);
}
return Promise.resolve(null);
}, k = () => {
l.value && (l.value = !1, i.value = "");
};
a({
getProp: m,
validateWithTrigger: S,
resetValidation: k,
change: n == null ? void 0 : n.change
}), o({
resetValidation: k,
formValue: c,
validate: p
});
const v = () => h.value ? t.error ? t.error() : m("showErrorMessage") ? f("p", {
class: Me("error"),
style: {
textAlign: "left"
}
}, [i.value]) : null : null;
return () => {
var b, T, N;
const {
label: u,
border: y,
colon: C
} = e;
return f("div", {
class: [Me({
"is-error": h.value,
[m("size")]: m("size"),
hairline: y
}), ya("el", {
"hairline-bottom": y
})]
}, [f("label", {
class: Me("label", {
"is-required": x.value
}),
style: {
width: m("labelWidth"),
textAlign: m("labelAlign") || "left"
}
}, [(b = t.labelIcon) == null ? void 0 : b.call(t), u, C ? " :" : ""]), f("div", {
class: Me("content")
}, [(T = t.default) == null ? void 0 : T.call(t), v()]), (N = t.extra) == null ? void 0 : N.call(t)]);
};
}
});
const wa = M(Sa), [xa, Ca] = O("input"), $a = 13, ka = /* @__PURE__ */ z({
name: xa,
props: {
modelValue: {
type: [String, Number],
default: ""
},
type: {
type: String,
default: "text"
},
border: {
type: Boolean,
default: !1
},
placeholder: {
type: String,
default: ""
},
size: {
type: String,
default: null
},
align: {
type: String,
default: null
},
autocomplete: {
type: String,
default: "on"
},
rows: {
type: Number,
default: 2
},
maxLength: {
type: Number,
default: null
},
showWordLimit: {
type: Boolean,
default: !1
},
readonly: {
type: Boolean,
default: !1
},
disabled: {
type: Boolean,
default: !1
}
},
emits: ["click", "input", "keypress", "focus", "blur", "update:modelValue"],
setup(e, {
emit: t
}) {
const o = le(), {
parent: n
} = me();
let a = null;
const r = (s, w) => {
s !== w && a && (a.innerHTML = `${e.modelValue.toString().length}/${e.maxLength}`);
}, l = (s, w) => {
s !== w && (s ? (a = document.createElement("div"), a.className = "y-input__limit-num", (o == null ? void 0 : o.vnode.el).insertAdjacentElement("afterend", a), e.maxLength && r(e.maxLength)) : (a && a.remove(), a = null));
};
j(() => e.showWordLimit, l), j(() => e.modelValue, r), j(() => e.maxLength, r);
const i = (s) => t("focus", s), m = (s) => t("click", s), g = (s) => {
if (n) {
const {
validateWithTrigger: w
} = n;
w("onBlur");
}
t("blur", s);
}, x = (s) => {
t("update:modelValue", s.target.value), t("input", s);
}, c = (s) => {
s.keyCode === $a && (n != null && n.getProp("enterable") || s.preventDefault(), e.type === "search" && (o == null ? void 0 : o.vnode.el).blur()), t("keypress", s);
};
Z(() => {
l(e.showWordLimit), r(e.maxLength);
}), xe(() => {
a && a.remove(), a = null;
});
const h = B({
get: () => e.modelValue,
set: (s) => t("update:modelValue", s)
});
return () => {
const {
type: s,
rows: w,
align: d,
disabled: p,
maxLength: S,
size: k,
border: v,
readonly: u,
autocomplete: y,
placeholder: C
} = e, b = k || (n == null ? void 0 : n.getProp("size")), T = {
class: Ca({
[b]: b,
border: v
}),
style: {
"text-align": d
},
disabled: p,
readonly: u,
placeholder: C,
maxlength: S,
onInput: x,
autocomplete: y,
onFocus: i,
onClick: m,
onKeypress: c,
onBlur: g
};
return s === "textarea" ? te(f("textarea", Ie(T, {
rows: w,
"onUpdate:modelValue": (N) => h.value = N
}), null), [[Ot, h.value]]) : te(f("input", Ie(T, {
"onUpdate:modelValue": (N) => h.value = N,
type: s
}), null), [[Sn, h.value]]);
};
}
});
const Ta = M(ka), at = 1e3, ot = 60 * at, rt = 60 * ot, It = 24 * rt, [Ea] = O("count-down"), Na = /* @__PURE__ */ z({
name: Ea,
props: {
time: {
type: [Number, String],
default: 0
},
format: {
type: String,
default: "HH:mm:ss"
},
/**
* @ignore
*/
autoStart: {
type: Boolean,
default: !0
},
millisecond: {
type: Boolean,
default: !1
}
},
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const a = L(), r = L(!1), l = L(Number(e.time)), i = L(0), m = B(() => p(l.value));
Z(() => {
e.autoStart && g();
});
const g = () => {
r.value = !0, i.value = l.value + Date.now(), h();
}, x = () => {
c(), l.value = Number(e.time), e.autoStart && g();
}, c = () => {
r.value = !1, window.cancelAnimationFrame(a.value);
}, h = () => {
r.value && (e.millisecond ? s() : d(l.value, w()) || s(), a.value = window.requestAnimationFrame(h));
}, s = () => {
if (l.value = w(), e.millisecond && l.value === 0 || !e.millisecond && Math.floor(l.value / 1e3) === 0) {
r.value = !1, o("finish");
return;
}
o("change", m.value);
}, w = () => Math.max(i.value - Date.now(), 0), d = (v, u) => Math.floor(v / 1e3) === Math.floor(u / 1e3), p = (v) => {
const u = Math.floor(v / It), y = Math.floor(v % It / rt), C = Math.floor(v % rt / ot), b = Math.floor(v % ot / at), T = Math.floor(v % at);
return {
days: u,
hours: y,
minutes: C,
seconds: b,
milliseconds: T,
timestamp: v
};
}, S = (v) => {
let u = v;
const {
days: y
} = m.value;
let {
hours: C,
minutes: b,
seconds: T,
milliseconds: N
} = m.value;
return u.indexOf("DD") === -1 ? C += y * 24 : u = u.replace("DD", k(y)), u.indexOf("HH") === -1 ? b += C * 60 : u = u.replace("HH", k(C)), u.indexOf("mm") === -1 ? T += b * 60 : u = u.replace("mm", k(b)), u.indexOf("ss") === -1 ? N += T * 1e3 : u = u.replace("ss", k(T)), u.indexOf("S") !== -1 && (u = u.replace(/S+/, (E) => k(N, E.length).slice(0, E.length))), u;
}, k = (v, u = 2) => {
let y = `${v}`;
for (; y.length < u; )
y = `0${y}`;
return y;
};
return n({
start: g,
reset: x,
suspend: c
}), () => {
var v;
return ((v = t.default) == null ? void 0 : v.call(t, m.value)) || f("div", null, [S(e.format)]);
};
}
});
const Ba = M(Na);
function La(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
}
const [Va, ne] = O("dialog"), Ia = {
// 控制显示
modelValue: {
type: Boolean,
default: !1
},
width: {
type: [Number, String],
default: 288
},
title: {
type: String,
default: ""
},
titleAlign: {
type: String,
default: "center"
},
message: {
type: String,
default: ""
},
messageAlign: {
type: String,
default: "center"
},
isCloseOnClickMask: {
type: Boolean,
default: !0
},
showCloseIcon: {
type: Boolean,
default: !1
},
showCancelBtn: {
type: Boolean,
default: !1
},
cancelButtonText: {
type: String,
default: "取消"
},
showConfirmBtn: {
type: Boolean,
default: !1
},
confirmButtonText: {
type: String,
default: "确认"
},
beforeClose: {
type: Function,
default: null
},
callback: {
type: Function,
default: null
},
imgSrc: {
type: String,
default: null
},
circleImg: {
type: Boolean,
default: !1
},
// 插入对象
teleport: {
type: String,
default: "body"
},
// 动画时长
duration: {
type: Number,
default: 300
},
onClickMask: {
type: Function,
default: null
}
}, sn = /* @__PURE__ */ z({
name: Va,
directives: {
loading: Qt
},
props: Ia,
emits: ["update:modelValue", "cancel", "confirm"],
setup(e, {
emit: t,
slots: o
}) {
const n = F({
cancel: !1,
confirm: !1
}), a = (h) => {
c.value = h;
}, r = (h) => {
var s;
a(!1), (s = e.callback) == null || s.call(e, h);
}, l = (h) => {
t("cancel", h, m("cancel"));
}, i = (h) => {
t("confirm", h, m("confirm"));
}, m = (h) => {
const {
modelValue: s,
beforeClose: w
} = e;
if (s)
if (Dt(w)) {
n[h] = !0;
const d = w(h);
Tn(d) ? d.then((S) => {
g(S, h);
}).catch((S) => {
throw new Error(S);
}) : g(d, h);
} else
r(h);
}, g = (h, s) => {
h && r(s), n[s] = !1;
}, x = (h, s, w) => {
let d = Number(h.substring(0, h.length - 2));
return d /= s || 2, w ? `${w(d)}px` : `${d}px`;
}, c = B({
get: () => e.modelValue,
set: (h) => t("update:modelValue", h)
});
return () => {
const {
width: h,
title: s,
titleAlign: w,
message: d,
messageAlign: p,
isCloseOnClickMask: S,
showCloseIcon: k,
showCancelBtn: v,
cancelButtonText: u,
showConfirmBtn: y,
confirmButtonText: C,
imgSrc: b,
circleImg: T,
teleport: N,
duration: E,
onClickMask: P
} = e;
return f(vt, Ie({
modelValue: c.value,
"onUpdate:modelValue": (D) => c.value = D,
customClass: ne(),
customStyle: {
width: R(h)
}
}, {
onClickMask: P,
"onUpdate:modelValue": a
}, {
isCloseOnClickMask: S,
teleport: N,
duration: E
}), {
default: () => {
var D, V, U, q;
return [((D = o.img) == null ? void 0 : D.call(o)) || b && f("div", {
class: ne("img", {
circle: T
}),
style: {
top: T ? `-${x(R(h), 4)}` : "auto",
left: T ? `calc(50% - ${x(R(h), 4)})` : "auto"
}
}, [f("div", {
style: {
width: T ? x(R(h)) : R(h),
height: x(R(h)),
background: `url(${b}) center`,
borderRadius: T ? "50%" : "20px 20px 0 0"
}
}, null)]), f("div", {
class: ne("container")
}, [f("div", {
style: {
height: T ? x(R(h), 4, (I) => I + 20) : "24px"
}
}, null), ((V = o.title) == null ? void 0 : V.call(o)) || f("div", {
class: ne("title"),
style: {
textAlign: w
}
}, [s]), f("div", {
class: ne("content")
}, [f("div", {
class: ne("message"),
style: {
textAlign: p
}
}, [((U = o.default) == null ? void 0 : U.call(o)) || d]), ((q = o.footer) == null ? void 0 : q.call(o)) || f("div", {
class: ne("footer"),
style: {
paddingTop: v || y ? "20px" : "0px"
}
}, [v && te(f(nt, {
type: "secondary",
class: ne("footer-btn"),
onClick: l
}, La(u) ? u : {
default: () => [u]
}), [[gt("loading"), n.cancel]]), y && te(f(nt, {
type: "primary",
class: ne("footer-btn"),
onClick: i
}, {
default: () => [n.confirm ? "" : C]
}), [[gt("loading"), n.confirm]])])]), k && f("div", {
class: ne("close"),
onClick: () => r("close")
}, [f(ve, {
name: "cross"
}, null)])])];
}
});
};
}
});
let Ge = Ce({}), Pa = 0;
const cn = [], _a = (e, t) => {
const o = `dialog${Pa += 1}`;
Ge = Ce({
setup() {
const r = L(!0), l = (i) => {
r.value = i;
};
return () => Ve(
sn,
{
modelValue: r.value,
"onUpdate:modelValue": l,
...e,
onAfterLeave: () => {
za(o);
}
},
{ ...t }
);
}
});
const a = document.createElement("div");
cn.push({ id: o, app: Ge, el: a }), Ge.mount(a);
}, za = (e) => {
cn.forEach((t) => {
e === t.id && t.app.unmount();
});
};
const Oa = M(sn), dn = {
// 是否显示
modelValue: {
type: Boolean,
default: !1
},
// 是否只能通过 v-model 控制显隐
manual: {
type: Boolean,
default: !1
},
text: {
type: String,
default: ""
},
color: {
type: String,
default: ""
},
bgColor: {
type: String,
default: ""
},
// popper挂载的位置
teleport: {
type: String,
default: "body"
},
width: {
type: [Number, String],
default: ""
},
minWidth: {
type: [Number, String],
default: ""
},
popperClass: {
type: String,
default: ""
},
popperStyle: {
type: Object,
default: {}
},
// 当tooltip显示超出视窗时会自动在另一侧渲染
autoFlipping: {
type: Boolean,
default: !0
},
// 展示位置
position: {
type: String,
default: Ft.Top
}
}, [Ma, Ke] = O("popper"), fn = (e) => e.parentElement ? getComputedStyle(e.parentElement).position !== "static" ? e.parentElement : fn(e.parentElement) : e, it = (e, t, o) => {
let n = t || e.offsetTop, a = o || e.offsetLeft;
return e.parentElement ? (getComputedStyle(e.parentElement).position !== "static" && (n += e.parentElement.offsetTop, a += e.parentElement.offsetLeft), it(e.parentElement, n, a)) : {
offsetLeft: a,
offsetTop: n
};
}, ut = /* @__PURE__ */ z({
name: Ma,
props: {
...dn,
reference: {
type: Object,
default: null
}
},
setup(e, {
slots: t
}) {
const o = le(), n = L(e.modelValue), a = F({
placement: "",
align: ""
}), r = F({
top: 0,
left: 0
}), l = () => {
var E;
const c = e.reference, h = (E = o == null ? void 0 : o.proxy) == null ? void 0 : E.$refs.popper;
if (!c || !h)
return;
const {
offsetWidth: s,
offsetHeight: w
} = c, {
offsetTop: d,
offsetLeft: p
} = it(c), {
offsetWidth: S,
offsetHeight: k
} = h, {
placement: v,
align: u
} = a, {
offsetLeft: y,
offsetTop: C
} = it(fn(h)), b = {
x: 0,
y: 0,
newPlacement: v
};
e.autoFlipping && (v === "left" && p - S < pageXOffset ? b.newPlacement = "right" : v === "right" && p + s + S > pageXOffset + innerWidth ? b.newPlacement = "left" : v === "top" && d - k < pageYOffset ? b.newPlacement = "bottom" : v === "bottom" && d + w + k > pageYOffset + innerHeight && (b.newPlacement = "top"));
const T = b.newPlacement === "top" ? -k : w, N = b.newPlacement === "left" ? -S : s;
switch (b.newPlacement) {
case "top":
case "bottom":
b.y = d + T, u === "start" ? b.x = p : u === "end" ? b.x = p + s - S : b.x = p + s / 2 - S / 2;
break;
case "left":
case "right":
b.x = p + N, u === "start" ? b.y = d : u === "end" ? b.y = d + w - k : b.y = d + w / 2 - k / 2;
break;
}
r.left = b.x - y, r.top = b.y - C, a.placement = b.newPlacement;
}, i = (c) => {
var w;
const h = (w = o == null ? void 0 : o.proxy) == null ? void 0 : w.$refs.popper, s = e.reference;
s && h && !s.contains(c.target) && !h.contains(c.target) && (n.value = !1);
}, m = () => {
n.value = !n.value;
}, g = () => {
const [c, h] = e.position.split("-");
a.align = h, a.placement = c;
}, x = () => {
e.manual && (n.value = e.modelValue), e.modelValue || n.value ? ue(l).catch((c) => {
throw new Error(c);
}) : (r.left = 0, r.top = 0);
};
return j(() => e.position, () => {
g(), x();
}), j([() => n.value, () => e.modelValue, () => e.reference], x), Z(() => {
var c;
g(), x(), e.manual || ((c = e.reference) == null || c.addEventListener("click", m), document.addEventListener("touchstart", i), document.addEventListener("mousedown", i));
}), xe(() => {
var c;
e.manual || ((c = e.reference) == null || c.removeEventListener("click", m), document.removeEventListener("touchstart", i), document.removeEventListener("mousedown", i));
}), () => {
const {
left: c,
top: h
} = r, {
width: s,
color: w,
bgColor: d,
modelValue: p,
minWidth: S,
popperClass: k,
popperStyle: v,
text: u
} = e;
return f(ct, {
to: e.teleport
}, {
default: () => {
var y;
return [te(f("div", {
class: [Ke({
[a.placement]: a.placement
}), k],
ref: "popper",
style: {
...v,
left: `${c}px`,
top: `${h}px`
}
}, [f("div", {
class: Ke("content"),
style: {
color: w,
width: R(s),
minWidth: R(S),
backgroundColor: d
}
}, [((y = t.default) == null ? void 0 : y.call(t)) || u]), f("div", {
class: Ke("arrow", [`${a.placement}${a.align ? `-${a.align}` : ""}`]),
style: {
color: d
}
}, null)]), [[ye, p || n.value]])];
}
});
};
}
});
function Da(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
}
const [Aa] = O("tooltip"), Ra = /* @__PURE__ */ z({
name: Aa,
props: dn,
setup(e, {
slots: t
}) {
const o = le(), n = L(), a = () => {
var l;
const r = (l = o == null ? void 0 : o.proxy) == null ? void 0 : l.$el;
return r == null ? void 0 : r.nextElementSibling;
};
return Z(() => {
n.value = a();
}), st(() => {
ue(() => {
n.value = a();
}).catch((r) => {
throw Error(r);
});
}), () => {
var l;
let r;
return f(He, null, [(l = t.default) == null ? void 0 : l.call(t)[0], n.value && (t.popper ? f(ut, Ie(e, {
reference: n.value
}), Da(r = t.popper()) ? r : {
default: () => [r]
}) : f(ut, Ie(e, {
reference: n.value
}), null))]);
};
}
}), Pt = (e, t) => {
t.value ? (e.classList.add("y-popper__wrap"), e.appendChild(e.instance.$el)) : (e.classList.remove("y-popper__wrap"), e.removeChild(e.instance.$el));
}, Wa = {
install: (e) => {
e.directive("tooltip", Fa);
}
}, Fa = {
getSSRProps: (e) => ({ ...e }),
// 指令是具有一组生命周期的钩子:
// 在绑定元素的 attribute 或事件监听器被应用之前调用
// 在绑定元素的父组件挂载之前调用
mounted: (e, t) => {
const n = Ce({
render: () => Ve(ut, { ...t.value, reference: e })
}), a = document.createElement("div");
e.instance = n.mount(a), t.value && Pt(e, t);
},
updated: (e, t) => {
t.oldValue !== t.value && Pt(e, t);
},
unmounted: (e) => {
e.instance && e.instance.$el.remove();
}
};
const Ha = M(Ra), Be = (e, t, o) => ({
number: e,
text: t,
active: o
}), [Ya, he] = O("pagination"), Xa = {
modelValue: {
type: Number,
default: 1
},
mode: {
type: String,
default: Wt.multi
},
prevText: {
type: String,
default: "上一页"
},
nextText: {
type: String,
default: "下一页"
},
pageCount: {
type: Number,
default: 0
},
totalItems: {
type: Number,
default: 0
},
itemsPerPage: {
type: Number,
default: 10
},
showPageSize: {
type: Number,
default: 5
},
forceEllipses: {
type: Boolean,
default: !0
},
ellipsesWithInclusio: {
type: Boolean,
default: !0
},
showPrevButton: {
type: Boolean,
default: !0
},
showNextButton: {
type: Boolean,
default: !0
},
isBlockUpdate: {
type: Boolean,
default: !1
}
}, ja = /* @__PURE__ */ z({
name: Ya,
props: Xa,
emits: ["change", "update:modelValue"],
setup(e, {
emit: t,
slots: o
}) {
const n = B(() => {
const {
pageCount: l,
totalItems: i,
itemsPerPage: m
} = e, g = Number(l) || Math.ceil(Number(i) / Number(m));
return Math.max(1, g);
}), a = B(() => {
const l = [], i = n.value, m = Number(e.showPageSize), {
modelValue: g,
forceEllipses: x,
ellipsesWithInclusio: c
} = e;
let h = 1, s = i;
const w = m < i;
w && (h = Math.max(g - Math.floor(m / 2), 1), s = h + m - 1, s > i && (s = i, h = s - m + 1));
for (let d = h; d <= s; d++) {
const p = Be(d, d, d === g);
l.push(p);
}
if (w && m > 0 && x) {
if (h > 1) {
const d = Be(h - 1, "...");
if (l.unshift(d), c) {
const p = Be(1, "1");
l.unshift(p);
}
}
if (s < i) {
const d = Be(s + 1, "...");
if (l.push(d), c) {
const p = Be(i, i);
l.push(p);
}
}
}
return l;
}), r = (l, i) => {
const m = Math.min(Math.max(l, 1), n.value);
e.modelValue !== m && (!e.isBlockUpdate && t("update:modelValue", m), i && t("change", m));
};
return wn(() => r(e.modelValue)), () => {
const {
mode: l,
modelValue: i,
showPrevButton: m,
showNextButton: g,
prevText: x,
nextText: c
} = e, h = o["prev-text"], s = i === 1, w = o["next-text"], d = i === n.value, p = o["simple-page"];
return f("nav", {
role: "navigation",
class: he()
}, [f("ul", {
class: he("items")
}, [m && f("li", {
class: [he("item", {
prevBtnDisabled: s,
prev: !0
})],
onClick: () => r(i - 1, !0)
}, [h ? h({
disabled: s,
text: x
}) : f("button", {
type: "button",
disabled: s
}, [x])]), l === "simple" ? f("li", {
class: he("page-desc")
}, [p ? p({
current: i,
total: n.value
}) : `${i}/${n.value}`]) : a.value.map((S) => f("li", {
class: [he("item", {
active: S.active,
page: !0
})],
onClick: () => r(S.number, !0)
}, [o.page ? o.page(S) : f("button", {
type: "button"
}, [S.text])])), g && f("li", {
class: [he("item", {
nextBtnDisabled: d,
next: !0
})],
onClick: () => r(i + 1, !0)
}, [w ? w({
disabled: d,
text: c
}) : f("button", {
type: "button",
disabled: d
}, [c])])])]);
};
}
});
const Ua = M(ja), [mn, De] = O("dropdown"), vn = mn, qa = {
zIndex: {
type: Number,
default: 100
},
duration: {
type: Number,
default: 300
},
direction: {
type: String,
default: be.DOWN
},
activeColor: {
type: String,
default: ""
},
isCloseOnClickOutside: {
type: Boolean,
default: !0
},
isCloseOnClickMask: {
type: Boolean,
default: !0
},
swipeThreshold: {
type: Number,
default: 0
}
}, Ga = /* @__PURE__ */ z({
name: mn,
props: qa,
setup(e, {
slots: t,
expose: o
}) {
const n = `dropdown-${Math.ceil(Math.random() * 100)}`, a = L(), r = L(null), l = L(0), {
initProvide: i,
children: m
} = fe(vn), g = B(() => m.some((y) => y.exposed.state.showPopup)), x = B(() => e.swipeThreshold && m.length > Number(e.swipeThreshold)), c = B(() => g.value && e.zIndex ? {
zIndex: Number(e.zIndex) + 1
} : {}), h = (y) => y.tagName !== "HTML" && y.tagName !== "BODY" && y.nodeType === 1, s = (y, C = window) => {
let b = y;
for (; b && b !== C && h(b); ) {
const {
overflowY: T
} = window.getComputedStyle(b);
if (/scroll|auto|overlay/i.test(T))
return b;
b = b.parentNode;
}
return C;
}, w = L(), d = () => {
if (r.value) {
let y = {
top: 0,
left: 0,
right: 0,
bottom: 0,
width: 0,
height: 0
};
const C = pt(r);
C === window && (y.width = window.innerWidth, y.height = window.innerHeight), C && (C != null && C.getBoundingClientRect) && (y = C.getBoundingClientRect()), e.direction === be.DOWN ? l.value = y.bottom : l.value = window.innerHeight - y.top;
}
}, p = () => {
g.value && d();
}, S = () => {
m.forEach((y) => {
y.exposed.toggle(!1);
});
}, k = (y) => {
(Array.isArray(a) ? a : [a]).every((T) => {
const N = pt(T);
return N && !N.contains(y.target);
}) && e.isCloseOnClickOutside && S();
};
Z(() => {
var y;
a.value && (w.value = s(a.value)), (y = w.value) == null || y.addEventListener("scroll", p, {
passive: !0
}), document.addEventListener("click", k);
}), xe(() => {
var y;
(y = w.value) == null || y.removeEventListener("scroll", p), document.removeEventListener("click", k);
});
const v = (y) => {
const C = [-1, -1];
m.forEach((b, T) => {
const N = b.exposed;
T === y ? C[1] = T : N.state.showPopup && (C[0] = T);
}), C[0] !== -1 && m[C[0]].exposed.toggle(!1, {
immediate: !0
}), ue(() => {
C[1] !== -1 && m[C[1]].exposed.toggle();
}).catch((b) => {
throw new Error(b);
});
}, u = (y, C) => {
const b = y.exposed, {
disabled: T,
titleClass: N
} = y.proxy;
return f("div", {
id: `${n}-${C}`,
class: [De("item", {
disabled: T,
grow: x.value
})],
onClick: () => {
T || v(C);
}
}, [f("span", {
class: [De("title", {
down: b.state.showPopup === (e.direction === be.DOWN),
active: b.state.showPopup
}), N],
style: {
color: b.state.showPopup ? e.activeColor : ""
}
}, [f("div", {
class: "y-el--ellipsis"
}, [b.renderItemTitle()])])]);
};
return o({
close: S
}), i({
id: n,
props: e,
offset: l,
updateOffset: d
}), () => {
var y;
return f("div", {
ref: a,
class: De()
}, [f("div", {
ref: r,
style: c.value,
class: De("bar", {
opened: g.value,
scrollable: x.value
})
}, [m.map(u)]), (y = t.default) == null ? void 0 : y.call(t)]);
};
}
});
const Ka = M(Ga);
function Za(e) {
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Se(e);
}
const [Qa, Ae] = O("dropdown-item"), Ja = {
modelValue: {
type: [Number, String],
default: ""
},
title: {
type: String,
default: ""
},
options: {
type: Object,
default: () => ({})
},
disabled: {
type: Boolean,
default: !1
},
teleport: {
type: String,
default: ""
}
}, eo = /* @__PURE__ */ z({
name: Qa,
props: Ja,
emits: ["change", "update:modelValue"],
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const a = F({
showPopup: !1,
transition: !0,
id: Math.random().toString(36).slice(2)
}), {
parent: r
} = ce(vn);
if (!r) {
console.error("<YDropdownItem> must be a child component of <YDropdown>.");
return;
}
const l = (c) => {
e.teleport && c.stopPropagation();
}, i = (c = !a.showPopup, h = {}) => {
c !== a.showPopup && (a.showPopup = c, a.transition = !h.immediate, c && r.updateOffset());
}, m = () => {
if (t.title)
return t.title();
if (e.title)
return e.title;
const c = e.options.find((h) => h.value === e.modelValue);
return c ? c.text : "";
}, g = (c) => {
const {
activeColor: h
} = r.props, s = c.value === e.modelValue, w = () => {
a.showPopup = !1, c.value !== e.modelValue && (o("update:modelValue", c.value), o("change", c.value));
}, d = () => s ? f(ve, {
class: Ae("icon"),
color: h,
name: c.icon || "done"
}, null) : null;
return f(Kt, {
key: String(c.value),
title: c.text,
class: Ae("option", {
active: s
}),
style: {
color: s ? h : ""
},
clickable: !0,
onClick: w
}, {
right: d
});
}, x = () => {
const {
offset: c
} = r, {
zIndex: h,
duration: s,
direction: w,
isCloseOnClickMask: d
} = r.props, p = {};
return p.zIndex = h, w === be.DOWN ? p.top = `${c.value}px` : p.bottom = `${c.value}px`, te(f("div", {
style: p,
class: Ae([w]),
onClick: l,
id: a.id
}, [f(vt, {
modelValue: a.showPopup,
"onUpdate:modelValue": (S) => a.showPopup = S,
customClass: Ae("content"),
maskCustomStyle: {
position: "absolute"
},
position: w === be.DOWN ? Qe.Top : Qe.Bottom,
duration: a.transition ? s : 0,
isCloseOnClickMask: d,
teleport: e.teleport
}, {
default: () => {
var S;
return [e.options.map(g), (S = t.default) == null ? void 0 : S.call(t)];
}
})]), [[ye, a.showPopup]]);
};
return n({
state: a,
toggle: i,
renderItemTitle: m
}), () => {
let c;
return e.teleport ? f(ct, {
to: e.teleport
}, Za(c = x()) ? c : {
default: () => [c]
}) : x();
};
}
});
const to = M(eo), no = {
modelValue: {
type: [String, Number],
default: ""
},
disabled: {
type: Boolean,
default: !1
},
square: {
type: Boolean,
default: null
},
horizontal: {
type: Boolean,
default: !1
},
checkedColor: {
type: String,
default: null
}
}, [gn, lo] = O("radio-group"), pn = gn, ao = /* @__PURE__ */ z({
name: gn,
props: no,
setup(e, {
slots: t,
emit: o
}) {
const {
initProvide: n
} = fe(pn);
me();
const a = (l) => {
o("update:modelValue", l), o("change", l);
};
return n({
props: e,
onItemChange: (l) => {
e.modelValue !== l && a(l);
}
}), () => {
var l;
return f("div", {
class: lo({
horizontal: e.horizontal
}),
role: "radiogroup"
}, [(l = t.default) == null ? void 0 : l.call(t)]);
};
}
}), [oo, Ze] = O("radio"), ro = /* @__PURE__ */ z({
name: oo,
props: {
modelValue: {
type: [Boolean, String, Number],
default: !1
},
name: {
type: String,
default: null
},
disabled: {
type: Boolean,
default: !1
},
square: {
type: Boolean,
default: !0
},
checkedColor: {
type: String,
default: null
},
size: {
type: [Number, String],
default: 20
}
},
setup(e, {
slots: t,
emit: o,
expose: n
}) {
const {
parent: a
} = ce(pn), r = a === null ? me().parent : null, l = (d, p = null) => B(() => a && a.props[d] !== null ? a.props[d] : Object.keys(e).includes(d) ? e[d] : p), i = l("disabled"), m = l("square"), g = l("checkedColor"), x = l("horizontal", !1), c = B(() => a ? a.props.modelValue === e.name : typeof e.modelValue == "boolean" ? e.modelValue : e.modelValue === e.name), h = (d) => {
var p;
i.value || typeof d < "u" && c.value === d || ((p = a == null ? void 0 : a.onItemChange) == null || p.call(a, e.name), o("update:modelValue", !e.modelValue), o("change", !e.modelValue));
};
n({
toggle: h
});
const s = B(() => ["mini", "small", "middle", "large"].includes(e.size.toString() || (r == null ? void 0 : r.getProp("size"))) ? null : R(e.size)), w = B(() => {
const d = {};
return s.value && (d.width = s.value, d.height = s.value), c.value && g.value && (d.backgroundColor = g.value), d;
});
return () => {
var p, S;
const {
size: d
} = e;
return f("div", {
class: Ze({
disabled: i.value,
checked: c.value,
horizontal: x.value,
[d]: ["mini", "small", "middle", "large"].includes(d.toString())
}),
onClick: () => h(),
role: "radio",
"aria-checked": c.value
}, [((p = t.icon) == null ? void 0 : p.call(t, {
checked: c.value
})) || f("div", {
class: Ze("icon", {
checked: c.value,
square: m.value
}),
style: w.value
}, [c.value ? f(ve, {
name: "done"
}, null) : null]), f("div", {
class: Ze("label")
}, [(S = t.default) == null ? void 0 : S.call(t)])]);
};
}
});
const io = M(ro);
const uo = M(ao), so = [
// 组件
ve,
Mt,
tl,
Rn,
Yn,
Kn,
nl,
ll,
ml,
vl,
hl,
$l,
Kt,
pa,
wa,
nt,
Ta,
Ol,
Ul,
tn,
Al,
Hl,
Kl,
vt,
lt,
ma,
Ba,
Oa,
Ha,
Ua,
Ka,
to,
io,
uo
], hn = (e) => {
hn.installed || (so.forEach((t) => {
t.name && e.component(t.name, t);
}), e.provide("loading", Il), e.provide("toast", ta), e.provide("dialog", _a), e.use(Pl), e.use(Wa));
}, fo = {
install: hn
};
export {
nt as Button,
Kt as Cell,
ml as Checkbox,
vl as CheckboxGroup,
Hl as Col,
Ba as CountDown,
Oa as Dialog,
Ka as Dropdown,
to as DropdownItem,
Ul as Empty,
pa as Form,
wa as FormItem,
ve as Icon,
Ta as Input,
tl as List,
Ol as Loading,
lt as Mask,
Ua as Pagination,
vt as Popup,
Kl as Progress,
$l as PullRefresh,
io as Radio,
uo as RadioGroup,
Al as Row,
Kn as Slider,
ma as Stepper,
nl as Swipe,
ll as SwipeItem,
hl as Switch,
Yn as Tab,
Rn as Tabs,
Ha as Tooltip,
_a as createDialog,
Il as createLoading,
ta as createToast,
fo as default,
tn as empty,
Mt as locale,
Pl as vLoading,
Wa as vTooltip
};