@guoyg578/k-ui 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 +21 -0
- package/README.md +59 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/KAlert.js +7 -0
- package/dist/components/KAlert.vue.d.ts +40 -0
- package/dist/components/KAlert.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/components/KAvatar.js +7 -0
- package/dist/components/KAvatar.vue.d.ts +15 -0
- package/dist/components/KAvatar.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/KAvatarGroup.js +7 -0
- package/dist/components/KAvatarGroup.vue.d.ts +18 -0
- package/dist/components/KAvatarGroup.vue_vue_type_script_setup_true_lang.js +11 -0
- package/dist/components/KBreadcrumb.js +7 -0
- package/dist/components/KBreadcrumb.vue.d.ts +12 -0
- package/dist/components/KBreadcrumb.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/KButton.js +7 -0
- package/dist/components/KButton.vue.d.ts +36 -0
- package/dist/components/KButton.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/components/KCard.js +7 -0
- package/dist/components/KCard.vue.d.ts +33 -0
- package/dist/components/KCard.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/components/KCarousel.js +7 -0
- package/dist/components/KCarousel.vue.d.ts +59 -0
- package/dist/components/KCarousel.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/KCheckbox.js +7 -0
- package/dist/components/KCheckbox.vue.d.ts +26 -0
- package/dist/components/KCheckbox.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/KCheckboxGroup.js +7 -0
- package/dist/components/KCheckboxGroup.vue.d.ts +27 -0
- package/dist/components/KCheckboxGroup.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/KCombobox.js +8 -0
- package/dist/components/KCombobox.vue.d.ts +28 -0
- package/dist/components/KCombobox.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/KCommandPalette.js +7 -0
- package/dist/components/KCommandPalette.vue.d.ts +31 -0
- package/dist/components/KCommandPalette.vue_vue_type_script_setup_true_lang.js +169 -0
- package/dist/components/KConfirmDialog.js +6 -0
- package/dist/components/KConfirmDialog.vue.d.ts +3 -0
- package/dist/components/KConfirmDialog.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/KDataTable.js +7 -0
- package/dist/components/KDataTable.vue.d.ts +47 -0
- package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/components/KDatePicker.js +6 -0
- package/dist/components/KDatePicker.vue.d.ts +19 -0
- package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/KDialog.js +7 -0
- package/dist/components/KDialog.vue.d.ts +52 -0
- package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/components/KDiff.js +7 -0
- package/dist/components/KDiff.vue.d.ts +13 -0
- package/dist/components/KDiff.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/components/KDrawer.js +7 -0
- package/dist/components/KDrawer.vue.d.ts +37 -0
- package/dist/components/KDrawer.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/KDropdown.js +7 -0
- package/dist/components/KDropdown.vue.d.ts +56 -0
- package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/components/KEmpty.js +5 -0
- package/dist/components/KEmpty.vue.d.ts +22 -0
- package/dist/components/KEmpty.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/KForm.js +7 -0
- package/dist/components/KForm.vue.d.ts +38 -0
- package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/components/KFormField.js +7 -0
- package/dist/components/KFormField.vue.d.ts +32 -0
- package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/components/KGridSkeleton.js +5 -0
- package/dist/components/KGridSkeleton.vue.d.ts +10 -0
- package/dist/components/KGridSkeleton.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/components/KImage.js +7 -0
- package/dist/components/KImage.vue.d.ts +25 -0
- package/dist/components/KImage.vue_vue_type_script_setup_true_lang.js +97 -0
- package/dist/components/KImageViewer.js +7 -0
- package/dist/components/KImageViewer.vue.d.ts +14 -0
- package/dist/components/KImageViewer.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/KInput.js +7 -0
- package/dist/components/KInput.vue.d.ts +43 -0
- package/dist/components/KInput.vue_vue_type_script_setup_true_lang.js +89 -0
- package/dist/components/KInputNumber.js +7 -0
- package/dist/components/KInputNumber.vue.d.ts +28 -0
- package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +109 -0
- package/dist/components/KListSkeleton.js +5 -0
- package/dist/components/KListSkeleton.vue.d.ts +8 -0
- package/dist/components/KListSkeleton.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/components/KLoadingOverlay.js +7 -0
- package/dist/components/KLoadingOverlay.vue.d.ts +11 -0
- package/dist/components/KLoadingOverlay.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/KMessage.d.ts +20 -0
- package/dist/components/KMessage.js +55 -0
- package/dist/components/KMessageContainer.js +7 -0
- package/dist/components/KMessageContainer.vue.d.ts +15 -0
- package/dist/components/KMessageContainer.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/components/KPagination.js +7 -0
- package/dist/components/KPagination.vue.d.ts +14 -0
- package/dist/components/KPagination.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/components/KPopover.js +6 -0
- package/dist/components/KPopover.vue.d.ts +40 -0
- package/dist/components/KPopover.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/KProgress.js +7 -0
- package/dist/components/KProgress.vue.d.ts +21 -0
- package/dist/components/KProgress.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/KRadio.js +7 -0
- package/dist/components/KRadio.vue.d.ts +18 -0
- package/dist/components/KRadio.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/components/KRadioGroup.js +7 -0
- package/dist/components/KRadioGroup.vue.d.ts +26 -0
- package/dist/components/KRadioGroup.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/KRefetchOverlay.js +5 -0
- package/dist/components/KRefetchOverlay.vue.d.ts +8 -0
- package/dist/components/KRefetchOverlay.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/components/KResizablePanel.js +7 -0
- package/dist/components/KResizablePanel.vue.d.ts +30 -0
- package/dist/components/KResizablePanel.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/KResult.js +7 -0
- package/dist/components/KResult.vue.d.ts +29 -0
- package/dist/components/KResult.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/components/KSearchBar.js +5 -0
- package/dist/components/KSearchBar.vue.d.ts +11 -0
- package/dist/components/KSearchBar.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/KSelect.js +9 -0
- package/dist/components/KSelect.vue.d.ts +22 -0
- package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/components/KSkeleton.js +7 -0
- package/dist/components/KSkeleton.vue.d.ts +14 -0
- package/dist/components/KSkeleton.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/components/KSteps.js +7 -0
- package/dist/components/KSteps.vue.d.ts +20 -0
- package/dist/components/KSteps.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/components/KSwitch.js +7 -0
- package/dist/components/KSwitch.vue.d.ts +16 -0
- package/dist/components/KSwitch.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/components/KTabs.js +7 -0
- package/dist/components/KTabs.vue.d.ts +35 -0
- package/dist/components/KTabs.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/components/KTag.js +7 -0
- package/dist/components/KTag.vue.d.ts +32 -0
- package/dist/components/KTag.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/components/KTextarea.js +7 -0
- package/dist/components/KTextarea.vue.d.ts +23 -0
- package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/components/KThemeToggleButton.js +7 -0
- package/dist/components/KThemeToggleButton.vue.d.ts +14 -0
- package/dist/components/KThemeToggleButton.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/KTooltip.js +6 -0
- package/dist/components/KTooltip.vue.d.ts +23 -0
- package/dist/components/KTooltip.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/KTreeNode.js +7 -0
- package/dist/components/KTreeNode.vue.d.ts +8 -0
- package/dist/components/KTreeNode.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/components/KTreeView.js +7 -0
- package/dist/components/KTreeView.vue.d.ts +22 -0
- package/dist/components/KTreeView.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/KUpload.js +7 -0
- package/dist/components/KUpload.vue.d.ts +81 -0
- package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +181 -0
- package/dist/components/KVirtualList.js +7 -0
- package/dist/components/KVirtualList.vue.d.ts +31 -0
- package/dist/components/KVirtualList.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/components/form-context.d.ts +25 -0
- package/dist/components/form-context.js +4 -0
- package/dist/components/tree-context.d.ts +16 -0
- package/dist/components/tree-context.js +4 -0
- package/dist/composables/useConfirm.d.ts +17 -0
- package/dist/composables/useConfirm.js +31 -0
- package/dist/directives/index.d.ts +6 -0
- package/dist/directives/index.js +8 -0
- package/dist/directives/reveal.d.ts +20 -0
- package/dist/directives/reveal.js +18 -0
- package/dist/directives/spotlight.d.ts +22 -0
- package/dist/directives/spotlight.js +25 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +55 -0
- package/dist/k-ui.css +2 -0
- package/dist/styles/components.css +92 -0
- package/dist/styles/index.css +2 -0
- package/dist/styles/menu.css +59 -0
- package/dist/styles/tokens.css +229 -0
- package/dist/types.d.ts +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import e from "./KImageViewer.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as u, openBlock as d, ref as f, unref as p, watch as m } from "vue";
|
|
3
|
+
import { ImageIcon as h, ImageOff as g } from "lucide-vue-next";
|
|
4
|
+
//#region components/KImage.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _ = ["src", "alt"], v = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "k-img__placeholder"
|
|
8
|
+
}, y = {
|
|
9
|
+
key: 2,
|
|
10
|
+
class: "k-img__error"
|
|
11
|
+
}, b = /* @__PURE__ */ o({
|
|
12
|
+
__name: "KImage",
|
|
13
|
+
props: {
|
|
14
|
+
src: {},
|
|
15
|
+
alt: {},
|
|
16
|
+
width: {},
|
|
17
|
+
height: {},
|
|
18
|
+
fit: { default: "cover" },
|
|
19
|
+
lazy: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !0
|
|
22
|
+
},
|
|
23
|
+
preview: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
},
|
|
27
|
+
rounded: {}
|
|
28
|
+
},
|
|
29
|
+
emits: [
|
|
30
|
+
"click",
|
|
31
|
+
"load",
|
|
32
|
+
"error"
|
|
33
|
+
],
|
|
34
|
+
setup(o, { emit: b }) {
|
|
35
|
+
let x = o, S = b, C = f("idle"), w = f(null), T = f(!x.lazy), E = f(!1), D = null;
|
|
36
|
+
u(() => {
|
|
37
|
+
if (!x.lazy) {
|
|
38
|
+
T.value = !0;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
w.value && (D = new IntersectionObserver((e) => {
|
|
42
|
+
for (let t of e) t.isIntersecting && (T.value = !0, D?.disconnect(), D = null);
|
|
43
|
+
}, { rootMargin: "100px" }), D.observe(w.value));
|
|
44
|
+
}), m(() => x.src, () => {
|
|
45
|
+
C.value = "idle";
|
|
46
|
+
}), l(() => D?.disconnect());
|
|
47
|
+
function O() {
|
|
48
|
+
C.value = "loaded", S("load");
|
|
49
|
+
}
|
|
50
|
+
function k() {
|
|
51
|
+
C.value = "error", S("error");
|
|
52
|
+
}
|
|
53
|
+
function A(e) {
|
|
54
|
+
x.preview && C.value === "loaded" && (E.value = !0), S("click", e);
|
|
55
|
+
}
|
|
56
|
+
let j = t(() => ({
|
|
57
|
+
width: x.width,
|
|
58
|
+
height: x.height,
|
|
59
|
+
borderRadius: x.rounded
|
|
60
|
+
}));
|
|
61
|
+
return (t, l) => (d(), i("div", {
|
|
62
|
+
ref_key: "containerRef",
|
|
63
|
+
ref: w,
|
|
64
|
+
class: s(["k-img", {
|
|
65
|
+
"k-img--preview": o.preview && C.value === "loaded",
|
|
66
|
+
"k-img--loaded": C.value === "loaded"
|
|
67
|
+
}]),
|
|
68
|
+
style: c(j.value),
|
|
69
|
+
onClick: A
|
|
70
|
+
}, [
|
|
71
|
+
T.value ? (d(), i("img", {
|
|
72
|
+
key: 0,
|
|
73
|
+
src: o.src,
|
|
74
|
+
alt: o.alt,
|
|
75
|
+
class: "k-img__el",
|
|
76
|
+
style: c({ objectFit: o.fit }),
|
|
77
|
+
onLoad: O,
|
|
78
|
+
onError: k
|
|
79
|
+
}, null, 44, _)) : r("", !0),
|
|
80
|
+
C.value === "idle" ? (d(), i("div", v, [a(p(h), {
|
|
81
|
+
size: 20,
|
|
82
|
+
"stroke-width": 1.5
|
|
83
|
+
})])) : C.value === "error" ? (d(), i("div", y, [a(p(g), {
|
|
84
|
+
size: 20,
|
|
85
|
+
"stroke-width": 1.5
|
|
86
|
+
})])) : r("", !0),
|
|
87
|
+
o.preview ? (d(), n(e, {
|
|
88
|
+
key: 3,
|
|
89
|
+
open: E.value,
|
|
90
|
+
"onUpdate:open": l[0] ||= (e) => E.value = e,
|
|
91
|
+
images: [o.src]
|
|
92
|
+
}, null, 8, ["open", "images"])) : r("", !0)
|
|
93
|
+
], 6));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
//#endregion
|
|
97
|
+
export { b as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KImageViewer.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KImageViewer.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-b951291f"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
open: boolean;
|
|
3
|
+
images: string[];
|
|
4
|
+
initial?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
+
"update:open": (v: boolean) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
"onUpdate:open"?: ((v: boolean) => any) | undefined;
|
|
10
|
+
}>, {
|
|
11
|
+
initial: number;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Teleport as e, Transition as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeStyle as l, onBeforeUnmount as u, openBlock as d, ref as f, toDisplayString as p, unref as m, watch as h, withCtx as g, withModifiers as _ } from "vue";
|
|
2
|
+
import { ChevronLeft as v, ChevronRight as y, RotateCw as b, X as x, ZoomIn as S, ZoomOut as C } from "lucide-vue-next";
|
|
3
|
+
//#region components/KImageViewer.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var w = ["disabled"], T = ["src", "alt"], E = ["disabled"], D = { class: "k-viewer__toolbar" }, O = { class: "k-viewer__scale" }, k = {
|
|
5
|
+
key: 2,
|
|
6
|
+
class: "k-viewer__counter"
|
|
7
|
+
}, A = /* @__PURE__ */ c({
|
|
8
|
+
__name: "KImageViewer",
|
|
9
|
+
props: {
|
|
10
|
+
open: { type: Boolean },
|
|
11
|
+
images: {},
|
|
12
|
+
initial: { default: 0 }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:open"],
|
|
15
|
+
setup(c, { emit: A }) {
|
|
16
|
+
let j = c, M = A, N = f(j.initial), P = f(1), F = f(0);
|
|
17
|
+
h(() => j.open, (e) => {
|
|
18
|
+
if (e) {
|
|
19
|
+
let e = Math.max(0, j.images.length - 1);
|
|
20
|
+
N.value = Math.min(Math.max(0, j.initial), e), P.value = 1, F.value = 0, window.addEventListener("keydown", W);
|
|
21
|
+
} else window.removeEventListener("keydown", W);
|
|
22
|
+
}), u(() => window.removeEventListener("keydown", W));
|
|
23
|
+
function I() {
|
|
24
|
+
M("update:open", !1);
|
|
25
|
+
}
|
|
26
|
+
function L() {
|
|
27
|
+
N.value > 0 && (N.value--, H());
|
|
28
|
+
}
|
|
29
|
+
function R() {
|
|
30
|
+
N.value < j.images.length - 1 && (N.value++, H());
|
|
31
|
+
}
|
|
32
|
+
function z() {
|
|
33
|
+
P.value = Math.min(4, P.value + .25);
|
|
34
|
+
}
|
|
35
|
+
function B() {
|
|
36
|
+
P.value = Math.max(.5, P.value - .25);
|
|
37
|
+
}
|
|
38
|
+
function V() {
|
|
39
|
+
F.value = (F.value + 90) % 360;
|
|
40
|
+
}
|
|
41
|
+
function H() {
|
|
42
|
+
P.value = 1, F.value = 0;
|
|
43
|
+
}
|
|
44
|
+
function U(e) {
|
|
45
|
+
let t = e.deltaY < 0 ? .1 : -.1;
|
|
46
|
+
P.value = Math.min(4, Math.max(.5, +(P.value + t).toFixed(2)));
|
|
47
|
+
}
|
|
48
|
+
function W(e) {
|
|
49
|
+
j.open && (e.key === "Escape" ? I() : e.key === "ArrowLeft" ? L() : e.key === "ArrowRight" && R());
|
|
50
|
+
}
|
|
51
|
+
let G = n(() => ({ transform: `scale(${P.value}) rotate(${F.value}deg)` }));
|
|
52
|
+
return (n, u) => (d(), r(e, { to: "body" }, [s(t, { name: "k-viewer" }, {
|
|
53
|
+
default: g(() => [c.open ? (d(), a("div", {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "k-viewer",
|
|
56
|
+
onClick: _(I, ["self"]),
|
|
57
|
+
onWheel: _(U, ["prevent"])
|
|
58
|
+
}, [
|
|
59
|
+
o("button", {
|
|
60
|
+
class: "k-viewer__close",
|
|
61
|
+
onClick: I,
|
|
62
|
+
"aria-label": "关闭"
|
|
63
|
+
}, [s(m(x), { size: 20 })]),
|
|
64
|
+
c.images.length > 1 ? (d(), a("button", {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: "k-viewer__nav k-viewer__nav--prev",
|
|
67
|
+
disabled: N.value === 0,
|
|
68
|
+
"aria-label": "上一张",
|
|
69
|
+
onClick: L
|
|
70
|
+
}, [s(m(v), { size: 24 })], 8, w)) : i("", !0),
|
|
71
|
+
o("img", {
|
|
72
|
+
src: c.images[N.value],
|
|
73
|
+
style: l(G.value),
|
|
74
|
+
class: "k-viewer__img",
|
|
75
|
+
alt: `图片 ${N.value + 1}`,
|
|
76
|
+
onClick: u[0] ||= _(() => {}, ["stop"])
|
|
77
|
+
}, null, 12, T),
|
|
78
|
+
c.images.length > 1 ? (d(), a("button", {
|
|
79
|
+
key: 1,
|
|
80
|
+
class: "k-viewer__nav k-viewer__nav--next",
|
|
81
|
+
disabled: N.value === c.images.length - 1,
|
|
82
|
+
"aria-label": "下一张",
|
|
83
|
+
onClick: R
|
|
84
|
+
}, [s(m(y), { size: 24 })], 8, E)) : i("", !0),
|
|
85
|
+
o("div", D, [
|
|
86
|
+
o("button", {
|
|
87
|
+
onClick: B,
|
|
88
|
+
title: "缩小"
|
|
89
|
+
}, [s(m(C), { size: 16 })]),
|
|
90
|
+
o("span", O, p(Math.round(P.value * 100)) + "%", 1),
|
|
91
|
+
o("button", {
|
|
92
|
+
onClick: z,
|
|
93
|
+
title: "放大"
|
|
94
|
+
}, [s(m(S), { size: 16 })]),
|
|
95
|
+
o("button", {
|
|
96
|
+
onClick: V,
|
|
97
|
+
title: "旋转 90°"
|
|
98
|
+
}, [s(m(b), { size: 16 })]),
|
|
99
|
+
o("button", { onClick: H }, "复原")
|
|
100
|
+
]),
|
|
101
|
+
c.images.length > 1 ? (d(), a("div", k, p(N.value + 1) + " / " + p(c.images.length), 1)) : i("", !0)
|
|
102
|
+
], 32)) : i("", !0)]),
|
|
103
|
+
_: 1
|
|
104
|
+
})]));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
//#endregion
|
|
108
|
+
export { A as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KInput.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KInput.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-a551ddc7"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue?: string | number;
|
|
3
|
+
size?: 'sm' | 'md' | 'lg';
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
error?: boolean;
|
|
9
|
+
type?: string;
|
|
10
|
+
};
|
|
11
|
+
declare var __VLS_1: {}, __VLS_8: {};
|
|
12
|
+
type __VLS_Slots = {} & {
|
|
13
|
+
prefix?: (props: typeof __VLS_1) => any;
|
|
14
|
+
} & {
|
|
15
|
+
suffix?: (props: typeof __VLS_8) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
|
+
"update:modelValue": (v: string) => any;
|
|
19
|
+
blur: (ev: FocusEvent) => any;
|
|
20
|
+
focus: (ev: FocusEvent) => any;
|
|
21
|
+
clear: () => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((v: string) => any) | undefined;
|
|
24
|
+
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
25
|
+
onFocus?: ((ev: FocusEvent) => any) | undefined;
|
|
26
|
+
onClear?: (() => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
type: string;
|
|
29
|
+
size: "sm" | "md" | "lg";
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
modelValue: string | number;
|
|
32
|
+
readonly: boolean;
|
|
33
|
+
clearable: boolean;
|
|
34
|
+
error: boolean;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, ref as c, renderSlot as l, unref as u, withModifiers as d } from "vue";
|
|
2
|
+
import { X as f } from "lucide-vue-next";
|
|
3
|
+
//#region components/KInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var p = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "k-input__affix k-input__affix--prefix"
|
|
7
|
+
}, m = [
|
|
8
|
+
"type",
|
|
9
|
+
"value",
|
|
10
|
+
"disabled",
|
|
11
|
+
"readonly",
|
|
12
|
+
"placeholder"
|
|
13
|
+
], h = {
|
|
14
|
+
key: 2,
|
|
15
|
+
class: "k-input__affix k-input__affix--suffix"
|
|
16
|
+
}, g = /* @__PURE__ */ a({
|
|
17
|
+
__name: "KInput",
|
|
18
|
+
props: {
|
|
19
|
+
modelValue: { default: "" },
|
|
20
|
+
size: { default: "md" },
|
|
21
|
+
placeholder: {},
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
readonly: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
clearable: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
error: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
type: { default: "text" }
|
|
39
|
+
},
|
|
40
|
+
emits: [
|
|
41
|
+
"update:modelValue",
|
|
42
|
+
"blur",
|
|
43
|
+
"focus",
|
|
44
|
+
"clear"
|
|
45
|
+
],
|
|
46
|
+
setup(a, { emit: g }) {
|
|
47
|
+
let _ = a, v = g, y = c(!1);
|
|
48
|
+
function b(e) {
|
|
49
|
+
v("update:modelValue", e.target.value);
|
|
50
|
+
}
|
|
51
|
+
function x() {
|
|
52
|
+
v("update:modelValue", ""), v("clear");
|
|
53
|
+
}
|
|
54
|
+
let S = e(() => _.clearable && !_.disabled && !_.readonly && String(_.modelValue ?? "").length > 0);
|
|
55
|
+
return (e, c) => (s(), n("div", { class: o(["k-input", [`k-input--${a.size}`, {
|
|
56
|
+
"k-input--focused": y.value,
|
|
57
|
+
"k-input--error": a.error,
|
|
58
|
+
"k-input--disabled": a.disabled
|
|
59
|
+
}]]) }, [
|
|
60
|
+
e.$slots.prefix ? (s(), n("span", p, [l(e.$slots, "prefix", {}, void 0, !0)])) : t("", !0),
|
|
61
|
+
r("input", {
|
|
62
|
+
type: a.type,
|
|
63
|
+
value: a.modelValue,
|
|
64
|
+
disabled: a.disabled,
|
|
65
|
+
readonly: a.readonly,
|
|
66
|
+
placeholder: a.placeholder,
|
|
67
|
+
class: "k-input__inner",
|
|
68
|
+
onInput: b,
|
|
69
|
+
onFocus: c[0] ||= (e) => {
|
|
70
|
+
y.value = !0, v("focus", e);
|
|
71
|
+
},
|
|
72
|
+
onBlur: c[1] ||= (e) => {
|
|
73
|
+
y.value = !1, v("blur", e);
|
|
74
|
+
}
|
|
75
|
+
}, null, 40, m),
|
|
76
|
+
S.value ? (s(), n("button", {
|
|
77
|
+
key: 1,
|
|
78
|
+
type: "button",
|
|
79
|
+
class: "k-input__clear",
|
|
80
|
+
tabindex: "-1",
|
|
81
|
+
onMousedown: c[2] ||= d(() => {}, ["prevent"]),
|
|
82
|
+
onClick: x
|
|
83
|
+
}, [i(u(f), { size: 10 })], 32)) : t("", !0),
|
|
84
|
+
e.$slots.suffix ? (s(), n("span", h, [l(e.$slots, "suffix", {}, void 0, !0)])) : t("", !0)
|
|
85
|
+
], 2));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { g as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KInputNumber.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KInputNumber.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-c7951eb7"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
modelValue?: number | null;
|
|
3
|
+
size?: 'sm' | 'md' | 'lg';
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
readonly?: boolean;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
precision?: number;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
14
|
+
"update:modelValue": (v: number | null) => any;
|
|
15
|
+
change: (v: number | null) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:modelValue"?: ((v: number | null) => any) | undefined;
|
|
18
|
+
onChange?: ((v: number | null) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
size: "sm" | "md" | "lg";
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
modelValue: number | null;
|
|
23
|
+
readonly: boolean;
|
|
24
|
+
error: boolean;
|
|
25
|
+
step: number;
|
|
26
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { computed as e, createElementBlock as t, createElementVNode as n, createVNode as r, defineComponent as i, normalizeClass as a, onBeforeUnmount as o, openBlock as s, unref as c, withModifiers as l } from "vue";
|
|
2
|
+
import { ChevronDown as u, ChevronUp as d } from "lucide-vue-next";
|
|
3
|
+
//#region components/KInputNumber.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var f = [
|
|
5
|
+
"value",
|
|
6
|
+
"disabled",
|
|
7
|
+
"readonly",
|
|
8
|
+
"placeholder"
|
|
9
|
+
], p = { class: "k-num__steps" }, m = ["disabled"], h = ["disabled"], g = /* @__PURE__ */ i({
|
|
10
|
+
__name: "KInputNumber",
|
|
11
|
+
props: {
|
|
12
|
+
modelValue: { default: null },
|
|
13
|
+
size: { default: "md" },
|
|
14
|
+
placeholder: {},
|
|
15
|
+
disabled: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
},
|
|
19
|
+
readonly: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
min: {},
|
|
24
|
+
max: {},
|
|
25
|
+
step: { default: 1 },
|
|
26
|
+
precision: {},
|
|
27
|
+
error: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !1
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: ["update:modelValue", "change"],
|
|
33
|
+
setup(i, { emit: g }) {
|
|
34
|
+
let _ = i, v = g;
|
|
35
|
+
function y(e) {
|
|
36
|
+
if (_.min !== void 0 && e < _.min && (e = _.min), _.max !== void 0 && e > _.max && (e = _.max), _.precision !== void 0) {
|
|
37
|
+
let t = 10 ** _.precision;
|
|
38
|
+
e = Math.round(e * t) / t;
|
|
39
|
+
}
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
let b = e(() => _.disabled || _.readonly || _.max !== void 0 && (_.modelValue ?? 0) >= _.max), x = e(() => _.disabled || _.readonly || _.min !== void 0 && (_.modelValue ?? 0) <= _.min);
|
|
43
|
+
function S(e) {
|
|
44
|
+
let t = y((_.modelValue ?? _.min ?? 0) + e * _.step);
|
|
45
|
+
v("update:modelValue", t), v("change", t);
|
|
46
|
+
}
|
|
47
|
+
let C = null, w = null;
|
|
48
|
+
function T(e) {
|
|
49
|
+
_.disabled || _.readonly || (S(e), C = window.setTimeout(() => {
|
|
50
|
+
w = window.setInterval(() => S(e), 60);
|
|
51
|
+
}, 400));
|
|
52
|
+
}
|
|
53
|
+
function E() {
|
|
54
|
+
C &&= (clearTimeout(C), null), w &&= (clearInterval(w), null);
|
|
55
|
+
}
|
|
56
|
+
o(E);
|
|
57
|
+
function D(e) {
|
|
58
|
+
let t = e.target.value;
|
|
59
|
+
if (t === "" || t === "-") {
|
|
60
|
+
v("update:modelValue", null);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let n = Number(t);
|
|
64
|
+
Number.isNaN(n) || v("update:modelValue", n);
|
|
65
|
+
}
|
|
66
|
+
function O() {
|
|
67
|
+
if (_.modelValue === null || _.modelValue === void 0) return;
|
|
68
|
+
let e = y(_.modelValue);
|
|
69
|
+
e !== _.modelValue && (v("update:modelValue", e), v("change", e));
|
|
70
|
+
}
|
|
71
|
+
function k(e) {
|
|
72
|
+
_.disabled || _.readonly || (e.key === "ArrowUp" ? (e.preventDefault(), S(1)) : e.key === "ArrowDown" && (e.preventDefault(), S(-1)));
|
|
73
|
+
}
|
|
74
|
+
let A = e(() => _.modelValue === null || _.modelValue === void 0 ? "" : String(_.modelValue));
|
|
75
|
+
return (e, o) => (s(), t("div", { class: a(["k-num", [`k-num--${i.size}`, {
|
|
76
|
+
"k-num--error": i.error,
|
|
77
|
+
"k-num--disabled": i.disabled
|
|
78
|
+
}]]) }, [n("input", {
|
|
79
|
+
type: "text",
|
|
80
|
+
inputmode: "decimal",
|
|
81
|
+
value: A.value,
|
|
82
|
+
disabled: i.disabled,
|
|
83
|
+
readonly: i.readonly,
|
|
84
|
+
placeholder: i.placeholder,
|
|
85
|
+
class: "k-num__inner",
|
|
86
|
+
onInput: D,
|
|
87
|
+
onBlur: O,
|
|
88
|
+
onKeydown: k
|
|
89
|
+
}, null, 40, f), n("div", p, [n("button", {
|
|
90
|
+
type: "button",
|
|
91
|
+
tabindex: "-1",
|
|
92
|
+
class: "k-num__step k-num__step--up",
|
|
93
|
+
disabled: b.value,
|
|
94
|
+
onMousedown: o[0] ||= l((e) => T(1), ["prevent"]),
|
|
95
|
+
onMouseup: E,
|
|
96
|
+
onMouseleave: E
|
|
97
|
+
}, [r(c(d), { size: 11 })], 40, m), n("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
tabindex: "-1",
|
|
100
|
+
class: "k-num__step k-num__step--down",
|
|
101
|
+
disabled: x.value,
|
|
102
|
+
onMousedown: o[1] ||= l((e) => T(-1), ["prevent"]),
|
|
103
|
+
onMouseup: E,
|
|
104
|
+
onMouseleave: E
|
|
105
|
+
}, [r(c(u), { size: 11 })], 40, h)])], 2));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
export { g as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
count?: number;
|
|
3
|
+
}
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
5
|
+
count: number;
|
|
6
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fragment as e, createElementBlock as t, createStaticVNode as n, defineComponent as r, openBlock as i, renderList as a } from "vue";
|
|
2
|
+
//#region components/KListSkeleton.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var o = { class: "divide-y divide-ink-200 overflow-hidden rounded-xl border border-ink-200 bg-white" }, s = /* @__PURE__ */ r({
|
|
4
|
+
__name: "KListSkeleton",
|
|
5
|
+
props: { count: { default: 6 } },
|
|
6
|
+
setup(r) {
|
|
7
|
+
return (s, c) => (i(), t("ul", o, [(i(!0), t(e, null, a(r.count, (e) => (i(), t("li", {
|
|
8
|
+
key: e,
|
|
9
|
+
class: "flex items-center gap-3 px-4 py-3.5"
|
|
10
|
+
}, [...c[0] ||= [n("<div class=\"k-skel-bar size-9 shrink-0 rounded-full\"></div><div class=\"min-w-0 flex-1 space-y-2\"><div class=\"k-skel-bar h-3 w-1/3 rounded\"></div><div class=\"k-skel-bar h-2.5 w-1/4 rounded\"></div></div><div class=\"k-skel-bar h-5 w-12 rounded-full\"></div>", 3)]]))), 128))]));
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { s as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KLoadingOverlay.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KLoadingOverlay.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-0199872e"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
show?: boolean;
|
|
3
|
+
text?: string;
|
|
4
|
+
blur?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
blur: boolean;
|
|
8
|
+
show: boolean;
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Transition as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, toDisplayString as c, unref as l, withCtx as u } from "vue";
|
|
2
|
+
import { Loader2 as d } from "lucide-vue-next";
|
|
3
|
+
//#region components/KLoadingOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var f = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "k-loading__text"
|
|
7
|
+
}, p = /* @__PURE__ */ a({
|
|
8
|
+
__name: "KLoadingOverlay",
|
|
9
|
+
props: {
|
|
10
|
+
show: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: !1
|
|
13
|
+
},
|
|
14
|
+
text: {},
|
|
15
|
+
blur: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !0
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(a) {
|
|
21
|
+
return (p, m) => (s(), t(e, { name: "k-loading" }, {
|
|
22
|
+
default: u(() => [a.show ? (s(), r("div", {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: o(["k-loading", { "k-loading--blur": a.blur }])
|
|
25
|
+
}, [i(l(d), {
|
|
26
|
+
size: 24,
|
|
27
|
+
class: "k-loading__spinner"
|
|
28
|
+
}), a.text ? (s(), r("div", f, c(a.text), 1)) : n("", !0)], 2)) : n("", !0)]),
|
|
29
|
+
_: 1
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
export { p as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface MessageOptions {
|
|
2
|
+
type?: 'success' | 'error' | 'info' | 'warning';
|
|
3
|
+
content: string;
|
|
4
|
+
duration?: number;
|
|
5
|
+
closable?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare function open(opts: MessageOptions): number;
|
|
8
|
+
declare function close(id: number): void;
|
|
9
|
+
declare function closeAll(): void;
|
|
10
|
+
type ShortHand = (content: string, opts?: Partial<MessageOptions>) => number;
|
|
11
|
+
export declare const KMessage: {
|
|
12
|
+
open: typeof open;
|
|
13
|
+
close: typeof close;
|
|
14
|
+
closeAll: typeof closeAll;
|
|
15
|
+
success: ShortHand;
|
|
16
|
+
error: ShortHand;
|
|
17
|
+
warning: ShortHand;
|
|
18
|
+
info: ShortHand;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import e from "./KMessageContainer.js";
|
|
2
|
+
import { createApp as t, h as n, ref as r } from "vue";
|
|
3
|
+
//#region components/KMessage.ts
|
|
4
|
+
var i = null, a = null, o = null;
|
|
5
|
+
function s() {
|
|
6
|
+
i || (o = document.createElement("div"), document.body.appendChild(o), a = r([]), i = t({ setup() {
|
|
7
|
+
return () => n(e, {
|
|
8
|
+
messages: a.value,
|
|
9
|
+
onRemove: u
|
|
10
|
+
});
|
|
11
|
+
} }), i.mount(o));
|
|
12
|
+
}
|
|
13
|
+
var c = 0;
|
|
14
|
+
function l(e) {
|
|
15
|
+
s();
|
|
16
|
+
let t = ++c, n = e.duration ?? 3e3, r = {
|
|
17
|
+
id: t,
|
|
18
|
+
...e,
|
|
19
|
+
duration: n
|
|
20
|
+
};
|
|
21
|
+
return a.value = [...a.value, r], n > 0 && setTimeout(() => u(t), n), t;
|
|
22
|
+
}
|
|
23
|
+
function u(e) {
|
|
24
|
+
a && (a.value = a.value.filter((t) => t.id !== e));
|
|
25
|
+
}
|
|
26
|
+
function d() {
|
|
27
|
+
a && (a.value = []);
|
|
28
|
+
}
|
|
29
|
+
var f = {
|
|
30
|
+
open: l,
|
|
31
|
+
close: u,
|
|
32
|
+
closeAll: d,
|
|
33
|
+
success: (e, t = {}) => l({
|
|
34
|
+
...t,
|
|
35
|
+
type: "success",
|
|
36
|
+
content: e
|
|
37
|
+
}),
|
|
38
|
+
error: (e, t = {}) => l({
|
|
39
|
+
...t,
|
|
40
|
+
type: "error",
|
|
41
|
+
content: e
|
|
42
|
+
}),
|
|
43
|
+
warning: (e, t = {}) => l({
|
|
44
|
+
...t,
|
|
45
|
+
type: "warning",
|
|
46
|
+
content: e
|
|
47
|
+
}),
|
|
48
|
+
info: (e, t = {}) => l({
|
|
49
|
+
...t,
|
|
50
|
+
type: "info",
|
|
51
|
+
content: e
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { f as KMessage };
|