@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,81 @@
|
|
|
1
|
+
import { createBlock as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, renderSlot as l, toDisplayString as u, unref as d, withCtx as f } from "vue";
|
|
2
|
+
import { X as p } from "lucide-vue-next";
|
|
3
|
+
import { DialogClose as m, DialogContent as h, DialogDescription as g, DialogOverlay as _, DialogPortal as v, DialogRoot as y, DialogTitle as b } from "reka-ui";
|
|
4
|
+
//#region components/KDrawer.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var x = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "k-drawer__header"
|
|
8
|
+
}, S = { class: "k-drawer__title-wrap" }, C = { class: "k-drawer__body" }, w = {
|
|
9
|
+
key: 1,
|
|
10
|
+
class: "k-drawer__footer"
|
|
11
|
+
}, T = /* @__PURE__ */ o({
|
|
12
|
+
__name: "KDrawer",
|
|
13
|
+
props: {
|
|
14
|
+
open: { type: Boolean },
|
|
15
|
+
title: {},
|
|
16
|
+
subtitle: {},
|
|
17
|
+
size: { default: "md" },
|
|
18
|
+
placement: { default: "right" },
|
|
19
|
+
closable: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !0
|
|
22
|
+
},
|
|
23
|
+
maskClosable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:open", "close"],
|
|
29
|
+
setup(o, { emit: T }) {
|
|
30
|
+
let E = T;
|
|
31
|
+
function D(e) {
|
|
32
|
+
E("update:open", e), e || E("close");
|
|
33
|
+
}
|
|
34
|
+
return (T, E) => (c(), e(d(y), {
|
|
35
|
+
open: o.open,
|
|
36
|
+
"onUpdate:open": D
|
|
37
|
+
}, {
|
|
38
|
+
default: f(() => [a(d(v), null, {
|
|
39
|
+
default: f(() => [a(d(_), { class: "k-drawer__overlay" }), a(d(h), {
|
|
40
|
+
class: s(["k-drawer", [`k-drawer--${o.placement}`, `k-drawer--${o.size}`]]),
|
|
41
|
+
onPointerDownOutside: E[0] ||= (e) => {
|
|
42
|
+
o.maskClosable || e.preventDefault();
|
|
43
|
+
},
|
|
44
|
+
onEscapeKeyDown: E[1] ||= (e) => {
|
|
45
|
+
o.closable || e.preventDefault();
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
default: f(() => [
|
|
49
|
+
o.title || T.$slots.title || o.closable ? (c(), n("header", x, [r("div", S, [o.title || T.$slots.title ? (c(), e(d(b), {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "k-drawer__title"
|
|
52
|
+
}, {
|
|
53
|
+
default: f(() => [l(T.$slots, "title", {}, () => [i(u(o.title), 1)], !0)]),
|
|
54
|
+
_: 3
|
|
55
|
+
})) : t("", !0), o.subtitle ? (c(), e(d(g), {
|
|
56
|
+
key: 1,
|
|
57
|
+
class: "k-drawer__subtitle"
|
|
58
|
+
}, {
|
|
59
|
+
default: f(() => [i(u(o.subtitle), 1)]),
|
|
60
|
+
_: 1
|
|
61
|
+
})) : t("", !0)]), o.closable ? (c(), e(d(m), {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: "k-drawer__close",
|
|
64
|
+
"aria-label": "关闭"
|
|
65
|
+
}, {
|
|
66
|
+
default: f(() => [a(d(p), { size: 18 })]),
|
|
67
|
+
_: 1
|
|
68
|
+
})) : t("", !0)])) : t("", !0),
|
|
69
|
+
r("div", C, [l(T.$slots, "default", {}, void 0, !0)]),
|
|
70
|
+
T.$slots.footer ? (c(), n("footer", w, [l(T.$slots, "footer", {}, void 0, !0)])) : t("", !0)
|
|
71
|
+
]),
|
|
72
|
+
_: 3
|
|
73
|
+
}, 8, ["class"])]),
|
|
74
|
+
_: 3
|
|
75
|
+
})]),
|
|
76
|
+
_: 3
|
|
77
|
+
}, 8, ["open"]));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
export { T as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
export interface DropdownItem {
|
|
3
|
+
/** 唯一标识,select 事件回传 */
|
|
4
|
+
key: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
/** lucide 图标组件,可选 */
|
|
7
|
+
icon?: Component;
|
|
8
|
+
/** 右侧快捷键提示文本,如 "⌘K" */
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
/** 危险操作(删除等),渲染为红色 */
|
|
11
|
+
danger?: boolean;
|
|
12
|
+
/** 当前选中项(单选场景,如排序菜单),整行高亮为主色 */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** 分隔线 / 分组标题;不填即普通菜单项 */
|
|
16
|
+
type?: 'item' | 'separator' | 'label';
|
|
17
|
+
}
|
|
18
|
+
type __VLS_Props = {
|
|
19
|
+
items: DropdownItem[];
|
|
20
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
21
|
+
align?: 'start' | 'center' | 'end';
|
|
22
|
+
sideOffset?: number;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
contentClass?: string;
|
|
25
|
+
};
|
|
26
|
+
type __VLS_ModelProps = {
|
|
27
|
+
'open'?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
30
|
+
declare var __VLS_14: {}, __VLS_52: {};
|
|
31
|
+
type __VLS_Slots = {} & {
|
|
32
|
+
default?: (props: typeof __VLS_14) => any;
|
|
33
|
+
} & {
|
|
34
|
+
extra?: (props: typeof __VLS_52) => any;
|
|
35
|
+
};
|
|
36
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
37
|
+
"update:open": (value: boolean | undefined) => any;
|
|
38
|
+
} & {
|
|
39
|
+
select: (key: string, item: DropdownItem) => any;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
41
|
+
onSelect?: ((key: string, item: DropdownItem) => any) | undefined;
|
|
42
|
+
"onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
side: "top" | "right" | "bottom" | "left";
|
|
46
|
+
sideOffset: number;
|
|
47
|
+
align: "start" | "center" | "end";
|
|
48
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
50
|
+
declare const _default: typeof __VLS_export;
|
|
51
|
+
export default _default;
|
|
52
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
53
|
+
new (): {
|
|
54
|
+
$slots: S;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Fragment as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, mergeModels as c, normalizeClass as l, openBlock as u, renderList as d, renderSlot as f, resolveDynamicComponent as p, toDisplayString as m, unref as h, useModel as g, withCtx as _ } from "vue";
|
|
2
|
+
import { DropdownMenuContent as v, DropdownMenuItem as y, DropdownMenuLabel as b, DropdownMenuPortal as x, DropdownMenuRoot as S, DropdownMenuSeparator as C, DropdownMenuTrigger as w } from "reka-ui";
|
|
3
|
+
//#region components/KDropdown.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var T = { class: "k-dropdown-item__label" }, E = {
|
|
5
|
+
key: 1,
|
|
6
|
+
class: "k-dropdown-item__shortcut"
|
|
7
|
+
}, D = /* @__PURE__ */ s({
|
|
8
|
+
__name: "KDropdown",
|
|
9
|
+
props: /* @__PURE__ */ c({
|
|
10
|
+
items: {},
|
|
11
|
+
side: { default: "bottom" },
|
|
12
|
+
align: { default: "end" },
|
|
13
|
+
sideOffset: { default: 6 },
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
contentClass: {}
|
|
19
|
+
}, {
|
|
20
|
+
open: { type: Boolean },
|
|
21
|
+
openModifiers: {}
|
|
22
|
+
}),
|
|
23
|
+
emits: /* @__PURE__ */ c(["select"], ["update:open"]),
|
|
24
|
+
setup(s, { emit: c }) {
|
|
25
|
+
let D = g(s, "open"), O = c;
|
|
26
|
+
function k(e) {
|
|
27
|
+
e.disabled || O("select", e.key, e);
|
|
28
|
+
}
|
|
29
|
+
return (c, g) => (u(), t(h(S), {
|
|
30
|
+
open: D.value,
|
|
31
|
+
"onUpdate:open": g[0] ||= (e) => D.value = e
|
|
32
|
+
}, {
|
|
33
|
+
default: _(() => [o(h(w), {
|
|
34
|
+
"as-child": "",
|
|
35
|
+
disabled: s.disabled
|
|
36
|
+
}, {
|
|
37
|
+
default: _(() => [f(c.$slots, "default")]),
|
|
38
|
+
_: 3
|
|
39
|
+
}, 8, ["disabled"]), o(h(x), null, {
|
|
40
|
+
default: _(() => [o(h(v), {
|
|
41
|
+
class: l(["k-dropdown-content k-menu-surface", s.contentClass]),
|
|
42
|
+
side: s.side,
|
|
43
|
+
align: s.align,
|
|
44
|
+
"side-offset": s.sideOffset
|
|
45
|
+
}, {
|
|
46
|
+
default: _(() => [(u(!0), r(e, null, d(s.items, (o, s) => (u(), r(e, { key: o.key || `_${s}` }, [o.type === "separator" ? (u(), t(h(C), {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: "k-dropdown-sep"
|
|
49
|
+
})) : o.type === "label" ? (u(), t(h(b), {
|
|
50
|
+
key: 1,
|
|
51
|
+
class: "k-dropdown-label"
|
|
52
|
+
}, {
|
|
53
|
+
default: _(() => [a(m(o.label), 1)]),
|
|
54
|
+
_: 2
|
|
55
|
+
}, 1024)) : (u(), t(h(y), {
|
|
56
|
+
key: 2,
|
|
57
|
+
class: l(["k-dropdown-item k-menu-item", {
|
|
58
|
+
"k-dropdown-item--danger": o.danger,
|
|
59
|
+
"k-dropdown-item--active": o.active
|
|
60
|
+
}]),
|
|
61
|
+
disabled: o.disabled,
|
|
62
|
+
onSelect: (e) => k(o)
|
|
63
|
+
}, {
|
|
64
|
+
default: _(() => [
|
|
65
|
+
o.icon ? (u(), t(p(o.icon), {
|
|
66
|
+
key: 0,
|
|
67
|
+
size: 15,
|
|
68
|
+
class: "k-dropdown-item__icon"
|
|
69
|
+
})) : n("", !0),
|
|
70
|
+
i("span", T, m(o.label), 1),
|
|
71
|
+
o.shortcut ? (u(), r("span", E, m(o.shortcut), 1)) : n("", !0)
|
|
72
|
+
]),
|
|
73
|
+
_: 2
|
|
74
|
+
}, 1032, [
|
|
75
|
+
"class",
|
|
76
|
+
"disabled",
|
|
77
|
+
"onSelect"
|
|
78
|
+
]))], 64))), 128)), f(c.$slots, "extra")]),
|
|
79
|
+
_: 3
|
|
80
|
+
}, 8, [
|
|
81
|
+
"class",
|
|
82
|
+
"side",
|
|
83
|
+
"align",
|
|
84
|
+
"side-offset"
|
|
85
|
+
])]),
|
|
86
|
+
_: 3
|
|
87
|
+
})]),
|
|
88
|
+
_: 3
|
|
89
|
+
}, 8, ["open"]));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { D as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
icon?: Component;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare var __VLS_6: {}, __VLS_8: {};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_6) => any;
|
|
11
|
+
} & {
|
|
12
|
+
actions?: (props: typeof __VLS_8) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createBlock as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, defineComponent as a, normalizeClass as o, openBlock as s, renderSlot as c, resolveDynamicComponent as l, toDisplayString as u } from "vue";
|
|
2
|
+
//#region components/KEmpty.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var d = {
|
|
4
|
+
key: 2,
|
|
5
|
+
class: "mt-3 flex flex-wrap items-center justify-center gap-2"
|
|
6
|
+
}, f = /* @__PURE__ */ a({
|
|
7
|
+
__name: "KEmpty",
|
|
8
|
+
props: {
|
|
9
|
+
icon: {},
|
|
10
|
+
title: {},
|
|
11
|
+
description: {},
|
|
12
|
+
compact: { type: Boolean }
|
|
13
|
+
},
|
|
14
|
+
setup(a) {
|
|
15
|
+
return (f, p) => (s(), n("div", { class: o(["grid place-items-center rounded-2xl border border-dashed border-ink-200 bg-white text-center", a.compact ? "px-4 py-10" : "px-6 py-20"]) }, [
|
|
16
|
+
a.icon ? (s(), e(l(a.icon), {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: o(["text-ink-300", a.compact ? "size-7" : "size-10"])
|
|
19
|
+
}, null, 8, ["class"])) : t("", !0),
|
|
20
|
+
r("p", { class: o(["mt-3 font-medium text-ink-700", a.compact ? "text-xs" : "text-sm"]) }, u(a.title), 3),
|
|
21
|
+
f.$slots.default || a.description ? (s(), n("p", {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: o(["mt-1 text-ink-400", a.compact ? "text-[11px]" : "text-xs"])
|
|
24
|
+
}, [c(f.$slots, "default", {}, () => [i(u(a.description), 1)])], 2)) : t("", !0),
|
|
25
|
+
f.$slots.actions ? (s(), n("div", d, [c(f.$slots, "actions")])) : t("", !0)
|
|
26
|
+
], 2));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { f as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KForm.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KForm.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-10becb62"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type FormRule } from './form-context';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
model: Record<string, any>;
|
|
4
|
+
rules?: Record<string, FormRule | FormRule[]>;
|
|
5
|
+
labelWidth?: string;
|
|
6
|
+
labelPosition?: 'top' | 'left';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
};
|
|
9
|
+
declare function validate(): Promise<boolean>;
|
|
10
|
+
declare function validateField(name: string): Promise<boolean>;
|
|
11
|
+
declare function resetFields(): void;
|
|
12
|
+
declare function clearValidate(): void;
|
|
13
|
+
declare var __VLS_1: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_1) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
18
|
+
validate: typeof validate;
|
|
19
|
+
validateField: typeof validateField;
|
|
20
|
+
resetFields: typeof resetFields;
|
|
21
|
+
clearValidate: typeof clearValidate;
|
|
22
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
submit: (ev: Event) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onSubmit?: ((ev: Event) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
size: "sm" | "md" | "lg";
|
|
28
|
+
labelWidth: string;
|
|
29
|
+
labelPosition: "top" | "left";
|
|
30
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
34
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
|
+
new (): {
|
|
36
|
+
$slots: S;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { formContextKey as e } from "./form-context.js";
|
|
2
|
+
import { createElementBlock as t, defineComponent as n, openBlock as r, provide as i, reactive as a, renderSlot as o } from "vue";
|
|
3
|
+
//#region components/KForm.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var s = /* @__PURE__ */ n({
|
|
5
|
+
__name: "KForm",
|
|
6
|
+
props: {
|
|
7
|
+
model: {},
|
|
8
|
+
rules: {},
|
|
9
|
+
labelWidth: { default: "100px" },
|
|
10
|
+
labelPosition: { default: "top" },
|
|
11
|
+
size: { default: "md" }
|
|
12
|
+
},
|
|
13
|
+
emits: ["submit"],
|
|
14
|
+
setup(n, { expose: s, emit: c }) {
|
|
15
|
+
let l = n, u = c, d = a(/* @__PURE__ */ new Map());
|
|
16
|
+
function f(e, t) {
|
|
17
|
+
d.set(e, t);
|
|
18
|
+
}
|
|
19
|
+
function p(e) {
|
|
20
|
+
d.delete(e);
|
|
21
|
+
}
|
|
22
|
+
i(e, {
|
|
23
|
+
get model() {
|
|
24
|
+
return l.model;
|
|
25
|
+
},
|
|
26
|
+
get rules() {
|
|
27
|
+
return l.rules;
|
|
28
|
+
},
|
|
29
|
+
get labelWidth() {
|
|
30
|
+
return l.labelWidth;
|
|
31
|
+
},
|
|
32
|
+
get labelPosition() {
|
|
33
|
+
return l.labelPosition;
|
|
34
|
+
},
|
|
35
|
+
get size() {
|
|
36
|
+
return l.size;
|
|
37
|
+
},
|
|
38
|
+
registerField: f,
|
|
39
|
+
unregisterField: p
|
|
40
|
+
});
|
|
41
|
+
async function m() {
|
|
42
|
+
return (await Promise.all(Array.from(d.values()).map((e) => e.validate()))).every(Boolean);
|
|
43
|
+
}
|
|
44
|
+
async function h(e) {
|
|
45
|
+
let t = d.get(e);
|
|
46
|
+
return t ? t.validate() : !0;
|
|
47
|
+
}
|
|
48
|
+
function g() {
|
|
49
|
+
d.forEach((e) => e.reset());
|
|
50
|
+
}
|
|
51
|
+
function _() {
|
|
52
|
+
d.forEach((e) => e.clearValidate());
|
|
53
|
+
}
|
|
54
|
+
async function v(e) {
|
|
55
|
+
e.preventDefault(), await m() && u("submit", e);
|
|
56
|
+
}
|
|
57
|
+
return s({
|
|
58
|
+
validate: m,
|
|
59
|
+
validateField: h,
|
|
60
|
+
resetFields: g,
|
|
61
|
+
clearValidate: _
|
|
62
|
+
}), (e, n) => (r(), t("form", {
|
|
63
|
+
class: "k-form",
|
|
64
|
+
onSubmit: v
|
|
65
|
+
}, [o(e.$slots, "default", {}, void 0, !0)], 32));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
export { s as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KFormField.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KFormField.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-7d8c47c8"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type FormRule } from './form-context';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
rules?: FormRule | FormRule[];
|
|
6
|
+
required?: boolean;
|
|
7
|
+
/** 字段提示 (label 下灰色小字, 错误时隐藏) */
|
|
8
|
+
hint?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function validate(): Promise<boolean>;
|
|
11
|
+
declare function reset(): void;
|
|
12
|
+
declare function clearValidate(): void;
|
|
13
|
+
declare var __VLS_1: {
|
|
14
|
+
error: boolean;
|
|
15
|
+
validate: typeof validate;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_Slots = {} & {
|
|
18
|
+
default?: (props: typeof __VLS_1) => any;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
21
|
+
validate: typeof validate;
|
|
22
|
+
reset: typeof reset;
|
|
23
|
+
clearValidate: typeof clearValidate;
|
|
24
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { formContextKey as e } from "./form-context.js";
|
|
2
|
+
import { computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, inject as s, normalizeClass as c, normalizeStyle as l, onBeforeUnmount as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g } from "vue";
|
|
3
|
+
//#region components/KFormField.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var _ = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "k-field__required"
|
|
7
|
+
}, v = { class: "k-field__control" }, y = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "k-field__hint"
|
|
10
|
+
}, b = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "k-field__error"
|
|
13
|
+
}, x = /* @__PURE__ */ o({
|
|
14
|
+
__name: "KFormField",
|
|
15
|
+
props: {
|
|
16
|
+
name: {},
|
|
17
|
+
label: {},
|
|
18
|
+
rules: {},
|
|
19
|
+
required: { type: Boolean },
|
|
20
|
+
hint: {}
|
|
21
|
+
},
|
|
22
|
+
setup(o, { expose: x }) {
|
|
23
|
+
let S = o, C = s(e);
|
|
24
|
+
if (!C) throw Error("KFormField 必须放在 <KForm> 内");
|
|
25
|
+
let w = p(""), T = t(() => {
|
|
26
|
+
let e = S.rules ?? C.rules?.[S.name] ?? [], t = Array.isArray(e) ? [...e] : [e];
|
|
27
|
+
return S.required && !t.some((e) => e.required) && t.unshift({ required: !0 }), t.filter(Boolean);
|
|
28
|
+
}), E = t(() => S.required || T.value.some((e) => e.required));
|
|
29
|
+
function D(e) {
|
|
30
|
+
return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
31
|
+
}
|
|
32
|
+
async function O() {
|
|
33
|
+
let e = C.model[S.name];
|
|
34
|
+
for (let t of T.value) {
|
|
35
|
+
if (t.required && D(e)) return w.value = t.message ?? `${S.label || S.name} 必填`, !1;
|
|
36
|
+
if (!D(e)) {
|
|
37
|
+
if (t.min !== void 0 && typeof e == "string" && e.length < t.min) return w.value = t.message ?? `至少 ${t.min} 个字符`, !1;
|
|
38
|
+
if (t.max !== void 0 && typeof e == "string" && e.length > t.max) return w.value = t.message ?? `最多 ${t.max} 个字符`, !1;
|
|
39
|
+
if (t.pattern && !t.pattern.test(String(e))) return w.value = t.message ?? "格式不正确", !1;
|
|
40
|
+
if (t.validator) {
|
|
41
|
+
let n = await t.validator(e);
|
|
42
|
+
if (n === !1) return w.value = t.message ?? "校验失败", !1;
|
|
43
|
+
if (typeof n == "string") return w.value = n, !1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return w.value = "", !0;
|
|
48
|
+
}
|
|
49
|
+
function k() {
|
|
50
|
+
w.value = "";
|
|
51
|
+
}
|
|
52
|
+
function A() {
|
|
53
|
+
w.value = "";
|
|
54
|
+
}
|
|
55
|
+
let j = {
|
|
56
|
+
validate: O,
|
|
57
|
+
reset: k,
|
|
58
|
+
clearValidate: A
|
|
59
|
+
};
|
|
60
|
+
d(() => C.registerField(S.name, j)), u(() => C.unregisterField(S.name));
|
|
61
|
+
let M = t(() => C.labelPosition === "left" ? {
|
|
62
|
+
width: C.labelWidth,
|
|
63
|
+
textAlign: "right"
|
|
64
|
+
} : {});
|
|
65
|
+
return x({
|
|
66
|
+
validate: O,
|
|
67
|
+
reset: k,
|
|
68
|
+
clearValidate: A
|
|
69
|
+
}), (e, t) => (f(), r("div", { class: c(["k-field", `k-field--${g(C).labelPosition}`]) }, [o.label ? (f(), r("label", {
|
|
70
|
+
key: 0,
|
|
71
|
+
class: "k-field__label",
|
|
72
|
+
style: l(M.value)
|
|
73
|
+
}, [E.value ? (f(), r("span", _, "*")) : n("", !0), a(" " + h(o.label), 1)], 4)) : n("", !0), i("div", v, [
|
|
74
|
+
m(e.$slots, "default", {
|
|
75
|
+
error: !!w.value,
|
|
76
|
+
validate: O
|
|
77
|
+
}, void 0, !0),
|
|
78
|
+
o.hint && !w.value ? (f(), r("p", y, h(o.hint), 1)) : n("", !0),
|
|
79
|
+
w.value ? (f(), r("p", b, h(w.value), 1)) : n("", !0)
|
|
80
|
+
])], 2));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { x as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
count?: number;
|
|
3
|
+
aspect?: '4/3' | '16/9' | '5/3';
|
|
4
|
+
}
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
6
|
+
count: number;
|
|
7
|
+
aspect: "4/3" | "16/9" | "5/3";
|
|
8
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fragment as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeClass as i, openBlock as a, renderList as o } from "vue";
|
|
2
|
+
//#region components/KGridSkeleton.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var s = { class: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3" }, c = /* @__PURE__ */ r({
|
|
4
|
+
__name: "KGridSkeleton",
|
|
5
|
+
props: {
|
|
6
|
+
count: { default: 6 },
|
|
7
|
+
aspect: { default: "4/3" }
|
|
8
|
+
},
|
|
9
|
+
setup(r) {
|
|
10
|
+
return (c, l) => (a(), t("div", s, [(a(!0), t(e, null, o(r.count, (e) => (a(), t("div", {
|
|
11
|
+
key: e,
|
|
12
|
+
class: "overflow-hidden rounded-xl border border-ink-200 bg-white"
|
|
13
|
+
}, [n("div", { class: i(["k-skel-bar w-full", {
|
|
14
|
+
"aspect-[4/3]": r.aspect === "4/3",
|
|
15
|
+
"aspect-video": r.aspect === "16/9",
|
|
16
|
+
"aspect-[5/3]": r.aspect === "5/3"
|
|
17
|
+
}]) }, null, 2), l[0] ||= n("div", { class: "space-y-2 p-4" }, [n("div", { class: "k-skel-bar h-3.5 w-3/4 rounded" }), n("div", { class: "k-skel-bar h-2.5 w-1/2 rounded" })], -1)]))), 128))]));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { c as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./KImage.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region components/KImage.vue
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-c1e4cb5f"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
src: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
width?: string;
|
|
5
|
+
height?: string;
|
|
6
|
+
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
7
|
+
lazy?: boolean;
|
|
8
|
+
preview?: boolean;
|
|
9
|
+
rounded?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
|
+
click: (ev: MouseEvent) => any;
|
|
13
|
+
error: () => any;
|
|
14
|
+
load: () => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
onClick?: ((ev: MouseEvent) => any) | undefined;
|
|
17
|
+
onError?: (() => any) | undefined;
|
|
18
|
+
onLoad?: (() => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
fit: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
21
|
+
lazy: boolean;
|
|
22
|
+
preview: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|