@kungal/ui-vue 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +137 -0
- package/dist/components/AlertProvider.vue.d.ts +4 -0
- package/dist/components/AlertProvider.vue.d.ts.map +1 -0
- package/dist/components/Avatar.vue.d.ts +10 -0
- package/dist/components/Avatar.vue.d.ts.map +1 -0
- package/dist/components/AvatarGroup.vue.d.ts +19 -0
- package/dist/components/AvatarGroup.vue.d.ts.map +1 -0
- package/dist/components/Badge.vue.d.ts +25 -0
- package/dist/components/Badge.vue.d.ts.map +1 -0
- package/dist/components/Brand.vue.d.ts +13 -0
- package/dist/components/Brand.vue.d.ts.map +1 -0
- package/dist/components/Button.vue.d.ts +39 -0
- package/dist/components/Button.vue.d.ts.map +1 -0
- package/dist/components/Card.vue.d.ts +37 -0
- package/dist/components/Card.vue.d.ts.map +1 -0
- package/dist/components/CheckBox.vue.d.ts +36 -0
- package/dist/components/CheckBox.vue.d.ts.map +1 -0
- package/dist/components/Chip.vue.d.ts +21 -0
- package/dist/components/Chip.vue.d.ts.map +1 -0
- package/dist/components/Content.vue.d.ts +7 -0
- package/dist/components/Content.vue.d.ts.map +1 -0
- package/dist/components/ContextMenu.vue.d.ts +19 -0
- package/dist/components/ContextMenu.vue.d.ts.map +1 -0
- package/dist/components/Copy.vue.d.ts +12 -0
- package/dist/components/Copy.vue.d.ts.map +1 -0
- package/dist/components/DatePicker.vue.d.ts +21 -0
- package/dist/components/DatePicker.vue.d.ts.map +1 -0
- package/dist/components/Divider.vue.d.ts +22 -0
- package/dist/components/Divider.vue.d.ts.map +1 -0
- package/dist/components/Drawer.vue.d.ts +43 -0
- package/dist/components/Drawer.vue.d.ts.map +1 -0
- package/dist/components/Dropdown.vue.d.ts +43 -0
- package/dist/components/Dropdown.vue.d.ts.map +1 -0
- package/dist/components/FadeCard.vue.d.ts +14 -0
- package/dist/components/FadeCard.vue.d.ts.map +1 -0
- package/dist/components/Favicon.vue.d.ts +4 -0
- package/dist/components/Favicon.vue.d.ts.map +1 -0
- package/dist/components/FileInput.vue.d.ts +50 -0
- package/dist/components/FileInput.vue.d.ts.map +1 -0
- package/dist/components/Header.vue.d.ts +25 -0
- package/dist/components/Header.vue.d.ts.map +1 -0
- package/dist/components/Icon.vue.d.ts +13 -0
- package/dist/components/Icon.vue.d.ts.map +1 -0
- package/dist/components/Image.vue.d.ts +27 -0
- package/dist/components/Image.vue.d.ts.map +1 -0
- package/dist/components/ImageNative.vue.d.ts +11 -0
- package/dist/components/ImageNative.vue.d.ts.map +1 -0
- package/dist/components/Info.vue.d.ts +26 -0
- package/dist/components/Info.vue.d.ts.map +1 -0
- package/dist/components/Input.vue.d.ts +51 -0
- package/dist/components/Input.vue.d.ts.map +1 -0
- package/dist/components/Lightbox.vue.d.ts +9 -0
- package/dist/components/Lightbox.vue.d.ts.map +1 -0
- package/dist/components/LightboxGallery.vue.d.ts +22 -0
- package/dist/components/LightboxGallery.vue.d.ts.map +1 -0
- package/dist/components/LightboxGalleryItem.vue.d.ts +29 -0
- package/dist/components/LightboxGalleryItem.vue.d.ts.map +1 -0
- package/dist/components/Link.vue.d.ts +29 -0
- package/dist/components/Link.vue.d.ts.map +1 -0
- package/dist/components/Loading.vue.d.ts +19 -0
- package/dist/components/Loading.vue.d.ts.map +1 -0
- package/dist/components/Loli.vue.d.ts +5 -0
- package/dist/components/Loli.vue.d.ts.map +1 -0
- package/dist/components/LoliProvider.vue.d.ts +4 -0
- package/dist/components/LoliProvider.vue.d.ts.map +1 -0
- package/dist/components/Markdown.vue.d.ts +4 -0
- package/dist/components/Markdown.vue.d.ts.map +1 -0
- package/dist/components/MessageItem.vue.d.ts +17 -0
- package/dist/components/MessageItem.vue.d.ts.map +1 -0
- package/dist/components/MessageProvider.vue.d.ts +4 -0
- package/dist/components/MessageProvider.vue.d.ts.map +1 -0
- package/dist/components/Modal.vue.d.ts +35 -0
- package/dist/components/Modal.vue.d.ts.map +1 -0
- package/dist/components/Null.vue.d.ts +8 -0
- package/dist/components/Null.vue.d.ts.map +1 -0
- package/dist/components/Pagination.vue.d.ts +9 -0
- package/dist/components/Pagination.vue.d.ts.map +1 -0
- package/dist/components/Popover.vue.d.ts +26 -0
- package/dist/components/Popover.vue.d.ts.map +1 -0
- package/dist/components/Progress.vue.d.ts +16 -0
- package/dist/components/Progress.vue.d.ts.map +1 -0
- package/dist/components/RadioGroup.vue.d.ts +25 -0
- package/dist/components/RadioGroup.vue.d.ts.map +1 -0
- package/dist/components/Rating.vue.d.ts +22 -0
- package/dist/components/Rating.vue.d.ts.map +1 -0
- package/dist/components/Ripple.vue.d.ts +8 -0
- package/dist/components/Ripple.vue.d.ts.map +1 -0
- package/dist/components/ScrollShadow.vue.d.ts +21 -0
- package/dist/components/ScrollShadow.vue.d.ts.map +1 -0
- package/dist/components/Select.vue.d.ts +25 -0
- package/dist/components/Select.vue.d.ts.map +1 -0
- package/dist/components/Slider.vue.d.ts +18 -0
- package/dist/components/Slider.vue.d.ts.map +1 -0
- package/dist/components/Switch.vue.d.ts +19 -0
- package/dist/components/Switch.vue.d.ts.map +1 -0
- package/dist/components/Tab.vue.d.ts +28 -0
- package/dist/components/Tab.vue.d.ts.map +1 -0
- package/dist/components/TagInput.vue.d.ts +59 -0
- package/dist/components/TagInput.vue.d.ts.map +1 -0
- package/dist/components/Text.vue.d.ts +8 -0
- package/dist/components/Text.vue.d.ts.map +1 -0
- package/dist/components/Textarea.vue.d.ts +45 -0
- package/dist/components/Textarea.vue.d.ts.map +1 -0
- package/dist/components/Tooltip.vue.d.ts +25 -0
- package/dist/components/Tooltip.vue.d.ts.map +1 -0
- package/dist/components/Upload.vue.d.ts +16 -0
- package/dist/components/Upload.vue.d.ts.map +1 -0
- package/dist/components/UserChip.vue.d.ts +11 -0
- package/dist/components/UserChip.vue.d.ts.map +1 -0
- package/dist/components/types.d.ts +465 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/composables/useBodyScrollLock.d.ts +5 -0
- package/dist/composables/useBodyScrollLock.d.ts.map +1 -0
- package/dist/composables/useCalendar.d.ts +36 -0
- package/dist/composables/useCalendar.d.ts.map +1 -0
- package/dist/composables/useContentLightbox.d.ts +18 -0
- package/dist/composables/useContentLightbox.d.ts.map +1 -0
- package/dist/composables/useFilePicker.d.ts +14 -0
- package/dist/composables/useFilePicker.d.ts.map +1 -0
- package/dist/composables/useImageLoadingStatus.d.ts +12 -0
- package/dist/composables/useImageLoadingStatus.d.ts.map +1 -0
- package/dist/composables/useKunAlert.d.ts +29 -0
- package/dist/composables/useKunAlert.d.ts.map +1 -0
- package/dist/composables/useKunCopy.d.ts +2 -0
- package/dist/composables/useKunCopy.d.ts.map +1 -0
- package/dist/composables/useKunLoliInfo.d.ts +10 -0
- package/dist/composables/useKunLoliInfo.d.ts.map +1 -0
- package/dist/composables/useKunMessage.d.ts +17 -0
- package/dist/composables/useKunMessage.d.ts.map +1 -0
- package/dist/composables/useKunUniqueId.d.ts +2 -0
- package/dist/composables/useKunUniqueId.d.ts.map +1 -0
- package/dist/composables/useResolvedRounded.d.ts +4 -0
- package/dist/composables/useResolvedRounded.d.ts.map +1 -0
- package/dist/composables/useRipple.d.ts +21 -0
- package/dist/composables/useRipple.d.ts.map +1 -0
- package/dist/composables/useSpoilerContent.d.ts +3 -0
- package/dist/composables/useSpoilerContent.d.ts.map +1 -0
- package/dist/config/useKunUIConfig.d.ts +42 -0
- package/dist/config/useKunUIConfig.d.ts.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4612 -0
- package/dist/style.css +2 -0
- package/dist/utils/extractTextFromVNodes.d.ts +3 -0
- package/dist/utils/extractTextFromVNodes.d.ts.map +1 -0
- package/dist/utils/handleFileChange.d.ts +3 -0
- package/dist/utils/handleFileChange.d.ts.map +1 -0
- package/dist/utils/loliAssets.d.ts +6 -0
- package/dist/utils/loliAssets.d.ts.map +1 -0
- package/package.json +61 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4612 @@
|
|
|
1
|
+
import { Comment as e, Fragment as t, Teleport as n, Text as r, Transition as i, TransitionGroup as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createStaticVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, inject as h, isRef as g, mergeModels as _, mergeProps as v, nextTick as y, normalizeClass as b, normalizeStyle as x, onBeforeUnmount as S, onMounted as C, onUnmounted as w, openBlock as T, provide as E, reactive as D, ref as O, renderList as k, renderSlot as A, resolveDynamicComponent as j, toDisplayString as M, toRefs as N, unref as P, useCssVars as F, useId as I, useModel as L, useSlots as ee, vModelText as R, watch as z, watchEffect as B, withCtx as V, withDirectives as te, withKeys as ne, withModifiers as H } from "vue";
|
|
2
|
+
import { KUN_DEFAULT_ROUNDED as re, cn as U, decodeIfEncoded as ie, decodeIfEncoded as ae, getKunIcon as oe, getRandomSticker as W, getRandomSticker as se, kunBgClasses as G, kunBorderClasses as K, kunRingClasses as ce, kunRoundedClasses as q, kunSoftBgClasses as J, kunTextClasses as le, kunVariantClasses as ue, randomNum as de, resolveRounded as fe } from "@kungal/core";
|
|
3
|
+
import { onClickOutside as pe, onKeyStroke as me, useElementSize as he, useEventListener as ge, useMediaQuery as _e, useScroll as ve } from "@vueuse/core";
|
|
4
|
+
import { useFocusTrap as ye } from "@vueuse/integrations/useFocusTrap";
|
|
5
|
+
import { autoUpdate as be, flip as xe, offset as Se, shift as Ce, size as we, useFloating as Te } from "@floating-ui/vue";
|
|
6
|
+
import { addMonths as Ee, addYears as De, eachDayOfInterval as Oe, endOfMonth as ke, endOfWeek as Ae, format as je, isAfter as Me, isBefore as Ne, isSameDay as Pe, isSameMonth as Fe, isToday as Ie, isValid as Le, parseISO as Re, startOfDay as ze, startOfMonth as Be, startOfToday as Ve, startOfWeek as He } from "date-fns";
|
|
7
|
+
import { enUS as Ue, ja as We, zhCN as Ge } from "date-fns/locale";
|
|
8
|
+
import { Cropper as Ke } from "vue-advanced-cropper";
|
|
9
|
+
import "vue-advanced-cropper/dist/style.css";
|
|
10
|
+
import "vue-advanced-cropper/dist/theme.compact.css";
|
|
11
|
+
//#region src/composables/useKunAlert.ts
|
|
12
|
+
var qe = O({
|
|
13
|
+
show: !1,
|
|
14
|
+
title: "",
|
|
15
|
+
message: "",
|
|
16
|
+
showCancel: !0
|
|
17
|
+
}), Je = null, Ye = () => ({
|
|
18
|
+
state: qe,
|
|
19
|
+
handleConfirm: () => {
|
|
20
|
+
qe.value.show = !1, Je?.(!0), Je = null;
|
|
21
|
+
},
|
|
22
|
+
handleCancel: () => {
|
|
23
|
+
qe.value.show = !1, Je?.(!1), Je = null;
|
|
24
|
+
}
|
|
25
|
+
}), Xe = (e = {}) => new Promise((t) => {
|
|
26
|
+
Je = t, qe.value = {
|
|
27
|
+
show: !0,
|
|
28
|
+
title: e.title ?? "",
|
|
29
|
+
message: e.message ?? "",
|
|
30
|
+
showCancel: e.showCancel ?? !0
|
|
31
|
+
};
|
|
32
|
+
}), Ze = Symbol("kun-ui-config"), Qe = {
|
|
33
|
+
rounded: re,
|
|
34
|
+
linkComponent: "a",
|
|
35
|
+
iconComponent: null,
|
|
36
|
+
navigate: (e) => {
|
|
37
|
+
typeof window < "u" && window.location.assign(e);
|
|
38
|
+
},
|
|
39
|
+
imageComponent: "img",
|
|
40
|
+
userLinkTemplate: "/user/{id}/info"
|
|
41
|
+
}, $e = (e = {}) => {
|
|
42
|
+
E(Ze, {
|
|
43
|
+
...Qe,
|
|
44
|
+
...e
|
|
45
|
+
});
|
|
46
|
+
}, et = (e, t = {}) => {
|
|
47
|
+
e.provide(Ze, {
|
|
48
|
+
...Qe,
|
|
49
|
+
...t
|
|
50
|
+
});
|
|
51
|
+
}, Y = () => h(Ze, Qe), X = (e, t) => {
|
|
52
|
+
let n = Y();
|
|
53
|
+
return o(() => fe(e(), t, n.rounded));
|
|
54
|
+
}, tt = () => {
|
|
55
|
+
let e = O([]), t = /* @__PURE__ */ new Set();
|
|
56
|
+
return w(() => {
|
|
57
|
+
t.forEach((e) => clearTimeout(e)), t.clear(), e.value = [];
|
|
58
|
+
}), {
|
|
59
|
+
ripples: e,
|
|
60
|
+
onClick: (n) => {
|
|
61
|
+
let r = n.currentTarget, i = Math.max(r.clientWidth, r.clientHeight), a = r.getBoundingClientRect();
|
|
62
|
+
e.value.push({
|
|
63
|
+
key: Date.now(),
|
|
64
|
+
size: i,
|
|
65
|
+
x: n.clientX - a.left - i / 2,
|
|
66
|
+
y: n.clientY - a.top - i / 2
|
|
67
|
+
});
|
|
68
|
+
let o = setTimeout(() => {
|
|
69
|
+
e.value.shift(), t.delete(o);
|
|
70
|
+
}, 600);
|
|
71
|
+
t.add(o);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}, nt = (t) => {
|
|
75
|
+
let n = "";
|
|
76
|
+
for (let i of t) if (i.type === r) n += i.children;
|
|
77
|
+
else if (i.type === e) continue;
|
|
78
|
+
else Array.isArray(i.children) && (n += nt(i.children));
|
|
79
|
+
return n;
|
|
80
|
+
}, rt = ["viewBox", "innerHTML"], Z = /* @__PURE__ */ m({
|
|
81
|
+
name: "KunIcon",
|
|
82
|
+
__name: "Icon",
|
|
83
|
+
props: {
|
|
84
|
+
name: { default: "" },
|
|
85
|
+
class: { default: "" },
|
|
86
|
+
className: { default: "" }
|
|
87
|
+
},
|
|
88
|
+
setup(e) {
|
|
89
|
+
let t = e, n = Y(), r = o(() => U("inline-block size-[1em] shrink-0 align-[-0.125em] text-inherit", t.class, t.className)), i = o(() => t.name ? oe(t.name) : void 0);
|
|
90
|
+
return (t, a) => i.value ? (T(), l("svg", {
|
|
91
|
+
key: 0,
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
+
viewBox: `0 0 ${i.value.width ?? 24} ${i.value.height ?? 24}`,
|
|
94
|
+
class: b(r.value),
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
innerHTML: i.value.body
|
|
97
|
+
}, null, 10, rt)) : e.name && P(n).iconComponent ? (T(), s(j(P(n).iconComponent), {
|
|
98
|
+
key: 1,
|
|
99
|
+
name: e.name,
|
|
100
|
+
class: b(r.value)
|
|
101
|
+
}, null, 8, ["name", "class"])) : c("", !0);
|
|
102
|
+
}
|
|
103
|
+
}), it = /*@__PURE__*/ m({
|
|
104
|
+
name: "KunRipple",
|
|
105
|
+
__name: "Ripple",
|
|
106
|
+
props: { ripples: {} },
|
|
107
|
+
setup(e) {
|
|
108
|
+
return (n, r) => (T(!0), l(t, null, k(e.ripples, (e) => (T(), l("span", {
|
|
109
|
+
key: e.key,
|
|
110
|
+
class: "bg-foreground/30 ripple pointer-events-none absolute rounded-full",
|
|
111
|
+
style: x({
|
|
112
|
+
width: `${e.size}px`,
|
|
113
|
+
height: `${e.size}px`,
|
|
114
|
+
top: `${e.y}px`,
|
|
115
|
+
left: `${e.x}px`
|
|
116
|
+
})
|
|
117
|
+
}, null, 4))), 128));
|
|
118
|
+
}
|
|
119
|
+
}), Q = (e, t) => {
|
|
120
|
+
let n = e.__vccOpts || e;
|
|
121
|
+
for (let [e, r] of t) n[e] = r;
|
|
122
|
+
return n;
|
|
123
|
+
}, at = /*#__PURE__*/ Q(it, [["__scopeId", "data-v-d7e2a8cf"]]), ot = {
|
|
124
|
+
key: 1,
|
|
125
|
+
class: "mr-2"
|
|
126
|
+
}, st = {
|
|
127
|
+
key: 2,
|
|
128
|
+
class: "ml-2"
|
|
129
|
+
}, $ = /* @__PURE__ */ m({
|
|
130
|
+
name: "KunButton",
|
|
131
|
+
__name: "Button",
|
|
132
|
+
props: {
|
|
133
|
+
variant: { default: "solid" },
|
|
134
|
+
color: { default: "primary" },
|
|
135
|
+
size: { default: "md" },
|
|
136
|
+
rounded: { default: "lg" },
|
|
137
|
+
type: { default: "button" },
|
|
138
|
+
disabled: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: !1
|
|
141
|
+
},
|
|
142
|
+
loading: {
|
|
143
|
+
type: Boolean,
|
|
144
|
+
default: !1
|
|
145
|
+
},
|
|
146
|
+
fullWidth: {
|
|
147
|
+
type: Boolean,
|
|
148
|
+
default: !1
|
|
149
|
+
},
|
|
150
|
+
isIconOnly: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: !1
|
|
153
|
+
},
|
|
154
|
+
icon: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
default: !1
|
|
157
|
+
},
|
|
158
|
+
iconPosition: { default: "left" },
|
|
159
|
+
className: { default: "" },
|
|
160
|
+
href: { default: "" },
|
|
161
|
+
target: { default: "_self" },
|
|
162
|
+
ariaLabel: { default: "" }
|
|
163
|
+
},
|
|
164
|
+
emits: ["click"],
|
|
165
|
+
setup(e, { emit: t }) {
|
|
166
|
+
let n = e, r = t, i = ee(), a = Y(), u = o(() => n.ariaLabel ? n.ariaLabel : n.isIconOnly ? "button" : i.default && nt(i.default()).trim() || ""), d = o(() => {
|
|
167
|
+
switch (n.size) {
|
|
168
|
+
case "xs": return "text-xs px-2 py-1";
|
|
169
|
+
case "sm": return "text-sm px-3 py-1.5";
|
|
170
|
+
case "md": return "text-sm px-4 py-2";
|
|
171
|
+
case "lg": return "text-base px-5 py-2.5";
|
|
172
|
+
case "xl": return "text-lg px-6 py-3";
|
|
173
|
+
default: return "text-sm px-4 py-2";
|
|
174
|
+
}
|
|
175
|
+
}), f = o(() => ue(n.variant, n.color)), m = X(() => n.rounded), h = o(() => q[m.value]), g = o(() => {
|
|
176
|
+
if (!n.isIconOnly) return "";
|
|
177
|
+
switch (n.size) {
|
|
178
|
+
case "xs": return "p-1";
|
|
179
|
+
case "sm": return "p-1.5";
|
|
180
|
+
case "md": return "p-2";
|
|
181
|
+
case "lg": return "p-2.5";
|
|
182
|
+
case "xl": return "p-3";
|
|
183
|
+
default: return "p-2";
|
|
184
|
+
}
|
|
185
|
+
}), { ripples: _, onClick: y } = tt(), b = o(() => n.disabled || n.loading), x = o(() => n.href ? a.linkComponent : "button"), S = o(() => n.href ? {
|
|
186
|
+
...typeof a.linkComponent == "string" ? { href: n.href } : { to: n.href },
|
|
187
|
+
target: n.target,
|
|
188
|
+
role: "link",
|
|
189
|
+
"aria-label": u.value
|
|
190
|
+
} : {
|
|
191
|
+
type: n.type,
|
|
192
|
+
disabled: n.disabled || n.loading,
|
|
193
|
+
role: "button",
|
|
194
|
+
"aria-label": u.value
|
|
195
|
+
}), C = (e) => {
|
|
196
|
+
if (n.disabled || n.loading) {
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
y(e), r("click", e);
|
|
201
|
+
};
|
|
202
|
+
return (t, n) => (T(), s(j(x.value), v(S.value, {
|
|
203
|
+
class: P(U)("relative inline-flex cursor-pointer items-center justify-center gap-1 overflow-hidden font-medium transition-all hover:opacity-80 active:scale-[0.97]", d.value, f.value, h.value, e.fullWidth ? "w-full" : "", g.value, b.value && "pointer-events-none cursor-not-allowed opacity-50 hover:bg-none", e.className),
|
|
204
|
+
onClick: C
|
|
205
|
+
}), {
|
|
206
|
+
default: V(() => [
|
|
207
|
+
e.loading ? (T(), s(Z, {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: "text-sm",
|
|
210
|
+
name: "svg-spinners:90-ring-with-bg"
|
|
211
|
+
})) : c("", !0),
|
|
212
|
+
e.icon && e.iconPosition === "left" ? (T(), l("span", ot, [A(t.$slots, "icon")])) : c("", !0),
|
|
213
|
+
A(t.$slots, "default"),
|
|
214
|
+
e.icon && e.iconPosition === "right" ? (T(), l("span", st, [A(t.$slots, "icon")])) : c("", !0),
|
|
215
|
+
p(at, { ripples: P(_) }, null, 8, ["ripples"])
|
|
216
|
+
]),
|
|
217
|
+
_: 3
|
|
218
|
+
}, 16, ["class"]));
|
|
219
|
+
}
|
|
220
|
+
}), ct = 0, lt = (e) => {
|
|
221
|
+
typeof document > "u" || (document.body.style.overflow = e ? "hidden" : "", document.body.style.paddingRight = e ? `${window.innerWidth - document.documentElement.clientWidth}px` : "");
|
|
222
|
+
}, ut = () => {
|
|
223
|
+
ct === 0 && lt(!0), ct++;
|
|
224
|
+
}, dt = () => {
|
|
225
|
+
ct !== 0 && (ct--, ct === 0 && lt(!1));
|
|
226
|
+
}, ft = () => ({
|
|
227
|
+
lock: ut,
|
|
228
|
+
unlock: dt
|
|
229
|
+
}), pt = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
230
|
+
name: "KunModal",
|
|
231
|
+
__name: "Modal",
|
|
232
|
+
props: /*@__PURE__*/ _({
|
|
233
|
+
className: { default: "" },
|
|
234
|
+
innerClassName: { default: "" },
|
|
235
|
+
isDismissable: {
|
|
236
|
+
type: Boolean,
|
|
237
|
+
default: !0
|
|
238
|
+
},
|
|
239
|
+
isShowCloseButton: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: !0
|
|
242
|
+
},
|
|
243
|
+
withContainer: {
|
|
244
|
+
type: Boolean,
|
|
245
|
+
default: !0
|
|
246
|
+
},
|
|
247
|
+
rounded: { default: void 0 }
|
|
248
|
+
}, {
|
|
249
|
+
modelValue: {
|
|
250
|
+
type: Boolean,
|
|
251
|
+
required: !0
|
|
252
|
+
},
|
|
253
|
+
modelModifiers: {}
|
|
254
|
+
}),
|
|
255
|
+
emits: /*@__PURE__*/ _(["close"], ["update:modelValue"]),
|
|
256
|
+
setup(e, { emit: t }) {
|
|
257
|
+
let r = e, a = X(() => r.rounded, "lg"), u = o(() => q[a.value]), d = L(e, "modelValue"), f = t, { lock: m, unlock: h } = ft(), g = !1, _ = (e) => {
|
|
258
|
+
e && !g ? (m(), g = !0) : !e && g && (h(), g = !1);
|
|
259
|
+
}, v = O(null), { activate: x, deactivate: S } = ye(v, {
|
|
260
|
+
immediate: !1,
|
|
261
|
+
escapeDeactivates: !1,
|
|
262
|
+
allowOutsideClick: !0,
|
|
263
|
+
returnFocusOnDeactivate: !0
|
|
264
|
+
}), E = () => {
|
|
265
|
+
r.isDismissable && (d.value = !1, f("close"));
|
|
266
|
+
};
|
|
267
|
+
return ge("keydown", (e) => {
|
|
268
|
+
e.key === "Escape" && d.value && E();
|
|
269
|
+
}), z(d, async (e) => {
|
|
270
|
+
_(e), e ? (await y(), x()) : S();
|
|
271
|
+
}), C(async () => {
|
|
272
|
+
d.value && (_(!0), await y(), x());
|
|
273
|
+
}), w(() => {
|
|
274
|
+
_(!1), S();
|
|
275
|
+
}), (t, r) => (T(), s(n, { to: "body" }, [p(i, { name: "kun-modal" }, {
|
|
276
|
+
default: V(() => [d.value ? (T(), l("div", {
|
|
277
|
+
key: 0,
|
|
278
|
+
ref_key: "trapEl",
|
|
279
|
+
ref: v,
|
|
280
|
+
class: b(P(U)("bg-default-800/70 dark:bg-background/70 fixed top-0 left-0 z-kun-modal flex h-full w-full items-center justify-center p-3 transition-all", e.className)),
|
|
281
|
+
onClick: E,
|
|
282
|
+
tabindex: "0"
|
|
283
|
+
}, [e.withContainer ? (T(), l("div", {
|
|
284
|
+
key: 0,
|
|
285
|
+
class: b(P(U)("bg-content1/85 scrollbar-hide relative m-auto max-h-[90vh] min-w-80 overflow-y-auto border p-6 backdrop-blur-[var(--kun-background-blur)] transition-all", u.value, e.innerClassName)),
|
|
286
|
+
onClick: r[1] ||= H(() => {}, ["stop"])
|
|
287
|
+
}, [A(t.$slots, "default", {}, void 0, !0), e.isShowCloseButton ? (T(), s($, {
|
|
288
|
+
key: 0,
|
|
289
|
+
color: "default",
|
|
290
|
+
variant: "light",
|
|
291
|
+
"class-name": "absolute top-1 right-1",
|
|
292
|
+
rounded: "full",
|
|
293
|
+
"is-icon-only": !0,
|
|
294
|
+
onClick: r[0] ||= () => {
|
|
295
|
+
d.value = !1, f("close");
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
default: V(() => [p(Z, {
|
|
299
|
+
class: "icon",
|
|
300
|
+
name: "lucide:x"
|
|
301
|
+
})]),
|
|
302
|
+
_: 1
|
|
303
|
+
})) : c("", !0)], 2)) : A(t.$slots, "default", { key: 1 }, void 0, !0)], 2)) : c("", !0)]),
|
|
304
|
+
_: 3
|
|
305
|
+
})]));
|
|
306
|
+
}
|
|
307
|
+
}), [["__scopeId", "data-v-cae13129"]]), mt = { class: "max-w-80" }, ht = { class: "space-y-2" }, gt = {
|
|
308
|
+
key: 0,
|
|
309
|
+
class: "text-lg"
|
|
310
|
+
}, _t = {
|
|
311
|
+
key: 1,
|
|
312
|
+
class: "text-sm"
|
|
313
|
+
}, vt = { class: "mt-6 flex justify-end gap-2" }, yt = /* @__PURE__ */ m({
|
|
314
|
+
name: "KunAlertProvider",
|
|
315
|
+
__name: "AlertProvider",
|
|
316
|
+
setup(e) {
|
|
317
|
+
let { state: t, handleConfirm: n, handleCancel: r } = Ye();
|
|
318
|
+
return (e, i) => (T(), s(pt, {
|
|
319
|
+
"model-value": P(t).show,
|
|
320
|
+
"class-name": "z-kun-alert fixed",
|
|
321
|
+
"onUpdate:modelValue": i[0] ||= (e) => !e && P(r)()
|
|
322
|
+
}, {
|
|
323
|
+
default: V(() => [u("div", mt, [u("div", ht, [P(t).title ? (T(), l("h3", gt, M(P(t).title), 1)) : c("", !0), P(t).message ? (T(), l("p", _t, M(P(t).message), 1)) : c("", !0)]), u("div", vt, [P(t).showCancel ? (T(), s($, {
|
|
324
|
+
key: 0,
|
|
325
|
+
variant: "light",
|
|
326
|
+
color: "danger",
|
|
327
|
+
onClick: P(r)
|
|
328
|
+
}, {
|
|
329
|
+
default: V(() => [...i[1] ||= [f(" 取消 ", -1)]]),
|
|
330
|
+
_: 1
|
|
331
|
+
}, 8, ["onClick"])) : c("", !0), p($, { onClick: P(n) }, {
|
|
332
|
+
default: V(() => [...i[2] ||= [f("确定", -1)]]),
|
|
333
|
+
_: 1
|
|
334
|
+
}, 8, ["onClick"])])])]),
|
|
335
|
+
_: 1
|
|
336
|
+
}, 8, ["model-value"]));
|
|
337
|
+
}
|
|
338
|
+
}), bt = (e) => {
|
|
339
|
+
if (!e) return null;
|
|
340
|
+
if (e instanceof HTMLImageElement) return e;
|
|
341
|
+
let t = e.$el;
|
|
342
|
+
return t instanceof HTMLImageElement ? t : null;
|
|
343
|
+
}, xt = (e, t) => {
|
|
344
|
+
let n = O(t.value ? "loading" : "error"), r = () => {
|
|
345
|
+
if (!t.value) {
|
|
346
|
+
n.value = "error";
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
let r = bt(e.value);
|
|
350
|
+
if (r) {
|
|
351
|
+
if (!r.complete) {
|
|
352
|
+
n.value = "loading";
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
n.value = r.naturalWidth === 0 ? "error" : "loaded";
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
return C(r), z(t, (e) => {
|
|
359
|
+
n.value = e ? "loading" : "error", y(r);
|
|
360
|
+
}), {
|
|
361
|
+
status: o(() => n.value),
|
|
362
|
+
onLoad: () => {
|
|
363
|
+
n.value = "loaded";
|
|
364
|
+
},
|
|
365
|
+
onError: () => {
|
|
366
|
+
n.value = "error";
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}, St = /* @__PURE__ */ m({
|
|
370
|
+
name: "KunImage",
|
|
371
|
+
__name: "Image",
|
|
372
|
+
props: {
|
|
373
|
+
src: {},
|
|
374
|
+
alt: { default: "image" },
|
|
375
|
+
loading: { default: void 0 },
|
|
376
|
+
className: { default: void 0 },
|
|
377
|
+
ariaLabel: { default: void 0 },
|
|
378
|
+
width: { default: void 0 },
|
|
379
|
+
height: { default: void 0 },
|
|
380
|
+
skeleton: {
|
|
381
|
+
type: Boolean,
|
|
382
|
+
default: !0
|
|
383
|
+
},
|
|
384
|
+
aspectRatio: { default: void 0 },
|
|
385
|
+
objectFit: { default: "cover" },
|
|
386
|
+
imageClassName: { default: void 0 },
|
|
387
|
+
decoding: { default: void 0 },
|
|
388
|
+
fetchpriority: { default: void 0 },
|
|
389
|
+
placeholder: {
|
|
390
|
+
type: [
|
|
391
|
+
String,
|
|
392
|
+
Number,
|
|
393
|
+
Boolean,
|
|
394
|
+
Array
|
|
395
|
+
],
|
|
396
|
+
default: void 0
|
|
397
|
+
},
|
|
398
|
+
format: { default: void 0 },
|
|
399
|
+
quality: { default: void 0 },
|
|
400
|
+
preload: {
|
|
401
|
+
type: [Boolean, Object],
|
|
402
|
+
default: void 0
|
|
403
|
+
},
|
|
404
|
+
provider: { default: void 0 },
|
|
405
|
+
densities: { default: void 0 },
|
|
406
|
+
sizes: { default: void 0 }
|
|
407
|
+
},
|
|
408
|
+
setup(e) {
|
|
409
|
+
let t = e, n = Y(), r = o(() => n.imageComponent ?? "img"), i = o(() => typeof r.value == "string"), a = O(null), { status: u, onLoad: d, onError: f } = xt(a, o(() => t.src)), p = o(() => ({
|
|
410
|
+
src: t.src,
|
|
411
|
+
alt: t.alt,
|
|
412
|
+
loading: t.loading,
|
|
413
|
+
width: t.width,
|
|
414
|
+
height: t.height,
|
|
415
|
+
decoding: t.decoding,
|
|
416
|
+
fetchpriority: t.fetchpriority,
|
|
417
|
+
"aria-label": t.ariaLabel
|
|
418
|
+
})), m = o(() => i.value ? p.value : {
|
|
419
|
+
...p.value,
|
|
420
|
+
placeholder: t.placeholder,
|
|
421
|
+
format: t.format,
|
|
422
|
+
quality: t.quality,
|
|
423
|
+
preload: t.preload,
|
|
424
|
+
provider: t.provider,
|
|
425
|
+
densities: t.densities,
|
|
426
|
+
sizes: t.sizes
|
|
427
|
+
}), h = o(() => {
|
|
428
|
+
switch (t.objectFit) {
|
|
429
|
+
case "contain": return "object-contain";
|
|
430
|
+
case "fill": return "object-fill";
|
|
431
|
+
case "none": return "object-none";
|
|
432
|
+
case "scale-down": return "object-scale-down";
|
|
433
|
+
default: return "object-cover";
|
|
434
|
+
}
|
|
435
|
+
}), g = o(() => t.aspectRatio ? { aspectRatio: t.aspectRatio } : void 0), _ = o(() => t.skeleton);
|
|
436
|
+
return (t, n) => _.value ? (T(), l("div", {
|
|
437
|
+
key: 1,
|
|
438
|
+
class: b(P(U)("relative overflow-hidden", e.aspectRatio ? "block w-full" : "inline-block", e.className)),
|
|
439
|
+
style: x(g.value)
|
|
440
|
+
}, [P(u) === "loaded" ? c("", !0) : (T(), l("div", {
|
|
441
|
+
key: 0,
|
|
442
|
+
"aria-hidden": "true",
|
|
443
|
+
class: b(["pointer-events-none absolute inset-0 transition-opacity duration-300", P(u) === "error" ? "opacity-0" : "bg-default-200 animate-pulse opacity-100"])
|
|
444
|
+
}, null, 2)), (T(), s(j(r.value), v({
|
|
445
|
+
ref_key: "imgEl",
|
|
446
|
+
ref: a
|
|
447
|
+
}, m.value, {
|
|
448
|
+
class: P(U)("block size-full transition-opacity duration-300", e.aspectRatio ? "absolute inset-0" : "", h.value, P(u) === "loaded" ? "opacity-100" : "opacity-0", e.imageClassName),
|
|
449
|
+
onLoad: P(d),
|
|
450
|
+
onError: P(f)
|
|
451
|
+
}), null, 16, [
|
|
452
|
+
"class",
|
|
453
|
+
"onLoad",
|
|
454
|
+
"onError"
|
|
455
|
+
]))], 6)) : (T(), s(j(r.value), v({ key: 0 }, m.value, { class: P(U)(e.className, e.imageClassName) }), null, 16, ["class"]));
|
|
456
|
+
}
|
|
457
|
+
}), Ct = /* @__PURE__ */ m({
|
|
458
|
+
name: "KunAvatar",
|
|
459
|
+
__name: "Avatar",
|
|
460
|
+
props: {
|
|
461
|
+
user: {},
|
|
462
|
+
size: { default: "md" },
|
|
463
|
+
isNavigation: {
|
|
464
|
+
type: Boolean,
|
|
465
|
+
default: !0
|
|
466
|
+
},
|
|
467
|
+
className: { default: "" },
|
|
468
|
+
imageClassName: { default: "" },
|
|
469
|
+
disableFloating: { type: Boolean },
|
|
470
|
+
floatingPosition: {}
|
|
471
|
+
},
|
|
472
|
+
setup(e) {
|
|
473
|
+
let t = e, n = Y(), r = async (e) => {
|
|
474
|
+
e.preventDefault(), !(!t.isNavigation || !t.user?.id) && await n.navigate(n.userLinkTemplate.replace("{id}", String(t.user.id)));
|
|
475
|
+
}, i = o(() => {
|
|
476
|
+
switch (t.size) {
|
|
477
|
+
case "original": return "size-40";
|
|
478
|
+
case "original-sm": return "size-24";
|
|
479
|
+
case "xs": return "size-4";
|
|
480
|
+
case "sm": return "size-6";
|
|
481
|
+
case "lg": return "size-10";
|
|
482
|
+
case "xl": return "size-12";
|
|
483
|
+
default: return "size-8";
|
|
484
|
+
}
|
|
485
|
+
}), a = o(() => {
|
|
486
|
+
let e = t.user;
|
|
487
|
+
return e?.avatar ? t.size === "original" || t.size === "original-sm" ? e.avatar : e.avatar.replace(/\.webp$/, "-100.webp") : se(e?.name ?? "");
|
|
488
|
+
});
|
|
489
|
+
return (n, o) => (T(), l("div", {
|
|
490
|
+
class: b(P(U)("flex shrink-0 cursor-pointer justify-center rounded-full transition duration-150 ease-in-out hover:scale-110", i.value, e.className)),
|
|
491
|
+
onClick: o[0] ||= (e) => r(e)
|
|
492
|
+
}, [p(St, {
|
|
493
|
+
"class-name": P(U)("inline-block rounded-full", i.value, t.imageClassName),
|
|
494
|
+
src: a.value,
|
|
495
|
+
alt: e.user?.name ?? "未知用户"
|
|
496
|
+
}, null, 8, [
|
|
497
|
+
"class-name",
|
|
498
|
+
"src",
|
|
499
|
+
"alt"
|
|
500
|
+
])], 2));
|
|
501
|
+
}
|
|
502
|
+
}), wt = { class: "flex flex-wrap items-center gap-1" }, Tt = {
|
|
503
|
+
key: 0,
|
|
504
|
+
class: "bg-default-500/20 flex items-center justify-center rounded-full px-2 py-2 text-xs"
|
|
505
|
+
}, Et = /* @__PURE__ */ m({
|
|
506
|
+
name: "KunAvatarGroup",
|
|
507
|
+
__name: "AvatarGroup",
|
|
508
|
+
props: {
|
|
509
|
+
users: {},
|
|
510
|
+
ellipsis: {
|
|
511
|
+
type: Boolean,
|
|
512
|
+
default: !0
|
|
513
|
+
},
|
|
514
|
+
visibleCount: { default: 5 },
|
|
515
|
+
total: { default: 0 }
|
|
516
|
+
},
|
|
517
|
+
setup(e) {
|
|
518
|
+
let n = e, r = o(() => n.ellipsis ? n.users.slice(0, n.visibleCount) : n.users);
|
|
519
|
+
return (e, i) => (T(), l("div", wt, [
|
|
520
|
+
(T(!0), l(t, null, k(r.value, (e, t) => (T(), s(Ct, {
|
|
521
|
+
key: t,
|
|
522
|
+
user: e
|
|
523
|
+
}, null, 8, ["user"]))), 128)),
|
|
524
|
+
n.total && n.total > n.visibleCount ? (T(), l("div", Tt, M(`+ ${n.total - n.visibleCount}`), 1)) : c("", !0),
|
|
525
|
+
A(e.$slots, "default")
|
|
526
|
+
]));
|
|
527
|
+
}
|
|
528
|
+
}), Dt = { class: "relative inline-flex" }, Ot = /* @__PURE__ */ m({
|
|
529
|
+
name: "KunBadge",
|
|
530
|
+
__name: "Badge",
|
|
531
|
+
props: {
|
|
532
|
+
variant: { default: "count" },
|
|
533
|
+
count: { default: 0 },
|
|
534
|
+
max: { default: 99 },
|
|
535
|
+
showZero: {
|
|
536
|
+
type: Boolean,
|
|
537
|
+
default: !1
|
|
538
|
+
},
|
|
539
|
+
show: {
|
|
540
|
+
type: Boolean,
|
|
541
|
+
default: !0
|
|
542
|
+
},
|
|
543
|
+
color: { default: "danger" },
|
|
544
|
+
size: { default: "md" },
|
|
545
|
+
placement: { default: "top-right" },
|
|
546
|
+
className: { default: "" }
|
|
547
|
+
},
|
|
548
|
+
setup(e) {
|
|
549
|
+
let t = e, n = o(() => !(!t.show || t.variant === "count" && t.count <= 0 && !t.showZero)), r = o(() => t.variant === "dot" ? "" : t.count > t.max ? `${t.max}+` : String(t.count)), i = {
|
|
550
|
+
sm: "size-2",
|
|
551
|
+
md: "size-2.5",
|
|
552
|
+
lg: "size-3"
|
|
553
|
+
}, a = {
|
|
554
|
+
sm: "min-w-4 h-4 px-1 text-[10px]",
|
|
555
|
+
md: "min-w-5 h-5 px-1.5 text-xs",
|
|
556
|
+
lg: "min-w-6 h-6 px-2 text-sm"
|
|
557
|
+
}, s = {
|
|
558
|
+
"top-right": "-top-1 -right-1",
|
|
559
|
+
"top-left": "-top-1 -left-1",
|
|
560
|
+
"bottom-right": "-bottom-1 -right-1",
|
|
561
|
+
"bottom-left": "-bottom-1 -left-1"
|
|
562
|
+
}, u = o(() => U("absolute z-10 inline-flex items-center justify-center rounded-full font-medium text-white ring-2 ring-background", G[t.color], t.variant === "dot" ? i[t.size] : a[t.size], s[t.placement], t.className));
|
|
563
|
+
return (e, t) => (T(), l("span", Dt, [A(e.$slots, "default"), n.value ? (T(), l("span", {
|
|
564
|
+
key: 0,
|
|
565
|
+
class: b(u.value)
|
|
566
|
+
}, M(r.value), 3)) : c("", !0)]));
|
|
567
|
+
}
|
|
568
|
+
}), kt = /* @__PURE__ */ m({
|
|
569
|
+
name: "KunChip",
|
|
570
|
+
__name: "Chip",
|
|
571
|
+
props: {
|
|
572
|
+
className: { default: "" },
|
|
573
|
+
color: { default: "default" },
|
|
574
|
+
size: { default: "sm" },
|
|
575
|
+
variant: { default: "flat" }
|
|
576
|
+
},
|
|
577
|
+
setup(e) {
|
|
578
|
+
let t = e, n = {
|
|
579
|
+
xs: "px-2 py-0.5 text-xs",
|
|
580
|
+
sm: "px-2 py-1 text-xs",
|
|
581
|
+
md: "px-3 py-1.5 text-sm",
|
|
582
|
+
lg: "px-4 py-2 text-sm",
|
|
583
|
+
xl: "px-6 py-3 text-base"
|
|
584
|
+
};
|
|
585
|
+
return (r, i) => (T(), l("span", { class: b(P(U)("inline-flex cursor-default items-center justify-center gap-1 rounded-full font-medium", n[t.size], P(ue)(t.variant, t.color), e.className)) }, [A(r.$slots, "default")], 2));
|
|
586
|
+
}
|
|
587
|
+
}), At = /* @__PURE__ */ m({
|
|
588
|
+
name: "KunBrand",
|
|
589
|
+
__name: "Brand",
|
|
590
|
+
props: {
|
|
591
|
+
name: {},
|
|
592
|
+
iconSrc: { default: "/favicon.webp" },
|
|
593
|
+
iconAlt: { default: "logo" },
|
|
594
|
+
iconClass: { default: "size-10 rounded-2xl" },
|
|
595
|
+
badge: { default: "" },
|
|
596
|
+
badgeColor: { default: "primary" },
|
|
597
|
+
to: { default: "/" },
|
|
598
|
+
nameClass: { default: "text-xl" }
|
|
599
|
+
},
|
|
600
|
+
setup(e) {
|
|
601
|
+
let t = e, n = Y();
|
|
602
|
+
return (r, i) => (T(), l("div", {
|
|
603
|
+
class: "flex cursor-pointer items-center gap-3",
|
|
604
|
+
onClick: i[0] ||= (e) => P(n).navigate(t.to)
|
|
605
|
+
}, [
|
|
606
|
+
p(St, {
|
|
607
|
+
"class-name": e.iconClass,
|
|
608
|
+
src: e.iconSrc,
|
|
609
|
+
alt: e.iconAlt
|
|
610
|
+
}, null, 8, [
|
|
611
|
+
"class-name",
|
|
612
|
+
"src",
|
|
613
|
+
"alt"
|
|
614
|
+
]),
|
|
615
|
+
u("span", { class: b(e.nameClass) }, M(e.name), 3),
|
|
616
|
+
e.badge ? (T(), s(kt, {
|
|
617
|
+
key: 0,
|
|
618
|
+
size: "md",
|
|
619
|
+
color: e.badgeColor
|
|
620
|
+
}, {
|
|
621
|
+
default: V(() => [f(M(e.badge), 1)]),
|
|
622
|
+
_: 1
|
|
623
|
+
}, 8, ["color"])) : c("", !0)
|
|
624
|
+
]));
|
|
625
|
+
}
|
|
626
|
+
}), jt = {
|
|
627
|
+
key: 0,
|
|
628
|
+
class: "border-b"
|
|
629
|
+
}, Mt = {
|
|
630
|
+
key: 1,
|
|
631
|
+
class: "w-full"
|
|
632
|
+
}, Nt = {
|
|
633
|
+
key: 2,
|
|
634
|
+
class: "bg-default-100 border-t px-3 py-2"
|
|
635
|
+
}, Pt = /* @__PURE__ */ m({
|
|
636
|
+
name: "KunCard",
|
|
637
|
+
__name: "Card",
|
|
638
|
+
props: {
|
|
639
|
+
isHoverable: {
|
|
640
|
+
type: Boolean,
|
|
641
|
+
default: !1
|
|
642
|
+
},
|
|
643
|
+
clickable: {
|
|
644
|
+
type: Boolean,
|
|
645
|
+
default: !1
|
|
646
|
+
},
|
|
647
|
+
href: { default: void 0 },
|
|
648
|
+
isTransparent: {
|
|
649
|
+
type: Boolean,
|
|
650
|
+
default: !1
|
|
651
|
+
},
|
|
652
|
+
bordered: {
|
|
653
|
+
type: Boolean,
|
|
654
|
+
default: !0
|
|
655
|
+
},
|
|
656
|
+
className: { default: "" },
|
|
657
|
+
contentClass: { default: "" },
|
|
658
|
+
rounded: { default: void 0 },
|
|
659
|
+
color: { default: "background" },
|
|
660
|
+
darkBorder: {
|
|
661
|
+
type: Boolean,
|
|
662
|
+
default: !1
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
emits: ["click"],
|
|
666
|
+
setup(e, { emit: t }) {
|
|
667
|
+
let n = e, r = t, i = Y(), { ripples: a, onClick: d } = tt(), f = o(() => !!n.href || n.clickable), m = o(() => n.href ? i.linkComponent : n.clickable ? "button" : "div"), h = o(() => n.href ? typeof i.linkComponent == "string" ? { href: n.href } : { to: n.href } : n.clickable ? { type: "button" } : {}), g = (e) => {
|
|
668
|
+
f.value && d(e), r("click", e);
|
|
669
|
+
}, _ = {
|
|
670
|
+
background: "bg-background",
|
|
671
|
+
default: "bg-default-100/30",
|
|
672
|
+
primary: "bg-primary-100/30 border-primary-300",
|
|
673
|
+
secondary: "bg-secondary-100/30 border-secondary-300",
|
|
674
|
+
success: "bg-success-100/30 border-success-300",
|
|
675
|
+
warning: "bg-warning-100/30 border-warning-300",
|
|
676
|
+
danger: "bg-danger-100/30 border-danger-300",
|
|
677
|
+
info: "bg-info-100/30 border-info-300"
|
|
678
|
+
}, y = X(() => n.rounded), x = o(() => q[y.value]);
|
|
679
|
+
return (t, r) => (T(), s(j(m.value), v(h.value, {
|
|
680
|
+
class: P(U)("relative flex flex-col gap-3 p-3 backdrop-blur-[var(--kun-background-blur)] transition-all duration-200", e.isHoverable && "hover:bg-default-100", e.bordered && "border-default/20 border", e.darkBorder && P(U)("dark:border-default-200 border border-transparent", e.bordered && "border-default/20"), f.value && "cursor-pointer overflow-hidden active:scale-[0.97] text-left", e.isTransparent ? "backdrop-blur-none" : _[n.color], x.value, e.className),
|
|
681
|
+
onClick: g
|
|
682
|
+
}), {
|
|
683
|
+
default: V(() => [
|
|
684
|
+
t.$slots.header ? (T(), l("div", jt, [A(t.$slots, "header")])) : c("", !0),
|
|
685
|
+
t.$slots.cover ? (T(), l("div", Mt, [A(t.$slots, "cover")])) : c("", !0),
|
|
686
|
+
u("div", { class: b(P(U)("flex h-full flex-col justify-between gap-1", e.contentClass)) }, [A(t.$slots, "default")], 2),
|
|
687
|
+
t.$slots.footer ? (T(), l("div", Nt, [A(t.$slots, "footer")])) : c("", !0),
|
|
688
|
+
p(at, { ripples: P(a) }, null, 8, ["ripples"])
|
|
689
|
+
]),
|
|
690
|
+
_: 3
|
|
691
|
+
}, 16, ["class"]));
|
|
692
|
+
}
|
|
693
|
+
}), Ft = (e) => {
|
|
694
|
+
let t = O(e || "");
|
|
695
|
+
return C(() => {
|
|
696
|
+
t.value = `${e ?? ""}${I()}`;
|
|
697
|
+
}), t;
|
|
698
|
+
}, It = { class: "relative flex items-center" }, Lt = [
|
|
699
|
+
"id",
|
|
700
|
+
"name",
|
|
701
|
+
"value",
|
|
702
|
+
"checked",
|
|
703
|
+
"disabled"
|
|
704
|
+
], Rt = { class: "pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white opacity-0 transition-opacity duration-200 peer-checked:opacity-100" }, zt = ["for"], Bt = /* @__PURE__ */ m({
|
|
705
|
+
name: "KunCheckBox",
|
|
706
|
+
__name: "CheckBox",
|
|
707
|
+
props: /*@__PURE__*/ _({
|
|
708
|
+
color: { default: "default" },
|
|
709
|
+
type: { default: "multiple" },
|
|
710
|
+
label: { default: void 0 },
|
|
711
|
+
id: { default: void 0 },
|
|
712
|
+
name: { default: void 0 },
|
|
713
|
+
value: {
|
|
714
|
+
type: [
|
|
715
|
+
String,
|
|
716
|
+
Number,
|
|
717
|
+
Boolean
|
|
718
|
+
],
|
|
719
|
+
default: void 0
|
|
720
|
+
},
|
|
721
|
+
disabled: {
|
|
722
|
+
type: Boolean,
|
|
723
|
+
default: !1
|
|
724
|
+
},
|
|
725
|
+
className: { default: "" }
|
|
726
|
+
}, {
|
|
727
|
+
modelValue: {
|
|
728
|
+
type: Boolean,
|
|
729
|
+
default: !1
|
|
730
|
+
},
|
|
731
|
+
modelModifiers: {}
|
|
732
|
+
}),
|
|
733
|
+
emits: /*@__PURE__*/ _(["change"], ["update:modelValue"]),
|
|
734
|
+
setup(e, { emit: t }) {
|
|
735
|
+
let n = e, r = L(e, "modelValue"), i = t, a = Ft("kun-checkbox"), o = (e) => {
|
|
736
|
+
let t = e.target.checked;
|
|
737
|
+
r.value = t, i("change", t);
|
|
738
|
+
}, s = {
|
|
739
|
+
default: "border-default-300 checked:bg-default checked:border-default hover:border-default",
|
|
740
|
+
primary: "border-primary-300 checked:bg-primary checked:border-primary hover:border-primary",
|
|
741
|
+
secondary: "border-secondary-300 checked:bg-secondary checked:border-secondary hover:border-secondary",
|
|
742
|
+
success: "border-success-300 checked:bg-success checked:border-success hover:border-success",
|
|
743
|
+
warning: "border-warning-300 checked:bg-warning checked:border-warning hover:border-warning",
|
|
744
|
+
danger: "border-danger-300 checked:bg-danger checked:border-danger hover:border-danger",
|
|
745
|
+
info: "border-info-300 checked:bg-info checked:border-info hover:border-info"
|
|
746
|
+
};
|
|
747
|
+
return (t, i) => (T(), l("div", { class: b(P(U)("flex cursor-pointer items-center", e.className)) }, [
|
|
748
|
+
u("div", It, [u("input", {
|
|
749
|
+
id: P(a),
|
|
750
|
+
type: "checkbox",
|
|
751
|
+
name: e.name,
|
|
752
|
+
value: e.value,
|
|
753
|
+
checked: r.value,
|
|
754
|
+
disabled: e.disabled,
|
|
755
|
+
class: b(P(U)("peer h-5 w-5 appearance-none border-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50", n.type === "single" ? "rounded-full" : "rounded", s[n.color])),
|
|
756
|
+
onChange: o
|
|
757
|
+
}, null, 42, Lt), u("div", Rt, [p(Z, { name: "lucide:check" })])]),
|
|
758
|
+
A(t.$slots, "default"),
|
|
759
|
+
e.label ? (T(), l("label", {
|
|
760
|
+
key: 0,
|
|
761
|
+
for: P(a),
|
|
762
|
+
class: b(P(U)("text-default-700 ml-2 cursor-pointer text-sm select-none", e.disabled && "cursor-not-allowed opacity-50"))
|
|
763
|
+
}, M(e.label), 11, zt)) : c("", !0)
|
|
764
|
+
], 2));
|
|
765
|
+
}
|
|
766
|
+
}), Vt = (e) => {
|
|
767
|
+
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
768
|
+
let t = document.createElement("div");
|
|
769
|
+
t.className = "spoiler-frost", e.insertBefore(t, e.firstChild);
|
|
770
|
+
let n = new ResizeObserver(() => {});
|
|
771
|
+
return n.observe(e), {
|
|
772
|
+
overlayEl: t,
|
|
773
|
+
resizeObserver: n
|
|
774
|
+
};
|
|
775
|
+
}, r = (e) => {
|
|
776
|
+
if (t.has(e)) return;
|
|
777
|
+
Array.from(e.childNodes).forEach((t) => {
|
|
778
|
+
if (t.nodeType === Node.TEXT_NODE && t.textContent?.trim()) {
|
|
779
|
+
let n = document.createElement("span");
|
|
780
|
+
n.textContent = t.textContent, e.replaceChild(n, t);
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
let r = n(e), i = getComputedStyle(e);
|
|
784
|
+
(i.position === "static" || !i.position) && e.classList.add("spoiler-relative-fix"), t.set(e, r);
|
|
785
|
+
}, i = (e) => {
|
|
786
|
+
let n = t.get(e);
|
|
787
|
+
n && (n.resizeObserver.disconnect(), n.overlayEl.classList.add("fade-out"), n.overlayEl.addEventListener("transitionend", () => {
|
|
788
|
+
n.overlayEl.remove(), t.delete(e);
|
|
789
|
+
}, { once: !0 }));
|
|
790
|
+
}, a = (e) => {
|
|
791
|
+
e.classList.remove("kun-spoiler-hidden"), e.classList.add("!text-foreground"), i(e);
|
|
792
|
+
}, o = (e) => {
|
|
793
|
+
let t = e.closest(".kun-code-container")?.querySelector("pre");
|
|
794
|
+
t && navigator.clipboard.writeText(t.innerText).then(() => {
|
|
795
|
+
e.classList.add("copied"), setTimeout(() => e.classList.remove("copied"), 3e3);
|
|
796
|
+
}).catch((e) => {
|
|
797
|
+
console.error("复制失败:", e);
|
|
798
|
+
});
|
|
799
|
+
}, s = (e) => {
|
|
800
|
+
let t = e.target;
|
|
801
|
+
if (!t) return;
|
|
802
|
+
let n = t.closest(".kun-spoiler.kun-spoiler-hidden");
|
|
803
|
+
if (n) {
|
|
804
|
+
e.preventDefault(), e.stopPropagation(), a(n);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let r = t.closest(".copy");
|
|
808
|
+
r && (e.preventDefault(), e.stopPropagation(), o(r));
|
|
809
|
+
}, c = () => {
|
|
810
|
+
let t = e.value;
|
|
811
|
+
t && (t.querySelectorAll(".kun-spoiler.kun-spoiler-hidden").forEach(r), t.addEventListener("click", s));
|
|
812
|
+
}, l = () => {
|
|
813
|
+
let n = e.value;
|
|
814
|
+
n && (t.forEach((e, t) => i(t)), t.clear(), n.removeEventListener("click", s));
|
|
815
|
+
};
|
|
816
|
+
z(e, (e, t) => {
|
|
817
|
+
t && l(), e && y(c);
|
|
818
|
+
}, { flush: "post" });
|
|
819
|
+
}, Ht = (e) => {
|
|
820
|
+
let t = O([]), n = O(!1), r = O(0), i = (i) => {
|
|
821
|
+
let a = i.target;
|
|
822
|
+
if (!a || a.tagName !== "IMG") return;
|
|
823
|
+
let o = e.value;
|
|
824
|
+
if (!o) return;
|
|
825
|
+
let s = Array.from(o.querySelectorAll("img")), c = s.indexOf(a);
|
|
826
|
+
c < 0 || (i.stopPropagation(), i.preventDefault(), t.value = s.map((e) => ({
|
|
827
|
+
src: e.getAttribute("src") || e.src,
|
|
828
|
+
alt: e.getAttribute("alt") || ""
|
|
829
|
+
})), r.value = c, n.value = !0);
|
|
830
|
+
};
|
|
831
|
+
return C(() => {
|
|
832
|
+
e.value?.addEventListener("click", i);
|
|
833
|
+
}), S(() => {
|
|
834
|
+
e.value?.removeEventListener("click", i);
|
|
835
|
+
}), {
|
|
836
|
+
images: t,
|
|
837
|
+
isLightboxOpen: n,
|
|
838
|
+
currentImageIndex: r
|
|
839
|
+
};
|
|
840
|
+
}, Ut = {
|
|
841
|
+
key: 0,
|
|
842
|
+
class: "relative flex h-full w-full items-center justify-center"
|
|
843
|
+
}, Wt = ["src", "alt"], Gt = {
|
|
844
|
+
key: 0,
|
|
845
|
+
class: "absolute top-4 left-4 z-50 rounded-lg border border-white/10 bg-black/70 px-3 py-1.5 text-sm font-medium text-white shadow-lg backdrop-blur-md",
|
|
846
|
+
"aria-live": "polite"
|
|
847
|
+
}, Kt = { class: "pointer-events-none absolute right-0 bottom-6 left-0 z-50 flex flex-col items-center gap-2" }, qt = {
|
|
848
|
+
key: 0,
|
|
849
|
+
class: "pointer-events-auto flex items-center gap-2 rounded-full border border-white/10 bg-black/70 px-3 py-2 shadow-lg backdrop-blur-md md:hidden"
|
|
850
|
+
}, Jt = [
|
|
851
|
+
"aria-label",
|
|
852
|
+
"aria-current",
|
|
853
|
+
"onClick"
|
|
854
|
+
], Yt = {
|
|
855
|
+
key: 1,
|
|
856
|
+
class: "pointer-events-auto hidden max-w-[80vw] items-center gap-1.5 overflow-x-auto rounded-xl border border-white/10 bg-black/70 p-2 shadow-lg backdrop-blur-md md:flex"
|
|
857
|
+
}, Xt = [
|
|
858
|
+
"aria-label",
|
|
859
|
+
"aria-current",
|
|
860
|
+
"onClick"
|
|
861
|
+
], Zt = ["src", "alt"], Qt = {
|
|
862
|
+
class: "min-w-[3.5rem] text-center text-sm font-medium tabular-nums text-white",
|
|
863
|
+
"aria-live": "polite"
|
|
864
|
+
}, $t = 1, en = 5, tn = 50, nn = .5, rn = 300, an = 30, on = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
865
|
+
name: "KunLightbox",
|
|
866
|
+
__name: "Lightbox",
|
|
867
|
+
props: {
|
|
868
|
+
images: {},
|
|
869
|
+
isOpen: { type: Boolean },
|
|
870
|
+
initialIndex: {}
|
|
871
|
+
},
|
|
872
|
+
emits: ["update:isOpen"],
|
|
873
|
+
setup(e, { emit: n }) {
|
|
874
|
+
let r = e, a = n, s = O(r.initialIndex || 0), d = O(1), f = O(!1), m = 0, h = 0, g = 0, _ = O(0), v = D({
|
|
875
|
+
x: 0,
|
|
876
|
+
y: 0
|
|
877
|
+
}), y = O(!1), S = D({
|
|
878
|
+
x: 0,
|
|
879
|
+
y: 0
|
|
880
|
+
}), C = D({
|
|
881
|
+
x: 0,
|
|
882
|
+
y: 0
|
|
883
|
+
}), E = O(0), A = O(0), j = D({
|
|
884
|
+
x: 0,
|
|
885
|
+
y: 0
|
|
886
|
+
}), N = O("slide-next"), P = O(null), F = O(null), I = O(null), L = o(() => r.images[s.value]?.src || ""), ee = o(() => r.images[s.value]?.alt || ""), R = o(() => ({
|
|
887
|
+
transform: `translate3d(${v.x}px, ${v.y}px, 0) scale(${d.value}) rotate(${_.value}deg)`,
|
|
888
|
+
transition: y.value || f.value ? "none" : "transform 0.3s ease-out"
|
|
889
|
+
})), B = () => {
|
|
890
|
+
_.value = Math.round(_.value / 360) * 360, d.value = $t, v.x = 0, v.y = 0;
|
|
891
|
+
}, te = () => {
|
|
892
|
+
let e = Math.min(en, d.value + nn);
|
|
893
|
+
if (e === d.value) return;
|
|
894
|
+
d.value = e;
|
|
895
|
+
let t = J(v.x, v.y);
|
|
896
|
+
v.x = t.x, v.y = t.y;
|
|
897
|
+
}, ne = () => {
|
|
898
|
+
let e = Math.max($t, d.value - nn);
|
|
899
|
+
if (e === d.value) return;
|
|
900
|
+
d.value = e;
|
|
901
|
+
let t = J(v.x, v.y);
|
|
902
|
+
v.x = t.x, v.y = t.y;
|
|
903
|
+
}, re = () => {
|
|
904
|
+
_.value += 90;
|
|
905
|
+
}, U = () => {
|
|
906
|
+
_.value -= 90;
|
|
907
|
+
}, ie = (e) => {
|
|
908
|
+
let t = document;
|
|
909
|
+
typeof t.startViewTransition == "function" ? t.startViewTransition(e) : e();
|
|
910
|
+
}, { lock: ae, unlock: oe } = ft(), W = !1;
|
|
911
|
+
z(() => r.isOpen, (e) => {
|
|
912
|
+
let t = P.value;
|
|
913
|
+
t && (e && !t.open ? (B(), ie(() => t.showModal()), W ||= (ae(), !0)) : !e && t.open && (ie(() => t.close()), W &&= (oe(), !1)));
|
|
914
|
+
}, { flush: "post" }), z(() => r.initialIndex, () => {
|
|
915
|
+
s.value = r.initialIndex || 0, B();
|
|
916
|
+
});
|
|
917
|
+
let se = () => {
|
|
918
|
+
r.isOpen && (a("update:isOpen", !1), B()), W &&= (oe(), !1);
|
|
919
|
+
}, G = (e) => {
|
|
920
|
+
e.target === P.value && a("update:isOpen", !1);
|
|
921
|
+
}, K = () => {
|
|
922
|
+
N.value = "slide-next", B(), s.value = (s.value + 1) % r.images.length;
|
|
923
|
+
}, ce = () => {
|
|
924
|
+
N.value = "slide-prev", B(), s.value = (s.value - 1 + r.images.length) % r.images.length;
|
|
925
|
+
}, q = () => {
|
|
926
|
+
if (!F.value || !I.value) return {
|
|
927
|
+
minX: 0,
|
|
928
|
+
maxX: 0,
|
|
929
|
+
minY: 0,
|
|
930
|
+
maxY: 0
|
|
931
|
+
};
|
|
932
|
+
let e = I.value.getBoundingClientRect(), t = F.value.getBoundingClientRect(), n = t.width * d.value, r = t.height * d.value, i = Math.max(0, (n - e.width) / 2), a = Math.max(0, (r - e.height) / 2);
|
|
933
|
+
return {
|
|
934
|
+
minX: -i,
|
|
935
|
+
maxX: i,
|
|
936
|
+
minY: -a,
|
|
937
|
+
maxY: a
|
|
938
|
+
};
|
|
939
|
+
}, J = (e, t) => {
|
|
940
|
+
if (d.value <= 1) return {
|
|
941
|
+
x: 0,
|
|
942
|
+
y: 0
|
|
943
|
+
};
|
|
944
|
+
let n = q();
|
|
945
|
+
return {
|
|
946
|
+
x: Math.min(Math.max(e, n.minX), n.maxX),
|
|
947
|
+
y: Math.min(Math.max(t, n.minY), n.maxY)
|
|
948
|
+
};
|
|
949
|
+
}, le = (e) => {
|
|
950
|
+
e.preventDefault();
|
|
951
|
+
let t = -e.deltaY, n = d.value + (t > 0 ? .2 : -.2), r = Math.max($t, Math.min(en, n));
|
|
952
|
+
if (r !== d.value) {
|
|
953
|
+
let t = I.value?.getBoundingClientRect();
|
|
954
|
+
if (!t) return;
|
|
955
|
+
let n = e.clientX - t.left, i = e.clientY - t.top, a = r / d.value, o = {
|
|
956
|
+
x: n - (n - v.x) * a,
|
|
957
|
+
y: i - (i - v.y) * a
|
|
958
|
+
}, s = J(o.x, o.y);
|
|
959
|
+
v.x = s.x, v.y = s.y, d.value = r;
|
|
960
|
+
}
|
|
961
|
+
}, ue = (e) => {
|
|
962
|
+
y.value = !0, A.value = Date.now();
|
|
963
|
+
let t = "touches" in e ? e.touches[0] : e;
|
|
964
|
+
S.x = t.clientX - v.x, S.y = t.clientY - v.y, j.x = t.clientX, j.y = t.clientY;
|
|
965
|
+
}, de = (e) => {
|
|
966
|
+
if (!y.value) return;
|
|
967
|
+
let t = "touches" in e ? e.touches[0] : e;
|
|
968
|
+
if (d.value <= 1) {
|
|
969
|
+
v.x = t.clientX - j.x;
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
let n = {
|
|
973
|
+
x: t.clientX - S.x,
|
|
974
|
+
y: t.clientY - S.y
|
|
975
|
+
}, r = J(n.x, n.y);
|
|
976
|
+
v.x = r.x, v.y = r.y;
|
|
977
|
+
}, fe = (e) => {
|
|
978
|
+
if (!y.value) return;
|
|
979
|
+
let t = ("touches" in e ? e.changedTouches[0] : e).clientX - j.x, n = Date.now() - A.value, r = Math.abs(t) / n;
|
|
980
|
+
d.value <= 1 && Math.abs(t) > tn && r > .2 && (t > 0 ? ce() : K(), v.x = 0, v.y = 0), y.value = !1;
|
|
981
|
+
}, pe = (e, t) => {
|
|
982
|
+
let n = I.value?.getBoundingClientRect();
|
|
983
|
+
if (!n) return;
|
|
984
|
+
if (d.value > $t) {
|
|
985
|
+
B();
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
let r = e - n.left, i = t - n.top;
|
|
989
|
+
d.value = 2;
|
|
990
|
+
let a = J(r - n.width / 2, i - n.height / 2);
|
|
991
|
+
v.x = a.x, v.y = a.y;
|
|
992
|
+
}, me = (e) => pe(e.clientX, e.clientY), he = (e) => {
|
|
993
|
+
if (e.touches.length >= 2) {
|
|
994
|
+
y.value = !1, f.value = !0;
|
|
995
|
+
let [t, n] = [e.touches[0], e.touches[1]];
|
|
996
|
+
E.value = Math.hypot(n.clientX - t.clientX, n.clientY - t.clientY), C.x = (t.clientX + n.clientX) / 2, C.y = (t.clientY + n.clientY) / 2;
|
|
997
|
+
} else e.touches.length === 1 && !f.value && ue(e);
|
|
998
|
+
}, ge = (e) => {
|
|
999
|
+
if (e.touches.length >= 2 && f.value) {
|
|
1000
|
+
let [t, n] = [e.touches[0], e.touches[1]], r = Math.hypot(n.clientX - t.clientX, n.clientY - t.clientY), i = (t.clientX + n.clientX) / 2, a = (t.clientY + n.clientY) / 2, o = r / (E.value || 1), s = Math.max($t, Math.min(en, d.value * o)), c = I.value?.getBoundingClientRect();
|
|
1001
|
+
if (c) {
|
|
1002
|
+
let e = i - c.left - c.width / 2, t = a - c.top - c.height / 2, n = s / d.value, r = e - (e - v.x) * n, o = t - (t - v.y) * n, l = i - C.x, u = a - C.y, f = J(r + l, o + u);
|
|
1003
|
+
v.x = f.x, v.y = f.y;
|
|
1004
|
+
}
|
|
1005
|
+
d.value = s, E.value = r, C.x = i, C.y = a;
|
|
1006
|
+
} else e.touches.length === 1 && y.value && de(e);
|
|
1007
|
+
}, _e = (e) => {
|
|
1008
|
+
if (f.value) {
|
|
1009
|
+
if (e.touches.length >= 2) return;
|
|
1010
|
+
if (f.value = !1, e.touches.length === 1) {
|
|
1011
|
+
let t = e.touches[0];
|
|
1012
|
+
y.value = !0, A.value = Date.now(), S.x = t.clientX - v.x, S.y = t.clientY - v.y, j.x = t.clientX, j.y = t.clientY;
|
|
1013
|
+
}
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (fe(e), e.touches.length !== 0) return;
|
|
1017
|
+
let t = e.changedTouches[0];
|
|
1018
|
+
if (!t) return;
|
|
1019
|
+
if (Math.abs(t.clientX - j.x) > an || Math.abs(t.clientY - j.y) > an) {
|
|
1020
|
+
m = 0;
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
let n = Date.now();
|
|
1024
|
+
n - m < rn && Math.abs(t.clientX - h) < an && Math.abs(t.clientY - g) < an ? (pe(t.clientX, t.clientY), m = 0) : (m = n, h = t.clientX, g = t.clientY);
|
|
1025
|
+
}, ve = async () => {
|
|
1026
|
+
let e = L.value;
|
|
1027
|
+
if (!e) return;
|
|
1028
|
+
let t = e.split("/").pop() || "image";
|
|
1029
|
+
try {
|
|
1030
|
+
let n = await fetch(e, { mode: "cors" });
|
|
1031
|
+
if (!n.ok) throw Error(`HTTP ${n.status}`);
|
|
1032
|
+
let r = await n.blob(), i = window.URL.createObjectURL(r), a = document.createElement("a");
|
|
1033
|
+
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), window.URL.revokeObjectURL(i);
|
|
1034
|
+
} catch (t) {
|
|
1035
|
+
console.warn("[KunLightbox] direct download blocked (likely CORS), opening in new tab", t), window.open(e, "_blank", "noopener,noreferrer");
|
|
1036
|
+
}
|
|
1037
|
+
}, ye = (e) => {
|
|
1038
|
+
e === s.value || e < 0 || e >= r.images.length || (N.value = e > s.value ? "slide-next" : "slide-prev", B(), s.value = e);
|
|
1039
|
+
}, be = o(() => Math.round(d.value * 100)), xe = (e) => {
|
|
1040
|
+
e.key === "ArrowLeft" ? (e.preventDefault(), ce()) : e.key === "ArrowRight" && (e.preventDefault(), K());
|
|
1041
|
+
};
|
|
1042
|
+
return w(() => {
|
|
1043
|
+
W && oe();
|
|
1044
|
+
}), (n, r) => (T(), l("dialog", {
|
|
1045
|
+
ref_key: "dialogRef",
|
|
1046
|
+
ref: P,
|
|
1047
|
+
"aria-label": "图片查看器",
|
|
1048
|
+
class: "kun-lightbox-dialog bg-transparent text-foreground p-0 m-0 max-w-none max-h-none w-screen h-screen overflow-hidden backdrop:bg-default-800/80",
|
|
1049
|
+
onClose: se,
|
|
1050
|
+
onClick: G,
|
|
1051
|
+
onKeydown: xe
|
|
1052
|
+
}, [e.isOpen ? (T(), l("div", Ut, [
|
|
1053
|
+
u("div", {
|
|
1054
|
+
ref_key: "containerRef",
|
|
1055
|
+
ref: I,
|
|
1056
|
+
class: "kun-lightbox-stage relative flex h-full w-full touch-none items-center justify-center overflow-hidden",
|
|
1057
|
+
onWheel: H(le, ["prevent"]),
|
|
1058
|
+
onMousedown: ue,
|
|
1059
|
+
onMousemove: de,
|
|
1060
|
+
onMouseup: fe,
|
|
1061
|
+
onMouseleave: fe,
|
|
1062
|
+
onTouchstartPassive: he,
|
|
1063
|
+
onTouchmovePassive: ge,
|
|
1064
|
+
onTouchend: _e,
|
|
1065
|
+
onTouchcancel: _e,
|
|
1066
|
+
onDblclick: me
|
|
1067
|
+
}, [p(i, { name: N.value }, {
|
|
1068
|
+
default: V(() => [(T(), l("div", {
|
|
1069
|
+
key: s.value,
|
|
1070
|
+
class: "kun-lightbox-slide absolute inset-0 flex items-center justify-center"
|
|
1071
|
+
}, [u("img", {
|
|
1072
|
+
ref_key: "imageRef",
|
|
1073
|
+
ref: F,
|
|
1074
|
+
src: L.value,
|
|
1075
|
+
alt: ee.value,
|
|
1076
|
+
class: "kun-lightbox-image max-h-full max-w-full will-change-transform",
|
|
1077
|
+
style: x(R.value),
|
|
1078
|
+
draggable: "false",
|
|
1079
|
+
onClick: r[0] ||= H(() => {}, ["stop"])
|
|
1080
|
+
}, null, 12, Wt)]))]),
|
|
1081
|
+
_: 1
|
|
1082
|
+
}, 8, ["name"])], 544),
|
|
1083
|
+
e.images.length > 1 ? (T(), l("div", Gt, M(s.value + 1) + " / " + M(e.images.length), 1)) : c("", !0),
|
|
1084
|
+
p($, {
|
|
1085
|
+
"is-icon-only": !0,
|
|
1086
|
+
color: "default",
|
|
1087
|
+
variant: "light",
|
|
1088
|
+
size: "lg",
|
|
1089
|
+
rounded: "lg",
|
|
1090
|
+
"aria-label": "关闭",
|
|
1091
|
+
"class-name": "absolute top-4 right-4 z-50 bg-black/70 backdrop-blur-md border border-white/10 shadow-lg",
|
|
1092
|
+
onClick: r[1] ||= H((e) => a("update:isOpen", !1), ["stop"])
|
|
1093
|
+
}, {
|
|
1094
|
+
default: V(() => [p(Z, {
|
|
1095
|
+
name: "lucide:x",
|
|
1096
|
+
class: "text-white"
|
|
1097
|
+
})]),
|
|
1098
|
+
_: 1
|
|
1099
|
+
}),
|
|
1100
|
+
e.images.length > 1 ? (T(), l(t, { key: 1 }, [p($, {
|
|
1101
|
+
"is-icon-only": !0,
|
|
1102
|
+
color: "default",
|
|
1103
|
+
variant: "light",
|
|
1104
|
+
size: "xl",
|
|
1105
|
+
rounded: "lg",
|
|
1106
|
+
"aria-label": "上一张",
|
|
1107
|
+
"class-name": "absolute left-4 top-1/2 z-50 hidden -translate-y-1/2 bg-black/70 backdrop-blur-md border border-white/10 shadow-lg md:flex",
|
|
1108
|
+
onClick: H(ce, ["stop"])
|
|
1109
|
+
}, {
|
|
1110
|
+
default: V(() => [p(Z, {
|
|
1111
|
+
name: "lucide:chevron-left",
|
|
1112
|
+
class: "text-white"
|
|
1113
|
+
})]),
|
|
1114
|
+
_: 1
|
|
1115
|
+
}), p($, {
|
|
1116
|
+
"is-icon-only": !0,
|
|
1117
|
+
color: "default",
|
|
1118
|
+
variant: "light",
|
|
1119
|
+
size: "xl",
|
|
1120
|
+
rounded: "lg",
|
|
1121
|
+
"aria-label": "下一张",
|
|
1122
|
+
"class-name": "absolute right-4 top-1/2 z-50 hidden -translate-y-1/2 bg-black/70 backdrop-blur-md border border-white/10 shadow-lg md:flex",
|
|
1123
|
+
onClick: H(K, ["stop"])
|
|
1124
|
+
}, {
|
|
1125
|
+
default: V(() => [p(Z, {
|
|
1126
|
+
name: "lucide:chevron-right",
|
|
1127
|
+
class: "text-white"
|
|
1128
|
+
})]),
|
|
1129
|
+
_: 1
|
|
1130
|
+
})], 64)) : c("", !0),
|
|
1131
|
+
u("div", Kt, [
|
|
1132
|
+
e.images.length > 1 ? (T(), l("div", qt, [(T(!0), l(t, null, k(e.images, (e, t) => (T(), l("button", {
|
|
1133
|
+
key: `dot-${t}`,
|
|
1134
|
+
type: "button",
|
|
1135
|
+
"aria-label": `跳转到第 ${t + 1} 张`,
|
|
1136
|
+
"aria-current": t === s.value,
|
|
1137
|
+
class: b(["size-2 rounded-full transition-colors", t === s.value ? "bg-primary-500" : "bg-default-400/60 hover:bg-default-300"]),
|
|
1138
|
+
onClick: H((e) => ye(t), ["stop"])
|
|
1139
|
+
}, null, 10, Jt))), 128))])) : c("", !0),
|
|
1140
|
+
e.images.length > 1 ? (T(), l("div", Yt, [(T(!0), l(t, null, k(e.images, (e, t) => (T(), l("button", {
|
|
1141
|
+
key: `thumb-${t}`,
|
|
1142
|
+
type: "button",
|
|
1143
|
+
"aria-label": `跳转到第 ${t + 1} 张`,
|
|
1144
|
+
"aria-current": t === s.value,
|
|
1145
|
+
class: b(["shrink-0 overflow-hidden rounded-md border-2 transition-all", t === s.value ? "border-primary-500 opacity-100" : "border-transparent opacity-60 hover:opacity-100"]),
|
|
1146
|
+
onClick: H((e) => ye(t), ["stop"])
|
|
1147
|
+
}, [u("img", {
|
|
1148
|
+
src: e.src,
|
|
1149
|
+
alt: e.alt ?? "",
|
|
1150
|
+
class: "size-14 object-cover",
|
|
1151
|
+
draggable: "false"
|
|
1152
|
+
}, null, 8, Zt)], 10, Xt))), 128))])) : c("", !0),
|
|
1153
|
+
u("div", {
|
|
1154
|
+
class: "kun-lightbox-toolbar pointer-events-auto flex items-center gap-1 rounded-full border border-white/10 bg-black/70 px-2 py-1.5 shadow-lg backdrop-blur-md",
|
|
1155
|
+
onClick: r[2] ||= H(() => {}, ["stop"])
|
|
1156
|
+
}, [
|
|
1157
|
+
p($, {
|
|
1158
|
+
"is-icon-only": !0,
|
|
1159
|
+
color: "default",
|
|
1160
|
+
variant: "light",
|
|
1161
|
+
size: "lg",
|
|
1162
|
+
rounded: "full",
|
|
1163
|
+
"aria-label": "缩小",
|
|
1164
|
+
onClick: ne
|
|
1165
|
+
}, {
|
|
1166
|
+
default: V(() => [p(Z, {
|
|
1167
|
+
name: "lucide:zoom-out",
|
|
1168
|
+
class: "text-white"
|
|
1169
|
+
})]),
|
|
1170
|
+
_: 1
|
|
1171
|
+
}),
|
|
1172
|
+
u("span", Qt, M(be.value) + "% ", 1),
|
|
1173
|
+
p($, {
|
|
1174
|
+
"is-icon-only": !0,
|
|
1175
|
+
color: "default",
|
|
1176
|
+
variant: "light",
|
|
1177
|
+
size: "lg",
|
|
1178
|
+
rounded: "full",
|
|
1179
|
+
"aria-label": "放大",
|
|
1180
|
+
onClick: te
|
|
1181
|
+
}, {
|
|
1182
|
+
default: V(() => [p(Z, {
|
|
1183
|
+
name: "lucide:zoom-in",
|
|
1184
|
+
class: "text-white"
|
|
1185
|
+
})]),
|
|
1186
|
+
_: 1
|
|
1187
|
+
}),
|
|
1188
|
+
r[3] ||= u("span", {
|
|
1189
|
+
class: "mx-1 h-5 w-px bg-default-200/30",
|
|
1190
|
+
"aria-hidden": "true"
|
|
1191
|
+
}, null, -1),
|
|
1192
|
+
p($, {
|
|
1193
|
+
"is-icon-only": !0,
|
|
1194
|
+
color: "default",
|
|
1195
|
+
variant: "light",
|
|
1196
|
+
size: "lg",
|
|
1197
|
+
rounded: "full",
|
|
1198
|
+
"aria-label": "向左旋转 90°",
|
|
1199
|
+
onClick: U
|
|
1200
|
+
}, {
|
|
1201
|
+
default: V(() => [p(Z, {
|
|
1202
|
+
name: "lucide:rotate-ccw",
|
|
1203
|
+
class: "text-white"
|
|
1204
|
+
})]),
|
|
1205
|
+
_: 1
|
|
1206
|
+
}),
|
|
1207
|
+
p($, {
|
|
1208
|
+
"is-icon-only": !0,
|
|
1209
|
+
color: "default",
|
|
1210
|
+
variant: "light",
|
|
1211
|
+
size: "lg",
|
|
1212
|
+
rounded: "full",
|
|
1213
|
+
"aria-label": "向右旋转 90°",
|
|
1214
|
+
onClick: re
|
|
1215
|
+
}, {
|
|
1216
|
+
default: V(() => [p(Z, {
|
|
1217
|
+
name: "lucide:rotate-cw",
|
|
1218
|
+
class: "text-white"
|
|
1219
|
+
})]),
|
|
1220
|
+
_: 1
|
|
1221
|
+
}),
|
|
1222
|
+
r[4] ||= u("span", {
|
|
1223
|
+
class: "mx-1 h-5 w-px bg-default-200/30",
|
|
1224
|
+
"aria-hidden": "true"
|
|
1225
|
+
}, null, -1),
|
|
1226
|
+
p($, {
|
|
1227
|
+
"is-icon-only": !0,
|
|
1228
|
+
color: "default",
|
|
1229
|
+
variant: "light",
|
|
1230
|
+
size: "lg",
|
|
1231
|
+
rounded: "full",
|
|
1232
|
+
"aria-label": "重置缩放/旋转/位置",
|
|
1233
|
+
onClick: B
|
|
1234
|
+
}, {
|
|
1235
|
+
default: V(() => [p(Z, {
|
|
1236
|
+
name: "lucide:refresh-ccw",
|
|
1237
|
+
class: "text-white"
|
|
1238
|
+
})]),
|
|
1239
|
+
_: 1
|
|
1240
|
+
}),
|
|
1241
|
+
p($, {
|
|
1242
|
+
"is-icon-only": !0,
|
|
1243
|
+
color: "default",
|
|
1244
|
+
variant: "light",
|
|
1245
|
+
size: "lg",
|
|
1246
|
+
rounded: "full",
|
|
1247
|
+
"aria-label": "下载",
|
|
1248
|
+
onClick: ve
|
|
1249
|
+
}, {
|
|
1250
|
+
default: V(() => [p(Z, {
|
|
1251
|
+
name: "lucide:download",
|
|
1252
|
+
class: "text-white"
|
|
1253
|
+
})]),
|
|
1254
|
+
_: 1
|
|
1255
|
+
})
|
|
1256
|
+
])
|
|
1257
|
+
])
|
|
1258
|
+
])) : c("", !0)], 544));
|
|
1259
|
+
}
|
|
1260
|
+
}), [["__scopeId", "data-v-10b9630a"]]), sn = ["innerHTML"], cn = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
1261
|
+
name: "KunContent",
|
|
1262
|
+
__name: "Content",
|
|
1263
|
+
props: {
|
|
1264
|
+
content: {},
|
|
1265
|
+
className: { default: "" }
|
|
1266
|
+
},
|
|
1267
|
+
setup(e) {
|
|
1268
|
+
let t = O(null);
|
|
1269
|
+
Vt(t);
|
|
1270
|
+
let { isLightboxOpen: n, images: r, currentImageIndex: i } = Ht(t);
|
|
1271
|
+
return (a, o) => (T(), l("div", null, [u("article", {
|
|
1272
|
+
ref_key: "articleRef",
|
|
1273
|
+
ref: t,
|
|
1274
|
+
class: b(P(U)("kun-prose", e.className)),
|
|
1275
|
+
innerHTML: e.content
|
|
1276
|
+
}, null, 10, sn), p(on, {
|
|
1277
|
+
"is-open": P(n),
|
|
1278
|
+
"onUpdate:isOpen": o[0] ||= (e) => g(n) ? n.value = e : null,
|
|
1279
|
+
images: P(r),
|
|
1280
|
+
"initial-index": P(i)
|
|
1281
|
+
}, null, 8, [
|
|
1282
|
+
"is-open",
|
|
1283
|
+
"images",
|
|
1284
|
+
"initial-index"
|
|
1285
|
+
])]));
|
|
1286
|
+
}
|
|
1287
|
+
}), [["__scopeId", "data-v-659d9838"]]), ln = /* @__PURE__ */ m({
|
|
1288
|
+
name: "KunContextMenu",
|
|
1289
|
+
__name: "ContextMenu",
|
|
1290
|
+
props: {
|
|
1291
|
+
visible: { type: Boolean },
|
|
1292
|
+
position: { default: () => ({
|
|
1293
|
+
x: 0,
|
|
1294
|
+
y: 0
|
|
1295
|
+
}) },
|
|
1296
|
+
items: { default: () => [] },
|
|
1297
|
+
width: { default: 192 },
|
|
1298
|
+
padding: { default: 12 }
|
|
1299
|
+
},
|
|
1300
|
+
emits: ["select", "close"],
|
|
1301
|
+
setup(e, { emit: r }) {
|
|
1302
|
+
let a = e, d = r, f = O(null), m = O({
|
|
1303
|
+
x: a.position?.x ?? 0,
|
|
1304
|
+
y: a.position?.y ?? 0
|
|
1305
|
+
}), h = (e, t, n) => Math.min(Math.max(e, t), Math.max(n, t)), g = async () => {
|
|
1306
|
+
if (!a.visible || typeof window > "u") return;
|
|
1307
|
+
await y();
|
|
1308
|
+
let e = f.value?.offsetWidth || a.width, t = f.value?.offsetHeight || 60, n = a.padding, r = a.position?.x ?? 0, i = a.position?.y ?? 0, o = window.innerWidth - e - n, s = window.innerHeight - t - n;
|
|
1309
|
+
m.value = {
|
|
1310
|
+
x: h(r, n, o),
|
|
1311
|
+
y: h(i, n, s)
|
|
1312
|
+
};
|
|
1313
|
+
};
|
|
1314
|
+
z(() => [
|
|
1315
|
+
a.visible,
|
|
1316
|
+
a.position?.x,
|
|
1317
|
+
a.position?.y
|
|
1318
|
+
], () => {
|
|
1319
|
+
a.visible && g();
|
|
1320
|
+
}, { immediate: !0 });
|
|
1321
|
+
let _ = () => d("close"), v = (e) => {
|
|
1322
|
+
if (!a.visible) return;
|
|
1323
|
+
let t = e.target;
|
|
1324
|
+
f.value && !f.value.contains(t) && _();
|
|
1325
|
+
}, b = (e) => {
|
|
1326
|
+
a.visible && e.key === "Escape" && _();
|
|
1327
|
+
}, w = () => {
|
|
1328
|
+
a.visible && _();
|
|
1329
|
+
};
|
|
1330
|
+
C(() => {
|
|
1331
|
+
window.addEventListener("pointerdown", v, !0), window.addEventListener("contextmenu", v, !0), window.addEventListener("scroll", w, !0), window.addEventListener("resize", w), window.addEventListener("keydown", b);
|
|
1332
|
+
}), S(() => {
|
|
1333
|
+
window.removeEventListener("pointerdown", v, !0), window.removeEventListener("contextmenu", v, !0), window.removeEventListener("scroll", w, !0), window.removeEventListener("resize", w), window.removeEventListener("keydown", b);
|
|
1334
|
+
});
|
|
1335
|
+
let E = o(() => ({
|
|
1336
|
+
top: `${m.value.y}px`,
|
|
1337
|
+
left: `${m.value.x}px`,
|
|
1338
|
+
minWidth: `${a.width}px`
|
|
1339
|
+
})), D = (e) => {
|
|
1340
|
+
e.disabled || (d("select", e), _());
|
|
1341
|
+
};
|
|
1342
|
+
return (r, a) => (T(), s(n, { to: "body" }, [p(i, {
|
|
1343
|
+
"enter-active-class": "transition duration-150 ease-out",
|
|
1344
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
1345
|
+
"enter-to-class": "opacity-100 scale-100",
|
|
1346
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
1347
|
+
"leave-from-class": "opacity-100 scale-100",
|
|
1348
|
+
"leave-to-class": "opacity-0 scale-95"
|
|
1349
|
+
}, {
|
|
1350
|
+
default: V(() => [e.visible && e.items.length ? (T(), l("div", {
|
|
1351
|
+
key: 0,
|
|
1352
|
+
ref_key: "menuRef",
|
|
1353
|
+
ref: f,
|
|
1354
|
+
class: "border-default-200 bg-background/95 fixed z-kun-popover rounded-xl border p-1 text-sm shadow-2xl backdrop-blur",
|
|
1355
|
+
style: x(E.value),
|
|
1356
|
+
onClick: a[0] ||= H(() => {}, ["stop"])
|
|
1357
|
+
}, [(T(!0), l(t, null, k(e.items, (e) => (T(), s($, {
|
|
1358
|
+
key: e.key,
|
|
1359
|
+
variant: "light",
|
|
1360
|
+
color: e.color || "default",
|
|
1361
|
+
size: "sm",
|
|
1362
|
+
"class-name": "justify-start gap-2 w-full",
|
|
1363
|
+
disabled: e.disabled,
|
|
1364
|
+
onClick: H((t) => D(e), ["stop"])
|
|
1365
|
+
}, {
|
|
1366
|
+
default: V(() => [e.icon ? (T(), s(Z, {
|
|
1367
|
+
key: 0,
|
|
1368
|
+
name: e.icon,
|
|
1369
|
+
class: "text-base"
|
|
1370
|
+
}, null, 8, ["name"])) : c("", !0), u("span", null, M(e.label), 1)]),
|
|
1371
|
+
_: 2
|
|
1372
|
+
}, 1032, [
|
|
1373
|
+
"color",
|
|
1374
|
+
"disabled",
|
|
1375
|
+
"onClick"
|
|
1376
|
+
]))), 128))], 4)) : c("", !0)]),
|
|
1377
|
+
_: 1
|
|
1378
|
+
})]));
|
|
1379
|
+
}
|
|
1380
|
+
}), un = "yyyy-MM-dd", dn = (e, t = un) => je(e, t), fn = (e) => {
|
|
1381
|
+
if (!e) return null;
|
|
1382
|
+
if (e instanceof Date) return Le(e) ? e : null;
|
|
1383
|
+
let t = Re(e);
|
|
1384
|
+
return Le(t) ? t : null;
|
|
1385
|
+
}, pn = (e) => {
|
|
1386
|
+
switch (e) {
|
|
1387
|
+
case "ja": return We;
|
|
1388
|
+
case "zh-CN": return Ge;
|
|
1389
|
+
default: return Ue;
|
|
1390
|
+
}
|
|
1391
|
+
}, mn = (e) => {
|
|
1392
|
+
let t = O(fn(Array.isArray(e.modelValue.value) ? e.modelValue.value[0] : e.modelValue.value) || Ve()), n = O(null), r = o(() => pn(typeof e.locale == "string" ? e.locale : e.locale?.value)), i = o(() => {
|
|
1393
|
+
let t = r.value, n = e.weekdays && "value" in e.weekdays ? e.weekdays.value : e.weekdays, i = e.months && "value" in e.months ? e.months.value : e.months;
|
|
1394
|
+
return {
|
|
1395
|
+
weekdays: n || [...Array(7)].map((e, n) => je(new Date(2023, 0, n + 1), "EEEEEE", { locale: t })),
|
|
1396
|
+
months: i || [...Array(12)].map((e, n) => je(new Date(2023, n, 1), "LLLL", { locale: t }))
|
|
1397
|
+
};
|
|
1398
|
+
}), a = (e) => {
|
|
1399
|
+
t.value = Ee(t.value, e);
|
|
1400
|
+
}, s = (e) => {
|
|
1401
|
+
t.value = De(t.value, e);
|
|
1402
|
+
}, c = o(() => {
|
|
1403
|
+
let n = Be(t.value), r = ke(t.value), i = Oe({
|
|
1404
|
+
start: He(n),
|
|
1405
|
+
end: Ae(r)
|
|
1406
|
+
}), a = fn(e.minDate?.value), o = fn(e.maxDate?.value), s = ze(a || /* @__PURE__ */ new Date(0)), c = ze(o || /* @__PURE__ */ new Date(864e13)), l = ze(fn(Array.isArray(e.modelValue.value) ? e.modelValue.value[0] : e.modelValue.value) || /* @__PURE__ */ new Date(0)), u = ze(fn(Array.isArray(e.modelValue.value) ? e.modelValue.value[0] : null) || /* @__PURE__ */ new Date(0)), d = ze(fn(Array.isArray(e.modelValue.value) ? e.modelValue.value[1] : null) || /* @__PURE__ */ new Date(0));
|
|
1407
|
+
return i.map((n) => {
|
|
1408
|
+
let r = e.mode.value === "single" ? Pe(n, l) : Pe(n, u) || Pe(n, d), i = u && d && Me(n, u) && Ne(n, d), a = e.isDateDisabled?.value ? e.isDateDisabled.value(n) : !1, o = Ne(n, s) || Me(n, c) || a;
|
|
1409
|
+
return {
|
|
1410
|
+
date: n,
|
|
1411
|
+
key: dn(n),
|
|
1412
|
+
dayOfMonth: n.getDate(),
|
|
1413
|
+
isCurrentMonth: Fe(n, t.value),
|
|
1414
|
+
isToday: Ie(n),
|
|
1415
|
+
isSelected: r,
|
|
1416
|
+
isRangeStart: Pe(n, u),
|
|
1417
|
+
isRangeEnd: Pe(n, d),
|
|
1418
|
+
isInRange: i,
|
|
1419
|
+
isDisabled: o
|
|
1420
|
+
};
|
|
1421
|
+
});
|
|
1422
|
+
}), l = (t) => je(t, (e.valueFormat && "value" in e.valueFormat ? e.valueFormat.value : e.valueFormat) || un);
|
|
1423
|
+
return {
|
|
1424
|
+
viewingDate: t,
|
|
1425
|
+
i18n: i,
|
|
1426
|
+
calendarGrid: c,
|
|
1427
|
+
navigateMonth: a,
|
|
1428
|
+
navigateYear: s,
|
|
1429
|
+
selectDate: (t) => {
|
|
1430
|
+
if (e.mode.value === "single") return l(t);
|
|
1431
|
+
if (!n.value || Array.isArray(e.modelValue.value) && e.modelValue.value[1]) return n.value = t, [l(t), null];
|
|
1432
|
+
let r = n.value;
|
|
1433
|
+
return n.value = null, r ? Ne(t, r) ? [l(t), l(r)] : [l(r), l(t)] : [l(t), null];
|
|
1434
|
+
},
|
|
1435
|
+
formatDate: dn,
|
|
1436
|
+
tempRangeStart: n
|
|
1437
|
+
};
|
|
1438
|
+
}, hn = {
|
|
1439
|
+
key: 0,
|
|
1440
|
+
class: "mb-2 block text-sm font-medium"
|
|
1441
|
+
}, gn = { class: "relative" }, _n = ["disabled"], vn = { class: "flex items-center" }, yn = { class: "flex items-center justify-between" }, bn = { class: "flex items-center gap-2" }, xn = { class: "font-semibold" }, Sn = { class: "flex items-center gap-2" }, Cn = { class: "text-default-600 mt-3 grid grid-cols-7 text-center text-xs" }, wn = {
|
|
1442
|
+
class: "mt-1 grid grid-cols-7",
|
|
1443
|
+
role: "grid"
|
|
1444
|
+
}, Tn = [
|
|
1445
|
+
"disabled",
|
|
1446
|
+
"aria-label",
|
|
1447
|
+
"aria-selected",
|
|
1448
|
+
"tabindex",
|
|
1449
|
+
"onClick",
|
|
1450
|
+
"onMouseenter"
|
|
1451
|
+
], En = { class: "mt-3 flex items-center justify-between" }, Dn = { class: "flex gap-2" }, On = {
|
|
1452
|
+
key: 1,
|
|
1453
|
+
class: "text-danger mt-2 text-sm"
|
|
1454
|
+
}, kn = /* @__PURE__ */ m({
|
|
1455
|
+
name: "KunDatePicker",
|
|
1456
|
+
__name: "DatePicker",
|
|
1457
|
+
props: {
|
|
1458
|
+
modelValue: { default: "" },
|
|
1459
|
+
mode: { default: "single" },
|
|
1460
|
+
label: { default: "" },
|
|
1461
|
+
placeholder: { default: "请选择日期" },
|
|
1462
|
+
error: { default: "" },
|
|
1463
|
+
disabled: {
|
|
1464
|
+
type: Boolean,
|
|
1465
|
+
default: !1
|
|
1466
|
+
},
|
|
1467
|
+
darkBorder: {
|
|
1468
|
+
type: Boolean,
|
|
1469
|
+
default: !0
|
|
1470
|
+
},
|
|
1471
|
+
clearable: {
|
|
1472
|
+
type: Boolean,
|
|
1473
|
+
default: !0
|
|
1474
|
+
},
|
|
1475
|
+
format: { default: "yyyy-MM-dd" },
|
|
1476
|
+
valueFormat: { default: "yyyy-MM-dd" },
|
|
1477
|
+
minDate: {},
|
|
1478
|
+
maxDate: {},
|
|
1479
|
+
isDateDisabled: {},
|
|
1480
|
+
locale: {},
|
|
1481
|
+
weekdays: {},
|
|
1482
|
+
months: {},
|
|
1483
|
+
rounded: { default: void 0 }
|
|
1484
|
+
},
|
|
1485
|
+
emits: ["update:modelValue"],
|
|
1486
|
+
setup(e, { emit: r }) {
|
|
1487
|
+
let a = e, d = X(() => a.rounded), m = o(() => q[d.value]), h = r, g = O(!1), _ = O(null), v = O(null), S = O(null);
|
|
1488
|
+
pe(_, () => g.value = !1);
|
|
1489
|
+
let { floatingStyles: C } = Te(_, v, {
|
|
1490
|
+
placement: "bottom-start",
|
|
1491
|
+
open: g,
|
|
1492
|
+
whileElementsMounted: be,
|
|
1493
|
+
transform: !1,
|
|
1494
|
+
middleware: [
|
|
1495
|
+
Se(4),
|
|
1496
|
+
xe(),
|
|
1497
|
+
Ce({ padding: 8 })
|
|
1498
|
+
]
|
|
1499
|
+
}), { modelValue: w, mode: E, minDate: D, maxDate: A, isDateDisabled: j, locale: F, weekdays: I, months: L, valueFormat: ee } = N(a), { viewingDate: R, i18n: B, calendarGrid: te, navigateMonth: ne, navigateYear: re, selectDate: ie, formatDate: ae, tempRangeStart: oe } = mn({
|
|
1500
|
+
modelValue: w,
|
|
1501
|
+
mode: E,
|
|
1502
|
+
minDate: D,
|
|
1503
|
+
maxDate: A,
|
|
1504
|
+
isDateDisabled: j,
|
|
1505
|
+
locale: F,
|
|
1506
|
+
weekdays: I,
|
|
1507
|
+
months: L,
|
|
1508
|
+
valueFormat: ee
|
|
1509
|
+
}), W = O(new Date(R.value));
|
|
1510
|
+
z(R, (e) => {
|
|
1511
|
+
W.value = new Date(e);
|
|
1512
|
+
});
|
|
1513
|
+
let se = (e) => {
|
|
1514
|
+
let t = new Date(W.value);
|
|
1515
|
+
t.setDate(t.getDate() + e), W.value = t, (t.getMonth() !== R.value.getMonth() || t.getFullYear() !== R.value.getFullYear()) && (R.value = new Date(t));
|
|
1516
|
+
}, G = (e) => {
|
|
1517
|
+
if (g.value) switch (e.key) {
|
|
1518
|
+
case "ArrowLeft":
|
|
1519
|
+
e.preventDefault(), se(-1);
|
|
1520
|
+
break;
|
|
1521
|
+
case "ArrowRight":
|
|
1522
|
+
e.preventDefault(), se(1);
|
|
1523
|
+
break;
|
|
1524
|
+
case "ArrowUp":
|
|
1525
|
+
e.preventDefault(), se(-7);
|
|
1526
|
+
break;
|
|
1527
|
+
case "ArrowDown":
|
|
1528
|
+
e.preventDefault(), se(7);
|
|
1529
|
+
break;
|
|
1530
|
+
case "Enter":
|
|
1531
|
+
e.preventDefault(), J(W.value);
|
|
1532
|
+
break;
|
|
1533
|
+
case "Escape":
|
|
1534
|
+
e.preventDefault(), g.value = !1;
|
|
1535
|
+
break;
|
|
1536
|
+
}
|
|
1537
|
+
}, K = o(() => a.mode === "single" ? a.modelValue ? ae(new Date(a.modelValue), a.format) : "" : Array.isArray(a.modelValue) && a.modelValue.every((e) => e) ? `${ae(new Date(a.modelValue[0]), a.format)} - ${ae(new Date(a.modelValue[1]), a.format)}` : ""), ce = () => {
|
|
1538
|
+
a.disabled || (g.value = !g.value, g.value && y(() => _.value?.focus()));
|
|
1539
|
+
}, J = (e) => {
|
|
1540
|
+
let t = ie(e);
|
|
1541
|
+
h("update:modelValue", t), (a.mode === "single" || Array.isArray(t) && t[1]) && (g.value = !1);
|
|
1542
|
+
}, le = () => {
|
|
1543
|
+
h("update:modelValue", a.mode === "single" ? null : [null, null]);
|
|
1544
|
+
}, ue = (e) => {
|
|
1545
|
+
if (!oe.value || !S.value) return !1;
|
|
1546
|
+
let t = oe.value, n = S.value;
|
|
1547
|
+
return !t || !n ? !1 : e > t && e < n || e < t && e > n;
|
|
1548
|
+
};
|
|
1549
|
+
return (r, a) => (T(), l("div", {
|
|
1550
|
+
ref_key: "datePickerRef",
|
|
1551
|
+
ref: _,
|
|
1552
|
+
class: "relative w-full",
|
|
1553
|
+
tabindex: "0",
|
|
1554
|
+
onKeydownCapture: H(G, ["prevent"])
|
|
1555
|
+
}, [
|
|
1556
|
+
e.label ? (T(), l("label", hn, M(e.label), 1)) : c("", !0),
|
|
1557
|
+
u("div", gn, [u("button", {
|
|
1558
|
+
type: "button",
|
|
1559
|
+
disabled: e.disabled,
|
|
1560
|
+
class: b(P(U)("flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left focus:ring-1 focus:outline-none sm:text-sm", m.value, "focus:border-primary-500 focus:ring-primary-500", e.darkBorder && "dark:border-default-200 border-default-200 border", e.disabled && "bg-default-100 cursor-not-allowed")),
|
|
1561
|
+
onClick: ce
|
|
1562
|
+
}, [u("span", { class: b(["block truncate", { "text-default-400": !K.value }]) }, M(K.value || e.placeholder), 3), u("div", vn, [e.clearable && K.value ? (T(), l("button", {
|
|
1563
|
+
key: 0,
|
|
1564
|
+
class: "text-default-500 hover:text-default-800 mr-2 p-1",
|
|
1565
|
+
"aria-label": "Clear date",
|
|
1566
|
+
onClick: H(le, ["stop"])
|
|
1567
|
+
}, [p(Z, {
|
|
1568
|
+
name: "lucide:x",
|
|
1569
|
+
class: "h-4 w-4"
|
|
1570
|
+
})])) : c("", !0), p(Z, {
|
|
1571
|
+
name: "lucide:calendar",
|
|
1572
|
+
class: "text-default-500"
|
|
1573
|
+
})])], 10, _n)]),
|
|
1574
|
+
(T(), s(n, { to: "body" }, [p(i, {
|
|
1575
|
+
"enter-active-class": "transition duration-150 ease-out",
|
|
1576
|
+
"enter-from-class": "opacity-0 -translate-y-1",
|
|
1577
|
+
"enter-to-class": "opacity-100 translate-y-0",
|
|
1578
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
1579
|
+
"leave-from-class": "opacity-100 translate-y-0",
|
|
1580
|
+
"leave-to-class": "opacity-0 -translate-y-1"
|
|
1581
|
+
}, {
|
|
1582
|
+
default: V(() => [g.value ? (T(), l("div", {
|
|
1583
|
+
key: 0,
|
|
1584
|
+
ref_key: "dropdownRef",
|
|
1585
|
+
ref: v,
|
|
1586
|
+
class: b(P(U)("bg-content1 border-default-200 z-kun-popover border p-3 shadow-lg", m.value)),
|
|
1587
|
+
style: x([P(C), { minWidth: "260px" }]),
|
|
1588
|
+
role: "dialog",
|
|
1589
|
+
"aria-modal": "true"
|
|
1590
|
+
}, [
|
|
1591
|
+
u("div", yn, [
|
|
1592
|
+
u("div", bn, [p($, {
|
|
1593
|
+
variant: "light",
|
|
1594
|
+
"is-icon-only": !0,
|
|
1595
|
+
size: "sm",
|
|
1596
|
+
"aria-label": "Previous year",
|
|
1597
|
+
onClick: a[0] ||= (e) => P(re)(-1)
|
|
1598
|
+
}, {
|
|
1599
|
+
default: V(() => [p(Z, { name: "lucide:chevrons-left" })]),
|
|
1600
|
+
_: 1
|
|
1601
|
+
}), p($, {
|
|
1602
|
+
variant: "light",
|
|
1603
|
+
"is-icon-only": !0,
|
|
1604
|
+
size: "sm",
|
|
1605
|
+
"aria-label": "Previous month",
|
|
1606
|
+
onClick: a[1] ||= (e) => P(ne)(-1)
|
|
1607
|
+
}, {
|
|
1608
|
+
default: V(() => [p(Z, { name: "lucide:chevron-left" })]),
|
|
1609
|
+
_: 1
|
|
1610
|
+
})]),
|
|
1611
|
+
u("div", xn, M(P(R).getFullYear()) + " / " + M(P(R).getMonth() + 1), 1),
|
|
1612
|
+
u("div", Sn, [p($, {
|
|
1613
|
+
variant: "light",
|
|
1614
|
+
"is-icon-only": !0,
|
|
1615
|
+
size: "sm",
|
|
1616
|
+
"aria-label": "Next month",
|
|
1617
|
+
onClick: a[2] ||= (e) => P(ne)(1)
|
|
1618
|
+
}, {
|
|
1619
|
+
default: V(() => [p(Z, { name: "lucide:chevron-right" })]),
|
|
1620
|
+
_: 1
|
|
1621
|
+
}), p($, {
|
|
1622
|
+
variant: "light",
|
|
1623
|
+
"is-icon-only": !0,
|
|
1624
|
+
size: "sm",
|
|
1625
|
+
"aria-label": "Next year",
|
|
1626
|
+
onClick: a[3] ||= (e) => P(re)(1)
|
|
1627
|
+
}, {
|
|
1628
|
+
default: V(() => [p(Z, { name: "lucide:chevrons-right" })]),
|
|
1629
|
+
_: 1
|
|
1630
|
+
})])
|
|
1631
|
+
]),
|
|
1632
|
+
u("div", Cn, [(T(!0), l(t, null, k(P(B).weekdays, (e) => (T(), l("div", {
|
|
1633
|
+
key: e,
|
|
1634
|
+
class: "p-1 font-medium"
|
|
1635
|
+
}, M(e), 1))), 128))]),
|
|
1636
|
+
u("div", wn, [(T(!0), l(t, null, k(P(te), (e) => (T(), l("div", {
|
|
1637
|
+
key: e.key,
|
|
1638
|
+
class: "p-0.5",
|
|
1639
|
+
role: "gridcell"
|
|
1640
|
+
}, [u("button", {
|
|
1641
|
+
disabled: e.isDisabled,
|
|
1642
|
+
class: b(P(U)("focus:ring-primary/40 flex h-8 w-8 items-center justify-center rounded-full text-sm transition-colors focus:ring-2 focus:outline-none", !e.isCurrentMonth && "text-default-400", e.isToday && "border-primary bg-primary/20 border", !e.isSelected && !e.isDisabled && "hover:bg-default/20", e.isDisabled && "cursor-not-allowed opacity-50", e.isSelected && "bg-primary hover:bg-primary/90 text-white", (e.isInRange || ue(e.date)) && !e.isSelected && "bg-primary/10 rounded-none", e.isRangeStart && "rounded-r-none", e.isRangeEnd && "rounded-l-none")),
|
|
1643
|
+
"aria-label": e.date.toDateString(),
|
|
1644
|
+
"aria-selected": e.isSelected,
|
|
1645
|
+
tabindex: e.date.toDateString() === W.value.toDateString() ? 0 : -1,
|
|
1646
|
+
onClick: (t) => J(e.date),
|
|
1647
|
+
onMouseenter: (t) => S.value = e.date,
|
|
1648
|
+
onMouseleave: a[4] ||= (e) => S.value = null
|
|
1649
|
+
}, M(e.dayOfMonth), 43, Tn)]))), 128))]),
|
|
1650
|
+
u("div", En, [p($, {
|
|
1651
|
+
size: "sm",
|
|
1652
|
+
variant: "light",
|
|
1653
|
+
onClick: a[5] ||= (e) => J(/* @__PURE__ */ new Date())
|
|
1654
|
+
}, {
|
|
1655
|
+
default: V(() => [...a[7] ||= [f(" 今天 ", -1)]]),
|
|
1656
|
+
_: 1
|
|
1657
|
+
}), u("div", Dn, [e.clearable ? (T(), s($, {
|
|
1658
|
+
key: 0,
|
|
1659
|
+
size: "sm",
|
|
1660
|
+
variant: "light",
|
|
1661
|
+
onClick: le
|
|
1662
|
+
}, {
|
|
1663
|
+
default: V(() => [...a[8] ||= [f(" 清空 ", -1)]]),
|
|
1664
|
+
_: 1
|
|
1665
|
+
})) : c("", !0), p($, {
|
|
1666
|
+
size: "sm",
|
|
1667
|
+
variant: "light",
|
|
1668
|
+
onClick: a[6] ||= (e) => g.value = !1
|
|
1669
|
+
}, {
|
|
1670
|
+
default: V(() => [...a[9] ||= [f(" 关闭 ", -1)]]),
|
|
1671
|
+
_: 1
|
|
1672
|
+
})])])
|
|
1673
|
+
], 6)) : c("", !0)]),
|
|
1674
|
+
_: 1
|
|
1675
|
+
})])),
|
|
1676
|
+
e.error ? (T(), l("p", On, M(e.error), 1)) : c("", !0)
|
|
1677
|
+
], 544));
|
|
1678
|
+
}
|
|
1679
|
+
}), An = O([]), jn = 0, Mn = () => ({
|
|
1680
|
+
messages: o(() => An.value),
|
|
1681
|
+
removeMessage: (e) => {
|
|
1682
|
+
An.value = An.value.filter((t) => t.id !== e);
|
|
1683
|
+
}
|
|
1684
|
+
}), Nn = (e, t, n = 3e3, r = !1, i = "top-center") => {
|
|
1685
|
+
let a = An.value.find((n) => n.message === e && n.position === i && n.type === t);
|
|
1686
|
+
if (a) return a.count++, a.duration = n, a.id;
|
|
1687
|
+
jn++;
|
|
1688
|
+
let o = `message_${jn}`, s = {
|
|
1689
|
+
id: o,
|
|
1690
|
+
message: e,
|
|
1691
|
+
type: t,
|
|
1692
|
+
duration: n,
|
|
1693
|
+
richText: r,
|
|
1694
|
+
position: i,
|
|
1695
|
+
count: 1
|
|
1696
|
+
};
|
|
1697
|
+
return i.startsWith("top") ? An.value.push(s) : An.value.unshift(s), o;
|
|
1698
|
+
}, Pn = (e) => {
|
|
1699
|
+
let t = ae(e);
|
|
1700
|
+
navigator.clipboard.writeText(t).then(() => {
|
|
1701
|
+
Nn(`${t} 复制成功`, "success");
|
|
1702
|
+
}).catch(() => {
|
|
1703
|
+
Nn(`${t} 复制失败! 请更换更现代的浏览器!`, "error");
|
|
1704
|
+
});
|
|
1705
|
+
}, Fn = /* @__PURE__ */ m({
|
|
1706
|
+
name: "KunCopy",
|
|
1707
|
+
__name: "Copy",
|
|
1708
|
+
props: {
|
|
1709
|
+
text: {},
|
|
1710
|
+
name: { default: "" },
|
|
1711
|
+
variant: { default: "light" },
|
|
1712
|
+
color: { default: "primary" },
|
|
1713
|
+
size: { default: "md" },
|
|
1714
|
+
rounded: { default: "lg" },
|
|
1715
|
+
className: { default: "" }
|
|
1716
|
+
},
|
|
1717
|
+
setup(e) {
|
|
1718
|
+
return (t, n) => (T(), s($, {
|
|
1719
|
+
variant: e.variant,
|
|
1720
|
+
color: e.color,
|
|
1721
|
+
size: e.size,
|
|
1722
|
+
rounded: e.rounded,
|
|
1723
|
+
"class-name": P(U)("gap-2", e.className),
|
|
1724
|
+
onClick: n[0] ||= (t) => P(Pn)(e.text)
|
|
1725
|
+
}, {
|
|
1726
|
+
default: V(() => [u("span", null, M(P(ae)(e.name ? e.name : e.text)), 1), p(Z, { name: "lucide:copy" })]),
|
|
1727
|
+
_: 1
|
|
1728
|
+
}, 8, [
|
|
1729
|
+
"variant",
|
|
1730
|
+
"color",
|
|
1731
|
+
"size",
|
|
1732
|
+
"rounded",
|
|
1733
|
+
"class-name"
|
|
1734
|
+
]));
|
|
1735
|
+
}
|
|
1736
|
+
}), In = /* @__PURE__ */ m({
|
|
1737
|
+
name: "KunDivider",
|
|
1738
|
+
__name: "Divider",
|
|
1739
|
+
props: {
|
|
1740
|
+
orientation: { default: "horizontal" },
|
|
1741
|
+
color: { default: "default" },
|
|
1742
|
+
borderStyle: { default: "solid" },
|
|
1743
|
+
className: { default: "" },
|
|
1744
|
+
withLabel: {
|
|
1745
|
+
type: Boolean,
|
|
1746
|
+
default: !1
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
setup(e) {
|
|
1750
|
+
let t = {
|
|
1751
|
+
default: "border-default/20",
|
|
1752
|
+
primary: "border-primary/20",
|
|
1753
|
+
secondary: "border-secondary/20",
|
|
1754
|
+
success: "border-success/20",
|
|
1755
|
+
warning: "border-warning/20",
|
|
1756
|
+
danger: "border-danger/20",
|
|
1757
|
+
info: "border-info/20"
|
|
1758
|
+
};
|
|
1759
|
+
return (n, r) => (T(), l("div", {
|
|
1760
|
+
class: b(P(U)("flex items-center", e.orientation === "horizontal" ? "w-full" : "h-full flex-col", e.className)),
|
|
1761
|
+
role: "separator"
|
|
1762
|
+
}, [
|
|
1763
|
+
u("div", { class: b([
|
|
1764
|
+
e.orientation === "horizontal" ? "w-full border-t" : "h-full border-l",
|
|
1765
|
+
e.borderStyle === "dashed" ? "border-dashed" : "border-solid",
|
|
1766
|
+
t[e.color]
|
|
1767
|
+
]) }, null, 2),
|
|
1768
|
+
n.$slots.default ? (T(), l("div", {
|
|
1769
|
+
key: 0,
|
|
1770
|
+
class: b(["text-default-500 text-sm", e.orientation === "horizontal" ? "px-4 whitespace-nowrap" : "py-4"])
|
|
1771
|
+
}, [A(n.$slots, "default")], 2)) : c("", !0),
|
|
1772
|
+
n.$slots.default ? (T(), l("div", {
|
|
1773
|
+
key: 1,
|
|
1774
|
+
class: b([
|
|
1775
|
+
e.orientation === "horizontal" ? "w-full border-t" : "h-full border-l",
|
|
1776
|
+
e.borderStyle === "dashed" ? "border-dashed" : "border-solid",
|
|
1777
|
+
t[e.color]
|
|
1778
|
+
])
|
|
1779
|
+
}, null, 2)) : c("", !0)
|
|
1780
|
+
], 2));
|
|
1781
|
+
}
|
|
1782
|
+
}), Ln = { class: "relative inline-flex" }, Rn = [
|
|
1783
|
+
"tabindex",
|
|
1784
|
+
"aria-expanded",
|
|
1785
|
+
"aria-disabled",
|
|
1786
|
+
"aria-controls"
|
|
1787
|
+
], zn = [
|
|
1788
|
+
"tabindex",
|
|
1789
|
+
"disabled",
|
|
1790
|
+
"aria-disabled",
|
|
1791
|
+
"onClick",
|
|
1792
|
+
"onMouseenter"
|
|
1793
|
+
], Bn = /* @__PURE__ */ m({
|
|
1794
|
+
name: "KunDropdown",
|
|
1795
|
+
__name: "Dropdown",
|
|
1796
|
+
props: {
|
|
1797
|
+
items: { default: () => [] },
|
|
1798
|
+
position: { default: "bottom-start" },
|
|
1799
|
+
triggerClass: { default: "" },
|
|
1800
|
+
menuClass: { default: "" },
|
|
1801
|
+
minWidth: { default: 192 },
|
|
1802
|
+
disabled: {
|
|
1803
|
+
type: Boolean,
|
|
1804
|
+
default: !1
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
emits: [
|
|
1808
|
+
"select",
|
|
1809
|
+
"open",
|
|
1810
|
+
"close"
|
|
1811
|
+
],
|
|
1812
|
+
setup(e, { expose: r, emit: a }) {
|
|
1813
|
+
let d = e, f = a, m = O(!1), h = O(-1), g = O(null), _ = O(null), v = `kun-dropdown-${I()}`, { floatingStyles: S } = Te(g, _, {
|
|
1814
|
+
placement: o(() => d.position),
|
|
1815
|
+
open: m,
|
|
1816
|
+
whileElementsMounted: be,
|
|
1817
|
+
transform: !1,
|
|
1818
|
+
middleware: [
|
|
1819
|
+
Se(6),
|
|
1820
|
+
xe(),
|
|
1821
|
+
Ce({ padding: 8 })
|
|
1822
|
+
]
|
|
1823
|
+
}), C = () => d.items.reduce((e, t, n) => (t.disabled || e.push(n), e), []), w = () => Array.from(_.value?.querySelectorAll("[role=\"menuitem\"]") ?? []), E = (e) => {
|
|
1824
|
+
h.value = e, w()[e]?.focus();
|
|
1825
|
+
}, D = (e = "none") => {
|
|
1826
|
+
d.disabled || d.items.length === 0 || (m.value || (m.value = !0, f("open")), y(() => {
|
|
1827
|
+
let t = C();
|
|
1828
|
+
e === "first" && t.length ? E(t[0]) : e === "last" && t.length ? E(t[t.length - 1]) : (h.value = -1, _.value?.focus());
|
|
1829
|
+
}));
|
|
1830
|
+
}, j = (e = !1) => {
|
|
1831
|
+
m.value && (m.value = !1, h.value = -1, f("close"), e && y(() => g.value?.focus()));
|
|
1832
|
+
}, N = () => m.value ? j() : D("none"), F = (e) => {
|
|
1833
|
+
let t = C();
|
|
1834
|
+
if (!t.length) return;
|
|
1835
|
+
let n = (t.indexOf(h.value) + e + t.length) % t.length;
|
|
1836
|
+
E(t[n === -1 ? t.length - 1 : n]);
|
|
1837
|
+
}, L = (e) => {
|
|
1838
|
+
e.disabled || (f("select", e), j(!0));
|
|
1839
|
+
}, ee = (e) => {
|
|
1840
|
+
if (!d.disabled) switch (e.key) {
|
|
1841
|
+
case "ArrowDown":
|
|
1842
|
+
case "Enter":
|
|
1843
|
+
case " ":
|
|
1844
|
+
e.preventDefault(), D("first");
|
|
1845
|
+
break;
|
|
1846
|
+
case "ArrowUp":
|
|
1847
|
+
e.preventDefault(), D("last");
|
|
1848
|
+
break;
|
|
1849
|
+
}
|
|
1850
|
+
}, R = (e) => {
|
|
1851
|
+
switch (e.key) {
|
|
1852
|
+
case "ArrowDown":
|
|
1853
|
+
e.preventDefault(), F(1);
|
|
1854
|
+
break;
|
|
1855
|
+
case "ArrowUp":
|
|
1856
|
+
e.preventDefault(), F(-1);
|
|
1857
|
+
break;
|
|
1858
|
+
case "Home": {
|
|
1859
|
+
e.preventDefault();
|
|
1860
|
+
let t = C()[0];
|
|
1861
|
+
t !== void 0 && E(t);
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
case "End": {
|
|
1865
|
+
e.preventDefault();
|
|
1866
|
+
let t = C();
|
|
1867
|
+
t.length && E(t[t.length - 1]);
|
|
1868
|
+
break;
|
|
1869
|
+
}
|
|
1870
|
+
case "Enter":
|
|
1871
|
+
case " ":
|
|
1872
|
+
e.preventDefault(), h.value >= 0 && L(d.items[h.value]);
|
|
1873
|
+
break;
|
|
1874
|
+
case "Escape":
|
|
1875
|
+
e.preventDefault(), j(!0);
|
|
1876
|
+
break;
|
|
1877
|
+
case "Tab":
|
|
1878
|
+
e.preventDefault(), j(!0);
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
pe(g, (e) => {
|
|
1883
|
+
_.value?.contains(e.target) || j();
|
|
1884
|
+
}), ge("keydown", (e) => {
|
|
1885
|
+
e.key === "Escape" && m.value && j(!0);
|
|
1886
|
+
});
|
|
1887
|
+
let z = {
|
|
1888
|
+
default: "focus:bg-default/20",
|
|
1889
|
+
primary: "focus:bg-primary/20",
|
|
1890
|
+
secondary: "focus:bg-secondary/20",
|
|
1891
|
+
success: "focus:bg-success/20",
|
|
1892
|
+
warning: "focus:bg-warning/20",
|
|
1893
|
+
danger: "focus:bg-danger/20",
|
|
1894
|
+
info: "focus:bg-info/20"
|
|
1895
|
+
}, B = (e) => U("relative flex w-full cursor-pointer items-center justify-start gap-2 overflow-hidden rounded-lg px-3 py-1.5 text-sm font-medium outline-none transition-colors", ue("light", e.color || "default"), z[e.color || "default"], e.disabled && "pointer-events-none cursor-not-allowed opacity-50");
|
|
1896
|
+
return r({
|
|
1897
|
+
open: () => D("none"),
|
|
1898
|
+
close: () => j(),
|
|
1899
|
+
toggle: N
|
|
1900
|
+
}), (r, a) => (T(), l("div", Ln, [u("div", {
|
|
1901
|
+
ref_key: "triggerRef",
|
|
1902
|
+
ref: g,
|
|
1903
|
+
role: "button",
|
|
1904
|
+
tabindex: e.disabled ? -1 : 0,
|
|
1905
|
+
class: b(P(U)("inline-flex cursor-pointer items-center", e.disabled && "cursor-not-allowed opacity-50", e.triggerClass)),
|
|
1906
|
+
"aria-haspopup": "menu",
|
|
1907
|
+
"aria-expanded": m.value,
|
|
1908
|
+
"aria-disabled": e.disabled || void 0,
|
|
1909
|
+
"aria-controls": m.value ? v : void 0,
|
|
1910
|
+
onClick: a[0] ||= (t) => e.disabled || N(),
|
|
1911
|
+
onKeydown: ee
|
|
1912
|
+
}, [A(r.$slots, "trigger")], 42, Rn), (T(), s(n, { to: "body" }, [p(i, {
|
|
1913
|
+
"enter-active-class": "transition duration-150 ease-out",
|
|
1914
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
1915
|
+
"enter-to-class": "opacity-100 scale-100",
|
|
1916
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
1917
|
+
"leave-from-class": "opacity-100 scale-100",
|
|
1918
|
+
"leave-to-class": "opacity-0 scale-95"
|
|
1919
|
+
}, {
|
|
1920
|
+
default: V(() => [m.value && e.items.length ? (T(), l("div", {
|
|
1921
|
+
key: 0,
|
|
1922
|
+
ref_key: "menuRef",
|
|
1923
|
+
ref: _,
|
|
1924
|
+
id: v,
|
|
1925
|
+
role: "menu",
|
|
1926
|
+
"aria-orientation": "vertical",
|
|
1927
|
+
tabindex: "-1",
|
|
1928
|
+
class: b(P(U)("border-default-200 bg-background/95 z-kun-popover rounded-xl border p-1 text-sm shadow-2xl outline-none backdrop-blur", e.menuClass)),
|
|
1929
|
+
style: x([P(S), { minWidth: `${e.minWidth}px` }]),
|
|
1930
|
+
onKeydown: R
|
|
1931
|
+
}, [(T(!0), l(t, null, k(e.items, (e, t) => (T(), l("button", {
|
|
1932
|
+
key: e.key,
|
|
1933
|
+
type: "button",
|
|
1934
|
+
role: "menuitem",
|
|
1935
|
+
tabindex: t === h.value ? 0 : -1,
|
|
1936
|
+
disabled: e.disabled,
|
|
1937
|
+
"aria-disabled": e.disabled || void 0,
|
|
1938
|
+
class: b(B(e)),
|
|
1939
|
+
onClick: (t) => L(e),
|
|
1940
|
+
onMouseenter: (n) => !e.disabled && E(t)
|
|
1941
|
+
}, [e.icon ? (T(), s(Z, {
|
|
1942
|
+
key: 0,
|
|
1943
|
+
name: e.icon,
|
|
1944
|
+
class: "text-base"
|
|
1945
|
+
}, null, 8, ["name"])) : c("", !0), u("span", null, M(e.label), 1)], 42, zn))), 128))], 38)) : c("", !0)]),
|
|
1946
|
+
_: 1
|
|
1947
|
+
})]))]));
|
|
1948
|
+
}
|
|
1949
|
+
}), Vn = ["aria-labelledby"], Hn = {
|
|
1950
|
+
key: 0,
|
|
1951
|
+
class: "border-default-200 flex items-center justify-between border-b px-6 py-4"
|
|
1952
|
+
}, Un = { class: "flex min-w-0 flex-1 items-center gap-2" }, Wn = ["id"], Gn = {
|
|
1953
|
+
key: 1,
|
|
1954
|
+
class: "scrollbar-hide flex-1 overflow-y-auto p-6"
|
|
1955
|
+
}, Kn = {
|
|
1956
|
+
key: 3,
|
|
1957
|
+
class: "border-default-200 border-t px-6 py-4"
|
|
1958
|
+
}, qn = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
1959
|
+
name: "KunDrawer",
|
|
1960
|
+
__name: "Drawer",
|
|
1961
|
+
props: /*@__PURE__*/ _({
|
|
1962
|
+
placement: { default: "right" },
|
|
1963
|
+
responsive: {
|
|
1964
|
+
type: Boolean,
|
|
1965
|
+
default: !0
|
|
1966
|
+
},
|
|
1967
|
+
size: { default: "md" },
|
|
1968
|
+
title: { default: "" },
|
|
1969
|
+
isDismissable: {
|
|
1970
|
+
type: Boolean,
|
|
1971
|
+
default: !0
|
|
1972
|
+
},
|
|
1973
|
+
isShowCloseButton: {
|
|
1974
|
+
type: Boolean,
|
|
1975
|
+
default: !0
|
|
1976
|
+
},
|
|
1977
|
+
withContainer: {
|
|
1978
|
+
type: Boolean,
|
|
1979
|
+
default: !0
|
|
1980
|
+
},
|
|
1981
|
+
rounded: { default: void 0 },
|
|
1982
|
+
className: { default: "" },
|
|
1983
|
+
innerClassName: { default: "" }
|
|
1984
|
+
}, {
|
|
1985
|
+
modelValue: {
|
|
1986
|
+
type: Boolean,
|
|
1987
|
+
required: !0
|
|
1988
|
+
},
|
|
1989
|
+
modelModifiers: {}
|
|
1990
|
+
}),
|
|
1991
|
+
emits: /*@__PURE__*/ _(["close"], ["update:modelValue"]),
|
|
1992
|
+
setup(e, { emit: t }) {
|
|
1993
|
+
let r = e, a = _e("(max-width: 47.99rem)"), d = o(() => r.responsive && a.value ? "bottom" : r.placement), f = X(() => r.rounded, "lg"), m = o(() => q[f.value]), h = L(e, "modelValue"), g = t, _ = Ft("kun-drawer"), v = o(() => `${_.value}-title`), x = {
|
|
1994
|
+
sm: "w-80",
|
|
1995
|
+
md: "w-96",
|
|
1996
|
+
lg: "w-[32rem]",
|
|
1997
|
+
xl: "w-[40rem]",
|
|
1998
|
+
full: "w-full"
|
|
1999
|
+
}, S = {
|
|
2000
|
+
sm: "h-80",
|
|
2001
|
+
md: "h-96",
|
|
2002
|
+
lg: "h-[32rem]",
|
|
2003
|
+
xl: "h-[40rem]",
|
|
2004
|
+
full: "h-full"
|
|
2005
|
+
}, E = {
|
|
2006
|
+
left: "left-0 top-0 h-full",
|
|
2007
|
+
right: "right-0 top-0 h-full",
|
|
2008
|
+
top: "top-0 left-0 w-full",
|
|
2009
|
+
bottom: "bottom-0 left-0 w-full"
|
|
2010
|
+
}, D = {
|
|
2011
|
+
left: "rounded-r-kun-lg",
|
|
2012
|
+
right: "rounded-l-kun-lg",
|
|
2013
|
+
top: "rounded-b-kun-lg",
|
|
2014
|
+
bottom: "rounded-t-kun-lg"
|
|
2015
|
+
}, k = o(() => {
|
|
2016
|
+
let e = d.value, t = e === "left" || e === "right" ? x[r.size] : S[r.size];
|
|
2017
|
+
return [
|
|
2018
|
+
"absolute",
|
|
2019
|
+
E[e],
|
|
2020
|
+
t,
|
|
2021
|
+
r.size === "full" ? "" : D[e]
|
|
2022
|
+
].filter(Boolean).join(" ");
|
|
2023
|
+
}), j = o(() => `kun-drawer-${d.value}`), { lock: N, unlock: F } = ft(), I = !1, ee = (e) => {
|
|
2024
|
+
e && !I ? (N(), I = !0) : !e && I && (F(), I = !1);
|
|
2025
|
+
}, R = O(null), { activate: B, deactivate: te } = ye(R, {
|
|
2026
|
+
immediate: !1,
|
|
2027
|
+
escapeDeactivates: !1,
|
|
2028
|
+
allowOutsideClick: !0,
|
|
2029
|
+
returnFocusOnDeactivate: !0
|
|
2030
|
+
}), ne = () => {
|
|
2031
|
+
r.isDismissable && (h.value = !1, g("close"));
|
|
2032
|
+
}, re = () => {
|
|
2033
|
+
h.value = !1, g("close");
|
|
2034
|
+
};
|
|
2035
|
+
return ge("keydown", (e) => {
|
|
2036
|
+
e.key === "Escape" && h.value && ne();
|
|
2037
|
+
}), z(h, async (e) => {
|
|
2038
|
+
ee(e), e ? (await y(), B()) : te();
|
|
2039
|
+
}), C(async () => {
|
|
2040
|
+
h.value && (ee(!0), await y(), B());
|
|
2041
|
+
}), w(() => {
|
|
2042
|
+
ee(!1), te();
|
|
2043
|
+
}), (t, r) => (T(), s(n, { to: "body" }, [p(i, { name: j.value }, {
|
|
2044
|
+
default: V(() => [h.value ? (T(), l("div", {
|
|
2045
|
+
key: 0,
|
|
2046
|
+
ref_key: "trapEl",
|
|
2047
|
+
ref: R,
|
|
2048
|
+
class: b(P(U)("z-kun-modal fixed inset-0", e.className)),
|
|
2049
|
+
role: "dialog",
|
|
2050
|
+
"aria-modal": "true",
|
|
2051
|
+
"aria-labelledby": e.title ? v.value : void 0,
|
|
2052
|
+
tabindex: "0"
|
|
2053
|
+
}, [u("div", {
|
|
2054
|
+
class: "bg-default-800/70 dark:bg-background/70 absolute inset-0 transition-opacity",
|
|
2055
|
+
onClick: ne
|
|
2056
|
+
}), u("div", {
|
|
2057
|
+
class: b(P(U)("bg-content1 flex flex-col border shadow-2xl", k.value, e.innerClassName, e.size === "full" ? m.value : "")),
|
|
2058
|
+
onClick: r[0] ||= H(() => {}, ["stop"])
|
|
2059
|
+
}, [
|
|
2060
|
+
e.title || t.$slots.header || e.isShowCloseButton ? (T(), l("header", Hn, [u("div", Un, [e.title ? (T(), l("h2", {
|
|
2061
|
+
key: 0,
|
|
2062
|
+
id: v.value,
|
|
2063
|
+
class: "text-foreground truncate text-lg font-semibold"
|
|
2064
|
+
}, M(e.title), 9, Wn)) : c("", !0), A(t.$slots, "header", {}, void 0, !0)]), e.isShowCloseButton ? (T(), s($, {
|
|
2065
|
+
key: 0,
|
|
2066
|
+
color: "default",
|
|
2067
|
+
variant: "light",
|
|
2068
|
+
size: "sm",
|
|
2069
|
+
rounded: "full",
|
|
2070
|
+
"is-icon-only": !0,
|
|
2071
|
+
"aria-label": "关闭抽屉",
|
|
2072
|
+
"class-name": "shrink-0",
|
|
2073
|
+
onClick: re
|
|
2074
|
+
}, {
|
|
2075
|
+
default: V(() => [p(Z, { name: "lucide:x" })]),
|
|
2076
|
+
_: 1
|
|
2077
|
+
})) : c("", !0)])) : c("", !0),
|
|
2078
|
+
e.withContainer ? (T(), l("div", Gn, [A(t.$slots, "default", {}, void 0, !0)])) : A(t.$slots, "default", { key: 2 }, void 0, !0),
|
|
2079
|
+
t.$slots.footer ? (T(), l("footer", Kn, [A(t.$slots, "footer", {}, void 0, !0)])) : c("", !0)
|
|
2080
|
+
], 2)], 10, Vn)) : c("", !0)]),
|
|
2081
|
+
_: 3
|
|
2082
|
+
}, 8, ["name"])]));
|
|
2083
|
+
}
|
|
2084
|
+
}), [["__scopeId", "data-v-19463245"]]), Jn = /* @__PURE__ */ m({
|
|
2085
|
+
name: "KunFadeCard",
|
|
2086
|
+
__name: "FadeCard",
|
|
2087
|
+
setup(e) {
|
|
2088
|
+
let t = O(!1);
|
|
2089
|
+
return C(() => {
|
|
2090
|
+
t.value = !0;
|
|
2091
|
+
}), (e, n) => t.value ? (T(), s(i, {
|
|
2092
|
+
key: 0,
|
|
2093
|
+
"enter-active-class": "transition-all duration-300 ease-out",
|
|
2094
|
+
"enter-from-class": "opacity-0 max-h-0",
|
|
2095
|
+
"enter-to-class": "opacity-100 max-h-96",
|
|
2096
|
+
"leave-active-class": "transition-all duration-300 ease-in",
|
|
2097
|
+
"leave-from-class": "opacity-100 max-h-96",
|
|
2098
|
+
"leave-to-class": "opacity-0 max-h-0"
|
|
2099
|
+
}, {
|
|
2100
|
+
default: V(() => [A(e.$slots, "default")]),
|
|
2101
|
+
_: 3
|
|
2102
|
+
})) : c("", !0);
|
|
2103
|
+
}
|
|
2104
|
+
}), Yn = {
|
|
2105
|
+
width: "200",
|
|
2106
|
+
height: "200",
|
|
2107
|
+
viewBox: "0 0 100 100",
|
|
2108
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2109
|
+
}, Xn = /* @__PURE__ */ m({
|
|
2110
|
+
name: "KunFavicon",
|
|
2111
|
+
__name: "Favicon",
|
|
2112
|
+
setup(e) {
|
|
2113
|
+
return (e, t) => (T(), l("svg", Yn, [...t[0] ||= [d("<g fill=\"none\" stroke=\"#FFC300\" stroke-width=\"2\"><ellipse cx=\"50\" cy=\"50\" rx=\"45\" ry=\"25\" transform=\"rotate(30 50 50)\"></ellipse><ellipse cx=\"50\" cy=\"50\" rx=\"45\" ry=\"25\" transform=\"rotate(-30 50 50)\"></ellipse></g><circle cx=\"80\" cy=\"42\" r=\"6\" fill=\"#6cb6f1\"></circle><circle cx=\"10\" cy=\"68\" r=\"4\" fill=\"#8b88e3\"></circle>", 3)]]));
|
|
2114
|
+
}
|
|
2115
|
+
}), Zn = (e = {}) => {
|
|
2116
|
+
let t = O([]);
|
|
2117
|
+
return {
|
|
2118
|
+
files: t,
|
|
2119
|
+
pickFiles: () => {
|
|
2120
|
+
if (typeof document > "u") return;
|
|
2121
|
+
let n = document.createElement("input");
|
|
2122
|
+
n.type = "file", e.accept && (n.accept = e.accept), e.multiple && (n.multiple = !0), n.addEventListener("change", (n) => {
|
|
2123
|
+
let r = Array.from(n.target.files ?? []);
|
|
2124
|
+
if (e.maxSize !== void 0) {
|
|
2125
|
+
let t = r.find((t) => t.size > e.maxSize);
|
|
2126
|
+
if (t) {
|
|
2127
|
+
e.onError?.(`${t.name} 超过大小限制 (${Qn(e.maxSize)})`, t);
|
|
2128
|
+
return;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
t.value = r;
|
|
2132
|
+
}), n.click();
|
|
2133
|
+
},
|
|
2134
|
+
clear: () => {
|
|
2135
|
+
t.value = [];
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2138
|
+
}, Qn = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(2)} GB`, $n = { class: "flex items-center gap-2" }, er = {
|
|
2139
|
+
key: 0,
|
|
2140
|
+
class: "text-default-500 truncate text-sm"
|
|
2141
|
+
}, tr = {
|
|
2142
|
+
key: 0,
|
|
2143
|
+
class: "text-default-400 text-xs"
|
|
2144
|
+
}, nr = {
|
|
2145
|
+
key: 1,
|
|
2146
|
+
class: "text-danger text-xs"
|
|
2147
|
+
}, rr = /* @__PURE__ */ m({
|
|
2148
|
+
name: "KunFileInput",
|
|
2149
|
+
__name: "FileInput",
|
|
2150
|
+
props: /*@__PURE__*/ _({
|
|
2151
|
+
accept: { default: "" },
|
|
2152
|
+
multiple: {
|
|
2153
|
+
type: Boolean,
|
|
2154
|
+
default: !1
|
|
2155
|
+
},
|
|
2156
|
+
maxSize: { default: void 0 },
|
|
2157
|
+
hint: { default: "" },
|
|
2158
|
+
error: { default: "" },
|
|
2159
|
+
disabled: {
|
|
2160
|
+
type: Boolean,
|
|
2161
|
+
default: !1
|
|
2162
|
+
},
|
|
2163
|
+
triggerText: { default: "选择文件" },
|
|
2164
|
+
triggerIcon: { default: "lucide:upload" },
|
|
2165
|
+
triggerVariant: { default: "flat" },
|
|
2166
|
+
triggerColor: { default: "primary" },
|
|
2167
|
+
triggerSize: { default: "md" },
|
|
2168
|
+
fullWidth: {
|
|
2169
|
+
type: Boolean,
|
|
2170
|
+
default: !1
|
|
2171
|
+
},
|
|
2172
|
+
showFileName: {
|
|
2173
|
+
type: Boolean,
|
|
2174
|
+
default: !0
|
|
2175
|
+
},
|
|
2176
|
+
className: { default: "" }
|
|
2177
|
+
}, {
|
|
2178
|
+
modelValue: { default: null },
|
|
2179
|
+
modelModifiers: {},
|
|
2180
|
+
files: { default: () => [] },
|
|
2181
|
+
filesModifiers: {}
|
|
2182
|
+
}),
|
|
2183
|
+
emits: /*@__PURE__*/ _(["change", "errorPick"], ["update:modelValue", "update:files"]),
|
|
2184
|
+
setup(e, { emit: t }) {
|
|
2185
|
+
let n = e, r = L(e, "modelValue"), i = L(e, "files"), a = t, { pickFiles: d, files: m } = Zn({
|
|
2186
|
+
accept: n.accept || void 0,
|
|
2187
|
+
multiple: n.multiple,
|
|
2188
|
+
maxSize: n.maxSize,
|
|
2189
|
+
onError: (e) => a("errorPick", e)
|
|
2190
|
+
});
|
|
2191
|
+
z(m, (e) => {
|
|
2192
|
+
e.length !== 0 && (n.multiple ? i.value = e : r.value = e[0] ?? null, a("change", e));
|
|
2193
|
+
});
|
|
2194
|
+
let h = o(() => {
|
|
2195
|
+
if (n.multiple) {
|
|
2196
|
+
let e = i.value.length;
|
|
2197
|
+
return e === 0 ? null : `已选 ${e} 个文件`;
|
|
2198
|
+
}
|
|
2199
|
+
return r.value?.name ?? null;
|
|
2200
|
+
}), g = () => {
|
|
2201
|
+
n.disabled || d();
|
|
2202
|
+
};
|
|
2203
|
+
return (t, n) => (T(), l("div", { class: b(P(U)("flex flex-col gap-1", e.className)) }, [
|
|
2204
|
+
u("div", $n, [A(t.$slots, "default", {
|
|
2205
|
+
pick: g,
|
|
2206
|
+
disabled: e.disabled,
|
|
2207
|
+
fileName: h.value
|
|
2208
|
+
}, () => [p($, {
|
|
2209
|
+
variant: e.triggerVariant,
|
|
2210
|
+
color: e.triggerColor,
|
|
2211
|
+
size: e.triggerSize,
|
|
2212
|
+
disabled: e.disabled,
|
|
2213
|
+
"full-width": e.fullWidth,
|
|
2214
|
+
type: "button",
|
|
2215
|
+
onClick: g
|
|
2216
|
+
}, {
|
|
2217
|
+
default: V(() => [e.triggerIcon ? (T(), s(Z, {
|
|
2218
|
+
key: 0,
|
|
2219
|
+
name: e.triggerIcon,
|
|
2220
|
+
class: "mr-1 size-4"
|
|
2221
|
+
}, null, 8, ["name"])) : c("", !0), f(" " + M(e.triggerText), 1)]),
|
|
2222
|
+
_: 1
|
|
2223
|
+
}, 8, [
|
|
2224
|
+
"variant",
|
|
2225
|
+
"color",
|
|
2226
|
+
"size",
|
|
2227
|
+
"disabled",
|
|
2228
|
+
"full-width"
|
|
2229
|
+
])]), e.showFileName && h.value ? (T(), l("span", er, M(h.value), 1)) : c("", !0)]),
|
|
2230
|
+
e.hint && !e.error ? (T(), l("p", tr, M(e.hint), 1)) : c("", !0),
|
|
2231
|
+
e.error ? (T(), l("p", nr, M(e.error), 1)) : c("", !0)
|
|
2232
|
+
], 2));
|
|
2233
|
+
}
|
|
2234
|
+
}), ir = { class: "space-y-2" }, ar = { class: "flex flex-wrap items-center justify-between gap-2" }, or = { class: "space-y-2" }, sr = { key: 0 }, cr = {
|
|
2235
|
+
key: 0,
|
|
2236
|
+
class: "text-default-500 text-sm whitespace-pre-wrap sm:text-base"
|
|
2237
|
+
}, lr = /* @__PURE__ */ m({
|
|
2238
|
+
name: "KunHeader",
|
|
2239
|
+
__name: "Header",
|
|
2240
|
+
props: {
|
|
2241
|
+
name: { default: "" },
|
|
2242
|
+
description: { default: "" },
|
|
2243
|
+
scale: { default: "h1" }
|
|
2244
|
+
},
|
|
2245
|
+
setup(e) {
|
|
2246
|
+
let t = e, n = o(() => U("font-medium", {
|
|
2247
|
+
h1: "text-2xl sm:text-3xl",
|
|
2248
|
+
h2: "text-xl sm:text-2xl",
|
|
2249
|
+
h3: "text-lg sm:text-xl"
|
|
2250
|
+
}[t.scale]));
|
|
2251
|
+
return (t, r) => (T(), l("div", ir, [u("div", ar, [u("div", or, [
|
|
2252
|
+
(T(), s(j(e.scale), {
|
|
2253
|
+
title: e.name,
|
|
2254
|
+
class: b(n.value)
|
|
2255
|
+
}, {
|
|
2256
|
+
default: V(() => [e.name ? (T(), l("span", sr, M(e.name), 1)) : c("", !0), A(t.$slots, "title")]),
|
|
2257
|
+
_: 3
|
|
2258
|
+
}, 8, ["title", "class"])),
|
|
2259
|
+
e.description ? (T(), l("p", cr, M(e.description), 1)) : c("", !0),
|
|
2260
|
+
A(t.$slots, "description")
|
|
2261
|
+
]), A(t.$slots, "headerEndContent")]), A(t.$slots, "endContent")]));
|
|
2262
|
+
}
|
|
2263
|
+
}), ur = [
|
|
2264
|
+
"src",
|
|
2265
|
+
"alt",
|
|
2266
|
+
"aria-label",
|
|
2267
|
+
"width",
|
|
2268
|
+
"height"
|
|
2269
|
+
], dr = /* @__PURE__ */ m({
|
|
2270
|
+
name: "KunImageNative",
|
|
2271
|
+
__name: "ImageNative",
|
|
2272
|
+
props: {
|
|
2273
|
+
src: {},
|
|
2274
|
+
alt: { default: "image" },
|
|
2275
|
+
ariaLabel: { default: void 0 },
|
|
2276
|
+
width: { default: void 0 },
|
|
2277
|
+
height: { default: void 0 },
|
|
2278
|
+
className: { default: void 0 }
|
|
2279
|
+
},
|
|
2280
|
+
setup(e) {
|
|
2281
|
+
return (t, n) => (T(), l("img", {
|
|
2282
|
+
class: b(P(U)(e.className)),
|
|
2283
|
+
src: e.src,
|
|
2284
|
+
alt: e.alt,
|
|
2285
|
+
"aria-label": e.ariaLabel,
|
|
2286
|
+
width: e.width,
|
|
2287
|
+
height: e.height
|
|
2288
|
+
}, null, 10, ur));
|
|
2289
|
+
}
|
|
2290
|
+
}), fr = { key: 1 }, pr = {
|
|
2291
|
+
key: 0,
|
|
2292
|
+
class: "text-sm opacity-90"
|
|
2293
|
+
}, mr = { key: 0 }, hr = /* @__PURE__ */ m({
|
|
2294
|
+
name: "KunInfo",
|
|
2295
|
+
__name: "Info",
|
|
2296
|
+
props: {
|
|
2297
|
+
title: { default: "" },
|
|
2298
|
+
description: { default: "" },
|
|
2299
|
+
className: { default: "" },
|
|
2300
|
+
color: { default: "default" },
|
|
2301
|
+
variant: { default: "flat" },
|
|
2302
|
+
icon: { default: "" },
|
|
2303
|
+
rounded: { default: void 0 }
|
|
2304
|
+
},
|
|
2305
|
+
setup(e) {
|
|
2306
|
+
let t = e, n = X(() => t.rounded, "lg"), r = o(() => q[n.value]), i = o(() => {
|
|
2307
|
+
switch (t.variant) {
|
|
2308
|
+
case "solid":
|
|
2309
|
+
case "shadow": return " text-white";
|
|
2310
|
+
case "bordered": return "border-[1.5px]";
|
|
2311
|
+
case "light": return "bg-opacity-20 border-transparent";
|
|
2312
|
+
case "flat": return "bg-opacity-20 border-transparent shadow-none";
|
|
2313
|
+
case "faded": return "bg-opacity-10 border-transparent";
|
|
2314
|
+
case "ghost": return "bg-transparent border-transparent shadow-none hover:bg-opacity-10";
|
|
2315
|
+
default: return "";
|
|
2316
|
+
}
|
|
2317
|
+
}), a = {
|
|
2318
|
+
solid: {
|
|
2319
|
+
default: "bg-default",
|
|
2320
|
+
primary: "bg-primary",
|
|
2321
|
+
secondary: "bg-secondary",
|
|
2322
|
+
success: "bg-success-600",
|
|
2323
|
+
warning: "bg-warning",
|
|
2324
|
+
danger: "bg-danger-600",
|
|
2325
|
+
info: "bg-info-600"
|
|
2326
|
+
},
|
|
2327
|
+
bordered: {
|
|
2328
|
+
default: "bg-transparent bg-default/15 border-default",
|
|
2329
|
+
primary: "bg-transparent bg-primary/15 border-primary text-primary",
|
|
2330
|
+
secondary: "bg-transparent bg-secondary/15 border-secondary text-secondary",
|
|
2331
|
+
success: "bg-transparent bg-success/15 border-success-600 text-success",
|
|
2332
|
+
warning: "bg-transparent bg-warning/15 border-warning-600 text-warning",
|
|
2333
|
+
danger: "bg-transparent bg-danger/15 border-danger text-danger",
|
|
2334
|
+
info: "bg-transparent bg-info/15 border-info text-info"
|
|
2335
|
+
},
|
|
2336
|
+
light: {
|
|
2337
|
+
default: "bg-transparent hover:bg-default/40",
|
|
2338
|
+
primary: "bg-transparent text-primary-800 hover:bg-primary/20",
|
|
2339
|
+
secondary: "bg-transparent text-secondary-800 hover:bg-secondary/20",
|
|
2340
|
+
success: "bg-transparent text-success-800 hover:bg-success/20",
|
|
2341
|
+
warning: "bg-transparent text-warning-800 hover:bg-warning/20",
|
|
2342
|
+
danger: "bg-transparent text-danger-800 hover:bg-danger/20",
|
|
2343
|
+
info: "bg-transparent text-info-800 hover:bg-info/20"
|
|
2344
|
+
},
|
|
2345
|
+
flat: {
|
|
2346
|
+
default: "bg-default/15 text-default-800",
|
|
2347
|
+
primary: "bg-primary/15 text-primary-800",
|
|
2348
|
+
secondary: "bg-secondary/15 text-secondary-800",
|
|
2349
|
+
success: "bg-success/15 text-success-800 dark:text-success",
|
|
2350
|
+
warning: "bg-warning/15 text-warning-800 dark:text-warning",
|
|
2351
|
+
danger: "bg-danger/15 text-danger-800 dark:text-danger-500",
|
|
2352
|
+
info: "bg-info/15 text-info-800 dark:text-info-500"
|
|
2353
|
+
},
|
|
2354
|
+
faded: {
|
|
2355
|
+
default: "border-default bg-default-100",
|
|
2356
|
+
primary: "border-default bg-primary-100 text-primary",
|
|
2357
|
+
secondary: "border-default bg-secondary-100 text-secondary",
|
|
2358
|
+
success: "border-default bg-success-100 text-success",
|
|
2359
|
+
warning: "border-default bg-warning-100 text-warning",
|
|
2360
|
+
danger: "border-default bg-danger-100 text-danger",
|
|
2361
|
+
info: "border-default bg-info-100 text-info"
|
|
2362
|
+
},
|
|
2363
|
+
shadow: {
|
|
2364
|
+
default: " shadow-default/50 bg-default",
|
|
2365
|
+
primary: " shadow-primary/40 bg-primary",
|
|
2366
|
+
secondary: " shadow-secondary/40 bg-secondary",
|
|
2367
|
+
success: " shadow-success/40 bg-success",
|
|
2368
|
+
warning: " shadow-warning/40 bg-warning dark:text-black",
|
|
2369
|
+
danger: " shadow-danger/40 bg-danger",
|
|
2370
|
+
info: " shadow-info/40 bg-info"
|
|
2371
|
+
},
|
|
2372
|
+
ghost: {
|
|
2373
|
+
default: "border-default",
|
|
2374
|
+
primary: "border-primary text-primary",
|
|
2375
|
+
secondary: "border-secondary text-secondary",
|
|
2376
|
+
success: "border-success text-success",
|
|
2377
|
+
warning: "border-warning text-warning",
|
|
2378
|
+
danger: "border-danger text-danger",
|
|
2379
|
+
info: "border-info text-info"
|
|
2380
|
+
}
|
|
2381
|
+
}, d = o(() => a[t.variant]?.[t.color] || ""), f = o(() => {
|
|
2382
|
+
switch (t.color) {
|
|
2383
|
+
case "primary": return "text-primary-900";
|
|
2384
|
+
case "secondary": return "text-secondary-900";
|
|
2385
|
+
case "danger": return "text-danger-900";
|
|
2386
|
+
case "info": return "text-info-900";
|
|
2387
|
+
case "success": return "text-success-900";
|
|
2388
|
+
case "warning": return "text-warning-900";
|
|
2389
|
+
default: return "text-default-900";
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
return (t, n) => (T(), l("div", { class: b(P(U)("space-y-2 p-3", r.value, i.value, d.value, e.className)) }, [u("h3", { class: b(P(U)("flex items-center gap-2 font-medium", f.value)) }, [
|
|
2393
|
+
e.icon ? (T(), s(Z, {
|
|
2394
|
+
key: 0,
|
|
2395
|
+
name: e.icon,
|
|
2396
|
+
"class-name": "h-5 w-5 flex-shrink-0"
|
|
2397
|
+
}, null, 8, ["name"])) : c("", !0),
|
|
2398
|
+
e.title ? (T(), l("span", fr, M(e.title), 1)) : c("", !0),
|
|
2399
|
+
A(t.$slots, "title")
|
|
2400
|
+
], 2), e.description || t.$slots.default ? (T(), l("div", pr, [e.description ? (T(), l("p", mr, M(e.description), 1)) : c("", !0), A(t.$slots, "default")])) : c("", !0)], 2));
|
|
2401
|
+
}
|
|
2402
|
+
}), gr = { class: "w-full" }, _r = ["for"], vr = {
|
|
2403
|
+
key: 0,
|
|
2404
|
+
class: "text-danger"
|
|
2405
|
+
}, yr = { class: "relative" }, br = [
|
|
2406
|
+
"id",
|
|
2407
|
+
"value",
|
|
2408
|
+
"type",
|
|
2409
|
+
"placeholder",
|
|
2410
|
+
"disabled",
|
|
2411
|
+
"required"
|
|
2412
|
+
], xr = {
|
|
2413
|
+
key: 0,
|
|
2414
|
+
class: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"
|
|
2415
|
+
}, Sr = {
|
|
2416
|
+
key: 1,
|
|
2417
|
+
class: "absolute inset-y-0 right-0 flex items-center pr-3"
|
|
2418
|
+
}, Cr = {
|
|
2419
|
+
key: 1,
|
|
2420
|
+
class: "text-default-500 mt-1 text-sm"
|
|
2421
|
+
}, wr = {
|
|
2422
|
+
key: 2,
|
|
2423
|
+
class: "text-danger mt-1 text-sm"
|
|
2424
|
+
}, Tr = /* @__PURE__ */ m({
|
|
2425
|
+
name: "KunInput",
|
|
2426
|
+
inheritAttrs: !1,
|
|
2427
|
+
__name: "Input",
|
|
2428
|
+
props: /*@__PURE__*/ _({
|
|
2429
|
+
label: { default: "" },
|
|
2430
|
+
type: { default: "text" },
|
|
2431
|
+
color: { default: "default" },
|
|
2432
|
+
className: { default: "" },
|
|
2433
|
+
placeholder: { default: "" },
|
|
2434
|
+
helperText: { default: "" },
|
|
2435
|
+
error: { default: "" },
|
|
2436
|
+
size: { default: "md" },
|
|
2437
|
+
required: {
|
|
2438
|
+
type: Boolean,
|
|
2439
|
+
default: !1
|
|
2440
|
+
},
|
|
2441
|
+
disabled: {
|
|
2442
|
+
type: Boolean,
|
|
2443
|
+
default: !1
|
|
2444
|
+
},
|
|
2445
|
+
darkBorder: {
|
|
2446
|
+
type: Boolean,
|
|
2447
|
+
default: !0
|
|
2448
|
+
},
|
|
2449
|
+
autofocus: {
|
|
2450
|
+
type: Boolean,
|
|
2451
|
+
default: !1
|
|
2452
|
+
},
|
|
2453
|
+
rounded: { default: void 0 }
|
|
2454
|
+
}, {
|
|
2455
|
+
modelValue: { default: "" },
|
|
2456
|
+
modelModifiers: {}
|
|
2457
|
+
}),
|
|
2458
|
+
emits: /*@__PURE__*/ _(["blur", "focus"], ["update:modelValue"]),
|
|
2459
|
+
setup(e, { expose: t, emit: n }) {
|
|
2460
|
+
let r = e, i = X(() => r.rounded), a = o(() => q[i.value]), s = L(e, "modelValue"), d = n, p = O(null), m = O(!1), h = Ft("kun-input"), g = {
|
|
2461
|
+
default: "focus:ring-default",
|
|
2462
|
+
primary: "focus:ring-primary",
|
|
2463
|
+
secondary: "focus:ring-secondary",
|
|
2464
|
+
success: "focus:ring-success",
|
|
2465
|
+
warning: "focus:ring-warning",
|
|
2466
|
+
danger: "focus:ring-danger",
|
|
2467
|
+
info: "focus:ring-info"
|
|
2468
|
+
}, _ = o(() => {
|
|
2469
|
+
switch (r.size) {
|
|
2470
|
+
case "xs": return "text-xs px-2 py-1";
|
|
2471
|
+
case "sm": return "text-sm px-3 py-1.5";
|
|
2472
|
+
case "lg": return "text-base px-5 py-2.5";
|
|
2473
|
+
case "xl": return "text-lg px-6 py-3";
|
|
2474
|
+
default: return "text-sm px-4 py-2";
|
|
2475
|
+
}
|
|
2476
|
+
}), b = (e) => {
|
|
2477
|
+
s.value = e.target.value;
|
|
2478
|
+
}, x = (e) => {
|
|
2479
|
+
m.value = !1, d("blur", e);
|
|
2480
|
+
}, S = (e) => {
|
|
2481
|
+
m.value = !0, d("focus", e);
|
|
2482
|
+
};
|
|
2483
|
+
return C(() => {
|
|
2484
|
+
r.autofocus && (m.value = !0, p.value?.focus());
|
|
2485
|
+
}), t({
|
|
2486
|
+
focus: () => p.value?.focus(),
|
|
2487
|
+
blur: () => p.value?.blur(),
|
|
2488
|
+
select: () => p.value?.select(),
|
|
2489
|
+
insertAtCaret: (e) => {
|
|
2490
|
+
let t = p.value;
|
|
2491
|
+
if (!t) return;
|
|
2492
|
+
let n = t.selectionStart ?? t.value.length, r = t.selectionEnd ?? t.value.length;
|
|
2493
|
+
s.value = t.value.slice(0, n) + e + t.value.slice(r), y(() => {
|
|
2494
|
+
if (!p.value) return;
|
|
2495
|
+
let t = n + e.length;
|
|
2496
|
+
p.value.setSelectionRange(t, t), p.value.focus();
|
|
2497
|
+
});
|
|
2498
|
+
},
|
|
2499
|
+
inputRef: p
|
|
2500
|
+
}), (t, n) => (T(), l("div", gr, [
|
|
2501
|
+
e.label ? (T(), l("label", {
|
|
2502
|
+
key: 0,
|
|
2503
|
+
for: P(h),
|
|
2504
|
+
class: "text-default-700 mb-1 block text-sm font-medium"
|
|
2505
|
+
}, [f(M(e.label) + " ", 1), e.required ? (T(), l("span", vr, "*")) : c("", !0)], 8, _r)) : c("", !0),
|
|
2506
|
+
u("div", yr, [
|
|
2507
|
+
u("input", v({
|
|
2508
|
+
id: P(h),
|
|
2509
|
+
ref_key: "input",
|
|
2510
|
+
ref: p
|
|
2511
|
+
}, t.$attrs, {
|
|
2512
|
+
value: s.value,
|
|
2513
|
+
type: e.type,
|
|
2514
|
+
placeholder: e.placeholder,
|
|
2515
|
+
disabled: e.disabled,
|
|
2516
|
+
required: e.required,
|
|
2517
|
+
class: P(U)("border-default/20 block w-full border transition duration-150 ease-in-out focus:border-transparent focus:ring-2", a.value, g[e.color], _.value, e.darkBorder && "dark:border-default-200", t.$slots.prefix && "pl-10", t.$slots.suffix && "pr-10", e.disabled && "bg-default-100 cursor-not-allowed", e.error ? "border-danger-300 focus:border-danger focus:ring-danger" : "", e.className),
|
|
2518
|
+
onInput: b,
|
|
2519
|
+
onBlur: x,
|
|
2520
|
+
onFocus: S
|
|
2521
|
+
}), null, 16, br),
|
|
2522
|
+
t.$slots.prefix ? (T(), l("div", xr, [A(t.$slots, "prefix")])) : c("", !0),
|
|
2523
|
+
t.$slots.suffix ? (T(), l("div", Sr, [A(t.$slots, "suffix")])) : c("", !0)
|
|
2524
|
+
]),
|
|
2525
|
+
e.helperText && !e.error ? (T(), l("p", Cr, M(e.helperText), 1)) : c("", !0),
|
|
2526
|
+
e.error ? (T(), l("p", wr, M(e.error), 1)) : c("", !0)
|
|
2527
|
+
]));
|
|
2528
|
+
}
|
|
2529
|
+
}), Er = { class: "contents" }, Dr = Symbol("KunLightboxGallery"), Or = /* @__PURE__ */ m({
|
|
2530
|
+
name: "KunLightboxGallery",
|
|
2531
|
+
__name: "LightboxGallery",
|
|
2532
|
+
setup(e) {
|
|
2533
|
+
let n = O([]), r = O(!1), i = O(0);
|
|
2534
|
+
return E(Dr, {
|
|
2535
|
+
register: (e) => (n.value.push(e), () => {
|
|
2536
|
+
let t = n.value.findIndex((t) => t.id === e.id);
|
|
2537
|
+
t >= 0 && n.value.splice(t, 1);
|
|
2538
|
+
}),
|
|
2539
|
+
open: (e) => {
|
|
2540
|
+
let t = n.value.findIndex((t) => t.id === e.id);
|
|
2541
|
+
t < 0 || (i.value = t, r.value = !0);
|
|
2542
|
+
}
|
|
2543
|
+
}), (e, a) => (T(), l(t, null, [u("div", Er, [A(e.$slots, "default")]), p(on, {
|
|
2544
|
+
"is-open": r.value,
|
|
2545
|
+
"onUpdate:isOpen": a[0] ||= (e) => r.value = e,
|
|
2546
|
+
images: n.value,
|
|
2547
|
+
"initial-index": i.value
|
|
2548
|
+
}, null, 8, [
|
|
2549
|
+
"is-open",
|
|
2550
|
+
"images",
|
|
2551
|
+
"initial-index"
|
|
2552
|
+
])], 64));
|
|
2553
|
+
}
|
|
2554
|
+
}), kr = /* @__PURE__ */ m({
|
|
2555
|
+
name: "KunLightboxGalleryItem",
|
|
2556
|
+
__name: "LightboxGalleryItem",
|
|
2557
|
+
props: {
|
|
2558
|
+
src: {},
|
|
2559
|
+
alt: {},
|
|
2560
|
+
as: { default: "span" },
|
|
2561
|
+
wrap: {
|
|
2562
|
+
type: Boolean,
|
|
2563
|
+
default: !0
|
|
2564
|
+
}
|
|
2565
|
+
},
|
|
2566
|
+
setup(e) {
|
|
2567
|
+
let t = e, n = h(Dr);
|
|
2568
|
+
if (!n) throw Error("KunLightboxGalleryItem must be a child of <KunLightboxGallery>.");
|
|
2569
|
+
let r = D({
|
|
2570
|
+
id: Symbol("KunLightboxGalleryItem"),
|
|
2571
|
+
src: t.src,
|
|
2572
|
+
alt: t.alt
|
|
2573
|
+
});
|
|
2574
|
+
B(() => {
|
|
2575
|
+
r.src = t.src, r.alt = t.alt;
|
|
2576
|
+
}), w(n.register(r));
|
|
2577
|
+
let i = () => n.open(r), a = (e) => {
|
|
2578
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), i());
|
|
2579
|
+
};
|
|
2580
|
+
return (t, n) => e.wrap ? (T(), s(j(e.as), {
|
|
2581
|
+
key: 0,
|
|
2582
|
+
role: "button",
|
|
2583
|
+
tabindex: "0",
|
|
2584
|
+
"aria-label": e.alt || "查看大图",
|
|
2585
|
+
class: "cursor-zoom-in",
|
|
2586
|
+
onClick: i,
|
|
2587
|
+
onKeydown: a
|
|
2588
|
+
}, {
|
|
2589
|
+
default: V(() => [A(t.$slots, "default", { open: i })]),
|
|
2590
|
+
_: 3
|
|
2591
|
+
}, 40, ["aria-label"])) : A(t.$slots, "default", {
|
|
2592
|
+
key: 1,
|
|
2593
|
+
open: i
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
}), Ar = /* @__PURE__ */ m({
|
|
2597
|
+
name: "KunLink",
|
|
2598
|
+
inheritAttrs: !1,
|
|
2599
|
+
__name: "Link",
|
|
2600
|
+
props: {
|
|
2601
|
+
href: { default: void 0 },
|
|
2602
|
+
to: { default: "" },
|
|
2603
|
+
color: { default: "primary" },
|
|
2604
|
+
underline: { default: "always" },
|
|
2605
|
+
size: { default: "md" },
|
|
2606
|
+
className: { default: "" },
|
|
2607
|
+
rel: { default: "" },
|
|
2608
|
+
target: { default: "_self" },
|
|
2609
|
+
isShowAnchorIcon: {
|
|
2610
|
+
type: Boolean,
|
|
2611
|
+
default: !1
|
|
2612
|
+
}
|
|
2613
|
+
},
|
|
2614
|
+
setup(e) {
|
|
2615
|
+
let t = e, n = Y(), r = o(() => {
|
|
2616
|
+
switch (t.underline) {
|
|
2617
|
+
case "none": return "";
|
|
2618
|
+
case "hover": return "hover:underline underline-offset-3";
|
|
2619
|
+
default: return "underline underline-offset-3";
|
|
2620
|
+
}
|
|
2621
|
+
}), i = o(() => {
|
|
2622
|
+
switch (t.size) {
|
|
2623
|
+
case "xs": return "text-xs";
|
|
2624
|
+
case "sm": return "text-sm";
|
|
2625
|
+
case "lg": return "text-lg";
|
|
2626
|
+
case "xl": return "text-xl";
|
|
2627
|
+
default: return "text-base";
|
|
2628
|
+
}
|
|
2629
|
+
}), a = o(() => t.to || t.href || ""), l = o(() => {
|
|
2630
|
+
let e = {
|
|
2631
|
+
rel: t.rel,
|
|
2632
|
+
target: t.target
|
|
2633
|
+
};
|
|
2634
|
+
return typeof n.linkComponent == "string" ? {
|
|
2635
|
+
...e,
|
|
2636
|
+
href: typeof a.value == "string" ? a.value : void 0
|
|
2637
|
+
} : {
|
|
2638
|
+
...e,
|
|
2639
|
+
to: a.value
|
|
2640
|
+
};
|
|
2641
|
+
});
|
|
2642
|
+
return (t, a) => (T(), s(j(P(n).linkComponent), v({
|
|
2643
|
+
...l.value,
|
|
2644
|
+
...t.$attrs
|
|
2645
|
+
}, { class: P(U)("inline-flex items-center gap-2 break-all", r.value, i.value, P(le)[e.color], e.className) }), {
|
|
2646
|
+
default: V(() => [
|
|
2647
|
+
A(t.$slots, "prefix"),
|
|
2648
|
+
A(t.$slots, "default"),
|
|
2649
|
+
e.isShowAnchorIcon ? (T(), s(Z, {
|
|
2650
|
+
key: 0,
|
|
2651
|
+
name: "lucide:external-link"
|
|
2652
|
+
})) : c("", !0),
|
|
2653
|
+
A(t.$slots, "suffix")
|
|
2654
|
+
]),
|
|
2655
|
+
_: 3
|
|
2656
|
+
}, 16, ["class"]));
|
|
2657
|
+
}
|
|
2658
|
+
}), jr = [
|
|
2659
|
+
"あーちゃん",
|
|
2660
|
+
"こじかひわ",
|
|
2661
|
+
"雪々",
|
|
2662
|
+
"琥珀"
|
|
2663
|
+
], Mr = () => {
|
|
2664
|
+
let e = jr[de(0, jr.length - 1)] ?? jr[0];
|
|
2665
|
+
return {
|
|
2666
|
+
name: e,
|
|
2667
|
+
loli: `/alert/${e}.webp`
|
|
2668
|
+
};
|
|
2669
|
+
}, Nr = {
|
|
2670
|
+
key: 0,
|
|
2671
|
+
class: "bg-background z-kun-message fixed right-0 bottom-0 left-0 min-h-30 w-full border-t"
|
|
2672
|
+
}, Pr = { class: "loli absolute -top-10 pl-24 text-lg sm:pl-32" }, Fr = { class: "bg-background px-10 py-1 text-center text-lg sm:text-2xl" }, Ir = { class: "pointer-events-none absolute mt-2 ml-6 select-none" }, Lr = { class: "info mt-4 mr-8 ml-24 text-base sm:ml-32 sm:text-lg" }, Rr = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
2673
|
+
name: "KunLoli",
|
|
2674
|
+
__name: "Loli",
|
|
2675
|
+
props: {
|
|
2676
|
+
message: {},
|
|
2677
|
+
duration: {}
|
|
2678
|
+
},
|
|
2679
|
+
setup(e) {
|
|
2680
|
+
let t = e, { loli: n, name: r } = Mr(), a = O(!1), o = O(100), d = null, f = () => {
|
|
2681
|
+
d && cancelAnimationFrame(d), a.value = !1;
|
|
2682
|
+
};
|
|
2683
|
+
return C(() => {
|
|
2684
|
+
a.value = !0;
|
|
2685
|
+
let e = performance.now(), n = t.duration, r = (t) => {
|
|
2686
|
+
let i = t - e, a = Math.max(0, 100 - i / n * 100);
|
|
2687
|
+
o.value = a, a > 0 ? d = requestAnimationFrame(r) : f();
|
|
2688
|
+
};
|
|
2689
|
+
d = requestAnimationFrame(r);
|
|
2690
|
+
}), S(() => {
|
|
2691
|
+
d && cancelAnimationFrame(d);
|
|
2692
|
+
}), (t, d) => (T(), s(i, {
|
|
2693
|
+
"enter-active-class": "animate-fadeInUp",
|
|
2694
|
+
"leave-active-class": "animate-fadeOutDown"
|
|
2695
|
+
}, {
|
|
2696
|
+
default: V(() => [a.value ? (T(), l("div", Nr, [
|
|
2697
|
+
p(i, {
|
|
2698
|
+
"enter-active-class": "animate-swing",
|
|
2699
|
+
appear: ""
|
|
2700
|
+
}, {
|
|
2701
|
+
default: V(() => [u("div", Pr, [u("span", Fr, M(P(r)), 1)])]),
|
|
2702
|
+
_: 1
|
|
2703
|
+
}),
|
|
2704
|
+
u("div", Ir, [p(St, {
|
|
2705
|
+
class: "h-16 w-full sm:h-24",
|
|
2706
|
+
src: P(n)
|
|
2707
|
+
}, null, 8, ["src"])]),
|
|
2708
|
+
p(i, {
|
|
2709
|
+
"enter-active-class": "animate-bounceInRight",
|
|
2710
|
+
appear: ""
|
|
2711
|
+
}, {
|
|
2712
|
+
default: V(() => [u("div", Lr, M(`「 ${e.message} 」`), 1)]),
|
|
2713
|
+
_: 1
|
|
2714
|
+
}),
|
|
2715
|
+
u("button", {
|
|
2716
|
+
class: "hover:bg-default/40 absolute top-1 right-1 inline-flex cursor-pointer overflow-hidden rounded-full border-transparent bg-transparent p-2 text-sm font-medium transition-all hover:opacity-80 active:scale-[0.97]",
|
|
2717
|
+
onClick: f
|
|
2718
|
+
}, [p(Z, {
|
|
2719
|
+
name: "lucide:x",
|
|
2720
|
+
class: "h-4 w-4"
|
|
2721
|
+
})]),
|
|
2722
|
+
u("span", {
|
|
2723
|
+
style: x({ width: `${o.value}%` }),
|
|
2724
|
+
class: "bg-primary absolute top-0 right-0 h-1.5"
|
|
2725
|
+
}, null, 4)
|
|
2726
|
+
])) : c("", !0)]),
|
|
2727
|
+
_: 1
|
|
2728
|
+
}));
|
|
2729
|
+
}
|
|
2730
|
+
}), [["__scopeId", "data-v-d9d23bff"]]), zr = O(null), Br = 0, Vr = null, Hr = () => ({
|
|
2731
|
+
current: o(() => zr.value),
|
|
2732
|
+
clear: () => {
|
|
2733
|
+
zr.value = null, Vr &&= (clearTimeout(Vr), null);
|
|
2734
|
+
}
|
|
2735
|
+
}), Ur = (e, t) => {
|
|
2736
|
+
let n = t ? t * 1e3 : 3e3;
|
|
2737
|
+
Br++, zr.value = {
|
|
2738
|
+
message: e,
|
|
2739
|
+
duration: n,
|
|
2740
|
+
key: Br
|
|
2741
|
+
}, Vr && clearTimeout(Vr), Vr = setTimeout(() => {
|
|
2742
|
+
zr.value = null, Vr = null;
|
|
2743
|
+
}, n + 600);
|
|
2744
|
+
}, Wr = /* @__PURE__ */ m({
|
|
2745
|
+
name: "KunLoliProvider",
|
|
2746
|
+
__name: "LoliProvider",
|
|
2747
|
+
setup(e) {
|
|
2748
|
+
let { current: t } = Hr();
|
|
2749
|
+
return (e, n) => P(t) ? (T(), s(Rr, {
|
|
2750
|
+
key: P(t).key,
|
|
2751
|
+
message: P(t).message,
|
|
2752
|
+
duration: P(t).duration
|
|
2753
|
+
}, null, 8, ["message", "duration"])) : c("", !0);
|
|
2754
|
+
}
|
|
2755
|
+
}), Gr = { class: "contents" }, Kr = {
|
|
2756
|
+
key: 0,
|
|
2757
|
+
class: "relative min-h-24"
|
|
2758
|
+
}, qr = {
|
|
2759
|
+
key: 0,
|
|
2760
|
+
class: "bg-background/50 absolute inset-0 z-50 flex items-center justify-center rounded-lg"
|
|
2761
|
+
}, Jr = { class: "flex flex-col items-center gap-3" }, Yr = { class: "info text-xl" }, Xr = {
|
|
2762
|
+
key: 1,
|
|
2763
|
+
class: "m-auto flex flex-col items-center gap-3"
|
|
2764
|
+
}, Zr = { class: "info" }, Qr = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
2765
|
+
name: "KunLoading",
|
|
2766
|
+
__name: "Loading",
|
|
2767
|
+
props: {
|
|
2768
|
+
loading: {
|
|
2769
|
+
type: Boolean,
|
|
2770
|
+
default: !1
|
|
2771
|
+
},
|
|
2772
|
+
description: { default: "正在摸鱼中...咕咕咕" },
|
|
2773
|
+
src: { default: "/kun.webp" }
|
|
2774
|
+
},
|
|
2775
|
+
setup(e) {
|
|
2776
|
+
let t = ee(), n = o(() => !!t.default);
|
|
2777
|
+
return (t, r) => (T(), l("div", Gr, [n.value ? (T(), l("div", Kr, [u("div", { class: b(P(U)("transition-opacity", e.loading && "opacity-50")) }, [A(t.$slots, "default", {}, void 0, !0)], 2), p(i, {
|
|
2778
|
+
"enter-active-class": "transition-opacity duration-300",
|
|
2779
|
+
"enter-from-class": "opacity-0",
|
|
2780
|
+
"leave-active-class": "transition-opacity duration-300",
|
|
2781
|
+
"leave-from-class": "opacity-0"
|
|
2782
|
+
}, {
|
|
2783
|
+
default: V(() => [e.loading ? (T(), l("div", qr, [u("div", Jr, [p(dr, {
|
|
2784
|
+
alt: "loading",
|
|
2785
|
+
src: e.src,
|
|
2786
|
+
"class-name": "h-48 w-48 rounded-lg"
|
|
2787
|
+
}, null, 8, ["src"]), u("span", Yr, M(e.description), 1)])])) : c("", !0)]),
|
|
2788
|
+
_: 1
|
|
2789
|
+
})])) : (T(), l("div", Xr, [p(dr, {
|
|
2790
|
+
alt: "loading",
|
|
2791
|
+
src: e.src,
|
|
2792
|
+
"class-name": "h-48 w-48 rounded-lg"
|
|
2793
|
+
}, null, 8, ["src"]), u("span", Zr, M(e.description), 1)]))]));
|
|
2794
|
+
}
|
|
2795
|
+
}), [["__scopeId", "data-v-03e5bd77"]]), $r = /* @__PURE__ */ m({
|
|
2796
|
+
name: "KunMarkdown",
|
|
2797
|
+
inheritAttrs: !1,
|
|
2798
|
+
__name: "Markdown",
|
|
2799
|
+
setup(e) {
|
|
2800
|
+
return (e, t) => (T(), l("svg", v({
|
|
2801
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2802
|
+
width: "15",
|
|
2803
|
+
height: "15",
|
|
2804
|
+
viewBox: "0 0 15 15",
|
|
2805
|
+
fill: "currentColor"
|
|
2806
|
+
}, e.$attrs), [...t[0] ||= [u("path", {
|
|
2807
|
+
fill: "currentColor",
|
|
2808
|
+
d: "m2.5 5.5l.354-.354A.5.5 0 0 0 2 5.5zm2 2l-.354.354l.354.353l.354-.353zm2-2H7a.5.5 0 0 0-.854-.354zm4 4l-.354.354l.354.353l.354-.353zM1.5 3h12V2h-12zm12.5.5v8h1v-8zm-.5 8.5h-12v1h12zM1 11.5v-8H0v8zm.5.5a.5.5 0 0 1-.5-.5H0A1.5 1.5 0 0 0 1.5 13zm12.5-.5a.5.5 0 0 1-.5.5v1a1.5 1.5 0 0 0 1.5-1.5zM13.5 3a.5.5 0 0 1 .5.5h1A1.5 1.5 0 0 0 13.5 2zm-12-1A1.5 1.5 0 0 0 0 3.5h1a.5.5 0 0 1 .5-.5zM3 10V5.5H2V10zm-.854-4.146l2 2l.708-.708l-2-2zm2.708 2l2-2l-.708-.708l-2 2zM6 5.5V10h1V5.5zm4-.5v4.5h1V5zM8.146 7.854l2 2l.708-.708l-2-2zm2.708 2l2-2l-.708-.708l-2 2z"
|
|
2809
|
+
}, null, -1)]], 16));
|
|
2810
|
+
}
|
|
2811
|
+
}), ei = { class: "flex-1 text-sm font-medium" }, ti = { key: 0 }, ni = ["innerHTML"], ri = {
|
|
2812
|
+
key: 0,
|
|
2813
|
+
class: "ml-3 flex h-6 w-6 items-center justify-center rounded-full bg-black/10 text-xs font-bold dark:bg-white/10"
|
|
2814
|
+
}, ii = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
2815
|
+
name: "KunMessageItem",
|
|
2816
|
+
__name: "MessageItem",
|
|
2817
|
+
props: {
|
|
2818
|
+
id: {},
|
|
2819
|
+
message: {},
|
|
2820
|
+
type: {},
|
|
2821
|
+
duration: {},
|
|
2822
|
+
richText: { type: Boolean },
|
|
2823
|
+
count: {}
|
|
2824
|
+
},
|
|
2825
|
+
emits: ["remove"],
|
|
2826
|
+
setup(e, { emit: t }) {
|
|
2827
|
+
F((e) => ({ v5544b04d: a.value }));
|
|
2828
|
+
let n = e, r = t, i = o(() => n.richText ?? !1), a = o(() => `${n.duration}ms`), s = O(null), d = null, f = O(n.duration), m = O(0), h = () => {
|
|
2829
|
+
if (n.duration <= 0) return;
|
|
2830
|
+
d && clearTimeout(d), s.value && (s.value.style.animationPlayState = "paused");
|
|
2831
|
+
let e = Date.now() - m.value;
|
|
2832
|
+
f.value -= e;
|
|
2833
|
+
}, g = () => {
|
|
2834
|
+
n.duration <= 0 || (m.value = Date.now(), s.value && (s.value.style.animationPlayState = "running"), d = setTimeout(() => r("remove", n.id), f.value));
|
|
2835
|
+
};
|
|
2836
|
+
C(() => {
|
|
2837
|
+
n.duration > 0 && g();
|
|
2838
|
+
}), w(() => {
|
|
2839
|
+
d && clearTimeout(d);
|
|
2840
|
+
}), z(() => n.count, () => {
|
|
2841
|
+
d && clearTimeout(d), f.value = n.duration, g();
|
|
2842
|
+
}, { flush: "post" });
|
|
2843
|
+
let _ = o(() => {
|
|
2844
|
+
switch (n.type) {
|
|
2845
|
+
case "success": return {
|
|
2846
|
+
bg: "bg-success-50 dark:bg-success-50/90",
|
|
2847
|
+
text: "text-success-800",
|
|
2848
|
+
icon: "text-success-500",
|
|
2849
|
+
progress: "bg-success-400",
|
|
2850
|
+
iconName: "lucide:circle-check"
|
|
2851
|
+
};
|
|
2852
|
+
case "error": return {
|
|
2853
|
+
bg: "bg-danger-50 dark:bg-danger-50/90",
|
|
2854
|
+
text: "text-danger-800",
|
|
2855
|
+
icon: "text-danger-500",
|
|
2856
|
+
progress: "bg-danger-400",
|
|
2857
|
+
iconName: "lucide:circle-x"
|
|
2858
|
+
};
|
|
2859
|
+
case "warn": return {
|
|
2860
|
+
bg: "bg-warning-50 dark:bg-warning-50/90",
|
|
2861
|
+
text: "text-warning-800",
|
|
2862
|
+
icon: "text-warning-500",
|
|
2863
|
+
progress: "bg-warning-400",
|
|
2864
|
+
iconName: "lucide:triangle-alert"
|
|
2865
|
+
};
|
|
2866
|
+
default: return {
|
|
2867
|
+
bg: "bg-primary-50 dark:bg-primary-50/90",
|
|
2868
|
+
text: "text-primary-800",
|
|
2869
|
+
icon: "text-primary-500",
|
|
2870
|
+
progress: "bg-primary-400",
|
|
2871
|
+
iconName: "lucide:info"
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
});
|
|
2875
|
+
return (t, n) => (T(), l("div", {
|
|
2876
|
+
class: b(P(U)("relative mb-3 flex w-full items-center overflow-hidden rounded-xl p-4 ring-1 ring-black/5 transition-all duration-300", _.value.bg, _.value.text)),
|
|
2877
|
+
onMouseenter: h,
|
|
2878
|
+
onMouseleave: g
|
|
2879
|
+
}, [
|
|
2880
|
+
p(Z, {
|
|
2881
|
+
name: _.value.iconName,
|
|
2882
|
+
class: b(P(U)("mt-0.5 mr-3 h-6 w-6 flex-shrink-0", _.value.icon))
|
|
2883
|
+
}, null, 8, ["name", "class"]),
|
|
2884
|
+
u("div", ei, [i.value ? (T(), l("div", {
|
|
2885
|
+
key: 1,
|
|
2886
|
+
innerHTML: e.message
|
|
2887
|
+
}, null, 8, ni)) : (T(), l("span", ti, M(e.message), 1))]),
|
|
2888
|
+
e.count > 1 ? (T(), l("span", ri, M(e.count), 1)) : c("", !0),
|
|
2889
|
+
(T(), l("div", {
|
|
2890
|
+
ref_key: "progressBarRef",
|
|
2891
|
+
ref: s,
|
|
2892
|
+
key: e.count,
|
|
2893
|
+
class: b(["progress-bar absolute bottom-0 left-0 h-1", _.value.progress])
|
|
2894
|
+
}, null, 2))
|
|
2895
|
+
], 34));
|
|
2896
|
+
}
|
|
2897
|
+
}), [["__scopeId", "data-v-8c507cac"]]), ai = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
2898
|
+
name: "KunMessageProvider",
|
|
2899
|
+
__name: "MessageProvider",
|
|
2900
|
+
setup(e) {
|
|
2901
|
+
let { messages: r, removeMessage: i } = Mn(), c = o(() => {
|
|
2902
|
+
let e = {
|
|
2903
|
+
"top-left": [],
|
|
2904
|
+
"top-center": [],
|
|
2905
|
+
"top-right": [],
|
|
2906
|
+
"bottom-left": [],
|
|
2907
|
+
"bottom-center": [],
|
|
2908
|
+
"bottom-right": []
|
|
2909
|
+
};
|
|
2910
|
+
return r.value.forEach((t) => {
|
|
2911
|
+
e[t.position] && e[t.position].push(t);
|
|
2912
|
+
}), e;
|
|
2913
|
+
}), u = {
|
|
2914
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2 items-center",
|
|
2915
|
+
"top-left": "top-4 left-4 items-start",
|
|
2916
|
+
"top-right": "top-4 right-4 items-end",
|
|
2917
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
|
|
2918
|
+
"bottom-left": "bottom-4 left-4 items-start",
|
|
2919
|
+
"bottom-right": "bottom-4 right-4 items-end"
|
|
2920
|
+
};
|
|
2921
|
+
return (e, r) => (T(), s(n, { to: "body" }, [(T(!0), l(t, null, k(c.value, (e, n) => (T(), l("div", {
|
|
2922
|
+
key: n,
|
|
2923
|
+
class: b(["pointer-events-none fixed z-kun-message flex w-full max-w-sm flex-col p-4", u[n]])
|
|
2924
|
+
}, [p(a, {
|
|
2925
|
+
name: "message-list",
|
|
2926
|
+
tag: "div",
|
|
2927
|
+
class: "w-full"
|
|
2928
|
+
}, {
|
|
2929
|
+
default: V(() => [(T(!0), l(t, null, k(e, (e) => (T(), s(ii, v({ key: e.id }, { ref_for: !0 }, e, {
|
|
2930
|
+
class: "pointer-events-auto",
|
|
2931
|
+
onRemove: P(i)
|
|
2932
|
+
}), null, 16, ["onRemove"]))), 128))]),
|
|
2933
|
+
_: 2
|
|
2934
|
+
}, 1024)], 2))), 128))]));
|
|
2935
|
+
}
|
|
2936
|
+
}), [["__scopeId", "data-v-b9dd1348"]]), oi = { class: "m-auto flex flex-col items-center gap-3" }, si = /* @__PURE__ */ m({
|
|
2937
|
+
name: "KunNull",
|
|
2938
|
+
__name: "Null",
|
|
2939
|
+
props: {
|
|
2940
|
+
description: { default: "请填满这只萝莉吧, 因为这里空空如也" },
|
|
2941
|
+
isShowSticker: {
|
|
2942
|
+
type: Boolean,
|
|
2943
|
+
default: !0
|
|
2944
|
+
}
|
|
2945
|
+
},
|
|
2946
|
+
setup(e) {
|
|
2947
|
+
return (t, n) => (T(), l("div", oi, [e.isShowSticker ? (T(), s(St, {
|
|
2948
|
+
key: 0,
|
|
2949
|
+
src: P(se)(e.description || ""),
|
|
2950
|
+
"class-name": "h-32 w-32 rounded-2xl",
|
|
2951
|
+
loading: "lazy",
|
|
2952
|
+
alt: "blank galgame"
|
|
2953
|
+
}, null, 8, ["src"])) : c("", !0), u("span", null, M(e.description), 1)]));
|
|
2954
|
+
}
|
|
2955
|
+
}), ci = { class: "flex w-full flex-wrap items-center justify-between gap-4" }, li = { class: "mx-auto flex flex-wrap items-center gap-2" }, ui = { class: "mx-auto flex items-center gap-2" }, di = { class: "flex items-center gap-1" }, fi = {
|
|
2956
|
+
key: 1,
|
|
2957
|
+
class: "px-2"
|
|
2958
|
+
}, pi = { class: "text-default-500 mx-auto hidden items-center gap-2 text-sm sm:flex" }, mi = { class: "mx-auto flex items-center gap-2" }, hi = ["for"], gi = [
|
|
2959
|
+
"id",
|
|
2960
|
+
"disabled",
|
|
2961
|
+
"max"
|
|
2962
|
+
], _i = /* @__PURE__ */ m({
|
|
2963
|
+
name: "KunPagination",
|
|
2964
|
+
__name: "Pagination",
|
|
2965
|
+
props: {
|
|
2966
|
+
currentPage: {},
|
|
2967
|
+
totalPage: {},
|
|
2968
|
+
isLoading: { type: Boolean }
|
|
2969
|
+
},
|
|
2970
|
+
emits: ["update:currentPage"],
|
|
2971
|
+
setup(e, { emit: n }) {
|
|
2972
|
+
let r = e, i = n, a = O(""), c = Ft("kun-pagination"), d = o(() => {
|
|
2973
|
+
let e = [];
|
|
2974
|
+
if (r.totalPage <= 7) return Array.from({ length: r.totalPage }, (e, t) => t + 1);
|
|
2975
|
+
e.push(1), r.currentPage > 3 && e.push("...");
|
|
2976
|
+
let t = Math.max(2, r.currentPage - 1), n = Math.min(r.totalPage - 1, r.currentPage + 1);
|
|
2977
|
+
r.currentPage <= 3 && (n = Math.min(r.totalPage - 1, 4)), r.currentPage >= r.totalPage - 2 && (t = Math.max(2, r.totalPage - 3));
|
|
2978
|
+
for (let r = t; r <= n; r++) e.push(r);
|
|
2979
|
+
return r.currentPage < r.totalPage - 2 && e.push("..."), e.push(r.totalPage), e;
|
|
2980
|
+
}), m = (e) => {
|
|
2981
|
+
r.isLoading || e === r.currentPage || i("update:currentPage", e);
|
|
2982
|
+
}, h = () => {
|
|
2983
|
+
if (r.isLoading) return;
|
|
2984
|
+
let e = parseInt(a.value);
|
|
2985
|
+
e && e >= 1 && e <= r.totalPage && (i("update:currentPage", e), a.value = "");
|
|
2986
|
+
}, g = new Set([
|
|
2987
|
+
"tab",
|
|
2988
|
+
"option",
|
|
2989
|
+
"menuitem",
|
|
2990
|
+
"menuitemradio",
|
|
2991
|
+
"menuitemcheckbox",
|
|
2992
|
+
"slider",
|
|
2993
|
+
"spinbutton",
|
|
2994
|
+
"combobox",
|
|
2995
|
+
"tree",
|
|
2996
|
+
"treeitem"
|
|
2997
|
+
]), _ = (e) => {
|
|
2998
|
+
let t = e.target;
|
|
2999
|
+
if (!t) return !1;
|
|
3000
|
+
if (t.isContentEditable) return !0;
|
|
3001
|
+
let n = t.tagName;
|
|
3002
|
+
if (n === "INPUT" || n === "TEXTAREA" || n === "SELECT") return !0;
|
|
3003
|
+
let r = t.getAttribute("role");
|
|
3004
|
+
return !!r && g.has(r);
|
|
3005
|
+
};
|
|
3006
|
+
return me("ArrowLeft", (e) => {
|
|
3007
|
+
_(e) || r.currentPage > 1 && m(r.currentPage - 1);
|
|
3008
|
+
}), me("ArrowRight", (e) => {
|
|
3009
|
+
_(e) || r.currentPage < r.totalPage && m(r.currentPage + 1);
|
|
3010
|
+
}), (n, r) => (T(), l("div", ci, [u("div", li, [u("div", ui, [
|
|
3011
|
+
p($, {
|
|
3012
|
+
"is-icon-only": !0,
|
|
3013
|
+
variant: "light",
|
|
3014
|
+
disabled: e.isLoading || e.currentPage === 1,
|
|
3015
|
+
class: b({ "cursor-not-allowed opacity-50": e.isLoading || e.currentPage === 1 }),
|
|
3016
|
+
onClick: r[0] ||= (t) => m(e.currentPage - 1)
|
|
3017
|
+
}, {
|
|
3018
|
+
default: V(() => [p(Z, { name: "lucide:chevron-left" })]),
|
|
3019
|
+
_: 1
|
|
3020
|
+
}, 8, ["disabled", "class"]),
|
|
3021
|
+
u("div", di, [(T(!0), l(t, null, k(d.value, (n) => (T(), l(t, { key: n }, [n === "..." ? (T(), l("span", fi, "...")) : (T(), s($, {
|
|
3022
|
+
key: 0,
|
|
3023
|
+
variant: e.currentPage === n ? "solid" : "light",
|
|
3024
|
+
size: "sm",
|
|
3025
|
+
disabled: e.isLoading,
|
|
3026
|
+
onClick: (e) => m(Number(n))
|
|
3027
|
+
}, {
|
|
3028
|
+
default: V(() => [f(M(n), 1)]),
|
|
3029
|
+
_: 2
|
|
3030
|
+
}, 1032, [
|
|
3031
|
+
"variant",
|
|
3032
|
+
"disabled",
|
|
3033
|
+
"onClick"
|
|
3034
|
+
]))], 64))), 128))]),
|
|
3035
|
+
p($, {
|
|
3036
|
+
"is-icon-only": !0,
|
|
3037
|
+
variant: "light",
|
|
3038
|
+
disabled: e.isLoading || e.currentPage === e.totalPage,
|
|
3039
|
+
class: b({ "cursor-not-allowed opacity-50": e.isLoading || e.currentPage === e.totalPage }),
|
|
3040
|
+
onClick: r[1] ||= (t) => m(e.currentPage + 1)
|
|
3041
|
+
}, {
|
|
3042
|
+
default: V(() => [p(Z, { name: "lucide:chevron-right" })]),
|
|
3043
|
+
_: 1
|
|
3044
|
+
}, 8, ["disabled", "class"])
|
|
3045
|
+
]), u("div", pi, [
|
|
3046
|
+
r[3] ||= f(" 您可以使用 ", -1),
|
|
3047
|
+
p(Z, { name: "lucide:arrow-left" }),
|
|
3048
|
+
p(Z, { name: "lucide:arrow-right" }),
|
|
3049
|
+
r[4] ||= f(" 来进行快速翻页 ", -1)
|
|
3050
|
+
])]), u("div", mi, [
|
|
3051
|
+
u("label", {
|
|
3052
|
+
for: P(c),
|
|
3053
|
+
class: "text-sm"
|
|
3054
|
+
}, "跳转到页数", 8, hi),
|
|
3055
|
+
te(u("input", {
|
|
3056
|
+
id: P(c),
|
|
3057
|
+
"onUpdate:modelValue": r[2] ||= (e) => a.value = e,
|
|
3058
|
+
type: "number",
|
|
3059
|
+
disabled: e.isLoading,
|
|
3060
|
+
min: "1",
|
|
3061
|
+
max: e.totalPage,
|
|
3062
|
+
class: b(P(U)("focus:ring-primary border-default-200 w-24 rounded-md border px-2 py-1 text-sm focus:ring-1 focus:outline-none", e.isLoading && "cursor-not-allowed opacity-50")),
|
|
3063
|
+
onKeyup: ne(h, ["enter"])
|
|
3064
|
+
}, null, 42, gi), [[R, a.value]]),
|
|
3065
|
+
p($, {
|
|
3066
|
+
size: "sm",
|
|
3067
|
+
disabled: e.isLoading,
|
|
3068
|
+
onClick: h
|
|
3069
|
+
}, {
|
|
3070
|
+
default: V(() => [...r[5] ||= [f(" 跳转 ", -1)]]),
|
|
3071
|
+
_: 1
|
|
3072
|
+
}, 8, ["disabled"])
|
|
3073
|
+
])]));
|
|
3074
|
+
}
|
|
3075
|
+
}), vi = { class: "relative inline-block" }, yi = ["onKeydown", "aria-expanded"], bi = ["aria-hidden"], xi = /* @__PURE__ */ m({
|
|
3076
|
+
name: "KunPopover",
|
|
3077
|
+
__name: "Popover",
|
|
3078
|
+
props: {
|
|
3079
|
+
position: { default: "bottom-start" },
|
|
3080
|
+
innerClass: { default: "" },
|
|
3081
|
+
autoPosition: {
|
|
3082
|
+
type: Boolean,
|
|
3083
|
+
default: !1
|
|
3084
|
+
},
|
|
3085
|
+
rounded: { default: void 0 }
|
|
3086
|
+
},
|
|
3087
|
+
setup(e, { expose: t }) {
|
|
3088
|
+
let r = e, a = X(() => r.rounded, "lg"), d = o(() => q[a.value]), f = O(!1), m = O(null), h = O(null), g = `kun-popover-${I()}`, { floatingStyles: _ } = Te(m, h, {
|
|
3089
|
+
placement: r.position,
|
|
3090
|
+
open: f,
|
|
3091
|
+
whileElementsMounted: be,
|
|
3092
|
+
transform: !1,
|
|
3093
|
+
middleware: [Se(8), ...r.autoPosition ? [xe(), Ce({ padding: 8 })] : []]
|
|
3094
|
+
}), v = () => {
|
|
3095
|
+
f.value = !f.value;
|
|
3096
|
+
};
|
|
3097
|
+
return pe(m, (e) => {
|
|
3098
|
+
h.value?.contains(e.target) || (f.value = !1);
|
|
3099
|
+
}), ge("keydown", (e) => {
|
|
3100
|
+
e.key === "Escape" && f.value && (f.value = !1);
|
|
3101
|
+
}), t({
|
|
3102
|
+
open: () => f.value = !0,
|
|
3103
|
+
close: () => f.value = !1,
|
|
3104
|
+
toggle: v
|
|
3105
|
+
}), (t, r) => (T(), l("div", vi, [u("div", {
|
|
3106
|
+
ref_key: "triggerRef",
|
|
3107
|
+
ref: m,
|
|
3108
|
+
onClick: v,
|
|
3109
|
+
onKeydown: [ne(v, ["enter"]), ne(H(v, ["prevent"]), ["space"])],
|
|
3110
|
+
tabindex: "0",
|
|
3111
|
+
role: "button",
|
|
3112
|
+
"aria-label": "popover-trigger",
|
|
3113
|
+
"aria-expanded": f.value,
|
|
3114
|
+
"aria-controls": g
|
|
3115
|
+
}, [A(t.$slots, "trigger")], 40, yi), (T(), s(n, { to: "body" }, [p(i, {
|
|
3116
|
+
"enter-active-class": "transition duration-200 ease-out",
|
|
3117
|
+
"enter-from-class": "transform scale-95 opacity-0",
|
|
3118
|
+
"enter-to-class": "transform scale-100 opacity-100",
|
|
3119
|
+
"leave-active-class": "transition duration-150 ease-in",
|
|
3120
|
+
"leave-from-class": "transform scale-100 opacity-100",
|
|
3121
|
+
"leave-to-class": "transform scale-95 opacity-0"
|
|
3122
|
+
}, {
|
|
3123
|
+
default: V(() => [f.value ? (T(), l("div", {
|
|
3124
|
+
key: 0,
|
|
3125
|
+
ref_key: "popoverRef",
|
|
3126
|
+
ref: h,
|
|
3127
|
+
id: g,
|
|
3128
|
+
role: "dialog",
|
|
3129
|
+
"aria-hidden": !f.value,
|
|
3130
|
+
class: b(P(U)("bg-content1 border-default-200 z-kun-popover border shadow-lg", d.value, e.innerClass)),
|
|
3131
|
+
style: x(P(_)),
|
|
3132
|
+
onClick: r[0] ||= H(() => {}, ["stop"])
|
|
3133
|
+
}, [A(t.$slots, "default")], 14, bi)) : c("", !0)]),
|
|
3134
|
+
_: 3
|
|
3135
|
+
})]))]));
|
|
3136
|
+
}
|
|
3137
|
+
}), Si = { class: "contents" }, Ci = {
|
|
3138
|
+
key: 0,
|
|
3139
|
+
class: "relative inline-flex items-center justify-center"
|
|
3140
|
+
}, wi = {
|
|
3141
|
+
class: "h-24 w-24 -rotate-90 transform",
|
|
3142
|
+
viewBox: "0 0 100 100"
|
|
3143
|
+
}, Ti = ["stroke-dashoffset"], Ei = {
|
|
3144
|
+
key: 0,
|
|
3145
|
+
class: "absolute text-sm font-medium"
|
|
3146
|
+
}, Di = ["aria-valuenow", "aria-valuemax"], Oi = {
|
|
3147
|
+
key: 0,
|
|
3148
|
+
class: "px-2 text-xs font-medium text-white"
|
|
3149
|
+
}, ki = 45, Ai = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
3150
|
+
name: "KunProgress",
|
|
3151
|
+
__name: "Progress",
|
|
3152
|
+
props: {
|
|
3153
|
+
value: { default: 0 },
|
|
3154
|
+
max: { default: 100 },
|
|
3155
|
+
variant: { default: "solid" },
|
|
3156
|
+
color: { default: "primary" },
|
|
3157
|
+
size: { default: "md" },
|
|
3158
|
+
rounded: { default: void 0 },
|
|
3159
|
+
showLabel: {
|
|
3160
|
+
type: Boolean,
|
|
3161
|
+
default: !1
|
|
3162
|
+
},
|
|
3163
|
+
indeterminate: {
|
|
3164
|
+
type: Boolean,
|
|
3165
|
+
default: !1
|
|
3166
|
+
},
|
|
3167
|
+
className: { default: "" }
|
|
3168
|
+
},
|
|
3169
|
+
setup(e) {
|
|
3170
|
+
let t = e, n = o(() => {
|
|
3171
|
+
let e = t.max || 100, n = Math.min(Math.max(t.value, 0), e);
|
|
3172
|
+
return Math.round(n / e * 100);
|
|
3173
|
+
}), r = o(() => {
|
|
3174
|
+
switch (t.size) {
|
|
3175
|
+
case "xs": return "h-1";
|
|
3176
|
+
case "sm": return "h-2";
|
|
3177
|
+
case "lg": return "h-4";
|
|
3178
|
+
case "xl": return "h-5";
|
|
3179
|
+
default: return "h-3";
|
|
3180
|
+
}
|
|
3181
|
+
}), i = X(() => t.rounded), a = o(() => q[i.value]), s = {
|
|
3182
|
+
default: "text-default",
|
|
3183
|
+
primary: "text-primary",
|
|
3184
|
+
secondary: "text-secondary",
|
|
3185
|
+
success: "text-success",
|
|
3186
|
+
warning: "text-warning",
|
|
3187
|
+
danger: "text-danger",
|
|
3188
|
+
info: "text-info"
|
|
3189
|
+
}, d = {
|
|
3190
|
+
default: "bg-gradient-to-r from-default-400 to-default-600",
|
|
3191
|
+
primary: "bg-gradient-to-r from-primary-400 to-primary-600",
|
|
3192
|
+
secondary: "bg-gradient-to-r from-secondary-400 to-secondary-600",
|
|
3193
|
+
success: "bg-gradient-to-r from-success-400 to-success-600",
|
|
3194
|
+
warning: "bg-gradient-to-r from-warning-400 to-warning-600",
|
|
3195
|
+
danger: "bg-gradient-to-r from-danger-400 to-danger-600",
|
|
3196
|
+
info: "bg-gradient-to-r from-info-400 to-info-600"
|
|
3197
|
+
}, f = o(() => {
|
|
3198
|
+
let e = G[t.color];
|
|
3199
|
+
switch (t.variant) {
|
|
3200
|
+
case "gradient": return d[t.color];
|
|
3201
|
+
case "striped": return `${e} bg-[length:1rem_1rem] bg-gradient-to-r from-white/20 to-transparent animate-[progress-stripes_1s_linear_infinite]`;
|
|
3202
|
+
default: return e;
|
|
3203
|
+
}
|
|
3204
|
+
}), p = 2 * Math.PI * ki, m = o(() => p - n.value / 100 * p);
|
|
3205
|
+
return (t, i) => (T(), l("div", Si, [e.variant === "circle" ? (T(), l("div", Ci, [(T(), l("svg", wi, [i[0] ||= u("circle", {
|
|
3206
|
+
class: "text-default-300",
|
|
3207
|
+
stroke: "currentColor",
|
|
3208
|
+
"stroke-width": "10",
|
|
3209
|
+
fill: "transparent",
|
|
3210
|
+
r: "45",
|
|
3211
|
+
cx: "50",
|
|
3212
|
+
cy: "50"
|
|
3213
|
+
}, null, -1), u("circle", {
|
|
3214
|
+
class: b(s[e.color]),
|
|
3215
|
+
stroke: "currentColor",
|
|
3216
|
+
"stroke-width": "10",
|
|
3217
|
+
fill: "transparent",
|
|
3218
|
+
r: "45",
|
|
3219
|
+
cx: "50",
|
|
3220
|
+
cy: "50",
|
|
3221
|
+
"stroke-linecap": "round",
|
|
3222
|
+
"stroke-dasharray": p,
|
|
3223
|
+
"stroke-dashoffset": m.value,
|
|
3224
|
+
style: { transition: "stroke-dashoffset 0.35s ease" }
|
|
3225
|
+
}, null, 10, Ti)])), e.showLabel ? (T(), l("span", Ei, M(n.value) + "% ", 1)) : c("", !0)])) : (T(), l("div", {
|
|
3226
|
+
key: 1,
|
|
3227
|
+
class: b(["bg-default-300 w-full overflow-hidden", [
|
|
3228
|
+
r.value,
|
|
3229
|
+
a.value,
|
|
3230
|
+
e.className
|
|
3231
|
+
]]),
|
|
3232
|
+
role: "progressbar",
|
|
3233
|
+
"aria-valuenow": e.indeterminate ? void 0 : n.value,
|
|
3234
|
+
"aria-valuemin": 0,
|
|
3235
|
+
"aria-valuemax": e.max
|
|
3236
|
+
}, [u("div", {
|
|
3237
|
+
class: b(P(U)("flex h-full items-center transition-all duration-500 ease-out", f.value)),
|
|
3238
|
+
style: x(e.indeterminate ? "width:100%" : `width:${n.value}%`)
|
|
3239
|
+
}, [e.showLabel && !e.indeterminate ? (T(), l("span", Oi, M(n.value) + "% ", 1)) : c("", !0)], 6)], 10, Di))]));
|
|
3240
|
+
}
|
|
3241
|
+
}), [["__scopeId", "data-v-1b0fa77a"]]), ji = ["id"], Mi = [
|
|
3242
|
+
"aria-label",
|
|
3243
|
+
"aria-labelledby",
|
|
3244
|
+
"aria-disabled"
|
|
3245
|
+
], Ni = [
|
|
3246
|
+
"aria-checked",
|
|
3247
|
+
"aria-disabled",
|
|
3248
|
+
"tabindex",
|
|
3249
|
+
"onClick",
|
|
3250
|
+
"onKeydown"
|
|
3251
|
+
], Pi = { class: "flex flex-col" }, Fi = { class: "text-foreground" }, Ii = {
|
|
3252
|
+
key: 0,
|
|
3253
|
+
class: "text-default-500 text-xs"
|
|
3254
|
+
}, Li = [
|
|
3255
|
+
"aria-checked",
|
|
3256
|
+
"aria-disabled",
|
|
3257
|
+
"tabindex",
|
|
3258
|
+
"onClick",
|
|
3259
|
+
"onKeydown"
|
|
3260
|
+
], Ri = { class: "flex flex-col" }, zi = { class: "text-foreground font-medium" }, Bi = {
|
|
3261
|
+
key: 0,
|
|
3262
|
+
class: "text-default-500 mt-0.5 text-xs"
|
|
3263
|
+
}, Vi = {
|
|
3264
|
+
key: 1,
|
|
3265
|
+
class: "text-danger mt-2 text-sm"
|
|
3266
|
+
}, Hi = /* @__PURE__ */ m({
|
|
3267
|
+
name: "KunRadioGroup",
|
|
3268
|
+
__name: "RadioGroup",
|
|
3269
|
+
props: /*@__PURE__*/ _({
|
|
3270
|
+
options: {},
|
|
3271
|
+
ariaLabel: { default: "" },
|
|
3272
|
+
label: { default: "" },
|
|
3273
|
+
variant: { default: "classic" },
|
|
3274
|
+
orientation: { default: "vertical" },
|
|
3275
|
+
color: { default: "primary" },
|
|
3276
|
+
size: { default: "md" },
|
|
3277
|
+
rounded: { default: void 0 },
|
|
3278
|
+
disabled: {
|
|
3279
|
+
type: Boolean,
|
|
3280
|
+
default: !1
|
|
3281
|
+
},
|
|
3282
|
+
error: { default: "" },
|
|
3283
|
+
className: { default: "" }
|
|
3284
|
+
}, {
|
|
3285
|
+
modelValue: { required: !0 },
|
|
3286
|
+
modelModifiers: {}
|
|
3287
|
+
}),
|
|
3288
|
+
emits: /*@__PURE__*/ _(["change"], ["update:modelValue"]),
|
|
3289
|
+
setup(e, { emit: n }) {
|
|
3290
|
+
let r = e, i = L(e, "modelValue"), a = n, s = X(() => r.rounded, "md"), d = o(() => q[s.value]), f = Ft("kun-radio-group"), p = o(() => `${f.value}-label`), m = O([]), h = (e) => r.disabled || e.disabled === !0, g = o(() => {
|
|
3291
|
+
let e = r.options.findIndex((e) => e.value === i.value);
|
|
3292
|
+
return e >= 0 && !h(r.options[e]) ? e : r.options.findIndex((e) => !h(e));
|
|
3293
|
+
}), _ = o(() => {
|
|
3294
|
+
switch (r.size) {
|
|
3295
|
+
case "xs": return {
|
|
3296
|
+
indicator: "size-3",
|
|
3297
|
+
dot: "size-1.5",
|
|
3298
|
+
text: "text-xs",
|
|
3299
|
+
gap: "gap-1.5"
|
|
3300
|
+
};
|
|
3301
|
+
case "sm": return {
|
|
3302
|
+
indicator: "size-3.5",
|
|
3303
|
+
dot: "size-1.5",
|
|
3304
|
+
text: "text-sm",
|
|
3305
|
+
gap: "gap-2"
|
|
3306
|
+
};
|
|
3307
|
+
case "lg": return {
|
|
3308
|
+
indicator: "size-5",
|
|
3309
|
+
dot: "size-2.5",
|
|
3310
|
+
text: "text-base",
|
|
3311
|
+
gap: "gap-2.5"
|
|
3312
|
+
};
|
|
3313
|
+
case "xl": return {
|
|
3314
|
+
indicator: "size-6",
|
|
3315
|
+
dot: "size-3",
|
|
3316
|
+
text: "text-lg",
|
|
3317
|
+
gap: "gap-3"
|
|
3318
|
+
};
|
|
3319
|
+
default: return {
|
|
3320
|
+
indicator: "size-4",
|
|
3321
|
+
dot: "size-2",
|
|
3322
|
+
text: "text-sm",
|
|
3323
|
+
gap: "gap-2"
|
|
3324
|
+
};
|
|
3325
|
+
}
|
|
3326
|
+
}), v = (e, t) => {
|
|
3327
|
+
h(e) || i.value !== e.value && (i.value = e.value, a("change", e.value, t));
|
|
3328
|
+
}, x = (e, t) => {
|
|
3329
|
+
let n = r.options.length;
|
|
3330
|
+
if (n === 0) return;
|
|
3331
|
+
let i = e;
|
|
3332
|
+
for (let e = 0; e < n; e++) {
|
|
3333
|
+
i = (i + t + n) % n;
|
|
3334
|
+
let e = r.options[i];
|
|
3335
|
+
if (e && !h(e)) {
|
|
3336
|
+
v(e, i), y(() => m.value[i]?.focus());
|
|
3337
|
+
return;
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
}, S = (e, t) => {
|
|
3341
|
+
switch (e.key) {
|
|
3342
|
+
case "ArrowDown":
|
|
3343
|
+
case "ArrowRight":
|
|
3344
|
+
e.preventDefault(), x(t, 1);
|
|
3345
|
+
break;
|
|
3346
|
+
case "ArrowUp":
|
|
3347
|
+
case "ArrowLeft":
|
|
3348
|
+
e.preventDefault(), x(t, -1);
|
|
3349
|
+
break;
|
|
3350
|
+
case " ":
|
|
3351
|
+
case "Enter": {
|
|
3352
|
+
e.preventDefault();
|
|
3353
|
+
let n = r.options[t];
|
|
3354
|
+
n && v(n, t);
|
|
3355
|
+
break;
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
};
|
|
3359
|
+
return (n, r) => (T(), l("div", { class: b(P(U)("w-full", e.className)) }, [
|
|
3360
|
+
e.label ? (T(), l("div", {
|
|
3361
|
+
key: 0,
|
|
3362
|
+
id: p.value,
|
|
3363
|
+
class: "text-default-700 mb-2 block text-sm font-medium"
|
|
3364
|
+
}, M(e.label), 9, ji)) : c("", !0),
|
|
3365
|
+
u("div", {
|
|
3366
|
+
role: "radiogroup",
|
|
3367
|
+
"aria-label": e.label ? void 0 : e.ariaLabel || "radio group",
|
|
3368
|
+
"aria-labelledby": e.label ? p.value : void 0,
|
|
3369
|
+
"aria-disabled": e.disabled || void 0,
|
|
3370
|
+
class: b(P(U)("flex", e.orientation === "vertical" ? "flex-col gap-2" : "flex-row flex-wrap gap-3"))
|
|
3371
|
+
}, [e.variant === "classic" ? (T(!0), l(t, { key: 0 }, k(e.options, (t, n) => (T(), l("label", {
|
|
3372
|
+
key: String(t.value),
|
|
3373
|
+
ref_for: !0,
|
|
3374
|
+
ref: (e) => m.value[n] = e,
|
|
3375
|
+
role: "radio",
|
|
3376
|
+
"aria-checked": i.value === t.value,
|
|
3377
|
+
"aria-disabled": h(t) || void 0,
|
|
3378
|
+
tabindex: g.value === n && !h(t) ? 0 : -1,
|
|
3379
|
+
class: b(P(U)("group inline-flex cursor-pointer items-center rounded-md p-1 transition-colors focus:outline-none", P(ce)[e.color], "focus:ring-2", _.value.gap, _.value.text, h(t) && "cursor-not-allowed opacity-50")),
|
|
3380
|
+
onClick: (e) => v(t, n),
|
|
3381
|
+
onKeydown: (e) => S(e, n)
|
|
3382
|
+
}, [u("span", { class: b(P(U)("inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-colors", _.value.indicator, i.value === t.value ? P(K)[e.color] : "border-default-300 group-hover:border-default-400")) }, [i.value === t.value ? (T(), l("span", {
|
|
3383
|
+
key: 0,
|
|
3384
|
+
class: b(P(U)("block rounded-full", _.value.dot, P(G)[e.color]))
|
|
3385
|
+
}, null, 2)) : c("", !0)], 2), u("span", Pi, [u("span", Fi, M(t.label), 1), t.description ? (T(), l("span", Ii, M(t.description), 1)) : c("", !0)])], 42, Ni))), 128)) : (T(!0), l(t, { key: 1 }, k(e.options, (t, n) => (T(), l("div", {
|
|
3386
|
+
key: String(t.value),
|
|
3387
|
+
ref_for: !0,
|
|
3388
|
+
ref: (e) => m.value[n] = e,
|
|
3389
|
+
role: "radio",
|
|
3390
|
+
"aria-checked": i.value === t.value,
|
|
3391
|
+
"aria-disabled": h(t) || void 0,
|
|
3392
|
+
tabindex: g.value === n && !h(t) ? 0 : -1,
|
|
3393
|
+
class: b(P(U)("relative flex cursor-pointer items-start border-2 p-3 transition-all focus:outline-none focus:ring-2", P(ce)[e.color], _.value.gap, _.value.text, d.value, e.orientation === "horizontal" && "flex-1 min-w-[8rem]", i.value === t.value ? P(U)(P(K)[e.color], P(J)[e.color]) : "border-default-200 hover:border-default-300 bg-content1", h(t) && "cursor-not-allowed opacity-50")),
|
|
3394
|
+
onClick: (e) => v(t, n),
|
|
3395
|
+
onKeydown: (e) => S(e, n)
|
|
3396
|
+
}, [u("span", { class: b(P(U)("mt-0.5 inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-colors", _.value.indicator, i.value === t.value ? P(K)[e.color] : "border-default-300")) }, [i.value === t.value ? (T(), l("span", {
|
|
3397
|
+
key: 0,
|
|
3398
|
+
class: b(P(U)("block rounded-full", _.value.dot, P(G)[e.color]))
|
|
3399
|
+
}, null, 2)) : c("", !0)], 2), u("div", Ri, [u("span", zi, M(t.label), 1), t.description ? (T(), l("span", Bi, M(t.description), 1)) : c("", !0)])], 42, Li))), 128))], 10, Mi),
|
|
3400
|
+
e.error ? (T(), l("p", Vi, M(e.error), 1)) : c("", !0)
|
|
3401
|
+
], 2));
|
|
3402
|
+
}
|
|
3403
|
+
}), Ui = ["aria-label"], Wi = [
|
|
3404
|
+
"aria-checked",
|
|
3405
|
+
"disabled",
|
|
3406
|
+
"title",
|
|
3407
|
+
"onMouseenter",
|
|
3408
|
+
"onClick"
|
|
3409
|
+
], Gi = /* @__PURE__ */ m({
|
|
3410
|
+
name: "KunRating",
|
|
3411
|
+
__name: "Rating",
|
|
3412
|
+
props: /*@__PURE__*/ _({
|
|
3413
|
+
max: { default: 5 },
|
|
3414
|
+
readonly: {
|
|
3415
|
+
type: Boolean,
|
|
3416
|
+
default: !1
|
|
3417
|
+
},
|
|
3418
|
+
disabled: {
|
|
3419
|
+
type: Boolean,
|
|
3420
|
+
default: !1
|
|
3421
|
+
},
|
|
3422
|
+
size: { default: "md" },
|
|
3423
|
+
ariaLabel: { default: "rating" }
|
|
3424
|
+
}, {
|
|
3425
|
+
modelValue: { default: 0 },
|
|
3426
|
+
modelModifiers: {}
|
|
3427
|
+
}),
|
|
3428
|
+
emits: /*@__PURE__*/ _(["set"], ["update:modelValue"]),
|
|
3429
|
+
setup(e, { emit: n }) {
|
|
3430
|
+
let r = e, i = L(e, "modelValue"), a = n, s = O(0), c = o(() => {
|
|
3431
|
+
switch (r.size) {
|
|
3432
|
+
case "sm": return "h-4 w-4";
|
|
3433
|
+
case "lg": return "h-6 w-6";
|
|
3434
|
+
default: return "h-5 w-5";
|
|
3435
|
+
}
|
|
3436
|
+
}), u = o(() => Array.from({ length: r.max }, (e, t) => t + 1)), d = o(() => s.value || i.value || 0), f = (e) => {
|
|
3437
|
+
r.readonly || r.disabled || (i.value = e, a("set", e));
|
|
3438
|
+
}, m = (e) => {
|
|
3439
|
+
r.readonly || r.disabled || (s.value = e);
|
|
3440
|
+
}, h = () => {
|
|
3441
|
+
r.readonly || r.disabled || (s.value = 0);
|
|
3442
|
+
};
|
|
3443
|
+
return (n, r) => (T(), l("div", {
|
|
3444
|
+
class: "inline-flex items-center gap-1",
|
|
3445
|
+
role: "radiogroup",
|
|
3446
|
+
"aria-label": e.ariaLabel
|
|
3447
|
+
}, [(T(!0), l(t, null, k(u.value, (t) => (T(), l("button", {
|
|
3448
|
+
key: t,
|
|
3449
|
+
type: "button",
|
|
3450
|
+
role: "radio",
|
|
3451
|
+
"aria-checked": d.value >= t,
|
|
3452
|
+
class: b(P(U)("disabled:text-default-200 cursor-pointer hover:scale-110 focus:outline-none disabled:cursor-not-allowed", d.value >= t ? "text-secondary" : "text-default-300")),
|
|
3453
|
+
disabled: e.disabled,
|
|
3454
|
+
title: `${t}/${e.max}`,
|
|
3455
|
+
onMouseenter: (e) => m(t),
|
|
3456
|
+
onMouseleave: h,
|
|
3457
|
+
onClick: (e) => f(t)
|
|
3458
|
+
}, [p(Z, {
|
|
3459
|
+
name: "lucide:lollipop",
|
|
3460
|
+
class: b(P(U)("transition-colors", c.value))
|
|
3461
|
+
}, null, 8, ["class"])], 42, Wi))), 128))], 8, Ui));
|
|
3462
|
+
}
|
|
3463
|
+
}), Ki = ["for"], qi = [
|
|
3464
|
+
"id",
|
|
3465
|
+
"aria-label",
|
|
3466
|
+
"aria-expanded",
|
|
3467
|
+
"disabled"
|
|
3468
|
+
], Ji = { class: "block min-w-0 flex-1 truncate" }, Yi = {
|
|
3469
|
+
class: "scrollbar-hide min-h-0 flex-1 overflow-x-hidden overflow-y-auto rounded-md text-sm focus:outline-none",
|
|
3470
|
+
tabindex: "-1",
|
|
3471
|
+
role: "listbox"
|
|
3472
|
+
}, Xi = ["aria-selected", "onClick"], Zi = { class: "block min-w-0 flex-1 truncate" }, Qi = {
|
|
3473
|
+
key: 1,
|
|
3474
|
+
class: "text-danger mt-2 text-sm"
|
|
3475
|
+
}, $i = /* @__PURE__ */ m({
|
|
3476
|
+
name: "KunSelect",
|
|
3477
|
+
__name: "Select",
|
|
3478
|
+
props: /*@__PURE__*/ _({
|
|
3479
|
+
options: {},
|
|
3480
|
+
label: { default: "" },
|
|
3481
|
+
placeholder: { default: "" },
|
|
3482
|
+
error: { default: "" },
|
|
3483
|
+
disabled: {
|
|
3484
|
+
type: Boolean,
|
|
3485
|
+
default: !1
|
|
3486
|
+
},
|
|
3487
|
+
darkBorder: {
|
|
3488
|
+
type: Boolean,
|
|
3489
|
+
default: !0
|
|
3490
|
+
},
|
|
3491
|
+
ariaLabel: { default: "" },
|
|
3492
|
+
className: { default: "" },
|
|
3493
|
+
rounded: { default: void 0 }
|
|
3494
|
+
}, {
|
|
3495
|
+
modelValue: { required: !0 },
|
|
3496
|
+
modelModifiers: {}
|
|
3497
|
+
}),
|
|
3498
|
+
emits: /*@__PURE__*/ _(["set"], ["update:modelValue"]),
|
|
3499
|
+
setup(e, { emit: r }) {
|
|
3500
|
+
let a = e, d = X(() => a.rounded), f = o(() => q[d.value]), m = L(e, "modelValue"), h = r, g = Ft("kun-select"), _ = O(!1), v = O(null), y = O(null), { floatingStyles: S } = Te(v, y, {
|
|
3501
|
+
placement: "bottom-start",
|
|
3502
|
+
open: _,
|
|
3503
|
+
whileElementsMounted: be,
|
|
3504
|
+
transform: !1,
|
|
3505
|
+
middleware: [
|
|
3506
|
+
Se(4),
|
|
3507
|
+
xe(),
|
|
3508
|
+
Ce({ padding: 8 }),
|
|
3509
|
+
we({ apply({ rects: e, elements: t, availableHeight: n }) {
|
|
3510
|
+
Object.assign(t.floating.style, {
|
|
3511
|
+
width: `${e.reference.width}px`,
|
|
3512
|
+
maxHeight: `${Math.min(240, n - 8)}px`
|
|
3513
|
+
});
|
|
3514
|
+
} })
|
|
3515
|
+
]
|
|
3516
|
+
});
|
|
3517
|
+
pe(v, (e) => {
|
|
3518
|
+
y.value?.contains(e.target) || (_.value = !1);
|
|
3519
|
+
});
|
|
3520
|
+
let C = o(() => a.options.find((e) => e.value === m.value)?.label), w = () => {
|
|
3521
|
+
a.disabled || (_.value = !_.value);
|
|
3522
|
+
}, E = (e, t) => {
|
|
3523
|
+
m.value = e, h("set", e, t), _.value = !1;
|
|
3524
|
+
};
|
|
3525
|
+
return (r, o) => (T(), l("div", { class: b(P(U)("relative w-full", a.className)) }, [
|
|
3526
|
+
e.label ? (T(), l("label", {
|
|
3527
|
+
key: 0,
|
|
3528
|
+
for: P(g),
|
|
3529
|
+
class: "mb-2 block text-sm font-medium"
|
|
3530
|
+
}, M(e.label), 9, Ki)) : c("", !0),
|
|
3531
|
+
u("button", {
|
|
3532
|
+
ref_key: "buttonRef",
|
|
3533
|
+
ref: v,
|
|
3534
|
+
id: P(g),
|
|
3535
|
+
type: "button",
|
|
3536
|
+
"aria-label": a.ariaLabel || "select",
|
|
3537
|
+
"aria-expanded": _.value,
|
|
3538
|
+
"aria-haspopup": "listbox",
|
|
3539
|
+
class: b(P(U)("focus:border-primary focus:ring-primary flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left text-sm focus:ring-1 focus:outline-none", f.value, e.darkBorder && "dark:border-default-200 border-default/20 border", e.disabled && "bg-default-100 cursor-not-allowed")),
|
|
3540
|
+
disabled: e.disabled,
|
|
3541
|
+
onClick: w
|
|
3542
|
+
}, [u("span", Ji, M(C.value || e.placeholder), 1), p(Z, {
|
|
3543
|
+
name: "lucide:chevron-down",
|
|
3544
|
+
class: b(["pointer-events-none shrink-0", P(U)("text-inherit transition-transform", _.value ? "rotate-180" : "")])
|
|
3545
|
+
}, null, 8, ["class"])], 10, qi),
|
|
3546
|
+
(T(), s(n, { to: "body" }, [p(i, {
|
|
3547
|
+
"enter-active-class": "transition duration-150 ease-out",
|
|
3548
|
+
"enter-from-class": "opacity-0 -translate-y-1",
|
|
3549
|
+
"enter-to-class": "opacity-100 translate-y-0",
|
|
3550
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
3551
|
+
"leave-from-class": "opacity-100 translate-y-0",
|
|
3552
|
+
"leave-to-class": "opacity-0 -translate-y-1"
|
|
3553
|
+
}, {
|
|
3554
|
+
default: V(() => [_.value ? (T(), l("div", {
|
|
3555
|
+
key: 0,
|
|
3556
|
+
ref_key: "dropdownRef",
|
|
3557
|
+
ref: y,
|
|
3558
|
+
style: x(P(S)),
|
|
3559
|
+
class: b(P(U)("bg-content1 border-default-200 z-kun-popover flex flex-col overflow-hidden border p-1 shadow-lg", f.value))
|
|
3560
|
+
}, [u("ul", Yi, [(T(!0), l(t, null, k(e.options, (e, t) => (T(), l("li", {
|
|
3561
|
+
key: e.value,
|
|
3562
|
+
class: "hover:bg-default-100 text-foreground relative flex cursor-pointer items-center justify-between rounded-lg px-3 py-2 select-none",
|
|
3563
|
+
role: "option",
|
|
3564
|
+
"aria-selected": m.value === e.value,
|
|
3565
|
+
onClick: (n) => E(e.value, t)
|
|
3566
|
+
}, [u("span", Zi, M(e.label), 1), m.value === e.value ? (T(), s(Z, {
|
|
3567
|
+
key: 0,
|
|
3568
|
+
name: "lucide:check",
|
|
3569
|
+
class: "ml-2 shrink-0"
|
|
3570
|
+
})) : c("", !0)], 8, Xi))), 128))])], 6)) : c("", !0)]),
|
|
3571
|
+
_: 1
|
|
3572
|
+
})])),
|
|
3573
|
+
e.error ? (T(), l("p", Qi, M(e.error), 1)) : c("", !0)
|
|
3574
|
+
], 2));
|
|
3575
|
+
}
|
|
3576
|
+
}), ea = { class: "relative" }, ta = ["aria-label"], na = /* @__PURE__ */ m({
|
|
3577
|
+
name: "KunScrollShadow",
|
|
3578
|
+
__name: "ScrollShadow",
|
|
3579
|
+
props: {
|
|
3580
|
+
axis: { default: "horizontal" },
|
|
3581
|
+
shadowColor: { default: "var(--color-background)" },
|
|
3582
|
+
shadowSize: { default: "2rem" },
|
|
3583
|
+
className: { default: "" },
|
|
3584
|
+
contentClass: { default: "" }
|
|
3585
|
+
},
|
|
3586
|
+
setup(e) {
|
|
3587
|
+
let t = e, n = O(null), r = O(null), { x: i, y: a } = ve(n, { throttle: 50 }), { width: s, height: c } = he(r), { width: d, height: f } = he(n), p = O(!1), m = O(!1);
|
|
3588
|
+
B(() => {
|
|
3589
|
+
n.value && (t.axis === "horizontal" ? (p.value = i.value > 1, m.value = s.value - d.value - i.value > 1) : (p.value = a.value > 1, m.value = c.value - f.value - a.value > 1));
|
|
3590
|
+
});
|
|
3591
|
+
let h = o(() => t.axis === "horizontal" ? "left-0 top-0 bottom-0" : "top-0 left-0 right-0"), g = o(() => t.axis === "horizontal" ? "right-0 top-0 bottom-0" : "bottom-0 left-0 right-0"), _ = o(() => {
|
|
3592
|
+
let e = t.axis === "horizontal" ? "width" : "height", n = t.axis === "horizontal" ? `linear-gradient(to right, ${t.shadowColor}, transparent)` : `linear-gradient(to bottom, ${t.shadowColor}, transparent)`, r = t.axis === "horizontal" ? `linear-gradient(to left, ${t.shadowColor}, transparent)` : `linear-gradient(to top, ${t.shadowColor}, transparent)`;
|
|
3593
|
+
return {
|
|
3594
|
+
start: {
|
|
3595
|
+
[e]: t.shadowSize,
|
|
3596
|
+
backgroundImage: n
|
|
3597
|
+
},
|
|
3598
|
+
end: {
|
|
3599
|
+
[e]: t.shadowSize,
|
|
3600
|
+
backgroundImage: r
|
|
3601
|
+
}
|
|
3602
|
+
};
|
|
3603
|
+
});
|
|
3604
|
+
return (i, a) => (T(), l("div", ea, [
|
|
3605
|
+
u("div", {
|
|
3606
|
+
"aria-hidden": "true",
|
|
3607
|
+
class: b(P(U)("pointer-events-none absolute z-10 transition-opacity", h.value, p.value ? "opacity-100" : "opacity-0")),
|
|
3608
|
+
style: x(_.value.start)
|
|
3609
|
+
}, null, 6),
|
|
3610
|
+
u("div", {
|
|
3611
|
+
ref_key: "scrollContainer",
|
|
3612
|
+
ref: n,
|
|
3613
|
+
tabindex: "0",
|
|
3614
|
+
role: "region",
|
|
3615
|
+
"aria-label": t.className || "scrollable content",
|
|
3616
|
+
class: b(P(U)("scrollbar-hide", e.axis === "horizontal" ? "overflow-x-auto" : "overflow-y-auto", t.className))
|
|
3617
|
+
}, [u("div", {
|
|
3618
|
+
ref_key: "contentWrapper",
|
|
3619
|
+
ref: r,
|
|
3620
|
+
class: b(P(U)(e.axis === "horizontal" ? "flex w-max gap-3" : "flex w-full flex-col gap-3", t.contentClass))
|
|
3621
|
+
}, [A(i.$slots, "default")], 2)], 10, ta),
|
|
3622
|
+
u("div", {
|
|
3623
|
+
"aria-hidden": "true",
|
|
3624
|
+
class: b(P(U)("pointer-events-none absolute z-10 transition-opacity", g.value, m.value ? "opacity-100" : "opacity-0")),
|
|
3625
|
+
style: x(_.value.end)
|
|
3626
|
+
}, null, 6)
|
|
3627
|
+
]));
|
|
3628
|
+
}
|
|
3629
|
+
}), ra = { class: "bg-default relative h-2 w-full rounded-full" }, ia = [
|
|
3630
|
+
"aria-valuenow",
|
|
3631
|
+
"aria-valuemin",
|
|
3632
|
+
"aria-valuemax"
|
|
3633
|
+
], aa = /* @__PURE__ */ m({
|
|
3634
|
+
name: "KunSlider",
|
|
3635
|
+
__name: "Slider",
|
|
3636
|
+
props: /*@__PURE__*/ _({
|
|
3637
|
+
min: { default: 17 },
|
|
3638
|
+
max: { default: 77 },
|
|
3639
|
+
step: { default: 1 }
|
|
3640
|
+
}, {
|
|
3641
|
+
modelValue: { required: !0 },
|
|
3642
|
+
modelModifiers: {}
|
|
3643
|
+
}),
|
|
3644
|
+
emits: ["update:modelValue"],
|
|
3645
|
+
setup(e) {
|
|
3646
|
+
let t = L(e, "modelValue"), n = e, r = O(null), i = O(!1), a = D({
|
|
3647
|
+
min: n.min,
|
|
3648
|
+
max: n.max,
|
|
3649
|
+
step: n.step
|
|
3650
|
+
}), s = o(() => (t.value - a.min) / (a.max - a.min) * 100 + "%"), c = o(() => ({
|
|
3651
|
+
left: s.value,
|
|
3652
|
+
transform: "translate(-50%, -50%)"
|
|
3653
|
+
})), d = (e) => {
|
|
3654
|
+
i.value = !0, p(e), window.addEventListener("mousemove", p), window.addEventListener("touchmove", p), window.addEventListener("mouseup", f), window.addEventListener("touchend", f);
|
|
3655
|
+
}, f = () => {
|
|
3656
|
+
i.value = !1, window.removeEventListener("mousemove", p), window.removeEventListener("touchmove", p), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f);
|
|
3657
|
+
}, p = (e) => {
|
|
3658
|
+
if (!r.value) return;
|
|
3659
|
+
let n = r.value.getBoundingClientRect(), i = ((e instanceof MouseEvent ? e.clientX : e.touches[0].clientX) - n.left) / n.width * (a.max - a.min) + a.min;
|
|
3660
|
+
t.value = Math.min(a.max, Math.max(a.min, Math.round(i / a.step) * a.step));
|
|
3661
|
+
};
|
|
3662
|
+
return w(() => {
|
|
3663
|
+
f();
|
|
3664
|
+
}), (n, i) => (T(), l("div", {
|
|
3665
|
+
class: "kun-slider",
|
|
3666
|
+
ref_key: "sliderRef",
|
|
3667
|
+
ref: r,
|
|
3668
|
+
onMousedownPassive: d,
|
|
3669
|
+
onTouchstartPassive: H(d, ["stop"])
|
|
3670
|
+
}, [u("div", ra, [u("div", {
|
|
3671
|
+
class: "bg-primary absolute h-full rounded-full",
|
|
3672
|
+
style: x({ width: s.value })
|
|
3673
|
+
}, null, 4), u("div", {
|
|
3674
|
+
class: "border-primary bg-content1 absolute top-[50%] size-5 cursor-grab rounded-full border-2 active:cursor-grabbing active:border-3",
|
|
3675
|
+
role: "slider",
|
|
3676
|
+
style: x(c.value),
|
|
3677
|
+
onMousedownPassive: d,
|
|
3678
|
+
onTouchstartPassive: H(d, ["stop"]),
|
|
3679
|
+
tabindex: 0,
|
|
3680
|
+
"aria-valuenow": t.value,
|
|
3681
|
+
"aria-valuemin": e.min,
|
|
3682
|
+
"aria-valuemax": e.max,
|
|
3683
|
+
"aria-orientation": "horizontal"
|
|
3684
|
+
}, null, 44, ia)])], 544));
|
|
3685
|
+
}
|
|
3686
|
+
}), oa = [
|
|
3687
|
+
"id",
|
|
3688
|
+
"checked",
|
|
3689
|
+
"disabled"
|
|
3690
|
+
], sa = { class: "relative" }, ca = /* @__PURE__ */ m({
|
|
3691
|
+
name: "KunSwitch",
|
|
3692
|
+
__name: "Switch",
|
|
3693
|
+
props: /*@__PURE__*/ _({
|
|
3694
|
+
label: { default: "" },
|
|
3695
|
+
disabled: {
|
|
3696
|
+
type: Boolean,
|
|
3697
|
+
default: !1
|
|
3698
|
+
},
|
|
3699
|
+
className: { default: "" },
|
|
3700
|
+
labelClassName: { default: "" }
|
|
3701
|
+
}, {
|
|
3702
|
+
modelValue: {
|
|
3703
|
+
type: Boolean,
|
|
3704
|
+
required: !0
|
|
3705
|
+
},
|
|
3706
|
+
modelModifiers: {}
|
|
3707
|
+
}),
|
|
3708
|
+
emits: ["update:modelValue"],
|
|
3709
|
+
setup(e) {
|
|
3710
|
+
let t = L(e, "modelValue"), n = Ft("kun-switch");
|
|
3711
|
+
return (r, i) => (T(), l("label", { class: b(P(U)("inline-flex cursor-pointer items-center", e.disabled ? "cursor-not-allowed" : "", e.className)) }, [
|
|
3712
|
+
u("input", {
|
|
3713
|
+
id: P(n),
|
|
3714
|
+
type: "checkbox",
|
|
3715
|
+
class: "peer sr-only",
|
|
3716
|
+
checked: t.value,
|
|
3717
|
+
disabled: e.disabled,
|
|
3718
|
+
onChange: i[0] ||= (e) => t.value = e.target.checked
|
|
3719
|
+
}, null, 40, oa),
|
|
3720
|
+
u("div", sa, [u("div", { class: b(["h-6 w-11 rounded-full transition-colors duration-200 ease-in-out", [
|
|
3721
|
+
t.value ? "bg-primary-500" : "bg-default-500",
|
|
3722
|
+
e.disabled ? "opacity-50" : "",
|
|
3723
|
+
t.value && e.disabled ? "bg-primary-300" : ""
|
|
3724
|
+
]]) }, null, 2), u("div", { class: b(P(U)("absolute top-0.5 left-0.5 h-5 w-5 transform rounded-full bg-white transition-transform duration-200 ease-in-out", t.value ? "translate-x-5" : "translate-x-0")) }, null, 2)]),
|
|
3725
|
+
e.label ? (T(), l("span", {
|
|
3726
|
+
key: 0,
|
|
3727
|
+
class: b(P(U)("ml-3 text-sm font-medium", e.disabled ? "text-default-400" : "", e.labelClassName))
|
|
3728
|
+
}, M(e.label), 3)) : c("", !0)
|
|
3729
|
+
], 2));
|
|
3730
|
+
}
|
|
3731
|
+
}), la = ["aria-orientation"], ua = [
|
|
3732
|
+
"aria-selected",
|
|
3733
|
+
"aria-disabled",
|
|
3734
|
+
"tabindex",
|
|
3735
|
+
"disabled",
|
|
3736
|
+
"onClick",
|
|
3737
|
+
"onKeydown"
|
|
3738
|
+
], da = { key: 1 }, fa = /* @__PURE__ */ m({
|
|
3739
|
+
name: "KunTab",
|
|
3740
|
+
__name: "Tab",
|
|
3741
|
+
props: /*@__PURE__*/ _({
|
|
3742
|
+
items: {},
|
|
3743
|
+
variant: { default: "underlined" },
|
|
3744
|
+
color: { default: "primary" },
|
|
3745
|
+
size: { default: "md" },
|
|
3746
|
+
orientation: { default: "horizontal" },
|
|
3747
|
+
fullWidth: {
|
|
3748
|
+
type: Boolean,
|
|
3749
|
+
default: !1
|
|
3750
|
+
},
|
|
3751
|
+
disabled: {
|
|
3752
|
+
type: Boolean,
|
|
3753
|
+
default: !1
|
|
3754
|
+
},
|
|
3755
|
+
disableAnimation: {
|
|
3756
|
+
type: Boolean,
|
|
3757
|
+
default: !1
|
|
3758
|
+
},
|
|
3759
|
+
scrollable: {
|
|
3760
|
+
type: Boolean,
|
|
3761
|
+
default: !1
|
|
3762
|
+
},
|
|
3763
|
+
iconSize: { default: "1em" },
|
|
3764
|
+
className: { default: "" },
|
|
3765
|
+
innerClassName: { default: "" }
|
|
3766
|
+
}, {
|
|
3767
|
+
modelValue: { required: !0 },
|
|
3768
|
+
modelModifiers: {}
|
|
3769
|
+
}),
|
|
3770
|
+
emits: /*@__PURE__*/ _(["change"], ["update:modelValue"]),
|
|
3771
|
+
setup(e, { emit: n }) {
|
|
3772
|
+
let r = e, i = L(e, "modelValue"), a = n, s = Y(), d = o(() => r.orientation === "vertical"), f = {
|
|
3773
|
+
sm: "text-sm px-2.5 py-1.5",
|
|
3774
|
+
md: "text-sm px-3 py-2",
|
|
3775
|
+
lg: "text-base px-4 py-2.5"
|
|
3776
|
+
}, m = {
|
|
3777
|
+
sm: "gap-1",
|
|
3778
|
+
md: "gap-1.5",
|
|
3779
|
+
lg: "gap-2"
|
|
3780
|
+
}, h = O([]), g = (e, t) => {
|
|
3781
|
+
let n = e && typeof e == "object" && "$el" in e ? e.$el ?? null : e;
|
|
3782
|
+
n instanceof HTMLElement && (h.value[t] = n);
|
|
3783
|
+
}, _ = o(() => r.items.findIndex((e) => e.value === i.value)), v = O({}), S = () => {
|
|
3784
|
+
let e = _.value, t = h.value[e];
|
|
3785
|
+
if (!t) {
|
|
3786
|
+
v.value = {};
|
|
3787
|
+
return;
|
|
3788
|
+
}
|
|
3789
|
+
let n = r.variant === "underlined";
|
|
3790
|
+
d.value ? v.value = n ? {
|
|
3791
|
+
transform: `translateY(${t.offsetTop}px)`,
|
|
3792
|
+
height: `${t.offsetHeight}px`,
|
|
3793
|
+
width: "2px"
|
|
3794
|
+
} : {
|
|
3795
|
+
transform: `translate(${t.offsetLeft}px, ${t.offsetTop}px)`,
|
|
3796
|
+
width: `${t.offsetWidth}px`,
|
|
3797
|
+
height: `${t.offsetHeight}px`
|
|
3798
|
+
} : v.value = n ? {
|
|
3799
|
+
transform: `translateX(${t.offsetLeft}px)`,
|
|
3800
|
+
width: `${t.offsetWidth}px`,
|
|
3801
|
+
height: "2px"
|
|
3802
|
+
} : {
|
|
3803
|
+
transform: `translate(${t.offsetLeft}px, ${t.offsetTop}px)`,
|
|
3804
|
+
width: `${t.offsetWidth}px`,
|
|
3805
|
+
height: `${t.offsetHeight}px`
|
|
3806
|
+
};
|
|
3807
|
+
};
|
|
3808
|
+
z([
|
|
3809
|
+
i,
|
|
3810
|
+
() => r.items.length,
|
|
3811
|
+
() => r.orientation
|
|
3812
|
+
], () => y(S), { immediate: !0 });
|
|
3813
|
+
let C = (e) => {
|
|
3814
|
+
let t = h.value[e];
|
|
3815
|
+
t && t.focus();
|
|
3816
|
+
}, w = (e, t) => {
|
|
3817
|
+
t?.preventDefault();
|
|
3818
|
+
let n = r.items.map((e, t) => e.disabled || r.disabled ? -1 : t).filter((e) => e >= 0);
|
|
3819
|
+
if (!n.length) return;
|
|
3820
|
+
let i = n.indexOf(_.value), a;
|
|
3821
|
+
if (a = i < 0 ? n[e > 0 ? 0 : n.length - 1] : n[(i + e + n.length) % n.length], a === void 0) return;
|
|
3822
|
+
let o = r.items[a];
|
|
3823
|
+
o && (D(o, a), C(a));
|
|
3824
|
+
}, E = (e, t) => {
|
|
3825
|
+
if (r.disabled) return;
|
|
3826
|
+
let n = d.value ? "ArrowDown" : "ArrowRight", i = d.value ? "ArrowUp" : "ArrowLeft";
|
|
3827
|
+
switch (e.key) {
|
|
3828
|
+
case n:
|
|
3829
|
+
w(1, e);
|
|
3830
|
+
break;
|
|
3831
|
+
case i:
|
|
3832
|
+
w(-1, e);
|
|
3833
|
+
break;
|
|
3834
|
+
case "Home":
|
|
3835
|
+
e.preventDefault();
|
|
3836
|
+
{
|
|
3837
|
+
let e = r.items.findIndex((e) => !(e.disabled || r.disabled));
|
|
3838
|
+
e >= 0 && r.items[e] && (D(r.items[e], e), C(e));
|
|
3839
|
+
}
|
|
3840
|
+
break;
|
|
3841
|
+
case "End":
|
|
3842
|
+
e.preventDefault();
|
|
3843
|
+
for (let e = r.items.length - 1; e >= 0; e--) {
|
|
3844
|
+
let t = r.items[e];
|
|
3845
|
+
if (t && !(t.disabled || r.disabled)) {
|
|
3846
|
+
D(t, e), C(e);
|
|
3847
|
+
break;
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
break;
|
|
3851
|
+
case "Enter":
|
|
3852
|
+
case " ": {
|
|
3853
|
+
e.preventDefault();
|
|
3854
|
+
let n = r.items[t];
|
|
3855
|
+
n && D(n, t);
|
|
3856
|
+
break;
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
}, D = async (e, t) => {
|
|
3860
|
+
r.disabled || e.disabled || (i.value !== e.value && (i.value = e.value, a("change", e.value)), e.href && await s.navigate(e.href));
|
|
3861
|
+
}, A = (e) => i.value === e.value, j = o(() => U("relative", d.value ? "inline-flex flex-col" : "inline-flex", r.fullWidth && "w-full", r.disabled && "opacity-50 cursor-not-allowed", r.scrollable && (d.value ? "max-h-full overflow-y-auto scrollbar-hide" : "max-w-full overflow-x-auto scrollbar-hide"), r.className)), N = o(() => {
|
|
3862
|
+
let e = d.value ? U("relative flex flex-col items-stretch", m[r.size]) : U("relative flex items-center", m[r.size]);
|
|
3863
|
+
switch (r.variant) {
|
|
3864
|
+
case "underlined": return U(e, d.value ? "border-l border-default-200" : "border-b border-default-200", r.innerClassName);
|
|
3865
|
+
case "solid":
|
|
3866
|
+
case "light": return U(e, "border border-default-200 rounded-lg p-1 bg-content2/30", r.innerClassName);
|
|
3867
|
+
case "bordered": return U(e, "border border-default-200 rounded-lg p-1", r.innerClassName);
|
|
3868
|
+
case "pills": return U(e, r.innerClassName);
|
|
3869
|
+
default: return U(e, r.innerClassName);
|
|
3870
|
+
}
|
|
3871
|
+
}), P = (e) => {
|
|
3872
|
+
let t = A(e), n = U("relative z-10 inline-flex items-center justify-center cursor-pointer select-none whitespace-nowrap transition-colors", f[r.size], e.disabled && "opacity-50 cursor-not-allowed", d.value && r.fullWidth && "w-full");
|
|
3873
|
+
switch (r.variant) {
|
|
3874
|
+
case "underlined": return U(n, t ? le[r.color] : "text-default-500 hover:text-foreground");
|
|
3875
|
+
case "solid": return U(n, "rounded-md", t ? "text-white" : "text-default-500 hover:text-foreground");
|
|
3876
|
+
case "light": return U(n, "rounded-md", t ? le[r.color] : "text-default-500 hover:text-foreground");
|
|
3877
|
+
case "bordered": return U(n, "rounded-md border", t ? U(K[r.color], le[r.color]) : "border-transparent text-default-500 hover:text-foreground");
|
|
3878
|
+
case "pills": return U(n, "rounded-full", t ? U(G[r.color], "text-white") : "text-default-500 hover:text-foreground");
|
|
3879
|
+
default: return n;
|
|
3880
|
+
}
|
|
3881
|
+
}, F = {
|
|
3882
|
+
default: "bg-default/15",
|
|
3883
|
+
primary: "bg-primary/15",
|
|
3884
|
+
secondary: "bg-secondary/15",
|
|
3885
|
+
success: "bg-success/15",
|
|
3886
|
+
warning: "bg-warning/15",
|
|
3887
|
+
danger: "bg-danger/15",
|
|
3888
|
+
info: "bg-info/15"
|
|
3889
|
+
}, I = o(() => {
|
|
3890
|
+
switch (r.variant) {
|
|
3891
|
+
case "underlined": return U("absolute rounded-full", G[r.color], d.value ? "left-0 top-0" : "bottom-0 left-0");
|
|
3892
|
+
case "solid": return U("absolute top-0 left-0 rounded-md", G[r.color]);
|
|
3893
|
+
case "light": return U("absolute top-0 left-0 rounded-md", F[r.color]);
|
|
3894
|
+
default: return null;
|
|
3895
|
+
}
|
|
3896
|
+
}), ee = o(() => !!I.value && _.value >= 0 && Object.keys(v.value).length > 0), R = o(() => {
|
|
3897
|
+
let e = { ...v.value };
|
|
3898
|
+
return r.disableAnimation || (e.transition = "transform .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1), height .25s cubic-bezier(.4,0,.2,1)"), e;
|
|
3899
|
+
});
|
|
3900
|
+
return (n, r) => (T(), l("div", { class: b(j.value) }, [u("div", {
|
|
3901
|
+
class: b(N.value),
|
|
3902
|
+
role: "tablist",
|
|
3903
|
+
"aria-orientation": e.orientation
|
|
3904
|
+
}, [ee.value ? (T(), l("div", {
|
|
3905
|
+
key: 0,
|
|
3906
|
+
"aria-hidden": "true",
|
|
3907
|
+
class: b(I.value),
|
|
3908
|
+
style: x(R.value)
|
|
3909
|
+
}, null, 6)) : c("", !0), (T(!0), l(t, null, k(e.items, (t, n) => (T(), l("button", {
|
|
3910
|
+
key: t.value,
|
|
3911
|
+
ref_for: !0,
|
|
3912
|
+
ref: (e) => g(e, n),
|
|
3913
|
+
type: "button",
|
|
3914
|
+
role: "tab",
|
|
3915
|
+
"aria-selected": A(t),
|
|
3916
|
+
"aria-disabled": t.disabled || e.disabled,
|
|
3917
|
+
tabindex: A(t) && !t.disabled && !e.disabled ? 0 : -1,
|
|
3918
|
+
disabled: t.disabled || e.disabled,
|
|
3919
|
+
class: b(P(t)),
|
|
3920
|
+
onClick: (e) => D(t, n),
|
|
3921
|
+
onKeydown: (e) => E(e, n)
|
|
3922
|
+
}, [t.icon ? (T(), l("span", {
|
|
3923
|
+
key: 0,
|
|
3924
|
+
class: "inline-flex shrink-0",
|
|
3925
|
+
style: x({ fontSize: e.iconSize })
|
|
3926
|
+
}, [p(Z, { name: t.icon }, null, 8, ["name"])], 4)) : c("", !0), t.textValue ? (T(), l("span", da, M(t.textValue), 1)) : c("", !0)], 42, ua))), 128))], 10, la)], 2));
|
|
3927
|
+
}
|
|
3928
|
+
}), pa = { class: "w-full" }, ma = ["for"], ha = [
|
|
3929
|
+
"aria-label",
|
|
3930
|
+
"aria-invalid",
|
|
3931
|
+
"aria-disabled"
|
|
3932
|
+
], ga = [
|
|
3933
|
+
"tabindex",
|
|
3934
|
+
"aria-label",
|
|
3935
|
+
"onKeydown"
|
|
3936
|
+
], _a = ["aria-label", "onClick"], va = [
|
|
3937
|
+
"id",
|
|
3938
|
+
"placeholder",
|
|
3939
|
+
"disabled",
|
|
3940
|
+
"readonly",
|
|
3941
|
+
"aria-describedby"
|
|
3942
|
+
], ya = {
|
|
3943
|
+
key: 1,
|
|
3944
|
+
class: "text-default-400 ml-auto text-xs tabular-nums"
|
|
3945
|
+
}, ba = ["id"], xa = ["id"], Sa = /* @__PURE__ */ m({
|
|
3946
|
+
name: "KunTagInput",
|
|
3947
|
+
__name: "TagInput",
|
|
3948
|
+
props: /*@__PURE__*/ _({
|
|
3949
|
+
label: { default: "" },
|
|
3950
|
+
placeholder: { default: "" },
|
|
3951
|
+
helperText: { default: "" },
|
|
3952
|
+
error: { default: "" },
|
|
3953
|
+
maxTags: { default: Infinity },
|
|
3954
|
+
maxTagLength: { default: 100 },
|
|
3955
|
+
minTagLength: { default: 1 },
|
|
3956
|
+
allowDuplicates: {
|
|
3957
|
+
type: Boolean,
|
|
3958
|
+
default: !1
|
|
3959
|
+
},
|
|
3960
|
+
caseSensitive: {
|
|
3961
|
+
type: Boolean,
|
|
3962
|
+
default: !1
|
|
3963
|
+
},
|
|
3964
|
+
trim: {
|
|
3965
|
+
type: Boolean,
|
|
3966
|
+
default: !0
|
|
3967
|
+
},
|
|
3968
|
+
transform: {
|
|
3969
|
+
type: Function,
|
|
3970
|
+
default: void 0
|
|
3971
|
+
},
|
|
3972
|
+
validate: {
|
|
3973
|
+
type: Function,
|
|
3974
|
+
default: void 0
|
|
3975
|
+
},
|
|
3976
|
+
splitChars: { default: () => [
|
|
3977
|
+
"\n",
|
|
3978
|
+
",",
|
|
3979
|
+
",",
|
|
3980
|
+
";"
|
|
3981
|
+
] },
|
|
3982
|
+
splitOnPaste: {
|
|
3983
|
+
type: Boolean,
|
|
3984
|
+
default: !0
|
|
3985
|
+
},
|
|
3986
|
+
confirmOnBlur: {
|
|
3987
|
+
type: Boolean,
|
|
3988
|
+
default: !0
|
|
3989
|
+
},
|
|
3990
|
+
respectComposition: {
|
|
3991
|
+
type: Boolean,
|
|
3992
|
+
default: !0
|
|
3993
|
+
},
|
|
3994
|
+
color: { default: "primary" },
|
|
3995
|
+
size: { default: "md" },
|
|
3996
|
+
variant: { default: "bordered" },
|
|
3997
|
+
disabled: {
|
|
3998
|
+
type: Boolean,
|
|
3999
|
+
default: !1
|
|
4000
|
+
},
|
|
4001
|
+
readonly: {
|
|
4002
|
+
type: Boolean,
|
|
4003
|
+
default: !1
|
|
4004
|
+
},
|
|
4005
|
+
showCounter: {
|
|
4006
|
+
type: Boolean,
|
|
4007
|
+
default: !1
|
|
4008
|
+
},
|
|
4009
|
+
rounded: { default: void 0 },
|
|
4010
|
+
className: { default: "" }
|
|
4011
|
+
}, {
|
|
4012
|
+
modelValue: { default: () => [] },
|
|
4013
|
+
modelModifiers: {}
|
|
4014
|
+
}),
|
|
4015
|
+
emits: /*@__PURE__*/ _([
|
|
4016
|
+
"add",
|
|
4017
|
+
"remove",
|
|
4018
|
+
"invalid"
|
|
4019
|
+
], ["update:modelValue"]),
|
|
4020
|
+
setup(e, { emit: n }) {
|
|
4021
|
+
let r = e, i = X(() => r.rounded), a = o(() => q[i.value]), s = L(e, "modelValue"), d = n, f = O(null), m = O([]), h = O(""), g = O(!1), _ = (e, t) => {
|
|
4022
|
+
let n = e && typeof e == "object" && "$el" in e ? e.$el ?? null : e;
|
|
4023
|
+
n instanceof HTMLElement && (m.value[t] = n);
|
|
4024
|
+
}, v = O(!1), x = Ft("kun-tag-input"), S = (e) => {
|
|
4025
|
+
let t = e;
|
|
4026
|
+
return r.trim && (t = t.trim()), r.transform && (t = r.transform(t)), t;
|
|
4027
|
+
}, C = (e, t) => {
|
|
4028
|
+
if (r.caseSensitive) return t.includes(e);
|
|
4029
|
+
let n = e.toLowerCase();
|
|
4030
|
+
return t.some((e) => e.toLowerCase() === n);
|
|
4031
|
+
}, w = (e) => {
|
|
4032
|
+
let t = S(e);
|
|
4033
|
+
if (!t) return !1;
|
|
4034
|
+
if (t.length < r.minTagLength) return d("invalid", "too-short", e), !1;
|
|
4035
|
+
if (t.length > r.maxTagLength) return d("invalid", "too-long", e), !1;
|
|
4036
|
+
if (s.value.length >= r.maxTags) return d("invalid", "max-reached", e), !1;
|
|
4037
|
+
if (!r.allowDuplicates && C(t, s.value)) return d("invalid", "duplicate", e), !1;
|
|
4038
|
+
if (r.validate) {
|
|
4039
|
+
let n = r.validate(t, s.value);
|
|
4040
|
+
if (n !== !0) return d("invalid", "custom", e, n), !1;
|
|
4041
|
+
}
|
|
4042
|
+
return s.value = [...s.value, t], d("add", t), !0;
|
|
4043
|
+
}, E = (e) => {
|
|
4044
|
+
let t = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), n = [];
|
|
4045
|
+
for (let e of r.splitChars) e instanceof RegExp ? e.source && n.push(`(?:${e.source})`) : e && n.push(t(e));
|
|
4046
|
+
if (!n.length) return +!!w(e);
|
|
4047
|
+
let i = new RegExp(n.join("|")), a = e.split(i), o = 0;
|
|
4048
|
+
for (let e of a) w(e) && o++;
|
|
4049
|
+
return o;
|
|
4050
|
+
}, D = (e) => {
|
|
4051
|
+
if (r.disabled || r.readonly) return;
|
|
4052
|
+
let t = s.value[e];
|
|
4053
|
+
t !== void 0 && (s.value = s.value.filter((t, n) => n !== e), m.value.length = s.value.length, d("remove", t, e));
|
|
4054
|
+
}, j = () => h.value && E(h.value) > 0 ? (h.value = "", !0) : !1, N = (e) => {
|
|
4055
|
+
if (!(r.disabled || r.readonly)) {
|
|
4056
|
+
if (e.key === "Enter") {
|
|
4057
|
+
if (r.respectComposition && g.value) return;
|
|
4058
|
+
e.preventDefault(), j(), v.value = !1;
|
|
4059
|
+
return;
|
|
4060
|
+
}
|
|
4061
|
+
if (e.key === "Backspace" && !h.value && s.value.length > 0) {
|
|
4062
|
+
if (e.repeat) return;
|
|
4063
|
+
v.value ? (D(s.value.length - 1), v.value = !1) : v.value = !0;
|
|
4064
|
+
return;
|
|
4065
|
+
}
|
|
4066
|
+
if (e.key === "ArrowLeft" && !h.value && s.value.length > 0) {
|
|
4067
|
+
e.preventDefault();
|
|
4068
|
+
let t = s.value.length - 1;
|
|
4069
|
+
m.value[t]?.focus();
|
|
4070
|
+
return;
|
|
4071
|
+
}
|
|
4072
|
+
e.key !== "Backspace" && (v.value = !1);
|
|
4073
|
+
}
|
|
4074
|
+
}, F = (e, t) => {
|
|
4075
|
+
if (!(r.disabled || r.readonly)) switch (e.key) {
|
|
4076
|
+
case "ArrowLeft":
|
|
4077
|
+
e.preventDefault(), t > 0 && m.value[t - 1]?.focus();
|
|
4078
|
+
break;
|
|
4079
|
+
case "ArrowRight":
|
|
4080
|
+
e.preventDefault(), t < s.value.length - 1 ? m.value[t + 1]?.focus() : f.value?.focus();
|
|
4081
|
+
break;
|
|
4082
|
+
case "Delete":
|
|
4083
|
+
case "Backspace":
|
|
4084
|
+
e.preventDefault(), D(t), y(() => {
|
|
4085
|
+
t > 0 ? m.value[t - 1]?.focus() : f.value?.focus();
|
|
4086
|
+
});
|
|
4087
|
+
break;
|
|
4088
|
+
case "Enter":
|
|
4089
|
+
case " ":
|
|
4090
|
+
e.preventDefault(), D(t);
|
|
4091
|
+
break;
|
|
4092
|
+
}
|
|
4093
|
+
}, I = () => {
|
|
4094
|
+
g.value = !0;
|
|
4095
|
+
}, ee = () => {
|
|
4096
|
+
g.value = !1;
|
|
4097
|
+
}, z = (e) => {
|
|
4098
|
+
if (!r.splitOnPaste || r.disabled || r.readonly) return;
|
|
4099
|
+
let t = e.clipboardData?.getData("text") ?? "";
|
|
4100
|
+
t && r.splitChars.some((e) => e instanceof RegExp ? e.test(t) : t.includes(e)) && (e.preventDefault(), E(t));
|
|
4101
|
+
}, B = () => {
|
|
4102
|
+
r.confirmOnBlur && j();
|
|
4103
|
+
}, V = () => {
|
|
4104
|
+
r.disabled || r.readonly || f.value?.focus();
|
|
4105
|
+
}, ne = {
|
|
4106
|
+
xs: "min-h-[30px]",
|
|
4107
|
+
sm: "min-h-[34px]",
|
|
4108
|
+
md: "min-h-[40px]",
|
|
4109
|
+
lg: "min-h-[48px]",
|
|
4110
|
+
xl: "min-h-[56px]"
|
|
4111
|
+
}, re = {
|
|
4112
|
+
xs: "px-2 py-1 gap-1",
|
|
4113
|
+
sm: "px-2.5 py-1.5 gap-1.5",
|
|
4114
|
+
md: "px-3 py-2 gap-2",
|
|
4115
|
+
lg: "px-3.5 py-2.5 gap-2",
|
|
4116
|
+
xl: "px-4 py-3 gap-2.5"
|
|
4117
|
+
}, ie = {
|
|
4118
|
+
xs: "text-xs",
|
|
4119
|
+
sm: "text-sm",
|
|
4120
|
+
md: "text-sm",
|
|
4121
|
+
lg: "text-base",
|
|
4122
|
+
xl: "text-lg"
|
|
4123
|
+
}, ae = o(() => U("flex flex-wrap items-center transition-shadow", a.value, ne[r.size], re[r.size], ie[r.size], r.variant === "bordered" && "border border-default-200", r.variant === "flat" && "bg-content2", ce[r.color], "focus-within:ring-2", r.error && "border-danger", r.disabled && "opacity-50 cursor-not-allowed bg-default-100", r.readonly && "cursor-default", r.className)), oe = {
|
|
4124
|
+
default: "bg-default/20 text-default-700",
|
|
4125
|
+
primary: "bg-primary/15 text-primary-700 dark:text-primary",
|
|
4126
|
+
secondary: "bg-secondary/15 text-secondary-700 dark:text-secondary",
|
|
4127
|
+
success: "bg-success/15 text-success-700 dark:text-success",
|
|
4128
|
+
warning: "bg-warning/15 text-warning-700 dark:text-warning",
|
|
4129
|
+
danger: "bg-danger/15 text-danger-700 dark:text-danger",
|
|
4130
|
+
info: "bg-info/15 text-info-700 dark:text-info"
|
|
4131
|
+
}, W = {
|
|
4132
|
+
xs: "px-1.5 py-0.5 text-xs gap-0.5",
|
|
4133
|
+
sm: "px-2 py-0.5 text-xs gap-1",
|
|
4134
|
+
md: "px-2 py-1 text-sm gap-1",
|
|
4135
|
+
lg: "px-2.5 py-1 text-sm gap-1.5",
|
|
4136
|
+
xl: "px-3 py-1.5 text-base gap-1.5"
|
|
4137
|
+
}, se = o(() => U("inline-flex items-center rounded-md font-medium select-none", oe[r.color], W[r.size], "focus:outline-none focus:ring-2", ce[r.color])), G = o(() => s.value.length >= r.maxTags);
|
|
4138
|
+
return (n, r) => (T(), l("div", pa, [
|
|
4139
|
+
e.label ? (T(), l("label", {
|
|
4140
|
+
key: 0,
|
|
4141
|
+
for: P(x),
|
|
4142
|
+
class: "text-default-700 mb-1 block text-sm font-medium"
|
|
4143
|
+
}, M(e.label), 9, ma)) : c("", !0),
|
|
4144
|
+
u("div", {
|
|
4145
|
+
role: "group",
|
|
4146
|
+
"aria-label": e.label || "tag input",
|
|
4147
|
+
"aria-invalid": !!e.error,
|
|
4148
|
+
"aria-disabled": e.disabled,
|
|
4149
|
+
class: b(ae.value),
|
|
4150
|
+
onClick: V
|
|
4151
|
+
}, [
|
|
4152
|
+
(T(!0), l(t, null, k(s.value, (t, i) => (T(), l("span", {
|
|
4153
|
+
key: `${i}-${t}`,
|
|
4154
|
+
ref_for: !0,
|
|
4155
|
+
ref: (e) => _(e, i),
|
|
4156
|
+
class: b(se.value),
|
|
4157
|
+
tabindex: e.disabled || e.readonly ? -1 : 0,
|
|
4158
|
+
"aria-label": `标签 ${t}`,
|
|
4159
|
+
onKeydown: (e) => F(e, i),
|
|
4160
|
+
onClick: r[0] ||= H(() => {}, ["stop"])
|
|
4161
|
+
}, [A(n.$slots, "tag", {
|
|
4162
|
+
tag: t,
|
|
4163
|
+
index: i,
|
|
4164
|
+
remove: () => D(i)
|
|
4165
|
+
}, () => [u("span", null, M(t), 1), !e.readonly && !e.disabled ? (T(), l("button", {
|
|
4166
|
+
key: 0,
|
|
4167
|
+
type: "button",
|
|
4168
|
+
tabindex: "-1",
|
|
4169
|
+
"aria-label": `移除标签 ${t}`,
|
|
4170
|
+
class: "hover:text-danger -mr-0.5 ml-1 inline-flex cursor-pointer rounded-full p-0.5 transition-colors focus:outline-none",
|
|
4171
|
+
onClick: H((e) => D(i), ["stop"])
|
|
4172
|
+
}, [p(Z, {
|
|
4173
|
+
name: "lucide:x",
|
|
4174
|
+
class: "size-3.5"
|
|
4175
|
+
})], 8, _a)) : c("", !0)])], 42, ga))), 128)),
|
|
4176
|
+
e.readonly ? c("", !0) : te((T(), l("input", {
|
|
4177
|
+
key: 0,
|
|
4178
|
+
id: P(x),
|
|
4179
|
+
ref_key: "inputEl",
|
|
4180
|
+
ref: f,
|
|
4181
|
+
"onUpdate:modelValue": r[1] ||= (e) => h.value = e,
|
|
4182
|
+
type: "text",
|
|
4183
|
+
placeholder: s.value.length === 0 ? e.placeholder : "",
|
|
4184
|
+
disabled: e.disabled,
|
|
4185
|
+
readonly: G.value,
|
|
4186
|
+
"aria-describedby": e.error || e.helperText ? `${P(x)}-msg` : void 0,
|
|
4187
|
+
class: "placeholder-default-400 min-w-[80px] flex-1 bg-transparent outline-none disabled:cursor-not-allowed read-only:cursor-not-allowed",
|
|
4188
|
+
onKeydown: N,
|
|
4189
|
+
onCompositionstart: I,
|
|
4190
|
+
onCompositionend: ee,
|
|
4191
|
+
onPaste: z,
|
|
4192
|
+
onBlur: B
|
|
4193
|
+
}, null, 40, va)), [[R, h.value]]),
|
|
4194
|
+
e.showCounter && e.maxTags !== Infinity ? (T(), l("span", ya, M(s.value.length) + "/" + M(e.maxTags), 1)) : c("", !0)
|
|
4195
|
+
], 10, ha),
|
|
4196
|
+
e.error ? (T(), l("p", {
|
|
4197
|
+
key: 1,
|
|
4198
|
+
id: `${P(x)}-msg`,
|
|
4199
|
+
class: "text-danger mt-1 text-sm"
|
|
4200
|
+
}, M(e.error), 9, ba)) : e.helperText ? (T(), l("p", {
|
|
4201
|
+
key: 2,
|
|
4202
|
+
id: `${P(x)}-msg`,
|
|
4203
|
+
class: "text-default-500 mt-1 text-sm"
|
|
4204
|
+
}, M(e.helperText), 9, xa)) : c("", !0)
|
|
4205
|
+
]));
|
|
4206
|
+
}
|
|
4207
|
+
}), Ca = /*#__PURE__*/ Q(/* @__PURE__ */ m({
|
|
4208
|
+
name: "KunText",
|
|
4209
|
+
__name: "Text",
|
|
4210
|
+
props: {
|
|
4211
|
+
content: { default: "" },
|
|
4212
|
+
className: { default: "" }
|
|
4213
|
+
},
|
|
4214
|
+
setup(e) {
|
|
4215
|
+
let t = e, n = o(() => t.content.replace(/([_/])/g, "$1"));
|
|
4216
|
+
return (e, r) => (T(), l("span", { class: b(P(U)("kun-text-block", t.className)) }, M(n.value), 3));
|
|
4217
|
+
}
|
|
4218
|
+
}), [["__scopeId", "data-v-a54bae78"]]), wa = { class: "w-full" }, Ta = ["for"], Ea = {
|
|
4219
|
+
key: 0,
|
|
4220
|
+
class: "text-danger ml-1"
|
|
4221
|
+
}, Da = { class: "relative" }, Oa = [
|
|
4222
|
+
"id",
|
|
4223
|
+
"name",
|
|
4224
|
+
"placeholder",
|
|
4225
|
+
"disabled",
|
|
4226
|
+
"readonly",
|
|
4227
|
+
"required",
|
|
4228
|
+
"maxlength",
|
|
4229
|
+
"minlength",
|
|
4230
|
+
"rows",
|
|
4231
|
+
"autofocus"
|
|
4232
|
+
], ka = {
|
|
4233
|
+
key: 0,
|
|
4234
|
+
class: "text-default-500 absolute right-2 bottom-2 text-xs"
|
|
4235
|
+
}, Aa = {
|
|
4236
|
+
key: 1,
|
|
4237
|
+
class: "text-danger-600 mt-1 text-sm"
|
|
4238
|
+
}, ja = {
|
|
4239
|
+
key: 2,
|
|
4240
|
+
class: "text-default-500 mt-1 text-sm"
|
|
4241
|
+
}, Ma = /* @__PURE__ */ m({
|
|
4242
|
+
name: "KunTextarea",
|
|
4243
|
+
__name: "Textarea",
|
|
4244
|
+
props: /*@__PURE__*/ _({
|
|
4245
|
+
placeholder: { default: "" },
|
|
4246
|
+
label: { default: "" },
|
|
4247
|
+
name: { default: "" },
|
|
4248
|
+
hint: { default: "" },
|
|
4249
|
+
error: { default: "" },
|
|
4250
|
+
maxHeight: { default: "" },
|
|
4251
|
+
disabled: {
|
|
4252
|
+
type: Boolean,
|
|
4253
|
+
default: !1
|
|
4254
|
+
},
|
|
4255
|
+
readonly: {
|
|
4256
|
+
type: Boolean,
|
|
4257
|
+
default: !1
|
|
4258
|
+
},
|
|
4259
|
+
required: {
|
|
4260
|
+
type: Boolean,
|
|
4261
|
+
default: !1
|
|
4262
|
+
},
|
|
4263
|
+
autofocus: {
|
|
4264
|
+
type: Boolean,
|
|
4265
|
+
default: !1
|
|
4266
|
+
},
|
|
4267
|
+
showCharCount: {
|
|
4268
|
+
type: Boolean,
|
|
4269
|
+
default: !1
|
|
4270
|
+
},
|
|
4271
|
+
autoGrow: {
|
|
4272
|
+
type: Boolean,
|
|
4273
|
+
default: !1
|
|
4274
|
+
},
|
|
4275
|
+
rows: { default: 4 },
|
|
4276
|
+
maxlength: { default: 100007 },
|
|
4277
|
+
minlength: { default: 1 },
|
|
4278
|
+
resize: { default: "none" },
|
|
4279
|
+
darkBorder: {
|
|
4280
|
+
type: Boolean,
|
|
4281
|
+
default: !0
|
|
4282
|
+
},
|
|
4283
|
+
rounded: { default: void 0 }
|
|
4284
|
+
}, {
|
|
4285
|
+
modelValue: { default: "" },
|
|
4286
|
+
modelModifiers: {}
|
|
4287
|
+
}),
|
|
4288
|
+
emits: /*@__PURE__*/ _([
|
|
4289
|
+
"blur",
|
|
4290
|
+
"focus",
|
|
4291
|
+
"input"
|
|
4292
|
+
], ["update:modelValue"]),
|
|
4293
|
+
setup(e, { expose: t, emit: n }) {
|
|
4294
|
+
let r = e, i = X(() => r.rounded), a = o(() => q[i.value]), s = L(e, "modelValue"), d = Ft("kun-textarea"), p = O(null), m = n;
|
|
4295
|
+
z(s, () => {
|
|
4296
|
+
r.autoGrow && y(() => g());
|
|
4297
|
+
});
|
|
4298
|
+
let h = (e) => {
|
|
4299
|
+
m("input", e), r.autoGrow && g();
|
|
4300
|
+
}, g = () => {
|
|
4301
|
+
if (!p.value) return;
|
|
4302
|
+
p.value.style.height = "auto";
|
|
4303
|
+
let e = p.value.scrollHeight + "px";
|
|
4304
|
+
r.maxHeight && parseInt(e) > parseInt(r.maxHeight) && (e = r.maxHeight), p.value.style.height = e;
|
|
4305
|
+
};
|
|
4306
|
+
return C(() => {
|
|
4307
|
+
r.autoGrow && p.value && g(), r.autofocus && p.value && p.value.focus();
|
|
4308
|
+
}), t({
|
|
4309
|
+
focus: () => p.value?.focus(),
|
|
4310
|
+
blur: () => p.value?.blur(),
|
|
4311
|
+
select: () => p.value?.select(),
|
|
4312
|
+
insertAtCaret: (e) => {
|
|
4313
|
+
let t = p.value;
|
|
4314
|
+
if (!t) return;
|
|
4315
|
+
let n = t.selectionStart ?? t.value.length, r = t.selectionEnd ?? t.value.length;
|
|
4316
|
+
s.value = t.value.slice(0, n) + e + t.value.slice(r), y(() => {
|
|
4317
|
+
if (!p.value) return;
|
|
4318
|
+
let t = n + e.length;
|
|
4319
|
+
p.value.setSelectionRange(t, t), p.value.focus();
|
|
4320
|
+
});
|
|
4321
|
+
},
|
|
4322
|
+
textareaRef: p
|
|
4323
|
+
}), (t, n) => (T(), l("div", wa, [
|
|
4324
|
+
e.label ? (T(), l("label", {
|
|
4325
|
+
key: 0,
|
|
4326
|
+
for: P(d),
|
|
4327
|
+
class: "mb-1 block text-sm font-medium"
|
|
4328
|
+
}, [f(M(e.label) + " ", 1), e.required ? (T(), l("span", Ea, "*")) : c("", !0)], 8, Ta)) : c("", !0),
|
|
4329
|
+
u("div", Da, [te(u("textarea", {
|
|
4330
|
+
id: P(d),
|
|
4331
|
+
ref_key: "textareaRef",
|
|
4332
|
+
ref: p,
|
|
4333
|
+
"onUpdate:modelValue": n[0] ||= (e) => s.value = e,
|
|
4334
|
+
name: e.name,
|
|
4335
|
+
placeholder: e.placeholder,
|
|
4336
|
+
disabled: e.disabled,
|
|
4337
|
+
readonly: e.readonly,
|
|
4338
|
+
required: e.required,
|
|
4339
|
+
maxlength: e.maxlength,
|
|
4340
|
+
minlength: e.minlength,
|
|
4341
|
+
rows: e.rows,
|
|
4342
|
+
autofocus: e.autofocus,
|
|
4343
|
+
class: b(P(U)("scrollbar-hide border-default/20 w-full border p-3 transition duration-150 ease-in-out", a.value, "focus:ring-primary focus:border-transparent focus:ring-2 focus:outline-none", e.disabled ? "text-default-500 cursor-not-allowed shadow-none" : "", e.darkBorder && "dark:border-default-200", e.resize === "none" ? "resize-none" : e.resize === "vertical" ? "resize-y" : e.resize === "horizontal" ? "resize-x" : "resize")),
|
|
4344
|
+
onInput: h,
|
|
4345
|
+
onBlur: n[1] ||= (e) => m("blur", e),
|
|
4346
|
+
onFocus: n[2] ||= (e) => m("focus", e)
|
|
4347
|
+
}, null, 42, Oa), [[R, s.value]]), e.maxlength && e.showCharCount ? (T(), l("div", ka, M(s.value.length) + "/" + M(e.maxlength), 1)) : c("", !0)]),
|
|
4348
|
+
e.error ? (T(), l("div", Aa, M(e.error), 1)) : e.hint ? (T(), l("div", ja, M(e.hint), 1)) : c("", !0)
|
|
4349
|
+
]));
|
|
4350
|
+
}
|
|
4351
|
+
}), Na = /* @__PURE__ */ m({
|
|
4352
|
+
name: "KunTooltip",
|
|
4353
|
+
__name: "Tooltip",
|
|
4354
|
+
props: {
|
|
4355
|
+
text: { default: "" },
|
|
4356
|
+
position: { default: "top" },
|
|
4357
|
+
className: { default: "" },
|
|
4358
|
+
delayShow: { default: 100 },
|
|
4359
|
+
delayHide: { default: 0 },
|
|
4360
|
+
hideOnMobile: {
|
|
4361
|
+
type: Boolean,
|
|
4362
|
+
default: !0
|
|
4363
|
+
},
|
|
4364
|
+
rounded: { default: void 0 }
|
|
4365
|
+
},
|
|
4366
|
+
setup(e) {
|
|
4367
|
+
let t = e, r = X(() => t.rounded), a = o(() => q[r.value]), u = O(null), d = O(null), m = O(!1), h = null, g = null, { floatingStyles: _ } = Te(u, d, {
|
|
4368
|
+
placement: o(() => t.position),
|
|
4369
|
+
open: m,
|
|
4370
|
+
whileElementsMounted: be,
|
|
4371
|
+
middleware: [
|
|
4372
|
+
Se(8),
|
|
4373
|
+
xe(),
|
|
4374
|
+
Ce({ padding: 8 })
|
|
4375
|
+
]
|
|
4376
|
+
}), v = () => {
|
|
4377
|
+
h &&= (clearTimeout(h), null), g &&= (clearTimeout(g), null);
|
|
4378
|
+
}, y = () => {
|
|
4379
|
+
v(), t.delayShow > 0 ? h = setTimeout(() => m.value = !0, t.delayShow) : m.value = !0;
|
|
4380
|
+
}, S = () => {
|
|
4381
|
+
v(), t.delayHide > 0 ? g = setTimeout(() => m.value = !1, t.delayHide) : m.value = !1;
|
|
4382
|
+
};
|
|
4383
|
+
return (t, r) => (T(), l("div", {
|
|
4384
|
+
ref_key: "triggerRef",
|
|
4385
|
+
ref: u,
|
|
4386
|
+
class: b(P(U)("relative inline-block", e.className)),
|
|
4387
|
+
onMouseenter: y,
|
|
4388
|
+
onMouseleave: S
|
|
4389
|
+
}, [A(t.$slots, "default"), (T(), s(n, { to: "body" }, [p(i, {
|
|
4390
|
+
"enter-active-class": "transition-opacity duration-150 ease-out",
|
|
4391
|
+
"enter-from-class": "opacity-0",
|
|
4392
|
+
"enter-to-class": "opacity-100",
|
|
4393
|
+
"leave-active-class": "transition-opacity duration-100 ease-in",
|
|
4394
|
+
"leave-from-class": "opacity-100",
|
|
4395
|
+
"leave-to-class": "opacity-0"
|
|
4396
|
+
}, {
|
|
4397
|
+
default: V(() => [m.value ? (T(), l("div", {
|
|
4398
|
+
key: 0,
|
|
4399
|
+
ref_key: "tooltipRef",
|
|
4400
|
+
ref: d,
|
|
4401
|
+
role: "tooltip",
|
|
4402
|
+
class: b(P(U)("bg-content1 border-default-200 z-kun-popover border px-3 py-2 text-sm font-medium whitespace-nowrap shadow-md", a.value, e.hideOnMobile && "hidden sm:block")),
|
|
4403
|
+
style: x(P(_))
|
|
4404
|
+
}, [A(t.$slots, "content", {}, () => [f(M(e.text), 1)])], 6)) : c("", !0)]),
|
|
4405
|
+
_: 3
|
|
4406
|
+
})]))], 34));
|
|
4407
|
+
}
|
|
4408
|
+
}), Pa = (e) => [
|
|
4409
|
+
"image/jpeg",
|
|
4410
|
+
"image/png",
|
|
4411
|
+
"image/webp"
|
|
4412
|
+
].includes(e.type) ? !0 : (console.error("Invalid file type"), !1), Fa = async (e, t, n) => new Promise((r) => {
|
|
4413
|
+
let i = new FileReader();
|
|
4414
|
+
i.onload = (e) => {
|
|
4415
|
+
let i = new Image();
|
|
4416
|
+
i.onload = () => {
|
|
4417
|
+
let e = document.createElement("canvas"), a = i.width, o = i.height;
|
|
4418
|
+
a > t && (o = o * t / a, a = t), o > n && (a = a * n / o, o = n), e.width = a, e.height = o, e.getContext("2d")?.drawImage(i, 0, 0, a, o), e.toBlob((e) => {
|
|
4419
|
+
e && r(e);
|
|
4420
|
+
}, "image/webp", .77);
|
|
4421
|
+
}, i.src = e.target?.result;
|
|
4422
|
+
}, i.readAsDataURL(e);
|
|
4423
|
+
}), Ia = {
|
|
4424
|
+
key: 0,
|
|
4425
|
+
class: "absolute inset-0 flex flex-col items-center justify-center"
|
|
4426
|
+
}, La = {
|
|
4427
|
+
key: 0,
|
|
4428
|
+
class: "text-default-500 mt-2 text-sm"
|
|
4429
|
+
}, Ra = ["src"], za = { class: "max-w-xl" }, Ba = { class: "mt-4 flex justify-end space-x-2" }, Va = /* @__PURE__ */ m({
|
|
4430
|
+
name: "KunUpload",
|
|
4431
|
+
__name: "Upload",
|
|
4432
|
+
props: {
|
|
4433
|
+
size: {},
|
|
4434
|
+
aspect: {},
|
|
4435
|
+
initialImage: { default: "" },
|
|
4436
|
+
hint: { default: "" },
|
|
4437
|
+
className: { default: "" },
|
|
4438
|
+
rounded: { default: void 0 }
|
|
4439
|
+
},
|
|
4440
|
+
emits: ["setImage"],
|
|
4441
|
+
setup(e, { emit: t }) {
|
|
4442
|
+
let n = e, r = X(() => n.rounded, "lg"), i = o(() => q[r.value]), a = t, d = O(), m = O(), h = O(""), g = O(!1), _ = O(""), v = o(() => n.initialImage || ""), y = (e) => {
|
|
4443
|
+
Pa(e) && (_.value = URL.createObjectURL(e), g.value = !0);
|
|
4444
|
+
}, S = async (e) => {
|
|
4445
|
+
let t = e.canvas, r = await new Promise((e) => {
|
|
4446
|
+
t.toBlob((t) => {
|
|
4447
|
+
t && e(t);
|
|
4448
|
+
}, "image/webp", .77);
|
|
4449
|
+
}), i = await Fa(new File([r], "cropped.webp", { type: "image/webp" }), n.size, n.size / n.aspect);
|
|
4450
|
+
m.value = i, h.value = URL.createObjectURL(i);
|
|
4451
|
+
}, C = (e) => {
|
|
4452
|
+
let t = e.target;
|
|
4453
|
+
!t.files || !t.files[0] || y(t.files[0]);
|
|
4454
|
+
}, w = (e) => {
|
|
4455
|
+
e.preventDefault(), e.stopPropagation();
|
|
4456
|
+
let t = e.dataTransfer;
|
|
4457
|
+
t?.files.length && t.files[0] && y(t.files[0]);
|
|
4458
|
+
}, E = (e) => {
|
|
4459
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "copy";
|
|
4460
|
+
}, D = () => {
|
|
4461
|
+
d.value?.click();
|
|
4462
|
+
}, k = () => {
|
|
4463
|
+
m.value && (g.value = !1, a("setImage", m.value));
|
|
4464
|
+
};
|
|
4465
|
+
return (t, r) => (T(), l("div", null, [u("div", {
|
|
4466
|
+
tabindex: "0",
|
|
4467
|
+
class: b(P(U)("border-default-500 hover:border-default-700 relative cursor-pointer border-2 border-dashed transition-colors", i.value, e.className)),
|
|
4468
|
+
style: x({ "aspect-ratio": n.aspect }),
|
|
4469
|
+
onDrop: w,
|
|
4470
|
+
onDragover: E,
|
|
4471
|
+
onClick: D
|
|
4472
|
+
}, [
|
|
4473
|
+
!h.value && !v.value ? (T(), l("div", Ia, [p(Z, {
|
|
4474
|
+
name: "lucide:plus",
|
|
4475
|
+
class: "text-default-500 text-3xl"
|
|
4476
|
+
}), e.hint ? (T(), l("span", La, M(e.hint), 1)) : c("", !0)])) : c("", !0),
|
|
4477
|
+
h.value || v.value ? (T(), l("img", {
|
|
4478
|
+
key: 1,
|
|
4479
|
+
src: h.value || v.value,
|
|
4480
|
+
alt: "上传图片",
|
|
4481
|
+
class: b(P(U)("h-full w-full object-cover", i.value))
|
|
4482
|
+
}, null, 10, Ra)) : c("", !0),
|
|
4483
|
+
u("input", {
|
|
4484
|
+
ref_key: "input",
|
|
4485
|
+
ref: d,
|
|
4486
|
+
hidden: "",
|
|
4487
|
+
type: "file",
|
|
4488
|
+
accept: ".jpg, .jpeg, .png, .webp",
|
|
4489
|
+
onChange: C
|
|
4490
|
+
}, null, 544)
|
|
4491
|
+
], 38), p(pt, {
|
|
4492
|
+
"model-value": g.value,
|
|
4493
|
+
"is-dismissable": !1,
|
|
4494
|
+
"onUpdate:modelValue": r[1] ||= (e) => g.value = e
|
|
4495
|
+
}, {
|
|
4496
|
+
default: V(() => [u("div", za, [
|
|
4497
|
+
r[4] ||= u("div", { class: "mb-4" }, [u("h3", { class: "text-lg font-semibold" }, "裁剪图片")], -1),
|
|
4498
|
+
_.value ? (T(), s(P(Ke), {
|
|
4499
|
+
key: 0,
|
|
4500
|
+
src: _.value,
|
|
4501
|
+
"stencil-props": { aspectRatio: n.aspect },
|
|
4502
|
+
onChange: S
|
|
4503
|
+
}, null, 8, ["src", "stencil-props"])) : c("", !0),
|
|
4504
|
+
u("div", Ba, [p($, {
|
|
4505
|
+
variant: "light",
|
|
4506
|
+
color: "danger",
|
|
4507
|
+
onClick: r[0] ||= (e) => g.value = !1
|
|
4508
|
+
}, {
|
|
4509
|
+
default: V(() => [...r[2] ||= [f(" 取消 ", -1)]]),
|
|
4510
|
+
_: 1
|
|
4511
|
+
}), p($, {
|
|
4512
|
+
variant: "solid",
|
|
4513
|
+
color: "primary",
|
|
4514
|
+
onClick: k
|
|
4515
|
+
}, {
|
|
4516
|
+
default: V(() => [...r[3] ||= [f(" 确定 ", -1)]]),
|
|
4517
|
+
_: 1
|
|
4518
|
+
})])
|
|
4519
|
+
])]),
|
|
4520
|
+
_: 1
|
|
4521
|
+
}, 8, ["model-value"])]));
|
|
4522
|
+
}
|
|
4523
|
+
}), Ha = { class: "flex flex-col text-sm" }, Ua = {
|
|
4524
|
+
key: 0,
|
|
4525
|
+
class: "text-default-500"
|
|
4526
|
+
}, Wa = /* @__PURE__ */ m({
|
|
4527
|
+
name: "KunUserChip",
|
|
4528
|
+
__name: "UserChip",
|
|
4529
|
+
props: {
|
|
4530
|
+
user: {},
|
|
4531
|
+
size: { default: "md" },
|
|
4532
|
+
description: { default: "" },
|
|
4533
|
+
className: { default: "" },
|
|
4534
|
+
disableFloating: {
|
|
4535
|
+
type: Boolean,
|
|
4536
|
+
default: !1
|
|
4537
|
+
},
|
|
4538
|
+
floatingPosition: { default: "top" }
|
|
4539
|
+
},
|
|
4540
|
+
setup(e) {
|
|
4541
|
+
let t = e;
|
|
4542
|
+
return (n, r) => (T(), l("div", { class: b(P(U)("flex items-center gap-2", t.className)) }, [p(Ct, {
|
|
4543
|
+
"floating-position": t.floatingPosition,
|
|
4544
|
+
"disable-floating": t.disableFloating,
|
|
4545
|
+
user: e.user,
|
|
4546
|
+
size: e.size
|
|
4547
|
+
}, null, 8, [
|
|
4548
|
+
"floating-position",
|
|
4549
|
+
"disable-floating",
|
|
4550
|
+
"user",
|
|
4551
|
+
"size"
|
|
4552
|
+
]), u("div", Ha, [u("span", null, M(e.user?.name || "未知用户"), 1), e.description ? (T(), l("span", Ua, M(e.description), 1)) : c("", !0)])], 2));
|
|
4553
|
+
}
|
|
4554
|
+
}), Ga = {
|
|
4555
|
+
KunAlertProvider: yt,
|
|
4556
|
+
KunAvatar: Ct,
|
|
4557
|
+
KunAvatarGroup: Et,
|
|
4558
|
+
KunBadge: Ot,
|
|
4559
|
+
KunBrand: At,
|
|
4560
|
+
KunButton: $,
|
|
4561
|
+
KunCard: Pt,
|
|
4562
|
+
KunCheckBox: Bt,
|
|
4563
|
+
KunChip: kt,
|
|
4564
|
+
KunContent: cn,
|
|
4565
|
+
KunContextMenu: ln,
|
|
4566
|
+
KunCopy: Fn,
|
|
4567
|
+
KunDatePicker: kn,
|
|
4568
|
+
KunDivider: In,
|
|
4569
|
+
KunDrawer: qn,
|
|
4570
|
+
KunDropdown: Bn,
|
|
4571
|
+
KunFadeCard: Jn,
|
|
4572
|
+
KunFavicon: Xn,
|
|
4573
|
+
KunFileInput: rr,
|
|
4574
|
+
KunHeader: lr,
|
|
4575
|
+
KunIcon: Z,
|
|
4576
|
+
KunImage: St,
|
|
4577
|
+
KunImageNative: dr,
|
|
4578
|
+
KunInfo: hr,
|
|
4579
|
+
KunInput: Tr,
|
|
4580
|
+
KunLightbox: on,
|
|
4581
|
+
KunLightboxGallery: Or,
|
|
4582
|
+
KunLightboxGalleryItem: kr,
|
|
4583
|
+
KunLink: Ar,
|
|
4584
|
+
KunLoading: Qr,
|
|
4585
|
+
KunLoli: Rr,
|
|
4586
|
+
KunLoliProvider: Wr,
|
|
4587
|
+
KunMarkdown: $r,
|
|
4588
|
+
KunMessageProvider: ai,
|
|
4589
|
+
KunModal: pt,
|
|
4590
|
+
KunNull: si,
|
|
4591
|
+
KunPagination: _i,
|
|
4592
|
+
KunPopover: xi,
|
|
4593
|
+
KunProgress: Ai,
|
|
4594
|
+
KunRadioGroup: Hi,
|
|
4595
|
+
KunRating: Gi,
|
|
4596
|
+
KunRipple: at,
|
|
4597
|
+
KunScrollShadow: na,
|
|
4598
|
+
KunSelect: $i,
|
|
4599
|
+
KunSlider: aa,
|
|
4600
|
+
KunSwitch: ca,
|
|
4601
|
+
KunTab: fa,
|
|
4602
|
+
KunTagInput: Sa,
|
|
4603
|
+
KunText: Ca,
|
|
4604
|
+
KunTextarea: Ma,
|
|
4605
|
+
KunTooltip: Na,
|
|
4606
|
+
KunUpload: Va,
|
|
4607
|
+
KunUserChip: Wa
|
|
4608
|
+
}, Ka = { install(e) {
|
|
4609
|
+
for (let [t, n] of Object.entries(Ga)) e.component(t, n);
|
|
4610
|
+
} };
|
|
4611
|
+
//#endregion
|
|
4612
|
+
export { Qe as KUN_UI_DEFAULT_CONFIG, yt as KunAlertProvider, Ct as KunAvatar, Et as KunAvatarGroup, Ot as KunBadge, At as KunBrand, $ as KunButton, Pt as KunCard, Bt as KunCheckBox, kt as KunChip, cn as KunContent, ln as KunContextMenu, Fn as KunCopy, kn as KunDatePicker, In as KunDivider, qn as KunDrawer, Bn as KunDropdown, Jn as KunFadeCard, Xn as KunFavicon, rr as KunFileInput, lr as KunHeader, Z as KunIcon, St as KunImage, dr as KunImageNative, hr as KunInfo, Tr as KunInput, on as KunLightbox, Or as KunLightboxGallery, kr as KunLightboxGalleryItem, Ar as KunLink, Qr as KunLoading, Rr as KunLoli, Wr as KunLoliProvider, $r as KunMarkdown, ai as KunMessageProvider, pt as KunModal, si as KunNull, _i as KunPagination, xi as KunPopover, Ai as KunProgress, Hi as KunRadioGroup, Gi as KunRating, at as KunRipple, na as KunScrollShadow, $i as KunSelect, aa as KunSlider, ca as KunSwitch, fa as KunTab, Sa as KunTagInput, Ca as KunText, Ma as KunTextarea, Na as KunTooltip, Ka as KunUI, Ka as default, Va as KunUpload, Wa as KunUserChip, Pa as checkImageValid, ie as decodeIfEncoded, Mr as getRandomLoli, W as getRandomSticker, et as installKunUIConfig, $e as provideKunUIConfig, Fa as resizeImage, Ht as useContentLightbox, Zn as useFilePicker, Xe as useKunAlert, Ye as useKunAlertState, Pn as useKunCopy, Ur as useKunLoliInfo, Hr as useKunLoliState, Nn as useKunMessage, Mn as useKunMessageState, Y as useKunUIConfig, Ft as useKunUniqueId, X as useResolvedRounded, tt as useRipple, Vt as useSpoilerContent };
|