kb-ui-vue 0.2.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/dist/components/Alert/Alert.vue.d.ts +26 -0
- package/dist/components/Alert/index.d.ts +4 -0
- package/dist/components/Avatar/Avatar.vue.d.ts +20 -0
- package/dist/components/Avatar/index.d.ts +4 -0
- package/dist/components/Badge/Badge.vue.d.ts +28 -0
- package/dist/components/Badge/index.d.ts +4 -0
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +15 -0
- package/dist/components/Breadcrumb/index.d.ts +4 -0
- package/dist/components/Button/Button.vue.d.ts +32 -0
- package/dist/components/Button/index.d.ts +4 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +12 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Card/Card.vue.d.ts +23 -0
- package/dist/components/Card/index.d.ts +4 -0
- package/dist/components/Carousel/Carousel.vue.d.ts +18 -0
- package/dist/components/Carousel/index.d.ts +4 -0
- package/dist/components/Cascader/Cascader.vue.d.ts +21 -0
- package/dist/components/Cascader/index.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.vue.d.ts +27 -0
- package/dist/components/Checkbox/index.d.ts +4 -0
- package/dist/components/Collapse/Collapse.vue.d.ts +35 -0
- package/dist/components/Collapse/index.d.ts +4 -0
- package/dist/components/ColorPicker/ColorPicker.vue.d.ts +12 -0
- package/dist/components/ColorPicker/index.d.ts +4 -0
- package/dist/components/CountUp/CountUp.vue.d.ts +20 -0
- package/dist/components/CountUp/index.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.vue.d.ts +14 -0
- package/dist/components/DatePicker/index.d.ts +4 -0
- package/dist/components/Descriptions/Descriptions.vue.d.ts +19 -0
- package/dist/components/Descriptions/index.d.ts +4 -0
- package/dist/components/Dialog/Dialog.vue.d.ts +35 -0
- package/dist/components/Dialog/index.d.ts +4 -0
- package/dist/components/Divider/Divider.vue.d.ts +20 -0
- package/dist/components/Divider/index.d.ts +4 -0
- package/dist/components/Drawer/Drawer.vue.d.ts +31 -0
- package/dist/components/Drawer/index.d.ts +4 -0
- package/dist/components/Dropdown/Dropdown.vue.d.ts +31 -0
- package/dist/components/Dropdown/index.d.ts +4 -0
- package/dist/components/Empty/Empty.vue.d.ts +21 -0
- package/dist/components/Empty/index.d.ts +4 -0
- package/dist/components/Form/Form.vue.d.ts +38 -0
- package/dist/components/Form/FormItem.vue.d.ts +21 -0
- package/dist/components/Form/index.d.ts +5 -0
- package/dist/components/Grid/Col.vue.d.ts +20 -0
- package/dist/components/Grid/Row.vue.d.ts +22 -0
- package/dist/components/Grid/constants.d.ts +1 -0
- package/dist/components/Grid/index.d.ts +5 -0
- package/dist/components/Icon/Icon.vue.d.ts +10 -0
- package/dist/components/Icon/index.d.ts +4 -0
- package/dist/components/Input/Input.vue.d.ts +29 -0
- package/dist/components/Input/index.d.ts +4 -0
- package/dist/components/InputNumber/InputNumber.vue.d.ts +20 -0
- package/dist/components/InputNumber/index.d.ts +4 -0
- package/dist/components/InputPassword/InputPassword.vue.d.ts +16 -0
- package/dist/components/InputPassword/index.d.ts +4 -0
- package/dist/components/List/List.vue.d.ts +26 -0
- package/dist/components/List/index.d.ts +4 -0
- package/dist/components/Loading/Loading.vue.d.ts +12 -0
- package/dist/components/Loading/index.d.ts +4 -0
- package/dist/components/Message/Message.vue.d.ts +10 -0
- package/dist/components/Message/index.d.ts +16 -0
- package/dist/components/Notification/Notification.vue.d.ts +11 -0
- package/dist/components/Notification/index.d.ts +16 -0
- package/dist/components/Pagination/Pagination.vue.d.ts +18 -0
- package/dist/components/Pagination/index.d.ts +4 -0
- package/dist/components/Popconfirm/Popconfirm.vue.d.ts +28 -0
- package/dist/components/Popconfirm/index.d.ts +4 -0
- package/dist/components/Popover/Popover.vue.d.ts +28 -0
- package/dist/components/Popover/index.d.ts +4 -0
- package/dist/components/Progress/Progress.vue.d.ts +21 -0
- package/dist/components/Progress/index.d.ts +4 -0
- package/dist/components/Radio/Radio.vue.d.ts +27 -0
- package/dist/components/Radio/index.d.ts +4 -0
- package/dist/components/Rate/Rate.vue.d.ts +17 -0
- package/dist/components/Rate/index.d.ts +4 -0
- package/dist/components/Result/Result.vue.d.ts +21 -0
- package/dist/components/Result/index.d.ts +4 -0
- package/dist/components/Search/Search.vue.d.ts +18 -0
- package/dist/components/Search/index.d.ts +4 -0
- package/dist/components/Segmented/Segmented.vue.d.ts +19 -0
- package/dist/components/Segmented/index.d.ts +4 -0
- package/dist/components/Select/Select.vue.d.ts +26 -0
- package/dist/components/Select/index.d.ts +4 -0
- package/dist/components/Skeleton/Skeleton.vue.d.ts +22 -0
- package/dist/components/Skeleton/index.d.ts +4 -0
- package/dist/components/Slider/Slider.vue.d.ts +20 -0
- package/dist/components/Slider/index.d.ts +4 -0
- package/dist/components/Space/Space.vue.d.ts +24 -0
- package/dist/components/Space/index.d.ts +4 -0
- package/dist/components/Statistic/Statistic.vue.d.ts +29 -0
- package/dist/components/Statistic/index.d.ts +4 -0
- package/dist/components/Steps/Steps.vue.d.ts +15 -0
- package/dist/components/Steps/index.d.ts +4 -0
- package/dist/components/Switch/Switch.vue.d.ts +16 -0
- package/dist/components/Switch/index.d.ts +4 -0
- package/dist/components/Table/Table.vue.d.ts +34 -0
- package/dist/components/Table/index.d.ts +4 -0
- package/dist/components/Tabs/Tabs.vue.d.ts +30 -0
- package/dist/components/Tabs/index.d.ts +4 -0
- package/dist/components/Tag/Tag.vue.d.ts +28 -0
- package/dist/components/Tag/index.d.ts +4 -0
- package/dist/components/Textarea/Textarea.vue.d.ts +20 -0
- package/dist/components/Textarea/index.d.ts +4 -0
- package/dist/components/Timeline/Timeline.vue.d.ts +13 -0
- package/dist/components/Timeline/index.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.vue.d.ts +24 -0
- package/dist/components/Tooltip/index.d.ts +4 -0
- package/dist/components/Transfer/Transfer.vue.d.ts +18 -0
- package/dist/components/Transfer/index.d.ts +4 -0
- package/dist/components/Tree/Tree.vue.d.ts +17 -0
- package/dist/components/Tree/index.d.ts +4 -0
- package/dist/components/Upload/Upload.vue.d.ts +55 -0
- package/dist/components/Upload/index.d.ts +4 -0
- package/dist/components/Watermark/Watermark.vue.d.ts +28 -0
- package/dist/components/Watermark/index.d.ts +4 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +2410 -0
- package/dist/styles/Alert.css +68 -0
- package/dist/styles/Avatar.css +31 -0
- package/dist/styles/Badge.css +49 -0
- package/dist/styles/Breadcrumb.css +28 -0
- package/dist/styles/Button.css +108 -0
- package/dist/styles/Calendar.css +79 -0
- package/dist/styles/Card.css +40 -0
- package/dist/styles/Carousel.css +87 -0
- package/dist/styles/Cascader.css +75 -0
- package/dist/styles/Checkbox.css +62 -0
- package/dist/styles/Collapse.css +49 -0
- package/dist/styles/ColorPicker.css +36 -0
- package/dist/styles/CountUp.css +4 -0
- package/dist/styles/DatePicker.css +33 -0
- package/dist/styles/Descriptions.css +44 -0
- package/dist/styles/Dialog.css +42 -0
- package/dist/styles/Divider.css +37 -0
- package/dist/styles/Drawer.css +81 -0
- package/dist/styles/Dropdown.css +40 -0
- package/dist/styles/Empty.css +24 -0
- package/dist/styles/Form.css +33 -0
- package/dist/styles/Grid.css +194 -0
- package/dist/styles/Icon.css +5 -0
- package/dist/styles/Input.css +79 -0
- package/dist/styles/InputNumber.css +40 -0
- package/dist/styles/InputPassword.css +42 -0
- package/dist/styles/List.css +29 -0
- package/dist/styles/Loading.css +27 -0
- package/dist/styles/Message.css +32 -0
- package/dist/styles/Notification.css +50 -0
- package/dist/styles/Pagination.css +57 -0
- package/dist/styles/Popconfirm.css +53 -0
- package/dist/styles/Popover.css +54 -0
- package/dist/styles/Progress.css +38 -0
- package/dist/styles/Radio.css +60 -0
- package/dist/styles/Rate.css +21 -0
- package/dist/styles/Result.css +41 -0
- package/dist/styles/Search.css +46 -0
- package/dist/styles/Segmented.css +32 -0
- package/dist/styles/Select.css +108 -0
- package/dist/styles/Skeleton.css +40 -0
- package/dist/styles/Slider.css +46 -0
- package/dist/styles/Space.css +27 -0
- package/dist/styles/Statistic.css +31 -0
- package/dist/styles/Steps.css +83 -0
- package/dist/styles/Switch.css +39 -0
- package/dist/styles/Table.css +43 -0
- package/dist/styles/Tabs.css +41 -0
- package/dist/styles/Tag.css +71 -0
- package/dist/styles/Textarea.css +43 -0
- package/dist/styles/Timeline.css +70 -0
- package/dist/styles/Tooltip.css +42 -0
- package/dist/styles/Transfer.css +64 -0
- package/dist/styles/Tree.css +50 -0
- package/dist/styles/Upload.css +66 -0
- package/dist/styles/Watermark.css +17 -0
- package/dist/styles/all.css +103 -0
- package/dist/styles/dark.css +10 -0
- package/dist/styles/index.css +2953 -0
- package/dist/styles/themes/amber.css +14 -0
- package/dist/styles/themes/aurora.css +15 -0
- package/dist/styles/themes/autumn.css +18 -0
- package/dist/styles/themes/business.css +20 -0
- package/dist/styles/themes/candy.css +21 -0
- package/dist/styles/themes/cartoon.css +31 -0
- package/dist/styles/themes/coffee.css +18 -0
- package/dist/styles/themes/cyber.css +37 -0
- package/dist/styles/themes/cyberpunk.css +32 -0
- package/dist/styles/themes/danqing.css +27 -0
- package/dist/styles/themes/flat.css +18 -0
- package/dist/styles/themes/forest.css +20 -0
- package/dist/styles/themes/gameboy.css +33 -0
- package/dist/styles/themes/glass.css +39 -0
- package/dist/styles/themes/gold.css +26 -0
- package/dist/styles/themes/gothic.css +20 -0
- package/dist/styles/themes/gradient.css +18 -0
- package/dist/styles/themes/ink.css +16 -0
- package/dist/styles/themes/lava.css +15 -0
- package/dist/styles/themes/macaron.css +27 -0
- package/dist/styles/themes/matcha.css +18 -0
- package/dist/styles/themes/memphis.css +25 -0
- package/dist/styles/themes/midnight.css +27 -0
- package/dist/styles/themes/minimal.css +36 -0
- package/dist/styles/themes/mint.css +20 -0
- package/dist/styles/themes/mono.css +36 -0
- package/dist/styles/themes/morandi.css +18 -0
- package/dist/styles/themes/neon.css +16 -0
- package/dist/styles/themes/neonlight.css +20 -0
- package/dist/styles/themes/ocean.css +20 -0
- package/dist/styles/themes/pastel.css +21 -0
- package/dist/styles/themes/pop.css +33 -0
- package/dist/styles/themes/retro.css +35 -0
- package/dist/styles/themes/rose.css +14 -0
- package/dist/styles/themes/rounded.css +18 -0
- package/dist/styles/themes/sakura.css +20 -0
- package/dist/styles/themes/sky.css +20 -0
- package/dist/styles/themes/spring.css +18 -0
- package/dist/styles/themes/starry.css +15 -0
- package/dist/styles/themes/sunset.css +18 -0
- package/dist/styles/themes/teal.css +14 -0
- package/dist/styles/themes/terminal.css +44 -0
- package/dist/styles/themes/vaporwave.css +27 -0
- package/dist/styles/themes/violet.css +14 -0
- package/dist/styles/themes/wabi.css +27 -0
- package/dist/styles/themes/winter.css +20 -0
- package/dist/styles/tokens.css +55 -0
- package/package.json +45 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2410 @@
|
|
|
1
|
+
import { Fragment as e, Teleport as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, inject as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, onMounted as g, openBlock as _, provide as v, reactive as y, ref as b, renderList as x, renderSlot as S, resolveComponent as C, toDisplayString as w, unref as T, useId as E, useSlots as D, watch as O, withKeys as k, withModifiers as A } from "vue";
|
|
2
|
+
//#region src/components/Button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var ee = ["type", "disabled"], j = /* @__PURE__ */ u({
|
|
4
|
+
name: "KbButton",
|
|
5
|
+
__name: "Button",
|
|
6
|
+
props: {
|
|
7
|
+
type: { default: "default" },
|
|
8
|
+
size: { default: "medium" },
|
|
9
|
+
disabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
round: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
plain: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !1
|
|
20
|
+
},
|
|
21
|
+
nativeType: { default: "button" }
|
|
22
|
+
},
|
|
23
|
+
emits: ["click"],
|
|
24
|
+
setup(e) {
|
|
25
|
+
let t = e, r = n(() => [
|
|
26
|
+
"kb-button",
|
|
27
|
+
`kb-button--${t.type}`,
|
|
28
|
+
`kb-button--${t.size}`,
|
|
29
|
+
{
|
|
30
|
+
"kb-button--disabled": t.disabled,
|
|
31
|
+
"kb-button--round": t.round,
|
|
32
|
+
"kb-button--plain": t.plain
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
return (t, n) => (_(), o("button", {
|
|
36
|
+
type: e.nativeType,
|
|
37
|
+
class: p(r.value),
|
|
38
|
+
disabled: e.disabled,
|
|
39
|
+
onClick: n[0] ||= (e) => t.$emit("click", e)
|
|
40
|
+
}, [S(t.$slots, "default")], 10, ee));
|
|
41
|
+
}
|
|
42
|
+
}), M = ["width", "height"], te = ["d"], N = /* @__PURE__ */ u({
|
|
43
|
+
name: "KbIcon",
|
|
44
|
+
__name: "Icon",
|
|
45
|
+
props: {
|
|
46
|
+
name: {},
|
|
47
|
+
size: { default: 16 },
|
|
48
|
+
color: {}
|
|
49
|
+
},
|
|
50
|
+
setup(e) {
|
|
51
|
+
let t = e, r = {
|
|
52
|
+
check: "M20 6 9 17l-5-5",
|
|
53
|
+
close: "M18 6 6 18M6 6l12 12",
|
|
54
|
+
info: "M12 16v-4M12 8h.01",
|
|
55
|
+
warning: "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01",
|
|
56
|
+
success: "M22 11.08V12a10 10 0 1 1-5.93-9.14M22 4 12 14.01l-3-3",
|
|
57
|
+
error: "M18 6 6 18M6 6l12 12",
|
|
58
|
+
"arrow-left": "M19 12H5M12 19l-7-7 7-7",
|
|
59
|
+
"arrow-right": "M5 12h14M12 5l7 7-7 7",
|
|
60
|
+
search: "M21 21l-4.35-4.35M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16z",
|
|
61
|
+
menu: "M4 6h16M4 12h16M4 18h16",
|
|
62
|
+
loading: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83",
|
|
63
|
+
"chevron-down": "m6 9 6 6 6-6"
|
|
64
|
+
}, i = n(() => r[t.name]);
|
|
65
|
+
return (t, n) => (_(), o("svg", {
|
|
66
|
+
class: "kb-icon",
|
|
67
|
+
width: e.size,
|
|
68
|
+
height: e.size,
|
|
69
|
+
viewBox: "0 0 24 24",
|
|
70
|
+
fill: "none",
|
|
71
|
+
stroke: "currentColor",
|
|
72
|
+
"stroke-width": "2",
|
|
73
|
+
"stroke-linecap": "round",
|
|
74
|
+
"stroke-linejoin": "round",
|
|
75
|
+
style: m(e.color ? { color: e.color } : void 0),
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
}, [i.value ? (_(), o("path", {
|
|
78
|
+
key: 0,
|
|
79
|
+
d: i.value
|
|
80
|
+
}, null, 8, te)) : a("", !0)], 12, M));
|
|
81
|
+
}
|
|
82
|
+
}), ne = /* @__PURE__ */ u({
|
|
83
|
+
name: "KbTag",
|
|
84
|
+
__name: "Tag",
|
|
85
|
+
props: {
|
|
86
|
+
type: { default: "default" },
|
|
87
|
+
size: { default: "medium" },
|
|
88
|
+
closable: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !1
|
|
91
|
+
},
|
|
92
|
+
round: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !1
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
emits: ["close"],
|
|
98
|
+
setup(e) {
|
|
99
|
+
let t = e, r = n(() => [
|
|
100
|
+
"kb-tag",
|
|
101
|
+
`kb-tag--${t.type}`,
|
|
102
|
+
`kb-tag--${t.size}`,
|
|
103
|
+
{ "kb-tag--round": t.round }
|
|
104
|
+
]);
|
|
105
|
+
return (t, n) => (_(), o("span", { class: p(r.value) }, [S(t.$slots, "default"), e.closable ? (_(), o("button", {
|
|
106
|
+
key: 0,
|
|
107
|
+
class: "kb-tag__close",
|
|
108
|
+
type: "button",
|
|
109
|
+
"aria-label": "close",
|
|
110
|
+
onClick: n[0] ||= (e) => t.$emit("close")
|
|
111
|
+
}, " × ")) : a("", !0)], 2));
|
|
112
|
+
}
|
|
113
|
+
}), re = /* @__PURE__ */ u({
|
|
114
|
+
name: "KbSpace",
|
|
115
|
+
__name: "Space",
|
|
116
|
+
props: {
|
|
117
|
+
direction: { default: "horizontal" },
|
|
118
|
+
size: { default: "medium" },
|
|
119
|
+
align: { default: "start" },
|
|
120
|
+
wrap: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: !1
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
setup(e) {
|
|
126
|
+
let t = e, r = {
|
|
127
|
+
small: "var(--kb-space-1)",
|
|
128
|
+
medium: "var(--kb-space-2)",
|
|
129
|
+
large: "var(--kb-space-4)"
|
|
130
|
+
}, i = n(() => [
|
|
131
|
+
"kb-space",
|
|
132
|
+
`kb-space--${t.direction}`,
|
|
133
|
+
`kb-space--align-${t.align}`,
|
|
134
|
+
{ "kb-space--wrap": t.wrap }
|
|
135
|
+
]), a = n(() => ({ gap: typeof t.size == "number" ? `${t.size}px` : r[t.size] }));
|
|
136
|
+
return (e, t) => (_(), o("div", {
|
|
137
|
+
class: p(i.value),
|
|
138
|
+
style: m(a.value)
|
|
139
|
+
}, [S(e.$slots, "default")], 6));
|
|
140
|
+
}
|
|
141
|
+
}), ie = {
|
|
142
|
+
key: 0,
|
|
143
|
+
class: "kb-divider__text"
|
|
144
|
+
}, ae = /* @__PURE__ */ u({
|
|
145
|
+
name: "KbDivider",
|
|
146
|
+
__name: "Divider",
|
|
147
|
+
props: {
|
|
148
|
+
direction: { default: "horizontal" },
|
|
149
|
+
contentPosition: { default: "center" }
|
|
150
|
+
},
|
|
151
|
+
setup(e) {
|
|
152
|
+
let t = e, r = n(() => [
|
|
153
|
+
"kb-divider",
|
|
154
|
+
`kb-divider--${t.direction}`,
|
|
155
|
+
t.direction === "horizontal" ? `kb-divider--content-${t.contentPosition}` : ""
|
|
156
|
+
]);
|
|
157
|
+
return (t, n) => (_(), o("div", {
|
|
158
|
+
class: p(r.value),
|
|
159
|
+
role: "separator"
|
|
160
|
+
}, [e.direction === "horizontal" && t.$slots.default ? (_(), o("span", ie, [S(t.$slots, "default")])) : a("", !0)], 2));
|
|
161
|
+
}
|
|
162
|
+
}), oe = Symbol("kbRowGutter"), P = /* @__PURE__ */ u({
|
|
163
|
+
name: "KbRow",
|
|
164
|
+
__name: "Row",
|
|
165
|
+
props: {
|
|
166
|
+
gutter: { default: 0 },
|
|
167
|
+
justify: { default: "start" },
|
|
168
|
+
align: { default: "top" }
|
|
169
|
+
},
|
|
170
|
+
setup(e) {
|
|
171
|
+
let t = e;
|
|
172
|
+
v(oe, n(() => t.gutter));
|
|
173
|
+
let r = n(() => [
|
|
174
|
+
"kb-row",
|
|
175
|
+
`kb-row--${t.justify}`,
|
|
176
|
+
`kb-row--align-${t.align}`
|
|
177
|
+
]), i = n(() => {
|
|
178
|
+
if (!t.gutter) return;
|
|
179
|
+
let e = `${t.gutter / 2}px`;
|
|
180
|
+
return {
|
|
181
|
+
marginLeft: `-${e}`,
|
|
182
|
+
marginRight: `-${e}`
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
return (e, t) => (_(), o("div", {
|
|
186
|
+
class: p(r.value),
|
|
187
|
+
style: m(i.value)
|
|
188
|
+
}, [S(e.$slots, "default")], 6));
|
|
189
|
+
}
|
|
190
|
+
}), F = /* @__PURE__ */ u({
|
|
191
|
+
name: "KbCol",
|
|
192
|
+
__name: "Col",
|
|
193
|
+
props: {
|
|
194
|
+
span: { default: 24 },
|
|
195
|
+
offset: { default: 0 }
|
|
196
|
+
},
|
|
197
|
+
setup(e) {
|
|
198
|
+
let t = e, r = d(oe, n(() => 0)), i = n(() => [
|
|
199
|
+
"kb-col",
|
|
200
|
+
`kb-col-${t.span}`,
|
|
201
|
+
t.offset ? `kb-col-offset-${t.offset}` : ""
|
|
202
|
+
]), a = n(() => {
|
|
203
|
+
if (!r.value) return;
|
|
204
|
+
let e = `${r.value / 2}px`;
|
|
205
|
+
return {
|
|
206
|
+
paddingLeft: e,
|
|
207
|
+
paddingRight: e
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
return (e, t) => (_(), o("div", {
|
|
211
|
+
class: p(i.value),
|
|
212
|
+
style: m(a.value)
|
|
213
|
+
}, [S(e.$slots, "default")], 6));
|
|
214
|
+
}
|
|
215
|
+
}), se = [
|
|
216
|
+
"type",
|
|
217
|
+
"value",
|
|
218
|
+
"placeholder",
|
|
219
|
+
"disabled",
|
|
220
|
+
"readonly"
|
|
221
|
+
], I = /* @__PURE__ */ u({
|
|
222
|
+
name: "KbInput",
|
|
223
|
+
__name: "Input",
|
|
224
|
+
props: {
|
|
225
|
+
modelValue: { default: "" },
|
|
226
|
+
type: { default: "text" },
|
|
227
|
+
placeholder: {},
|
|
228
|
+
disabled: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
default: !1
|
|
231
|
+
},
|
|
232
|
+
readonly: {
|
|
233
|
+
type: Boolean,
|
|
234
|
+
default: !1
|
|
235
|
+
},
|
|
236
|
+
clearable: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
default: !1
|
|
239
|
+
},
|
|
240
|
+
size: { default: "medium" }
|
|
241
|
+
},
|
|
242
|
+
emits: [
|
|
243
|
+
"update:modelValue",
|
|
244
|
+
"change",
|
|
245
|
+
"focus",
|
|
246
|
+
"blur"
|
|
247
|
+
],
|
|
248
|
+
setup(e, { emit: t }) {
|
|
249
|
+
let r = e, i = t, c = b(!1), l = n(() => [
|
|
250
|
+
"kb-input",
|
|
251
|
+
`kb-input--${r.size}`,
|
|
252
|
+
{
|
|
253
|
+
"kb-input--disabled": r.disabled,
|
|
254
|
+
"kb-input--focused": c.value,
|
|
255
|
+
"kb-input--clearable": r.clearable
|
|
256
|
+
}
|
|
257
|
+
]);
|
|
258
|
+
function u(e) {
|
|
259
|
+
let t = e.target.value;
|
|
260
|
+
i("update:modelValue", t);
|
|
261
|
+
}
|
|
262
|
+
function d(e) {
|
|
263
|
+
i("change", e.target.value);
|
|
264
|
+
}
|
|
265
|
+
return (t, n) => (_(), o("div", { class: p(l.value) }, [s("input", {
|
|
266
|
+
class: "kb-input__inner",
|
|
267
|
+
type: e.type,
|
|
268
|
+
value: e.modelValue,
|
|
269
|
+
placeholder: e.placeholder,
|
|
270
|
+
disabled: e.disabled,
|
|
271
|
+
readonly: e.readonly,
|
|
272
|
+
onInput: u,
|
|
273
|
+
onChange: d,
|
|
274
|
+
onFocus: n[0] ||= (e) => {
|
|
275
|
+
c.value = !0, t.$emit("focus", e);
|
|
276
|
+
},
|
|
277
|
+
onBlur: n[1] ||= (e) => {
|
|
278
|
+
c.value = !1, t.$emit("blur", e);
|
|
279
|
+
}
|
|
280
|
+
}, null, 40, se), e.clearable && e.modelValue && !e.disabled ? (_(), o("button", {
|
|
281
|
+
key: 0,
|
|
282
|
+
class: "kb-input__clear",
|
|
283
|
+
type: "button",
|
|
284
|
+
"aria-label": "clear",
|
|
285
|
+
onClick: n[2] ||= (e) => i("update:modelValue", "")
|
|
286
|
+
}, " × ")) : a("", !0)], 2));
|
|
287
|
+
}
|
|
288
|
+
}), ce = ["checked", "disabled"], le = {
|
|
289
|
+
key: 0,
|
|
290
|
+
class: "kb-checkbox__label"
|
|
291
|
+
}, L = /* @__PURE__ */ u({
|
|
292
|
+
name: "KbCheckbox",
|
|
293
|
+
__name: "Checkbox",
|
|
294
|
+
props: {
|
|
295
|
+
modelValue: {
|
|
296
|
+
type: Boolean,
|
|
297
|
+
default: !1
|
|
298
|
+
},
|
|
299
|
+
disabled: {
|
|
300
|
+
type: Boolean,
|
|
301
|
+
default: !1
|
|
302
|
+
},
|
|
303
|
+
label: {}
|
|
304
|
+
},
|
|
305
|
+
emits: ["update:modelValue", "change"],
|
|
306
|
+
setup(e, { emit: t }) {
|
|
307
|
+
let r = e, i = t, l = n(() => ["kb-checkbox", {
|
|
308
|
+
"kb-checkbox--checked": r.modelValue,
|
|
309
|
+
"kb-checkbox--disabled": r.disabled
|
|
310
|
+
}]);
|
|
311
|
+
function u(e) {
|
|
312
|
+
let t = e.target.checked;
|
|
313
|
+
i("update:modelValue", t), i("change", t);
|
|
314
|
+
}
|
|
315
|
+
return (t, n) => (_(), o("label", { class: p(l.value) }, [
|
|
316
|
+
s("input", {
|
|
317
|
+
class: "kb-checkbox__input",
|
|
318
|
+
type: "checkbox",
|
|
319
|
+
checked: e.modelValue,
|
|
320
|
+
disabled: e.disabled,
|
|
321
|
+
onChange: u
|
|
322
|
+
}, null, 40, ce),
|
|
323
|
+
n[0] ||= s("span", { class: "kb-checkbox__inner" }, null, -1),
|
|
324
|
+
e.label || t.$slots.default ? (_(), o("span", le, [S(t.$slots, "default", {}, () => [c(w(e.label), 1)])])) : a("", !0)
|
|
325
|
+
], 2));
|
|
326
|
+
}
|
|
327
|
+
}), ue = ["checked", "disabled"], de = { class: "kb-radio__label" }, R = /* @__PURE__ */ u({
|
|
328
|
+
name: "KbRadio",
|
|
329
|
+
__name: "Radio",
|
|
330
|
+
props: {
|
|
331
|
+
modelValue: {
|
|
332
|
+
type: [
|
|
333
|
+
String,
|
|
334
|
+
Number,
|
|
335
|
+
Boolean
|
|
336
|
+
],
|
|
337
|
+
default: void 0
|
|
338
|
+
},
|
|
339
|
+
value: { type: [
|
|
340
|
+
String,
|
|
341
|
+
Number,
|
|
342
|
+
Boolean
|
|
343
|
+
] },
|
|
344
|
+
disabled: {
|
|
345
|
+
type: Boolean,
|
|
346
|
+
default: !1
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
emits: ["update:modelValue", "change"],
|
|
350
|
+
setup(e, { emit: t }) {
|
|
351
|
+
let r = e, i = t, a = n(() => ["kb-radio", {
|
|
352
|
+
"kb-radio--checked": r.modelValue === r.value,
|
|
353
|
+
"kb-radio--disabled": r.disabled
|
|
354
|
+
}]);
|
|
355
|
+
function c() {
|
|
356
|
+
i("update:modelValue", r.value), i("change", r.value);
|
|
357
|
+
}
|
|
358
|
+
return (t, n) => (_(), o("label", { class: p(a.value) }, [
|
|
359
|
+
s("input", {
|
|
360
|
+
class: "kb-radio__input",
|
|
361
|
+
type: "radio",
|
|
362
|
+
checked: e.modelValue === e.value,
|
|
363
|
+
disabled: e.disabled,
|
|
364
|
+
onChange: c
|
|
365
|
+
}, null, 40, ue),
|
|
366
|
+
n[0] ||= s("span", { class: "kb-radio__inner" }, null, -1),
|
|
367
|
+
s("span", de, [S(t.$slots, "default")])
|
|
368
|
+
], 2));
|
|
369
|
+
}
|
|
370
|
+
}), fe = ["aria-checked", "disabled"], z = /* @__PURE__ */ u({
|
|
371
|
+
name: "KbSwitch",
|
|
372
|
+
__name: "Switch",
|
|
373
|
+
props: {
|
|
374
|
+
modelValue: {
|
|
375
|
+
type: Boolean,
|
|
376
|
+
default: !1
|
|
377
|
+
},
|
|
378
|
+
disabled: {
|
|
379
|
+
type: Boolean,
|
|
380
|
+
default: !1
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
emits: ["update:modelValue", "change"],
|
|
384
|
+
setup(e, { emit: t }) {
|
|
385
|
+
let r = e, i = t, a = n(() => ["kb-switch", {
|
|
386
|
+
"kb-switch--checked": r.modelValue,
|
|
387
|
+
"kb-switch--disabled": r.disabled
|
|
388
|
+
}]);
|
|
389
|
+
function c() {
|
|
390
|
+
if (r.disabled) return;
|
|
391
|
+
let e = !r.modelValue;
|
|
392
|
+
i("update:modelValue", e), i("change", e);
|
|
393
|
+
}
|
|
394
|
+
return (t, n) => (_(), o("button", {
|
|
395
|
+
class: p(a.value),
|
|
396
|
+
type: "button",
|
|
397
|
+
role: "switch",
|
|
398
|
+
"aria-checked": e.modelValue,
|
|
399
|
+
disabled: e.disabled,
|
|
400
|
+
onClick: c
|
|
401
|
+
}, [...n[0] ||= [s("span", { class: "kb-switch__dot" }, null, -1)]], 10, fe));
|
|
402
|
+
}
|
|
403
|
+
}), pe = ["aria-expanded", "aria-activedescendant"], me = [
|
|
404
|
+
"id",
|
|
405
|
+
"aria-selected",
|
|
406
|
+
"aria-disabled",
|
|
407
|
+
"onClick"
|
|
408
|
+
], B = /* @__PURE__ */ u({
|
|
409
|
+
name: "KbSelect",
|
|
410
|
+
__name: "Select",
|
|
411
|
+
props: {
|
|
412
|
+
modelValue: { default: void 0 },
|
|
413
|
+
options: {},
|
|
414
|
+
placeholder: { default: "" },
|
|
415
|
+
disabled: {
|
|
416
|
+
type: Boolean,
|
|
417
|
+
default: !1
|
|
418
|
+
},
|
|
419
|
+
size: { default: "medium" }
|
|
420
|
+
},
|
|
421
|
+
emits: ["update:modelValue", "change"],
|
|
422
|
+
setup(t, { emit: r }) {
|
|
423
|
+
let i = t, c = r, l = b(!1), u = b(null), d = `kb-select-${Math.random().toString(36).slice(2, 8)}`, m = b(-1), v = n(() => i.options.find((e) => e.value === i.modelValue)?.label ?? ""), y = n(() => i.options.reduce((e, t, n) => (t.disabled || e.push(n), e), [])), S = n(() => l.value && m.value >= 0 ? `${d}-opt-${m.value}` : void 0), C = n(() => [
|
|
424
|
+
"kb-select",
|
|
425
|
+
`kb-select--${i.size}`,
|
|
426
|
+
{
|
|
427
|
+
"kb-select--open": l.value,
|
|
428
|
+
"kb-select--disabled": i.disabled
|
|
429
|
+
}
|
|
430
|
+
]);
|
|
431
|
+
function T() {
|
|
432
|
+
f(() => {
|
|
433
|
+
document.getElementById(S.value ?? "")?.scrollIntoView?.({ block: "nearest" });
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function E(e) {
|
|
437
|
+
l.value = !0;
|
|
438
|
+
let t = i.options.findIndex((e) => e.value === i.modelValue);
|
|
439
|
+
e === "selected" && t >= 0 && !i.options[t].disabled ? m.value = t : m.value = y.value[0] ?? -1, T();
|
|
440
|
+
}
|
|
441
|
+
function D() {
|
|
442
|
+
l.value = !1, m.value = -1;
|
|
443
|
+
}
|
|
444
|
+
function O() {
|
|
445
|
+
i.disabled || (l.value ? D() : E("selected"));
|
|
446
|
+
}
|
|
447
|
+
function k(e) {
|
|
448
|
+
if (!y.value.length) return;
|
|
449
|
+
let t = m.value;
|
|
450
|
+
do
|
|
451
|
+
t += e;
|
|
452
|
+
while (t >= 0 && t < i.options.length && i.options[t].disabled);
|
|
453
|
+
t >= 0 && t < i.options.length && (m.value = t, T());
|
|
454
|
+
}
|
|
455
|
+
function A(e) {
|
|
456
|
+
let t = y.value;
|
|
457
|
+
t.length && (m.value = e ? t[t.length - 1] : t[0], T());
|
|
458
|
+
}
|
|
459
|
+
function ee() {
|
|
460
|
+
let e = i.options[m.value];
|
|
461
|
+
e && M(e);
|
|
462
|
+
}
|
|
463
|
+
function j(e) {
|
|
464
|
+
if (!i.disabled) switch (e.key) {
|
|
465
|
+
case "Enter":
|
|
466
|
+
case " ":
|
|
467
|
+
e.preventDefault(), l.value ? ee() : E("selected");
|
|
468
|
+
break;
|
|
469
|
+
case "ArrowDown":
|
|
470
|
+
e.preventDefault(), l.value ? k(1) : E("selected");
|
|
471
|
+
break;
|
|
472
|
+
case "ArrowUp":
|
|
473
|
+
e.preventDefault(), l.value ? k(-1) : E("selected");
|
|
474
|
+
break;
|
|
475
|
+
case "Home":
|
|
476
|
+
e.preventDefault(), l.value && A(!1);
|
|
477
|
+
break;
|
|
478
|
+
case "End":
|
|
479
|
+
e.preventDefault(), l.value && A(!0);
|
|
480
|
+
break;
|
|
481
|
+
case "Escape":
|
|
482
|
+
e.preventDefault(), D();
|
|
483
|
+
break;
|
|
484
|
+
case "Tab": D();
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function M(e) {
|
|
488
|
+
e.disabled || (c("update:modelValue", e.value), c("change", e.value), D());
|
|
489
|
+
}
|
|
490
|
+
function te(e) {
|
|
491
|
+
u.value && !u.value.contains(e.target) && D();
|
|
492
|
+
}
|
|
493
|
+
return g(() => document.addEventListener("click", te)), h(() => document.removeEventListener("click", te)), (n, r) => (_(), o("div", {
|
|
494
|
+
ref_key: "triggerEl",
|
|
495
|
+
ref: u,
|
|
496
|
+
class: p(C.value)
|
|
497
|
+
}, [s("div", {
|
|
498
|
+
class: "kb-select__trigger",
|
|
499
|
+
role: "combobox",
|
|
500
|
+
tabindex: "0",
|
|
501
|
+
"aria-haspopup": "listbox",
|
|
502
|
+
"aria-expanded": l.value,
|
|
503
|
+
"aria-controls": d,
|
|
504
|
+
"aria-activedescendant": S.value,
|
|
505
|
+
onClick: O,
|
|
506
|
+
onKeydown: j
|
|
507
|
+
}, [s("span", { class: p(["kb-select__value", { "kb-select__placeholder": !v.value }]) }, w(v.value || t.placeholder), 3), r[0] ||= s("span", {
|
|
508
|
+
class: "kb-select__arrow",
|
|
509
|
+
"aria-hidden": "true"
|
|
510
|
+
}, "▾", -1)], 40, pe), l.value ? (_(), o("div", {
|
|
511
|
+
key: 0,
|
|
512
|
+
id: d,
|
|
513
|
+
class: "kb-select__panel",
|
|
514
|
+
role: "listbox"
|
|
515
|
+
}, [(_(!0), o(e, null, x(t.options, (e, n) => (_(), o("div", {
|
|
516
|
+
id: `${d}-opt-${n}`,
|
|
517
|
+
key: e.value,
|
|
518
|
+
class: p(["kb-select__option", {
|
|
519
|
+
"kb-select__option--active": n === m.value,
|
|
520
|
+
"kb-select__option--selected": e.value === t.modelValue,
|
|
521
|
+
"kb-select__option--disabled": e.disabled
|
|
522
|
+
}]),
|
|
523
|
+
role: "option",
|
|
524
|
+
"aria-selected": e.value === t.modelValue,
|
|
525
|
+
"aria-disabled": e.disabled || void 0,
|
|
526
|
+
onClick: (t) => M(e)
|
|
527
|
+
}, w(e.label), 11, me))), 128))])) : a("", !0)], 2));
|
|
528
|
+
}
|
|
529
|
+
}), V = /* @__PURE__ */ u({
|
|
530
|
+
name: "KbTooltip",
|
|
531
|
+
__name: "Tooltip",
|
|
532
|
+
props: {
|
|
533
|
+
content: { default: "" },
|
|
534
|
+
placement: { default: "top" },
|
|
535
|
+
trigger: { default: "hover" },
|
|
536
|
+
disabled: {
|
|
537
|
+
type: Boolean,
|
|
538
|
+
default: !1
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
setup(e) {
|
|
542
|
+
let t = e, r = b(!1), i = n(() => ["kb-tooltip__popper", `kb-tooltip__popper--${t.placement}`]);
|
|
543
|
+
function s() {
|
|
544
|
+
t.disabled || (r.value = !0);
|
|
545
|
+
}
|
|
546
|
+
function c() {
|
|
547
|
+
r.value = !1;
|
|
548
|
+
}
|
|
549
|
+
function l() {
|
|
550
|
+
t.disabled || (r.value = !r.value);
|
|
551
|
+
}
|
|
552
|
+
return (t, n) => (_(), o("span", {
|
|
553
|
+
class: "kb-tooltip",
|
|
554
|
+
onMouseenter: n[0] ||= (t) => e.trigger === "hover" && s(),
|
|
555
|
+
onMouseleave: n[1] ||= (t) => e.trigger === "hover" && c(),
|
|
556
|
+
onClick: n[2] ||= (t) => e.trigger === "click" && l()
|
|
557
|
+
}, [S(t.$slots, "default"), r.value ? (_(), o("div", {
|
|
558
|
+
key: 0,
|
|
559
|
+
class: p(i.value),
|
|
560
|
+
role: "tooltip"
|
|
561
|
+
}, w(e.content), 3)) : a("", !0)], 32));
|
|
562
|
+
}
|
|
563
|
+
}), he = ["aria-label"], ge = {
|
|
564
|
+
key: 0,
|
|
565
|
+
class: "kb-dialog__header"
|
|
566
|
+
}, _e = { class: "kb-dialog__body" }, ve = {
|
|
567
|
+
key: 1,
|
|
568
|
+
class: "kb-dialog__footer"
|
|
569
|
+
}, H = /* @__PURE__ */ u({
|
|
570
|
+
name: "KbDialog",
|
|
571
|
+
__name: "Dialog",
|
|
572
|
+
props: {
|
|
573
|
+
modelValue: {
|
|
574
|
+
type: Boolean,
|
|
575
|
+
default: !1
|
|
576
|
+
},
|
|
577
|
+
title: { default: "" },
|
|
578
|
+
width: { default: 480 },
|
|
579
|
+
closeOnClickOverlay: {
|
|
580
|
+
type: Boolean,
|
|
581
|
+
default: !0
|
|
582
|
+
},
|
|
583
|
+
closeOnEsc: {
|
|
584
|
+
type: Boolean,
|
|
585
|
+
default: !0
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
emits: ["update:modelValue", "close"],
|
|
589
|
+
setup(e, { emit: r }) {
|
|
590
|
+
let c = e, l = r, u = b(null), d = b(null), p = n(() => ({ width: typeof c.width == "number" ? `${c.width}px` : c.width }));
|
|
591
|
+
function v() {
|
|
592
|
+
l("update:modelValue", !1), l("close");
|
|
593
|
+
}
|
|
594
|
+
function y() {
|
|
595
|
+
c.closeOnClickOverlay && v();
|
|
596
|
+
}
|
|
597
|
+
O(() => c.modelValue, (e) => {
|
|
598
|
+
e ? (d.value = document.activeElement, f(() => u.value?.focus())) : d.value?.isConnected && d.value.focus();
|
|
599
|
+
});
|
|
600
|
+
function x(e) {
|
|
601
|
+
c.closeOnEsc && e.key === "Escape" && c.modelValue && v();
|
|
602
|
+
}
|
|
603
|
+
return g(() => document.addEventListener("keydown", x)), h(() => document.removeEventListener("keydown", x)), (n, r) => (_(), i(t, { to: "body" }, [e.modelValue ? (_(), o("div", {
|
|
604
|
+
key: 0,
|
|
605
|
+
class: "kb-dialog-overlay",
|
|
606
|
+
onClick: A(y, ["self"])
|
|
607
|
+
}, [s("div", {
|
|
608
|
+
ref_key: "dialogRef",
|
|
609
|
+
ref: u,
|
|
610
|
+
class: "kb-dialog",
|
|
611
|
+
style: m(p.value),
|
|
612
|
+
role: "dialog",
|
|
613
|
+
"aria-modal": "true",
|
|
614
|
+
"aria-label": e.title || "对话框",
|
|
615
|
+
tabindex: "-1"
|
|
616
|
+
}, [
|
|
617
|
+
e.title ? (_(), o("header", ge, w(e.title), 1)) : a("", !0),
|
|
618
|
+
s("div", _e, [S(n.$slots, "default")]),
|
|
619
|
+
n.$slots.footer ? (_(), o("footer", ve, [S(n.$slots, "footer")])) : a("", !0)
|
|
620
|
+
], 12, he)])) : a("", !0)]));
|
|
621
|
+
}
|
|
622
|
+
}), ye = { class: "kb-message__content" }, be = /* @__PURE__ */ u({
|
|
623
|
+
name: "KbMessage",
|
|
624
|
+
__name: "Message",
|
|
625
|
+
props: {
|
|
626
|
+
type: { default: "info" },
|
|
627
|
+
content: { default: "" }
|
|
628
|
+
},
|
|
629
|
+
setup(e) {
|
|
630
|
+
let t = e, r = {
|
|
631
|
+
success: "success",
|
|
632
|
+
error: "error",
|
|
633
|
+
info: "info",
|
|
634
|
+
warning: "warning"
|
|
635
|
+
}, i = n(() => r[t.type]);
|
|
636
|
+
return (t, n) => (_(), o("div", {
|
|
637
|
+
class: p(["kb-message", `kb-message--${e.type}`]),
|
|
638
|
+
role: "status"
|
|
639
|
+
}, [l(T(N), {
|
|
640
|
+
name: i.value,
|
|
641
|
+
size: 16
|
|
642
|
+
}, null, 8, ["name"]), s("span", ye, w(e.content), 1)], 2));
|
|
643
|
+
}
|
|
644
|
+
}), U = null;
|
|
645
|
+
function xe(e) {
|
|
646
|
+
(!U || !U.isConnected) && (U = document.createElement("div"), document.body.appendChild(U));
|
|
647
|
+
let t = document.createElement("div");
|
|
648
|
+
U.appendChild(t);
|
|
649
|
+
let n = r(be, {
|
|
650
|
+
type: e.type ?? "info",
|
|
651
|
+
content: e.content
|
|
652
|
+
});
|
|
653
|
+
n.mount(t);
|
|
654
|
+
let i = !1, a = () => {
|
|
655
|
+
i || (i = !0, n.unmount(), t.remove(), U && U.childElementCount === 0 && (U.remove(), U = null));
|
|
656
|
+
}, o = e.duration ?? 3e3;
|
|
657
|
+
return o > 0 && setTimeout(a, o), a;
|
|
658
|
+
}
|
|
659
|
+
function W(e) {
|
|
660
|
+
return (t, n) => xe({
|
|
661
|
+
type: e,
|
|
662
|
+
content: t,
|
|
663
|
+
duration: n
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
var Se = {
|
|
667
|
+
success: W("success"),
|
|
668
|
+
error: W("error"),
|
|
669
|
+
info: W("info"),
|
|
670
|
+
warning: W("warning"),
|
|
671
|
+
show: (e, t) => xe({
|
|
672
|
+
content: e,
|
|
673
|
+
...t
|
|
674
|
+
})
|
|
675
|
+
}, G = /* @__PURE__ */ u({
|
|
676
|
+
name: "KbTable",
|
|
677
|
+
__name: "Table",
|
|
678
|
+
props: {
|
|
679
|
+
data: {},
|
|
680
|
+
columns: {},
|
|
681
|
+
stripe: {
|
|
682
|
+
type: Boolean,
|
|
683
|
+
default: !1
|
|
684
|
+
},
|
|
685
|
+
border: {
|
|
686
|
+
type: Boolean,
|
|
687
|
+
default: !1
|
|
688
|
+
},
|
|
689
|
+
rowKey: { default: void 0 }
|
|
690
|
+
},
|
|
691
|
+
setup(t) {
|
|
692
|
+
let r = t;
|
|
693
|
+
function i(e, t) {
|
|
694
|
+
return r.rowKey ? String(e[r.rowKey]) : String(t);
|
|
695
|
+
}
|
|
696
|
+
let a = n(() => ["kb-table", {
|
|
697
|
+
"kb-table--stripe": r.stripe,
|
|
698
|
+
"kb-table--border": r.border
|
|
699
|
+
}]);
|
|
700
|
+
function l(e) {
|
|
701
|
+
if (e.width) return { width: typeof e.width == "number" ? `${e.width}px` : e.width };
|
|
702
|
+
}
|
|
703
|
+
return (n, r) => (_(), o("table", { class: p(a.value) }, [s("thead", null, [s("tr", null, [(_(!0), o(e, null, x(t.columns, (e) => (_(), o("th", {
|
|
704
|
+
key: e.prop,
|
|
705
|
+
style: m(l(e))
|
|
706
|
+
}, w(e.label), 5))), 128))])]), s("tbody", null, [(_(!0), o(e, null, x(t.data, (r, a) => (_(), o("tr", { key: i(r, a) }, [(_(!0), o(e, null, x(t.columns, (e) => (_(), o("td", { key: e.prop }, [S(n.$slots, "cell", {
|
|
707
|
+
row: r,
|
|
708
|
+
column: e,
|
|
709
|
+
index: a
|
|
710
|
+
}, () => [c(w(r[e.prop]), 1)])]))), 128))]))), 128))])], 2));
|
|
711
|
+
}
|
|
712
|
+
}), K = /* @__PURE__ */ u({
|
|
713
|
+
name: "KbBadge",
|
|
714
|
+
__name: "Badge",
|
|
715
|
+
props: {
|
|
716
|
+
content: { default: "" },
|
|
717
|
+
dot: {
|
|
718
|
+
type: Boolean,
|
|
719
|
+
default: !1
|
|
720
|
+
},
|
|
721
|
+
max: { default: 99 },
|
|
722
|
+
color: { default: void 0 }
|
|
723
|
+
},
|
|
724
|
+
setup(e) {
|
|
725
|
+
let t = e, r = D(), i = n(() => !!r.default), a = n(() => {
|
|
726
|
+
if (t.dot) return "";
|
|
727
|
+
let e = Number(t.content);
|
|
728
|
+
return !Number.isNaN(e) && e > t.max ? `${t.max}+` : String(t.content);
|
|
729
|
+
}), c = n(() => ["kb-badge", { "kb-badge--independent": !i.value }]), l = n(() => t.color ? { background: t.color } : void 0);
|
|
730
|
+
return (t, n) => (_(), o("span", { class: p(c.value) }, [S(t.$slots, "default"), s("span", {
|
|
731
|
+
class: p(["kb-badge__content", { "kb-badge__content--dot": e.dot }]),
|
|
732
|
+
style: m(l.value)
|
|
733
|
+
}, w(a.value), 7)], 2));
|
|
734
|
+
}
|
|
735
|
+
}), Ce = ["src", "alt"], we = {
|
|
736
|
+
key: 1,
|
|
737
|
+
class: "kb-avatar__fallback"
|
|
738
|
+
}, q = /* @__PURE__ */ u({
|
|
739
|
+
name: "KbAvatar",
|
|
740
|
+
__name: "Avatar",
|
|
741
|
+
props: {
|
|
742
|
+
src: { default: "" },
|
|
743
|
+
alt: { default: "" },
|
|
744
|
+
fallback: { default: "" },
|
|
745
|
+
size: { default: "medium" },
|
|
746
|
+
round: {
|
|
747
|
+
type: Boolean,
|
|
748
|
+
default: !1
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
setup(e) {
|
|
752
|
+
let t = e, r = {
|
|
753
|
+
small: "28px",
|
|
754
|
+
medium: "40px",
|
|
755
|
+
large: "56px"
|
|
756
|
+
}, a = n(() => [
|
|
757
|
+
"kb-avatar",
|
|
758
|
+
typeof t.size == "string" ? `kb-avatar--${t.size}` : "",
|
|
759
|
+
{ "kb-avatar--round": t.round }
|
|
760
|
+
]), s = n(() => {
|
|
761
|
+
if (typeof t.size == "number") return {
|
|
762
|
+
width: `${t.size}px`,
|
|
763
|
+
height: `${t.size}px`,
|
|
764
|
+
fontSize: `${t.size / 2}px`
|
|
765
|
+
};
|
|
766
|
+
let e = r[t.size];
|
|
767
|
+
return {
|
|
768
|
+
width: e,
|
|
769
|
+
height: e
|
|
770
|
+
};
|
|
771
|
+
}), c = n(() => !!t.src), l = n(() => !t.src && !!t.fallback);
|
|
772
|
+
return (t, n) => (_(), o("span", {
|
|
773
|
+
class: p(a.value),
|
|
774
|
+
style: m(s.value)
|
|
775
|
+
}, [c.value ? (_(), o("img", {
|
|
776
|
+
key: 0,
|
|
777
|
+
class: "kb-avatar__img",
|
|
778
|
+
src: e.src,
|
|
779
|
+
alt: e.alt
|
|
780
|
+
}, null, 8, Ce)) : l.value ? (_(), o("span", we, w(e.fallback), 1)) : (_(), i(T(N), {
|
|
781
|
+
key: 2,
|
|
782
|
+
class: "kb-avatar__icon",
|
|
783
|
+
name: "menu",
|
|
784
|
+
size: "50%"
|
|
785
|
+
}))], 6));
|
|
786
|
+
}
|
|
787
|
+
}), Te = { class: "kb-progress" }, Ee = { class: "kb-progress__track" }, De = {
|
|
788
|
+
key: 0,
|
|
789
|
+
class: "kb-progress__text"
|
|
790
|
+
}, J = /* @__PURE__ */ u({
|
|
791
|
+
name: "KbProgress",
|
|
792
|
+
__name: "Progress",
|
|
793
|
+
props: {
|
|
794
|
+
percentage: { default: 0 },
|
|
795
|
+
strokeWidth: { default: 8 },
|
|
796
|
+
color: { default: void 0 },
|
|
797
|
+
showText: {
|
|
798
|
+
type: Boolean,
|
|
799
|
+
default: !0
|
|
800
|
+
},
|
|
801
|
+
status: { default: "normal" }
|
|
802
|
+
},
|
|
803
|
+
setup(e) {
|
|
804
|
+
let t = e, r = n(() => Math.min(100, Math.max(0, t.percentage))), i = n(() => ["kb-progress__bar", `kb-progress__bar--${t.status}`]), c = n(() => ({
|
|
805
|
+
width: `${r.value}%`,
|
|
806
|
+
height: `${t.strokeWidth}px`,
|
|
807
|
+
...t.color ? { background: t.color } : {}
|
|
808
|
+
}));
|
|
809
|
+
return (t, n) => (_(), o("div", Te, [s("div", Ee, [s("div", {
|
|
810
|
+
class: p(i.value),
|
|
811
|
+
style: m(c.value)
|
|
812
|
+
}, null, 6)]), e.showText ? (_(), o("span", De, w(r.value) + "%", 1)) : a("", !0)]));
|
|
813
|
+
}
|
|
814
|
+
}), Oe = {
|
|
815
|
+
key: 0,
|
|
816
|
+
class: "kb-card__header"
|
|
817
|
+
}, ke = { class: "kb-card__body" }, Ae = {
|
|
818
|
+
key: 1,
|
|
819
|
+
class: "kb-card__footer"
|
|
820
|
+
}, Y = /* @__PURE__ */ u({
|
|
821
|
+
name: "KbCard",
|
|
822
|
+
__name: "Card",
|
|
823
|
+
props: {
|
|
824
|
+
title: { default: "" },
|
|
825
|
+
shadow: { default: "always" }
|
|
826
|
+
},
|
|
827
|
+
setup(e) {
|
|
828
|
+
let t = e, r = n(() => ["kb-card", `kb-card--shadow-${t.shadow}`]);
|
|
829
|
+
return (t, n) => (_(), o("div", { class: p(r.value) }, [
|
|
830
|
+
e.title ? (_(), o("header", Oe, w(e.title), 1)) : a("", !0),
|
|
831
|
+
s("div", ke, [S(t.$slots, "default")]),
|
|
832
|
+
t.$slots.footer ? (_(), o("footer", Ae, [S(t.$slots, "footer")])) : a("", !0)
|
|
833
|
+
], 2));
|
|
834
|
+
}
|
|
835
|
+
}), je = { class: "kb-alert__main" }, Me = {
|
|
836
|
+
key: 0,
|
|
837
|
+
class: "kb-alert__title"
|
|
838
|
+
}, Ne = {
|
|
839
|
+
key: 1,
|
|
840
|
+
class: "kb-alert__content"
|
|
841
|
+
}, Pe = /* @__PURE__ */ u({
|
|
842
|
+
name: "KbAlert",
|
|
843
|
+
__name: "Alert",
|
|
844
|
+
props: {
|
|
845
|
+
type: { default: "info" },
|
|
846
|
+
title: { default: "" },
|
|
847
|
+
closable: {
|
|
848
|
+
type: Boolean,
|
|
849
|
+
default: !1
|
|
850
|
+
},
|
|
851
|
+
showIcon: {
|
|
852
|
+
type: Boolean,
|
|
853
|
+
default: !1
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
setup(e) {
|
|
857
|
+
let t = e, r = b(!0), c = {
|
|
858
|
+
info: "info",
|
|
859
|
+
success: "success",
|
|
860
|
+
warning: "warning",
|
|
861
|
+
danger: "error"
|
|
862
|
+
}, l = n(() => [
|
|
863
|
+
"kb-alert",
|
|
864
|
+
`kb-alert--${t.type}`,
|
|
865
|
+
{ "kb-alert--hidden": !r.value }
|
|
866
|
+
]);
|
|
867
|
+
function u() {
|
|
868
|
+
r.value = !1;
|
|
869
|
+
}
|
|
870
|
+
return (t, n) => r.value ? (_(), o("div", {
|
|
871
|
+
key: 0,
|
|
872
|
+
class: p(l.value),
|
|
873
|
+
role: "alert"
|
|
874
|
+
}, [
|
|
875
|
+
e.showIcon ? (_(), i(T(N), {
|
|
876
|
+
key: 0,
|
|
877
|
+
name: c[e.type],
|
|
878
|
+
size: 18,
|
|
879
|
+
class: "kb-alert__icon"
|
|
880
|
+
}, null, 8, ["name"])) : a("", !0),
|
|
881
|
+
s("div", je, [e.title ? (_(), o("div", Me, w(e.title), 1)) : a("", !0), t.$slots.default ? (_(), o("div", Ne, [S(t.$slots, "default")])) : a("", !0)]),
|
|
882
|
+
e.closable ? (_(), o("button", {
|
|
883
|
+
key: 1,
|
|
884
|
+
class: "kb-alert__close",
|
|
885
|
+
type: "button",
|
|
886
|
+
"aria-label": "close",
|
|
887
|
+
onClick: u
|
|
888
|
+
}, " × ")) : a("", !0)
|
|
889
|
+
], 2)) : a("", !0);
|
|
890
|
+
}
|
|
891
|
+
}), Fe = /* @__PURE__ */ u({
|
|
892
|
+
name: "KbSkeleton",
|
|
893
|
+
__name: "Skeleton",
|
|
894
|
+
props: {
|
|
895
|
+
rows: { default: 3 },
|
|
896
|
+
animated: {
|
|
897
|
+
type: Boolean,
|
|
898
|
+
default: !0
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
setup(t) {
|
|
902
|
+
let r = t, i = n(() => ["kb-skeleton", { "kb-skeleton--animated": r.animated }]);
|
|
903
|
+
return (n, r) => n.$slots.default ? S(n.$slots, "default", {}, void 0, void 0, 1) : (_(), o("div", {
|
|
904
|
+
key: 0,
|
|
905
|
+
class: p(i.value)
|
|
906
|
+
}, [(_(!0), o(e, null, x(t.rows, (e) => (_(), o("div", {
|
|
907
|
+
key: e,
|
|
908
|
+
class: "kb-skeleton__item"
|
|
909
|
+
}))), 128))], 2));
|
|
910
|
+
}
|
|
911
|
+
}), Ie = { class: "kb-empty" }, Le = { class: "kb-empty__image" }, Re = { class: "kb-empty__description" }, ze = {
|
|
912
|
+
key: 0,
|
|
913
|
+
class: "kb-empty__action"
|
|
914
|
+
}, Be = /* @__PURE__ */ u({
|
|
915
|
+
name: "KbEmpty",
|
|
916
|
+
__name: "Empty",
|
|
917
|
+
props: { description: { default: "暂无数据" } },
|
|
918
|
+
setup(e) {
|
|
919
|
+
return (t, n) => (_(), o("div", Ie, [
|
|
920
|
+
s("div", Le, [S(t.$slots, "image", {}, () => [l(T(N), {
|
|
921
|
+
name: "menu",
|
|
922
|
+
size: 48
|
|
923
|
+
})])]),
|
|
924
|
+
s("p", Re, w(e.description), 1),
|
|
925
|
+
t.$slots.action ? (_(), o("div", ze, [S(t.$slots, "action")])) : a("", !0)
|
|
926
|
+
]));
|
|
927
|
+
}
|
|
928
|
+
}), Ve = {
|
|
929
|
+
class: "kb-breadcrumb",
|
|
930
|
+
"aria-label": "Breadcrumb"
|
|
931
|
+
}, He = ["href"], Ue = { key: 1 }, We = {
|
|
932
|
+
key: 0,
|
|
933
|
+
class: "kb-breadcrumb__separator"
|
|
934
|
+
}, Ge = /* @__PURE__ */ u({
|
|
935
|
+
name: "KbBreadcrumb",
|
|
936
|
+
__name: "Breadcrumb",
|
|
937
|
+
props: {
|
|
938
|
+
items: { default: () => [] },
|
|
939
|
+
separator: { default: "/" }
|
|
940
|
+
},
|
|
941
|
+
setup(t) {
|
|
942
|
+
let r = t, i = n(() => r.items);
|
|
943
|
+
return (n, r) => (_(), o("nav", Ve, [(_(!0), o(e, null, x(i.value, (n, r) => (_(), o(e, { key: r }, [s("span", { class: p(["kb-breadcrumb__item", { "kb-breadcrumb__item--current": r === i.value.length - 1 }]) }, [n.href && r < i.value.length - 1 ? (_(), o("a", {
|
|
944
|
+
key: 0,
|
|
945
|
+
href: n.href
|
|
946
|
+
}, w(n.label), 9, He)) : (_(), o("span", Ue, w(n.label), 1))], 2), r < i.value.length - 1 ? (_(), o("span", We, w(t.separator), 1)) : a("", !0)], 64))), 128))]));
|
|
947
|
+
}
|
|
948
|
+
}), Ke = { class: "kb-collapse" }, qe = ["onClick", "onKeydown"], Je = { class: "kb-collapse__title" }, Ye = {
|
|
949
|
+
key: 0,
|
|
950
|
+
class: "kb-collapse__content"
|
|
951
|
+
}, Xe = /* @__PURE__ */ u({
|
|
952
|
+
name: "KbCollapse",
|
|
953
|
+
__name: "Collapse",
|
|
954
|
+
props: {
|
|
955
|
+
items: { default: () => [] },
|
|
956
|
+
modelValue: { default: () => [] },
|
|
957
|
+
accordion: {
|
|
958
|
+
type: Boolean,
|
|
959
|
+
default: !1
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
emits: ["update:modelValue"],
|
|
963
|
+
setup(t, { emit: r }) {
|
|
964
|
+
let i = t, l = r, u = b([]);
|
|
965
|
+
O(() => i.modelValue, (e) => {
|
|
966
|
+
JSON.stringify(e) !== JSON.stringify(u.value) && (u.value = [...e]);
|
|
967
|
+
}, { immediate: !0 });
|
|
968
|
+
let d = n(() => u.value);
|
|
969
|
+
function f(e) {
|
|
970
|
+
return d.value.includes(String(e));
|
|
971
|
+
}
|
|
972
|
+
function m(e, t) {
|
|
973
|
+
if (t.disabled) return;
|
|
974
|
+
let n = String(e), r;
|
|
975
|
+
r = i.accordion ? f(e) ? [] : [n] : f(e) ? d.value.filter((e) => e !== n) : [...d.value, n], l("update:modelValue", r), u.value = r;
|
|
976
|
+
}
|
|
977
|
+
return (n, r) => (_(), o("div", Ke, [(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("div", {
|
|
978
|
+
key: t,
|
|
979
|
+
class: "kb-collapse__panel"
|
|
980
|
+
}, [s("div", {
|
|
981
|
+
class: p(["kb-collapse__header", { "kb-collapse__header--disabled": e.disabled }]),
|
|
982
|
+
role: "button",
|
|
983
|
+
tabindex: "0",
|
|
984
|
+
onClick: (n) => m(t, e),
|
|
985
|
+
onKeydown: k((n) => m(t, e), ["enter"])
|
|
986
|
+
}, [s("span", Je, w(e.title), 1), s("span", { class: p(["kb-collapse__arrow", { "kb-collapse__arrow--open": f(t) }]) }, "▾", 2)], 42, qe), f(t) ? (_(), o("div", Ye, [S(n.$slots, `item-${t}`, { item: e }, () => [c(w(e.content), 1)])])) : a("", !0)]))), 128))]));
|
|
987
|
+
}
|
|
988
|
+
}), Ze = { class: "kb-tabs" }, Qe = { class: "kb-tabs__nav" }, $e = ["aria-selected", "onClick"], et = { class: "kb-tabs__panel" }, tt = /* @__PURE__ */ u({
|
|
989
|
+
name: "KbTabs",
|
|
990
|
+
__name: "Tabs",
|
|
991
|
+
props: {
|
|
992
|
+
tabs: { default: () => [] },
|
|
993
|
+
modelValue: { default: "" }
|
|
994
|
+
},
|
|
995
|
+
emits: ["update:modelValue"],
|
|
996
|
+
setup(t, { emit: r }) {
|
|
997
|
+
let i = t, a = r, c = n(() => i.modelValue);
|
|
998
|
+
function l(e) {
|
|
999
|
+
e.disabled || a("update:modelValue", e.name);
|
|
1000
|
+
}
|
|
1001
|
+
return (n, r) => (_(), o("div", Ze, [s("div", Qe, [(_(!0), o(e, null, x(t.tabs, (e) => (_(), o("div", {
|
|
1002
|
+
key: e.name,
|
|
1003
|
+
class: p(["kb-tabs__tab", {
|
|
1004
|
+
"kb-tabs__tab--active": e.name === c.value,
|
|
1005
|
+
"kb-tabs__tab--disabled": e.disabled
|
|
1006
|
+
}]),
|
|
1007
|
+
role: "tab",
|
|
1008
|
+
"aria-selected": e.name === c.value,
|
|
1009
|
+
onClick: (t) => l(e)
|
|
1010
|
+
}, w(e.label), 11, $e))), 128))]), s("div", et, [S(n.$slots, "default")])]));
|
|
1011
|
+
}
|
|
1012
|
+
}), nt = {
|
|
1013
|
+
class: "kb-pagination",
|
|
1014
|
+
"aria-label": "Pagination"
|
|
1015
|
+
}, rt = { class: "kb-pagination__total" }, it = ["disabled"], at = ["onClick"], ot = {
|
|
1016
|
+
key: 1,
|
|
1017
|
+
class: "kb-pagination__more"
|
|
1018
|
+
}, st = ["disabled"], ct = /* @__PURE__ */ u({
|
|
1019
|
+
name: "KbPagination",
|
|
1020
|
+
__name: "Pagination",
|
|
1021
|
+
props: {
|
|
1022
|
+
total: {},
|
|
1023
|
+
pageSize: { default: 10 },
|
|
1024
|
+
currentPage: { default: 1 },
|
|
1025
|
+
pagerCount: { default: 7 }
|
|
1026
|
+
},
|
|
1027
|
+
emits: ["update:currentPage"],
|
|
1028
|
+
setup(t, { emit: r }) {
|
|
1029
|
+
let i = t, a = r, c = n(() => Math.max(1, Math.ceil(i.total / i.pageSize))), l = n(() => Math.min(i.currentPage, c.value)), u = n(() => {
|
|
1030
|
+
let e = c.value;
|
|
1031
|
+
if (e <= i.pagerCount) return Array.from({ length: e }, (e, t) => t + 1);
|
|
1032
|
+
let t = Math.floor(i.pagerCount / 2), n = Math.max(1, l.value - t), r = Math.min(e, n + i.pagerCount - 1);
|
|
1033
|
+
n = Math.max(1, r - i.pagerCount + 1);
|
|
1034
|
+
let a = [];
|
|
1035
|
+
n > 1 && (a.push(1), n > 2 && a.push("prev-more"));
|
|
1036
|
+
for (let e = n; e <= r; e++) a.push(e);
|
|
1037
|
+
return r < e && (r < e - 1 && a.push("next-more"), a.push(e)), a;
|
|
1038
|
+
});
|
|
1039
|
+
function d(e) {
|
|
1040
|
+
let t = Math.min(c.value, Math.max(1, e));
|
|
1041
|
+
t !== l.value && a("update:currentPage", t);
|
|
1042
|
+
}
|
|
1043
|
+
function f(e) {
|
|
1044
|
+
d(e === "prev" ? l.value - 1 : l.value + 1);
|
|
1045
|
+
}
|
|
1046
|
+
return (n, r) => (_(), o("nav", nt, [
|
|
1047
|
+
s("span", rt, "共 " + w(t.total) + " 条", 1),
|
|
1048
|
+
s("button", {
|
|
1049
|
+
class: "kb-pagination__prev",
|
|
1050
|
+
type: "button",
|
|
1051
|
+
disabled: l.value <= 1,
|
|
1052
|
+
"aria-label": "上一页",
|
|
1053
|
+
onClick: r[0] ||= (e) => f("prev")
|
|
1054
|
+
}, " ‹ ", 8, it),
|
|
1055
|
+
(_(!0), o(e, null, x(u.value, (t, n) => (_(), o(e, { key: n }, [typeof t == "number" ? (_(), o("button", {
|
|
1056
|
+
key: 0,
|
|
1057
|
+
class: p(["kb-pagination__item", { "kb-pagination__item--active": t === l.value }]),
|
|
1058
|
+
type: "button",
|
|
1059
|
+
onClick: (e) => d(t)
|
|
1060
|
+
}, w(t), 11, at)) : (_(), o("span", ot, "…"))], 64))), 128)),
|
|
1061
|
+
s("button", {
|
|
1062
|
+
class: "kb-pagination__next",
|
|
1063
|
+
type: "button",
|
|
1064
|
+
disabled: l.value >= c.value,
|
|
1065
|
+
"aria-label": "下一页",
|
|
1066
|
+
onClick: r[1] ||= (e) => f("next")
|
|
1067
|
+
}, " › ", 8, st)
|
|
1068
|
+
]));
|
|
1069
|
+
}
|
|
1070
|
+
}), lt = ["aria-activedescendant"], ut = [
|
|
1071
|
+
"id",
|
|
1072
|
+
"aria-disabled",
|
|
1073
|
+
"onClick"
|
|
1074
|
+
], dt = /* @__PURE__ */ u({
|
|
1075
|
+
name: "KbDropdown",
|
|
1076
|
+
__name: "Dropdown",
|
|
1077
|
+
props: {
|
|
1078
|
+
items: { default: () => [] },
|
|
1079
|
+
trigger: { default: "hover" }
|
|
1080
|
+
},
|
|
1081
|
+
emits: ["select"],
|
|
1082
|
+
setup(t, { emit: r }) {
|
|
1083
|
+
let i = t, s = r, c = b(!1), l = b(null), u = b(-1), d = `kb-dropdown-${Math.random().toString(36).slice(2, 8)}`, f = n(() => c.value && u.value >= 0 ? `${d}-item-${u.value}` : void 0);
|
|
1084
|
+
function m() {
|
|
1085
|
+
c.value = !0, u.value = i.items.findIndex((e) => !e.disabled);
|
|
1086
|
+
}
|
|
1087
|
+
function v() {
|
|
1088
|
+
c.value = !1, u.value = -1;
|
|
1089
|
+
}
|
|
1090
|
+
function y() {
|
|
1091
|
+
c.value ? v() : m();
|
|
1092
|
+
}
|
|
1093
|
+
function C() {
|
|
1094
|
+
i.trigger === "hover" && m();
|
|
1095
|
+
}
|
|
1096
|
+
function T() {
|
|
1097
|
+
i.trigger === "hover" && v();
|
|
1098
|
+
}
|
|
1099
|
+
function E(e) {
|
|
1100
|
+
e.disabled || (s("select", e.key), v());
|
|
1101
|
+
}
|
|
1102
|
+
function D(e) {
|
|
1103
|
+
if (!i.items.reduce((e, t, n) => (t.disabled || e.push(n), e), []).length) return;
|
|
1104
|
+
let t = u.value;
|
|
1105
|
+
do
|
|
1106
|
+
t += e;
|
|
1107
|
+
while (t >= 0 && t < i.items.length && i.items[t].disabled);
|
|
1108
|
+
t >= 0 && t < i.items.length && (u.value = t);
|
|
1109
|
+
}
|
|
1110
|
+
function O(e) {
|
|
1111
|
+
switch (e.key) {
|
|
1112
|
+
case "Enter":
|
|
1113
|
+
case " ":
|
|
1114
|
+
e.preventDefault(), c.value && u.value >= 0 ? E(i.items[u.value]) : m();
|
|
1115
|
+
break;
|
|
1116
|
+
case "ArrowDown":
|
|
1117
|
+
e.preventDefault(), c.value ? D(1) : m();
|
|
1118
|
+
break;
|
|
1119
|
+
case "ArrowUp":
|
|
1120
|
+
e.preventDefault(), c.value ? D(-1) : m();
|
|
1121
|
+
break;
|
|
1122
|
+
case "Escape": e.preventDefault(), v();
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
function k(e) {
|
|
1126
|
+
l.value && !l.value.contains(e.target) && v();
|
|
1127
|
+
}
|
|
1128
|
+
return g(() => document.addEventListener("click", k)), h(() => document.removeEventListener("click", k)), (n, r) => (_(), o("div", {
|
|
1129
|
+
ref_key: "rootEl",
|
|
1130
|
+
ref: l,
|
|
1131
|
+
class: "kb-dropdown",
|
|
1132
|
+
onMouseenter: C,
|
|
1133
|
+
onMouseleave: T,
|
|
1134
|
+
onClick: y,
|
|
1135
|
+
onKeydown: O
|
|
1136
|
+
}, [S(n.$slots, "default"), c.value ? (_(), o("div", {
|
|
1137
|
+
key: 0,
|
|
1138
|
+
id: d,
|
|
1139
|
+
class: "kb-dropdown__menu",
|
|
1140
|
+
role: "menu",
|
|
1141
|
+
"aria-activedescendant": f.value
|
|
1142
|
+
}, [(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("div", {
|
|
1143
|
+
id: `${d}-item-${t}`,
|
|
1144
|
+
key: e.key,
|
|
1145
|
+
class: p(["kb-dropdown__item", {
|
|
1146
|
+
"kb-dropdown__item--active": t === u.value,
|
|
1147
|
+
"kb-dropdown__item--disabled": e.disabled,
|
|
1148
|
+
"kb-dropdown__item--danger": e.danger
|
|
1149
|
+
}]),
|
|
1150
|
+
role: "menuitem",
|
|
1151
|
+
"aria-disabled": e.disabled || void 0,
|
|
1152
|
+
onClick: (t) => E(e)
|
|
1153
|
+
}, w(e.label), 11, ut))), 128))], 8, lt)) : a("", !0)], 544));
|
|
1154
|
+
}
|
|
1155
|
+
}), ft = { class: "kb-drawer__header" }, pt = { class: "kb-drawer__body" }, mt = {
|
|
1156
|
+
key: 0,
|
|
1157
|
+
class: "kb-drawer__footer"
|
|
1158
|
+
}, ht = /* @__PURE__ */ u({
|
|
1159
|
+
name: "KbDrawer",
|
|
1160
|
+
__name: "Drawer",
|
|
1161
|
+
props: {
|
|
1162
|
+
modelValue: {
|
|
1163
|
+
type: Boolean,
|
|
1164
|
+
default: !1
|
|
1165
|
+
},
|
|
1166
|
+
title: { default: "" },
|
|
1167
|
+
direction: { default: "right" },
|
|
1168
|
+
width: { default: 320 }
|
|
1169
|
+
},
|
|
1170
|
+
emits: ["update:modelValue"],
|
|
1171
|
+
setup(e, { emit: r }) {
|
|
1172
|
+
let c = e, l = r, u = n(() => c.direction === "top" || c.direction === "bottom" ? { height: typeof c.width == "number" ? `${c.width}px` : c.width } : { width: typeof c.width == "number" ? `${c.width}px` : c.width });
|
|
1173
|
+
function d() {
|
|
1174
|
+
l("update:modelValue", !1);
|
|
1175
|
+
}
|
|
1176
|
+
return (n, r) => (_(), i(t, { to: "body" }, [e.modelValue ? (_(), o("div", {
|
|
1177
|
+
key: 0,
|
|
1178
|
+
class: "kb-drawer-overlay",
|
|
1179
|
+
onClick: A(d, ["self"])
|
|
1180
|
+
}, [s("div", {
|
|
1181
|
+
class: p(["kb-drawer", `kb-drawer--${e.direction}`]),
|
|
1182
|
+
style: m(u.value),
|
|
1183
|
+
role: "dialog",
|
|
1184
|
+
"aria-modal": "true"
|
|
1185
|
+
}, [
|
|
1186
|
+
s("header", ft, [s("span", null, w(e.title), 1), s("button", {
|
|
1187
|
+
class: "kb-drawer__close",
|
|
1188
|
+
type: "button",
|
|
1189
|
+
"aria-label": "close",
|
|
1190
|
+
onClick: d
|
|
1191
|
+
}, "×")]),
|
|
1192
|
+
s("div", pt, [S(n.$slots, "default")]),
|
|
1193
|
+
n.$slots.footer ? (_(), o("footer", mt, [S(n.$slots, "footer")])) : a("", !0)
|
|
1194
|
+
], 6)])) : a("", !0)]));
|
|
1195
|
+
}
|
|
1196
|
+
}), gt = [
|
|
1197
|
+
"tabindex",
|
|
1198
|
+
"aria-expanded",
|
|
1199
|
+
"aria-describedby"
|
|
1200
|
+
], _t = ["role"], vt = {
|
|
1201
|
+
key: 0,
|
|
1202
|
+
class: "kb-popover__title"
|
|
1203
|
+
}, yt = { class: "kb-popover__content" }, bt = /* @__PURE__ */ u({
|
|
1204
|
+
name: "KbPopover",
|
|
1205
|
+
__name: "Popover",
|
|
1206
|
+
props: {
|
|
1207
|
+
title: { default: "" },
|
|
1208
|
+
content: { default: "" },
|
|
1209
|
+
trigger: { default: "hover" },
|
|
1210
|
+
placement: { default: "top" }
|
|
1211
|
+
},
|
|
1212
|
+
setup(e) {
|
|
1213
|
+
let t = e, n = b(!1), r = `kb-popover-${Math.random().toString(36).slice(2, 8)}`;
|
|
1214
|
+
function i() {
|
|
1215
|
+
n.value = !n.value;
|
|
1216
|
+
}
|
|
1217
|
+
function c(e) {
|
|
1218
|
+
t.trigger === "click" && (e.key === "Enter" || e.key === " " ? (e.preventDefault(), i()) : e.key === "Escape" && (e.preventDefault(), n.value = !1));
|
|
1219
|
+
}
|
|
1220
|
+
return (t, l) => (_(), o("span", {
|
|
1221
|
+
class: "kb-popover",
|
|
1222
|
+
tabindex: e.trigger === "click" ? 0 : void 0,
|
|
1223
|
+
role: "button",
|
|
1224
|
+
"aria-expanded": e.trigger === "click" ? n.value : void 0,
|
|
1225
|
+
"aria-describedby": n.value ? r : void 0,
|
|
1226
|
+
onMouseenter: l[0] ||= (t) => e.trigger === "hover" && (n.value = !0),
|
|
1227
|
+
onMouseleave: l[1] ||= (t) => e.trigger === "hover" && (n.value = !1),
|
|
1228
|
+
onClick: i,
|
|
1229
|
+
onKeydown: c
|
|
1230
|
+
}, [S(t.$slots, "default"), n.value ? (_(), o("div", {
|
|
1231
|
+
key: 0,
|
|
1232
|
+
id: r,
|
|
1233
|
+
class: p(["kb-popover__panel", `kb-popover__panel--${e.placement}`]),
|
|
1234
|
+
role: e.trigger === "click" ? "dialog" : "tooltip"
|
|
1235
|
+
}, [
|
|
1236
|
+
e.title ? (_(), o("div", vt, w(e.title), 1)) : a("", !0),
|
|
1237
|
+
s("div", yt, w(e.content), 1),
|
|
1238
|
+
S(t.$slots, "extra")
|
|
1239
|
+
], 10, _t)) : a("", !0)], 40, gt));
|
|
1240
|
+
}
|
|
1241
|
+
}), xt = { class: "kb-rate" }, St = ["aria-checked", "onClick"], Ct = /* @__PURE__ */ u({
|
|
1242
|
+
name: "KbRate",
|
|
1243
|
+
__name: "Rate",
|
|
1244
|
+
props: {
|
|
1245
|
+
modelValue: { default: 0 },
|
|
1246
|
+
max: { default: 5 },
|
|
1247
|
+
disabled: {
|
|
1248
|
+
type: Boolean,
|
|
1249
|
+
default: !1
|
|
1250
|
+
}
|
|
1251
|
+
},
|
|
1252
|
+
emits: ["update:modelValue"],
|
|
1253
|
+
setup(t, { emit: r }) {
|
|
1254
|
+
let i = t, a = r, s = n(() => Array.from({ length: i.max }, (e, t) => t + 1));
|
|
1255
|
+
function c(e) {
|
|
1256
|
+
i.disabled || a("update:modelValue", e);
|
|
1257
|
+
}
|
|
1258
|
+
return (n, r) => (_(), o("div", xt, [(_(!0), o(e, null, x(s.value, (e) => (_(), o("span", {
|
|
1259
|
+
key: e,
|
|
1260
|
+
class: p(["kb-rate__star", { "kb-rate__star--active": e <= t.modelValue }]),
|
|
1261
|
+
role: "radio",
|
|
1262
|
+
"aria-checked": e <= t.modelValue,
|
|
1263
|
+
onClick: (t) => c(e)
|
|
1264
|
+
}, " ★ ", 10, St))), 128))]));
|
|
1265
|
+
}
|
|
1266
|
+
}), wt = [
|
|
1267
|
+
"aria-valuemin",
|
|
1268
|
+
"aria-valuemax",
|
|
1269
|
+
"aria-valuenow"
|
|
1270
|
+
], Tt = { class: "kb-slider__track" }, Et = /* @__PURE__ */ u({
|
|
1271
|
+
name: "KbSlider",
|
|
1272
|
+
__name: "Slider",
|
|
1273
|
+
props: {
|
|
1274
|
+
modelValue: { default: 0 },
|
|
1275
|
+
min: { default: 0 },
|
|
1276
|
+
max: { default: 100 },
|
|
1277
|
+
step: { default: 1 },
|
|
1278
|
+
disabled: {
|
|
1279
|
+
type: Boolean,
|
|
1280
|
+
default: !1
|
|
1281
|
+
}
|
|
1282
|
+
},
|
|
1283
|
+
emits: ["update:modelValue"],
|
|
1284
|
+
setup(e, { emit: t }) {
|
|
1285
|
+
let r = e, i = t, a = n(() => Math.min(r.max, Math.max(r.min, r.modelValue))), c = n(() => (a.value - r.min) / (r.max - r.min) * 100);
|
|
1286
|
+
function l(e) {
|
|
1287
|
+
if (r.disabled) return;
|
|
1288
|
+
let t = e.currentTarget.getBoundingClientRect(), n = Math.min(1, Math.max(0, (e.clientX - t.left) / t.width)), a = r.min + n * (r.max - r.min), o = Math.round(a / r.step) * r.step;
|
|
1289
|
+
i("update:modelValue", Math.min(r.max, Math.max(r.min, o)));
|
|
1290
|
+
}
|
|
1291
|
+
return (t, n) => (_(), o("div", {
|
|
1292
|
+
class: p(["kb-slider", { "kb-slider--disabled": e.disabled }]),
|
|
1293
|
+
role: "slider",
|
|
1294
|
+
"aria-valuemin": e.min,
|
|
1295
|
+
"aria-valuemax": e.max,
|
|
1296
|
+
"aria-valuenow": a.value,
|
|
1297
|
+
onClick: l
|
|
1298
|
+
}, [s("div", Tt, [s("div", {
|
|
1299
|
+
class: "kb-slider__fill",
|
|
1300
|
+
style: m({ width: `${c.value}%` })
|
|
1301
|
+
}, null, 4), s("div", {
|
|
1302
|
+
class: "kb-slider__handle",
|
|
1303
|
+
style: m({ left: `${c.value}%` })
|
|
1304
|
+
}, null, 4)])], 10, wt));
|
|
1305
|
+
}
|
|
1306
|
+
}), Dt = { class: "kb-result" }, Ot = { class: "kb-result__title" }, kt = {
|
|
1307
|
+
key: 0,
|
|
1308
|
+
class: "kb-result__description"
|
|
1309
|
+
}, At = {
|
|
1310
|
+
key: 1,
|
|
1311
|
+
class: "kb-result__action"
|
|
1312
|
+
}, jt = /* @__PURE__ */ u({
|
|
1313
|
+
name: "KbResult",
|
|
1314
|
+
__name: "Result",
|
|
1315
|
+
props: {
|
|
1316
|
+
status: { default: "success" },
|
|
1317
|
+
title: {},
|
|
1318
|
+
description: { default: "" }
|
|
1319
|
+
},
|
|
1320
|
+
setup(e) {
|
|
1321
|
+
let t = e, r = {
|
|
1322
|
+
success: "success",
|
|
1323
|
+
error: "error",
|
|
1324
|
+
warning: "warning",
|
|
1325
|
+
info: "info"
|
|
1326
|
+
}, i = n(() => ["kb-result__icon", `kb-result__icon--${t.status}`]);
|
|
1327
|
+
return (t, n) => (_(), o("div", Dt, [
|
|
1328
|
+
l(T(N), {
|
|
1329
|
+
name: r[e.status],
|
|
1330
|
+
size: 64,
|
|
1331
|
+
class: p(i.value)
|
|
1332
|
+
}, null, 8, ["name", "class"]),
|
|
1333
|
+
s("h3", Ot, w(e.title), 1),
|
|
1334
|
+
e.description ? (_(), o("p", kt, w(e.description), 1)) : a("", !0),
|
|
1335
|
+
t.$slots.action ? (_(), o("div", At, [S(t.$slots, "action")])) : a("", !0)
|
|
1336
|
+
]));
|
|
1337
|
+
}
|
|
1338
|
+
}), Mt = { class: "kb-statistic" }, Nt = { class: "kb-statistic__title" }, Pt = { class: "kb-statistic__value" }, Ft = {
|
|
1339
|
+
key: 0,
|
|
1340
|
+
class: "kb-statistic__prefix"
|
|
1341
|
+
}, It = {
|
|
1342
|
+
key: 1,
|
|
1343
|
+
class: "kb-statistic__suffix"
|
|
1344
|
+
}, Lt = {
|
|
1345
|
+
key: 0,
|
|
1346
|
+
class: "kb-statistic__extra"
|
|
1347
|
+
}, Rt = /* @__PURE__ */ u({
|
|
1348
|
+
name: "KbStatistic",
|
|
1349
|
+
__name: "Statistic",
|
|
1350
|
+
props: {
|
|
1351
|
+
title: {},
|
|
1352
|
+
value: {},
|
|
1353
|
+
prefix: { default: "" },
|
|
1354
|
+
suffix: { default: "" },
|
|
1355
|
+
precision: { default: 0 },
|
|
1356
|
+
groupSeparator: {
|
|
1357
|
+
type: Boolean,
|
|
1358
|
+
default: !0
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
setup(e) {
|
|
1362
|
+
let t = e, r = n(() => {
|
|
1363
|
+
let e = t.value.toFixed(t.precision);
|
|
1364
|
+
if (!t.groupSeparator) return e;
|
|
1365
|
+
let [n, r] = e.split(".");
|
|
1366
|
+
return `${n.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}${r ? `.${r}` : ""}`;
|
|
1367
|
+
});
|
|
1368
|
+
return (t, n) => (_(), o("div", Mt, [
|
|
1369
|
+
s("div", Nt, w(e.title), 1),
|
|
1370
|
+
s("div", Pt, [
|
|
1371
|
+
e.prefix ? (_(), o("span", Ft, w(e.prefix), 1)) : a("", !0),
|
|
1372
|
+
c(" " + w(r.value) + " ", 1),
|
|
1373
|
+
e.suffix ? (_(), o("span", It, w(e.suffix), 1)) : a("", !0)
|
|
1374
|
+
]),
|
|
1375
|
+
t.$slots.default ? (_(), o("div", Lt, [S(t.$slots, "default")])) : a("", !0)
|
|
1376
|
+
]));
|
|
1377
|
+
}
|
|
1378
|
+
}), zt = {
|
|
1379
|
+
class: "kb-steps",
|
|
1380
|
+
role: "list"
|
|
1381
|
+
}, Bt = ["aria-current"], Vt = { class: "kb-steps__head" }, Ht = { class: "kb-steps__circle" }, Ut = { key: 1 }, Wt = {
|
|
1382
|
+
key: 0,
|
|
1383
|
+
class: "kb-steps__line"
|
|
1384
|
+
}, Gt = { class: "kb-steps__body" }, Kt = { class: "kb-steps__title" }, qt = {
|
|
1385
|
+
key: 0,
|
|
1386
|
+
class: "kb-steps__description"
|
|
1387
|
+
}, Jt = /* @__PURE__ */ u({
|
|
1388
|
+
name: "KbSteps",
|
|
1389
|
+
__name: "Steps",
|
|
1390
|
+
props: {
|
|
1391
|
+
steps: { default: () => [] },
|
|
1392
|
+
active: { default: 0 }
|
|
1393
|
+
},
|
|
1394
|
+
setup(t) {
|
|
1395
|
+
let r = t, c = n(() => (e) => e < r.active ? "done" : e === r.active ? "active" : "wait");
|
|
1396
|
+
return (n, r) => (_(), o("div", zt, [(_(!0), o(e, null, x(t.steps, (e, n) => (_(), o("div", {
|
|
1397
|
+
key: n,
|
|
1398
|
+
class: p(["kb-steps__item", `kb-steps__item--${c.value(n)}`]),
|
|
1399
|
+
role: "listitem",
|
|
1400
|
+
"aria-current": n === t.active ? "step" : void 0
|
|
1401
|
+
}, [s("div", Vt, [s("span", Ht, [c.value(n) === "done" ? (_(), i(T(N), {
|
|
1402
|
+
key: 0,
|
|
1403
|
+
name: "check",
|
|
1404
|
+
size: 12
|
|
1405
|
+
})) : (_(), o("span", Ut, w(n + 1), 1))]), n < t.steps.length - 1 ? (_(), o("span", Wt)) : a("", !0)]), s("div", Gt, [s("div", Kt, w(e.title), 1), e.description ? (_(), o("div", qt, w(e.description), 1)) : a("", !0)])], 10, Bt))), 128))]));
|
|
1406
|
+
}
|
|
1407
|
+
}), Yt = {
|
|
1408
|
+
class: "kb-timeline",
|
|
1409
|
+
role: "list"
|
|
1410
|
+
}, Xt = { class: "kb-timeline__node" }, Zt = {
|
|
1411
|
+
key: 0,
|
|
1412
|
+
class: "kb-timeline__tail"
|
|
1413
|
+
}, Qt = { class: "kb-timeline__main" }, $t = { class: "kb-timeline__content" }, en = {
|
|
1414
|
+
key: 0,
|
|
1415
|
+
class: "kb-timeline__time"
|
|
1416
|
+
}, tn = /* @__PURE__ */ u({
|
|
1417
|
+
name: "KbTimeline",
|
|
1418
|
+
__name: "Timeline",
|
|
1419
|
+
props: { items: { default: () => [] } },
|
|
1420
|
+
setup(t) {
|
|
1421
|
+
return (n, r) => (_(), o("div", Yt, [(_(!0), o(e, null, x(t.items, (e, n) => (_(), o("div", {
|
|
1422
|
+
key: n,
|
|
1423
|
+
class: "kb-timeline__item",
|
|
1424
|
+
role: "listitem"
|
|
1425
|
+
}, [s("div", Xt, [s("span", { class: p(["kb-timeline__dot", `kb-timeline__dot--${e.type ?? "default"}`]) }, null, 2), n < t.items.length - 1 ? (_(), o("span", Zt)) : a("", !0)]), s("div", Qt, [s("div", $t, w(e.content), 1), e.time ? (_(), o("div", en, w(e.time), 1)) : a("", !0)])]))), 128))]));
|
|
1426
|
+
}
|
|
1427
|
+
}), nn = { class: "kb-notification__main" }, rn = { class: "kb-notification__title" }, an = {
|
|
1428
|
+
key: 0,
|
|
1429
|
+
class: "kb-notification__message"
|
|
1430
|
+
}, on = /* @__PURE__ */ u({
|
|
1431
|
+
name: "KbNotification",
|
|
1432
|
+
__name: "Notification",
|
|
1433
|
+
props: {
|
|
1434
|
+
type: { default: "info" },
|
|
1435
|
+
title: {},
|
|
1436
|
+
message: { default: "" }
|
|
1437
|
+
},
|
|
1438
|
+
setup(e) {
|
|
1439
|
+
let t = e, r = {
|
|
1440
|
+
success: "success",
|
|
1441
|
+
error: "error",
|
|
1442
|
+
info: "info",
|
|
1443
|
+
warning: "warning"
|
|
1444
|
+
}, i = n(() => r[t.type]);
|
|
1445
|
+
return (t, n) => (_(), o("div", {
|
|
1446
|
+
class: p(["kb-notification", `kb-notification--${e.type}`]),
|
|
1447
|
+
role: "alert"
|
|
1448
|
+
}, [l(T(N), {
|
|
1449
|
+
name: i.value,
|
|
1450
|
+
size: 20,
|
|
1451
|
+
class: "kb-notification__icon"
|
|
1452
|
+
}, null, 8, ["name"]), s("div", nn, [s("div", rn, w(e.title), 1), e.message ? (_(), o("div", an, w(e.message), 1)) : a("", !0)])], 2));
|
|
1453
|
+
}
|
|
1454
|
+
}), X = null;
|
|
1455
|
+
function sn(e) {
|
|
1456
|
+
(!X || !X.isConnected) && (X = document.createElement("div"), X.className = "kb-notification-container", document.body.appendChild(X));
|
|
1457
|
+
let t = document.createElement("div");
|
|
1458
|
+
X.appendChild(t);
|
|
1459
|
+
let n = r(on, {
|
|
1460
|
+
type: e.type ?? "info",
|
|
1461
|
+
title: e.title,
|
|
1462
|
+
message: e.message ?? ""
|
|
1463
|
+
});
|
|
1464
|
+
n.mount(t);
|
|
1465
|
+
let i = !1, a = () => {
|
|
1466
|
+
i || (i = !0, n.unmount(), t.remove(), X && X.childElementCount === 0 && (X.remove(), X = null));
|
|
1467
|
+
}, o = e.duration ?? 4500;
|
|
1468
|
+
return o > 0 && setTimeout(a, o), a;
|
|
1469
|
+
}
|
|
1470
|
+
function Z(e) {
|
|
1471
|
+
return (t) => sn({
|
|
1472
|
+
...t,
|
|
1473
|
+
type: e
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
var cn = {
|
|
1477
|
+
success: Z("success"),
|
|
1478
|
+
error: Z("error"),
|
|
1479
|
+
info: Z("info"),
|
|
1480
|
+
warning: Z("warning")
|
|
1481
|
+
}, ln = ["disabled"], un = ["value", "disabled"], dn = ["disabled"], fn = /* @__PURE__ */ u({
|
|
1482
|
+
name: "KbInputNumber",
|
|
1483
|
+
__name: "InputNumber",
|
|
1484
|
+
props: {
|
|
1485
|
+
modelValue: { default: 0 },
|
|
1486
|
+
min: { default: void 0 },
|
|
1487
|
+
max: { default: void 0 },
|
|
1488
|
+
step: { default: 1 },
|
|
1489
|
+
disabled: {
|
|
1490
|
+
type: Boolean,
|
|
1491
|
+
default: !1
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
emits: ["update:modelValue"],
|
|
1495
|
+
setup(e, { emit: t }) {
|
|
1496
|
+
let r = e, i = t, a = n(() => String(r.modelValue));
|
|
1497
|
+
function c(e) {
|
|
1498
|
+
let t = e;
|
|
1499
|
+
return r.min !== void 0 && (t = Math.max(r.min, t)), r.max !== void 0 && (t = Math.min(r.max, t)), t;
|
|
1500
|
+
}
|
|
1501
|
+
function l(e) {
|
|
1502
|
+
if (r.disabled) return;
|
|
1503
|
+
let t = c(r.modelValue + e * r.step);
|
|
1504
|
+
t !== r.modelValue && i("update:modelValue", t);
|
|
1505
|
+
}
|
|
1506
|
+
function u(e) {
|
|
1507
|
+
let t = Number(e.target.value);
|
|
1508
|
+
Number.isNaN(t) || i("update:modelValue", c(t));
|
|
1509
|
+
}
|
|
1510
|
+
return (t, n) => (_(), o("div", { class: p(["kb-input-number", { "kb-input-number--disabled": e.disabled }]) }, [
|
|
1511
|
+
s("button", {
|
|
1512
|
+
class: "kb-input-number__step kb-input-number__step--down",
|
|
1513
|
+
type: "button",
|
|
1514
|
+
disabled: e.disabled || e.min !== void 0 && e.modelValue <= e.min,
|
|
1515
|
+
onClick: n[0] ||= (e) => l(-1)
|
|
1516
|
+
}, " − ", 8, ln),
|
|
1517
|
+
s("input", {
|
|
1518
|
+
class: "kb-input-number__input",
|
|
1519
|
+
value: a.value,
|
|
1520
|
+
type: "number",
|
|
1521
|
+
disabled: e.disabled,
|
|
1522
|
+
onInput: u
|
|
1523
|
+
}, null, 40, un),
|
|
1524
|
+
s("button", {
|
|
1525
|
+
class: "kb-input-number__step kb-input-number__step--up",
|
|
1526
|
+
type: "button",
|
|
1527
|
+
disabled: e.disabled || e.max !== void 0 && e.modelValue >= e.max,
|
|
1528
|
+
onClick: n[1] ||= (e) => l(1)
|
|
1529
|
+
}, " + ", 8, dn)
|
|
1530
|
+
], 2));
|
|
1531
|
+
}
|
|
1532
|
+
}), pn = [
|
|
1533
|
+
"value",
|
|
1534
|
+
"placeholder",
|
|
1535
|
+
"rows",
|
|
1536
|
+
"maxlength",
|
|
1537
|
+
"disabled"
|
|
1538
|
+
], mn = {
|
|
1539
|
+
key: 0,
|
|
1540
|
+
class: "kb-textarea__count"
|
|
1541
|
+
}, hn = /* @__PURE__ */ u({
|
|
1542
|
+
name: "KbTextarea",
|
|
1543
|
+
__name: "Textarea",
|
|
1544
|
+
props: {
|
|
1545
|
+
modelValue: { default: "" },
|
|
1546
|
+
placeholder: { default: "" },
|
|
1547
|
+
rows: { default: 3 },
|
|
1548
|
+
maxlength: { default: void 0 },
|
|
1549
|
+
disabled: {
|
|
1550
|
+
type: Boolean,
|
|
1551
|
+
default: !1
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
emits: ["update:modelValue"],
|
|
1555
|
+
setup(e, { emit: t }) {
|
|
1556
|
+
let r = e, i = t, c = n(() => r.modelValue.length), l = n(() => r.maxlength !== void 0);
|
|
1557
|
+
function u(e) {
|
|
1558
|
+
i("update:modelValue", e.target.value);
|
|
1559
|
+
}
|
|
1560
|
+
return (t, n) => (_(), o("div", { class: p(["kb-textarea", { "kb-textarea--disabled": e.disabled }]) }, [s("textarea", {
|
|
1561
|
+
class: "kb-textarea__inner",
|
|
1562
|
+
value: e.modelValue,
|
|
1563
|
+
placeholder: e.placeholder,
|
|
1564
|
+
rows: e.rows,
|
|
1565
|
+
maxlength: e.maxlength,
|
|
1566
|
+
disabled: e.disabled,
|
|
1567
|
+
onInput: u
|
|
1568
|
+
}, null, 40, pn), l.value ? (_(), o("div", mn, w(c.value) + "/" + w(e.maxlength), 1)) : a("", !0)], 2));
|
|
1569
|
+
}
|
|
1570
|
+
}), gn = { class: "kb-search" }, _n = ["value", "placeholder"], vn = /* @__PURE__ */ u({
|
|
1571
|
+
name: "KbSearch",
|
|
1572
|
+
__name: "Search",
|
|
1573
|
+
props: {
|
|
1574
|
+
modelValue: { default: "" },
|
|
1575
|
+
placeholder: { default: "搜索…" },
|
|
1576
|
+
size: { default: "medium" }
|
|
1577
|
+
},
|
|
1578
|
+
emits: ["update:modelValue", "search"],
|
|
1579
|
+
setup(e, { emit: t }) {
|
|
1580
|
+
let n = e, r = t;
|
|
1581
|
+
function i(e) {
|
|
1582
|
+
r("update:modelValue", e.target.value);
|
|
1583
|
+
}
|
|
1584
|
+
function a() {
|
|
1585
|
+
r("search", n.modelValue);
|
|
1586
|
+
}
|
|
1587
|
+
return (t, n) => (_(), o("div", gn, [
|
|
1588
|
+
l(T(N), {
|
|
1589
|
+
name: "search",
|
|
1590
|
+
size: 16,
|
|
1591
|
+
class: "kb-search__icon"
|
|
1592
|
+
}),
|
|
1593
|
+
s("input", {
|
|
1594
|
+
class: "kb-search__input",
|
|
1595
|
+
value: e.modelValue,
|
|
1596
|
+
placeholder: e.placeholder,
|
|
1597
|
+
onInput: i,
|
|
1598
|
+
onKeyup: k(a, ["enter"])
|
|
1599
|
+
}, null, 40, _n),
|
|
1600
|
+
s("button", {
|
|
1601
|
+
class: "kb-search__button",
|
|
1602
|
+
type: "button",
|
|
1603
|
+
onClick: a
|
|
1604
|
+
}, "搜索")
|
|
1605
|
+
]));
|
|
1606
|
+
}
|
|
1607
|
+
}), yn = { class: "kb-segmented" }, bn = ["aria-selected", "onClick"], xn = /* @__PURE__ */ u({
|
|
1608
|
+
name: "KbSegmented",
|
|
1609
|
+
__name: "Segmented",
|
|
1610
|
+
props: {
|
|
1611
|
+
options: { default: () => [] },
|
|
1612
|
+
modelValue: { default: void 0 }
|
|
1613
|
+
},
|
|
1614
|
+
emits: ["update:modelValue"],
|
|
1615
|
+
setup(t, { emit: n }) {
|
|
1616
|
+
let r = n;
|
|
1617
|
+
function i(e) {
|
|
1618
|
+
e.disabled || r("update:modelValue", e.value);
|
|
1619
|
+
}
|
|
1620
|
+
return (n, r) => (_(), o("div", yn, [(_(!0), o(e, null, x(t.options, (e) => (_(), o("div", {
|
|
1621
|
+
key: e.value,
|
|
1622
|
+
class: p(["kb-segmented__item", {
|
|
1623
|
+
"kb-segmented__item--active": e.value === t.modelValue,
|
|
1624
|
+
"kb-segmented__item--disabled": e.disabled
|
|
1625
|
+
}]),
|
|
1626
|
+
role: "tab",
|
|
1627
|
+
"aria-selected": e.value === t.modelValue,
|
|
1628
|
+
onClick: (t) => i(e)
|
|
1629
|
+
}, w(e.label), 11, bn))), 128))]));
|
|
1630
|
+
}
|
|
1631
|
+
}), Sn = { class: "kb-watermark" }, Cn = { class: "kb-watermark__content" }, wn = /* @__PURE__ */ u({
|
|
1632
|
+
name: "KbWatermark",
|
|
1633
|
+
__name: "Watermark",
|
|
1634
|
+
props: {
|
|
1635
|
+
text: { default: "" },
|
|
1636
|
+
color: { default: "rgb(0 0 0 / 8%)" },
|
|
1637
|
+
fontSize: { default: 16 },
|
|
1638
|
+
rotate: { default: -24 }
|
|
1639
|
+
},
|
|
1640
|
+
setup(e) {
|
|
1641
|
+
let t = e, r = n(() => ({
|
|
1642
|
+
"--kb-watermark-color": t.color,
|
|
1643
|
+
"--kb-watermark-font-size": `${t.fontSize}px`,
|
|
1644
|
+
"--kb-watermark-rotate": `${t.rotate}deg`,
|
|
1645
|
+
backgroundImage: `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="140"><text x="100" y="70" fill="${t.color}" font-size="${t.fontSize}" text-anchor="middle" transform="rotate(${t.rotate} 100 70)">${t.text}</text></svg>`)}")`
|
|
1646
|
+
}));
|
|
1647
|
+
return (e, t) => (_(), o("div", Sn, [s("div", {
|
|
1648
|
+
class: "kb-watermark__layer",
|
|
1649
|
+
style: m(r.value),
|
|
1650
|
+
"aria-hidden": "true"
|
|
1651
|
+
}, null, 4), s("div", Cn, [S(e.$slots, "default")])]));
|
|
1652
|
+
}
|
|
1653
|
+
}), Tn = ["aria-expanded"], En = { class: "kb-popconfirm__title" }, Dn = { class: "kb-popconfirm__actions" }, On = /* @__PURE__ */ u({
|
|
1654
|
+
name: "KbPopconfirm",
|
|
1655
|
+
__name: "Popconfirm",
|
|
1656
|
+
props: {
|
|
1657
|
+
title: {},
|
|
1658
|
+
confirmText: { default: "确定" },
|
|
1659
|
+
cancelText: { default: "取消" }
|
|
1660
|
+
},
|
|
1661
|
+
emits: ["confirm", "cancel"],
|
|
1662
|
+
setup(e, { emit: t }) {
|
|
1663
|
+
let n = t, r = b(!1), i = b(null);
|
|
1664
|
+
function c() {
|
|
1665
|
+
n("confirm"), r.value = !1;
|
|
1666
|
+
}
|
|
1667
|
+
function l() {
|
|
1668
|
+
n("cancel"), r.value = !1;
|
|
1669
|
+
}
|
|
1670
|
+
function u(e) {
|
|
1671
|
+
e.key === "Escape" && (e.preventDefault(), l());
|
|
1672
|
+
}
|
|
1673
|
+
function d(e) {
|
|
1674
|
+
i.value && !i.value.contains(e.target) && (r.value = !1);
|
|
1675
|
+
}
|
|
1676
|
+
return g(() => document.addEventListener("click", d)), h(() => document.removeEventListener("click", d)), (t, n) => (_(), o("div", {
|
|
1677
|
+
ref_key: "rootEl",
|
|
1678
|
+
ref: i,
|
|
1679
|
+
class: "kb-popconfirm",
|
|
1680
|
+
"aria-expanded": r.value,
|
|
1681
|
+
onClick: n[1] ||= (e) => r.value = !r.value,
|
|
1682
|
+
onKeydown: u
|
|
1683
|
+
}, [S(t.$slots, "default"), r.value ? (_(), o("div", {
|
|
1684
|
+
key: 0,
|
|
1685
|
+
class: "kb-popconfirm__panel",
|
|
1686
|
+
role: "dialog",
|
|
1687
|
+
"aria-modal": "false",
|
|
1688
|
+
onClick: n[0] ||= A(() => {}, ["stop"])
|
|
1689
|
+
}, [s("div", En, w(e.title), 1), s("div", Dn, [s("button", {
|
|
1690
|
+
class: "kb-popconfirm__cancel",
|
|
1691
|
+
type: "button",
|
|
1692
|
+
onClick: l
|
|
1693
|
+
}, w(e.cancelText), 1), s("button", {
|
|
1694
|
+
class: "kb-popconfirm__ok",
|
|
1695
|
+
type: "button",
|
|
1696
|
+
onClick: c
|
|
1697
|
+
}, w(e.confirmText), 1)])])) : a("", !0)], 40, Tn));
|
|
1698
|
+
}
|
|
1699
|
+
}), kn = { class: "kb-carousel__content" }, An = { class: "kb-carousel__title" }, jn = {
|
|
1700
|
+
key: 0,
|
|
1701
|
+
class: "kb-carousel__description"
|
|
1702
|
+
}, Mn = { class: "kb-carousel__dots" }, Nn = ["aria-label", "onClick"], Pn = /* @__PURE__ */ u({
|
|
1703
|
+
name: "KbCarousel",
|
|
1704
|
+
__name: "Carousel",
|
|
1705
|
+
props: {
|
|
1706
|
+
items: { default: () => [] },
|
|
1707
|
+
height: { default: 180 },
|
|
1708
|
+
autoplay: { default: 0 }
|
|
1709
|
+
},
|
|
1710
|
+
setup(t) {
|
|
1711
|
+
let r = t, i = b(0), c = n(() => r.items.length);
|
|
1712
|
+
function l(e) {
|
|
1713
|
+
i.value = (e % c.value + c.value) % c.value;
|
|
1714
|
+
}
|
|
1715
|
+
function u() {
|
|
1716
|
+
l(i.value + 1);
|
|
1717
|
+
}
|
|
1718
|
+
function d() {
|
|
1719
|
+
l(i.value - 1);
|
|
1720
|
+
}
|
|
1721
|
+
return (n, r) => (_(), o("div", {
|
|
1722
|
+
class: "kb-carousel",
|
|
1723
|
+
style: m({ height: `${t.height}px` })
|
|
1724
|
+
}, [
|
|
1725
|
+
(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("div", {
|
|
1726
|
+
key: t,
|
|
1727
|
+
class: p(["kb-carousel__item", { "kb-carousel__item--active": t === i.value }])
|
|
1728
|
+
}, [s("div", kn, [s("div", An, w(e.title), 1), e.description ? (_(), o("div", jn, w(e.description), 1)) : a("", !0)])], 2))), 128)),
|
|
1729
|
+
s("button", {
|
|
1730
|
+
class: "kb-carousel__prev",
|
|
1731
|
+
type: "button",
|
|
1732
|
+
"aria-label": "上一张",
|
|
1733
|
+
onClick: d
|
|
1734
|
+
}, "‹"),
|
|
1735
|
+
s("button", {
|
|
1736
|
+
class: "kb-carousel__next",
|
|
1737
|
+
type: "button",
|
|
1738
|
+
"aria-label": "下一张",
|
|
1739
|
+
onClick: u
|
|
1740
|
+
}, "›"),
|
|
1741
|
+
s("div", Mn, [(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("button", {
|
|
1742
|
+
key: t,
|
|
1743
|
+
class: p(["kb-carousel__dot", { "kb-carousel__dot--active": t === i.value }]),
|
|
1744
|
+
type: "button",
|
|
1745
|
+
"aria-label": `第 ${t + 1} 张`,
|
|
1746
|
+
onClick: (e) => l(t)
|
|
1747
|
+
}, null, 10, Nn))), 128))])
|
|
1748
|
+
], 4));
|
|
1749
|
+
}
|
|
1750
|
+
}), Fn = {
|
|
1751
|
+
key: 0,
|
|
1752
|
+
class: "kb-descriptions__title"
|
|
1753
|
+
}, In = { class: "kb-descriptions__label" }, Ln = { class: "kb-descriptions__value" }, Rn = /* @__PURE__ */ u({
|
|
1754
|
+
name: "KbDescriptions",
|
|
1755
|
+
__name: "Descriptions",
|
|
1756
|
+
props: {
|
|
1757
|
+
items: { default: () => [] },
|
|
1758
|
+
title: { default: "" },
|
|
1759
|
+
column: { default: 3 },
|
|
1760
|
+
border: {
|
|
1761
|
+
type: Boolean,
|
|
1762
|
+
default: !1
|
|
1763
|
+
}
|
|
1764
|
+
},
|
|
1765
|
+
setup(t) {
|
|
1766
|
+
let r = t, i = n(() => ({ gridTemplateColumns: `repeat(${r.column}, 1fr)` })), c = n(() => ["kb-descriptions", { "kb-descriptions--border": r.border }]);
|
|
1767
|
+
return (n, r) => (_(), o("div", { class: p(c.value) }, [t.title ? (_(), o("div", Fn, w(t.title), 1)) : a("", !0), s("div", {
|
|
1768
|
+
class: "kb-descriptions__grid",
|
|
1769
|
+
style: m(i.value)
|
|
1770
|
+
}, [(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("div", {
|
|
1771
|
+
key: t,
|
|
1772
|
+
class: "kb-descriptions__item"
|
|
1773
|
+
}, [s("div", In, w(e.label), 1), s("div", Ln, w(e.value), 1)]))), 128))], 4)], 2));
|
|
1774
|
+
}
|
|
1775
|
+
}), zn = { class: "kb-calendar" }, Bn = { class: "kb-calendar__header" }, Vn = { class: "kb-calendar__title" }, Hn = { class: "kb-calendar__week" }, Un = { class: "kb-calendar__grid" }, Wn = ["onClick"], Q = /* @__PURE__ */ u({
|
|
1776
|
+
name: "KbCalendar",
|
|
1777
|
+
__name: "Calendar",
|
|
1778
|
+
props: { modelValue: { default: "" } },
|
|
1779
|
+
emits: ["update:modelValue"],
|
|
1780
|
+
setup(t, { emit: r }) {
|
|
1781
|
+
let i = t, a = r, c = [
|
|
1782
|
+
"一",
|
|
1783
|
+
"二",
|
|
1784
|
+
"三",
|
|
1785
|
+
"四",
|
|
1786
|
+
"五",
|
|
1787
|
+
"六",
|
|
1788
|
+
"日"
|
|
1789
|
+
], l = n(() => i.modelValue ? new Date(i.modelValue) : /* @__PURE__ */ new Date()), u = b(l.value.getFullYear()), d = b(l.value.getMonth()), f = n(() => `${u.value} 年 ${d.value + 1} 月`), m = n(() => {
|
|
1790
|
+
let e = (new Date(u.value, d.value, 1).getDay() + 6) % 7, t = new Date(u.value, d.value, 1 - e), n = [];
|
|
1791
|
+
for (let e = 0; e < 42; e++) {
|
|
1792
|
+
let r = new Date(t.getFullYear(), t.getMonth(), t.getDate() + e);
|
|
1793
|
+
n.push({
|
|
1794
|
+
date: r,
|
|
1795
|
+
inMonth: r.getMonth() === d.value,
|
|
1796
|
+
isSelected: r.getFullYear() === l.value.getFullYear() && r.getMonth() === l.value.getMonth() && r.getDate() === l.value.getDate()
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
return n;
|
|
1800
|
+
});
|
|
1801
|
+
function h(e) {
|
|
1802
|
+
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
1803
|
+
}
|
|
1804
|
+
function g(e) {
|
|
1805
|
+
a("update:modelValue", h(e.date));
|
|
1806
|
+
}
|
|
1807
|
+
function v() {
|
|
1808
|
+
d.value === 0 ? (u.value--, d.value = 11) : d.value--;
|
|
1809
|
+
}
|
|
1810
|
+
function y() {
|
|
1811
|
+
d.value === 11 ? (u.value++, d.value = 0) : d.value++;
|
|
1812
|
+
}
|
|
1813
|
+
return (t, n) => (_(), o("div", zn, [
|
|
1814
|
+
s("div", Bn, [
|
|
1815
|
+
s("button", {
|
|
1816
|
+
class: "kb-calendar__nav",
|
|
1817
|
+
type: "button",
|
|
1818
|
+
"aria-label": "上一月",
|
|
1819
|
+
onClick: v
|
|
1820
|
+
}, "‹"),
|
|
1821
|
+
s("span", Vn, w(f.value), 1),
|
|
1822
|
+
s("button", {
|
|
1823
|
+
class: "kb-calendar__nav",
|
|
1824
|
+
type: "button",
|
|
1825
|
+
"aria-label": "下一月",
|
|
1826
|
+
onClick: y
|
|
1827
|
+
}, "›")
|
|
1828
|
+
]),
|
|
1829
|
+
s("div", Hn, [(_(), o(e, null, x(c, (e) => s("span", {
|
|
1830
|
+
key: e,
|
|
1831
|
+
class: "kb-calendar__week-label"
|
|
1832
|
+
}, w(e), 1)), 64))]),
|
|
1833
|
+
s("div", Un, [(_(!0), o(e, null, x(m.value, (e, t) => (_(), o("button", {
|
|
1834
|
+
key: t,
|
|
1835
|
+
class: p(["kb-calendar__day", {
|
|
1836
|
+
"kb-calendar__day--outside": !e.inMonth,
|
|
1837
|
+
"kb-calendar__day--active": e.isSelected
|
|
1838
|
+
}]),
|
|
1839
|
+
type: "button",
|
|
1840
|
+
onClick: (t) => g(e)
|
|
1841
|
+
}, w(e.date.getDate()), 11, Wn))), 128))])
|
|
1842
|
+
]));
|
|
1843
|
+
}
|
|
1844
|
+
}), Gn = {
|
|
1845
|
+
class: "kb-loading",
|
|
1846
|
+
role: "status"
|
|
1847
|
+
}, Kn = {
|
|
1848
|
+
key: 0,
|
|
1849
|
+
class: "kb-loading__text"
|
|
1850
|
+
}, qn = /* @__PURE__ */ u({
|
|
1851
|
+
name: "KbLoading",
|
|
1852
|
+
__name: "Loading",
|
|
1853
|
+
props: {
|
|
1854
|
+
size: { default: 24 },
|
|
1855
|
+
text: { default: "" }
|
|
1856
|
+
},
|
|
1857
|
+
setup(e) {
|
|
1858
|
+
let t = e, r = n(() => ({
|
|
1859
|
+
width: `${t.size}px`,
|
|
1860
|
+
height: `${t.size}px`,
|
|
1861
|
+
borderWidth: `${Math.max(2, t.size / 8)}px`
|
|
1862
|
+
}));
|
|
1863
|
+
return (t, n) => (_(), o("div", Gn, [s("span", {
|
|
1864
|
+
class: "kb-loading__spinner",
|
|
1865
|
+
style: m(r.value)
|
|
1866
|
+
}, null, 4), e.text ? (_(), o("span", Kn, w(e.text), 1)) : a("", !0)]));
|
|
1867
|
+
}
|
|
1868
|
+
}), Jn = /* @__PURE__ */ u({
|
|
1869
|
+
name: "KbForm",
|
|
1870
|
+
__name: "Form",
|
|
1871
|
+
props: {
|
|
1872
|
+
model: {},
|
|
1873
|
+
rules: { default: () => ({}) },
|
|
1874
|
+
labelWidth: { default: "80px" }
|
|
1875
|
+
},
|
|
1876
|
+
setup(e, { expose: t }) {
|
|
1877
|
+
let r = e, i = y({});
|
|
1878
|
+
function a(e) {
|
|
1879
|
+
let t = r.rules[e] ?? [], n = r.model[e];
|
|
1880
|
+
for (let r of t) {
|
|
1881
|
+
if (r.required && (n == null || n === "")) return r.message ?? `${e} 为必填项`;
|
|
1882
|
+
if (r.pattern && !r.pattern.test(String(n ?? ""))) return r.message ?? `${e} 格式不正确`;
|
|
1883
|
+
if (r.validator && !r.validator(n)) return r.message ?? `${e} 不合法`;
|
|
1884
|
+
}
|
|
1885
|
+
return null;
|
|
1886
|
+
}
|
|
1887
|
+
function s() {
|
|
1888
|
+
let e = !0;
|
|
1889
|
+
return Object.keys(r.model).forEach((t) => {
|
|
1890
|
+
let n = a(t);
|
|
1891
|
+
i[t] = n, n && (e = !1);
|
|
1892
|
+
}), Promise.resolve(e);
|
|
1893
|
+
}
|
|
1894
|
+
let c = {
|
|
1895
|
+
model: r.model,
|
|
1896
|
+
rules: r.rules,
|
|
1897
|
+
errors: i,
|
|
1898
|
+
validateField: a
|
|
1899
|
+
};
|
|
1900
|
+
v("kbFormContext", c);
|
|
1901
|
+
let l = n(() => ["kb-form"]);
|
|
1902
|
+
return t({
|
|
1903
|
+
validate: s,
|
|
1904
|
+
validateField: a
|
|
1905
|
+
}), (e, t) => (_(), o("form", {
|
|
1906
|
+
class: p(l.value),
|
|
1907
|
+
role: "form",
|
|
1908
|
+
onSubmit: t[0] ||= A(() => {}, ["prevent"])
|
|
1909
|
+
}, [S(e.$slots, "default")], 34));
|
|
1910
|
+
}
|
|
1911
|
+
}), Yn = ["id"], Xn = ["role", "aria-labelledby"], Zn = {
|
|
1912
|
+
key: 0,
|
|
1913
|
+
class: "kb-form-item__error"
|
|
1914
|
+
}, Qn = /* @__PURE__ */ u({
|
|
1915
|
+
name: "KbFormItem",
|
|
1916
|
+
__name: "FormItem",
|
|
1917
|
+
props: {
|
|
1918
|
+
label: { default: "" },
|
|
1919
|
+
prop: { default: "" }
|
|
1920
|
+
},
|
|
1921
|
+
setup(e) {
|
|
1922
|
+
let t = e, r = d("kbFormContext", null), i = E(), c = n(() => r && t.prop ? r.errors[t.prop] : null), l = n(() => ["kb-form-item", { "kb-form-item--error": c.value }]);
|
|
1923
|
+
return (t, n) => (_(), o("div", { class: p(l.value) }, [e.label ? (_(), o("label", {
|
|
1924
|
+
key: 0,
|
|
1925
|
+
id: `label-${T(i)}`,
|
|
1926
|
+
class: "kb-form-item__label"
|
|
1927
|
+
}, w(e.label), 9, Yn)) : a("", !0), s("div", {
|
|
1928
|
+
role: e.label ? "group" : void 0,
|
|
1929
|
+
"aria-labelledby": e.label ? `label-${T(i)}` : void 0,
|
|
1930
|
+
class: "kb-form-item__content"
|
|
1931
|
+
}, [S(t.$slots, "default"), c.value ? (_(), o("div", Zn, w(c.value), 1)) : a("", !0)], 8, Xn)], 2));
|
|
1932
|
+
}
|
|
1933
|
+
}), $n = { class: "kb-datepicker" }, er = ["value", "placeholder"], tr = {
|
|
1934
|
+
key: 0,
|
|
1935
|
+
class: "kb-datepicker__panel"
|
|
1936
|
+
}, nr = /* @__PURE__ */ u({
|
|
1937
|
+
name: "KbDatePicker",
|
|
1938
|
+
__name: "DatePicker",
|
|
1939
|
+
props: {
|
|
1940
|
+
modelValue: { default: "" },
|
|
1941
|
+
placeholder: { default: "选择日期" }
|
|
1942
|
+
},
|
|
1943
|
+
emits: ["update:modelValue"],
|
|
1944
|
+
setup(e, { emit: t }) {
|
|
1945
|
+
let n = t, r = b(!1);
|
|
1946
|
+
function i() {
|
|
1947
|
+
r.value = !r.value;
|
|
1948
|
+
}
|
|
1949
|
+
function c(e) {
|
|
1950
|
+
n("update:modelValue", e), r.value = !1;
|
|
1951
|
+
}
|
|
1952
|
+
return (t, n) => (_(), o("div", $n, [s("input", {
|
|
1953
|
+
class: "kb-datepicker__input",
|
|
1954
|
+
value: e.modelValue,
|
|
1955
|
+
placeholder: e.placeholder,
|
|
1956
|
+
readonly: "",
|
|
1957
|
+
onClick: i
|
|
1958
|
+
}, null, 8, er), r.value ? (_(), o("div", tr, [l(T(Q), {
|
|
1959
|
+
"model-value": e.modelValue,
|
|
1960
|
+
"onUpdate:modelValue": c
|
|
1961
|
+
}, null, 8, ["model-value"])])) : a("", !0)]));
|
|
1962
|
+
}
|
|
1963
|
+
}), rr = { class: "kb-upload" }, ir = { class: "kb-upload__button" }, ar = ["accept", "multiple"], or = {
|
|
1964
|
+
key: 0,
|
|
1965
|
+
class: "kb-upload__list"
|
|
1966
|
+
}, sr = { class: "kb-upload__name" }, cr = { class: "kb-upload__size" }, lr = {
|
|
1967
|
+
key: 0,
|
|
1968
|
+
class: "kb-upload__status"
|
|
1969
|
+
}, ur = {
|
|
1970
|
+
key: 1,
|
|
1971
|
+
class: "kb-upload__status kb-upload__status--success"
|
|
1972
|
+
}, dr = {
|
|
1973
|
+
key: 2,
|
|
1974
|
+
class: "kb-upload__status kb-upload__status--error"
|
|
1975
|
+
}, fr = ["onClick"], pr = /* @__PURE__ */ u({
|
|
1976
|
+
name: "KbUpload",
|
|
1977
|
+
__name: "Upload",
|
|
1978
|
+
props: {
|
|
1979
|
+
accept: { default: "" },
|
|
1980
|
+
multiple: {
|
|
1981
|
+
type: Boolean,
|
|
1982
|
+
default: !1
|
|
1983
|
+
},
|
|
1984
|
+
action: { default: "" },
|
|
1985
|
+
headers: {},
|
|
1986
|
+
withCredentials: {
|
|
1987
|
+
type: Boolean,
|
|
1988
|
+
default: !1
|
|
1989
|
+
},
|
|
1990
|
+
name: { default: "file" }
|
|
1991
|
+
},
|
|
1992
|
+
emits: [
|
|
1993
|
+
"change",
|
|
1994
|
+
"remove",
|
|
1995
|
+
"progress",
|
|
1996
|
+
"success",
|
|
1997
|
+
"error"
|
|
1998
|
+
],
|
|
1999
|
+
setup(t, { emit: n }) {
|
|
2000
|
+
let r = t, i = n, l = b([]);
|
|
2001
|
+
function u(e) {
|
|
2002
|
+
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
2003
|
+
}
|
|
2004
|
+
function d(e) {
|
|
2005
|
+
return {
|
|
2006
|
+
name: e.name,
|
|
2007
|
+
size: e.size,
|
|
2008
|
+
status: e.status,
|
|
2009
|
+
progress: e.progress
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
function f(e) {
|
|
2013
|
+
let t = new XMLHttpRequest();
|
|
2014
|
+
e.status = "uploading", e.progress = 0, t.upload.addEventListener("progress", (t) => {
|
|
2015
|
+
t.lengthComputable && (e.progress = Math.round(t.loaded / t.total * 100), i("progress", d(e)));
|
|
2016
|
+
}), t.addEventListener("load", () => {
|
|
2017
|
+
t.status >= 200 && t.status < 300 ? (e.status = "success", e.progress = 100, i("success", {
|
|
2018
|
+
file: d(e),
|
|
2019
|
+
response: t.responseText
|
|
2020
|
+
})) : (e.status = "error", i("error", {
|
|
2021
|
+
file: d(e),
|
|
2022
|
+
error: `HTTP ${t.status}`
|
|
2023
|
+
}));
|
|
2024
|
+
}), t.addEventListener("error", () => {
|
|
2025
|
+
e.status = "error", i("error", {
|
|
2026
|
+
file: d(e),
|
|
2027
|
+
error: "network error"
|
|
2028
|
+
});
|
|
2029
|
+
}), t.addEventListener("abort", () => {
|
|
2030
|
+
e.status = "error", i("error", {
|
|
2031
|
+
file: d(e),
|
|
2032
|
+
error: "aborted"
|
|
2033
|
+
});
|
|
2034
|
+
});
|
|
2035
|
+
let n = new FormData();
|
|
2036
|
+
n.append(r.name, e.raw);
|
|
2037
|
+
for (let [e, n] of Object.entries(r.headers ?? {})) t.setRequestHeader(e, n);
|
|
2038
|
+
r.withCredentials && (t.withCredentials = !0), t.open("POST", r.action), t.send(n);
|
|
2039
|
+
}
|
|
2040
|
+
function p(e) {
|
|
2041
|
+
let t = e.target, n = Array.from(t.files ?? []).map((e) => ({
|
|
2042
|
+
name: e.name,
|
|
2043
|
+
size: e.size,
|
|
2044
|
+
raw: e,
|
|
2045
|
+
status: "pending"
|
|
2046
|
+
}));
|
|
2047
|
+
if (l.value = r.multiple ? [...l.value, ...n] : n, i("change", n.map(d)), r.action) for (let e of l.value) f(e);
|
|
2048
|
+
t.value = "";
|
|
2049
|
+
}
|
|
2050
|
+
function m(e) {
|
|
2051
|
+
let [t] = l.value.splice(e, 1);
|
|
2052
|
+
t && i("remove", d(t));
|
|
2053
|
+
}
|
|
2054
|
+
return (n, r) => (_(), o("div", rr, [s("label", ir, [s("input", {
|
|
2055
|
+
type: "file",
|
|
2056
|
+
accept: t.accept,
|
|
2057
|
+
multiple: t.multiple,
|
|
2058
|
+
"aria-label": "选择文件",
|
|
2059
|
+
onChange: p
|
|
2060
|
+
}, null, 40, ar), r[0] ||= c(" 选择文件 ", -1)]), l.value.length ? (_(), o("div", or, [(_(!0), o(e, null, x(l.value, (e, t) => (_(), o("div", {
|
|
2061
|
+
key: `${e.name}-${t}`,
|
|
2062
|
+
class: "kb-upload__item"
|
|
2063
|
+
}, [
|
|
2064
|
+
r[1] ||= s("span", { class: "kb-upload__icon" }, "📄", -1),
|
|
2065
|
+
s("span", sr, w(e.name), 1),
|
|
2066
|
+
s("span", cr, w(u(e.size)), 1),
|
|
2067
|
+
e.status === "uploading" ? (_(), o("span", lr, " 上传中 " + w(e.progress ?? 0) + "% ", 1)) : e.status === "success" ? (_(), o("span", ur, " 已上传 ")) : e.status === "error" ? (_(), o("span", dr, " 上传失败 ")) : a("", !0),
|
|
2068
|
+
s("button", {
|
|
2069
|
+
class: "kb-upload__delete",
|
|
2070
|
+
type: "button",
|
|
2071
|
+
"aria-label": "删除",
|
|
2072
|
+
onClick: (e) => m(t)
|
|
2073
|
+
}, "×", 8, fr)
|
|
2074
|
+
]))), 128))])) : a("", !0)]));
|
|
2075
|
+
}
|
|
2076
|
+
}), mr = { class: "kb-tree" }, hr = { class: "kb-tree__row" }, gr = ["onClick"], _r = {
|
|
2077
|
+
key: 1,
|
|
2078
|
+
class: "kb-tree__toggle kb-tree__toggle--leaf"
|
|
2079
|
+
}, vr = ["onClick"], yr = {
|
|
2080
|
+
key: 0,
|
|
2081
|
+
class: "kb-tree__children"
|
|
2082
|
+
}, br = /* @__PURE__ */ u({
|
|
2083
|
+
name: "KbTree",
|
|
2084
|
+
__name: "Tree",
|
|
2085
|
+
props: { data: { default: () => [] } },
|
|
2086
|
+
emits: ["select"],
|
|
2087
|
+
setup(t, { emit: n }) {
|
|
2088
|
+
let r = t, i = n, c = b(/* @__PURE__ */ new Set()), u = b(null);
|
|
2089
|
+
function d(e) {
|
|
2090
|
+
return c.value.has(e);
|
|
2091
|
+
}
|
|
2092
|
+
function f(e) {
|
|
2093
|
+
let t = new Set(c.value);
|
|
2094
|
+
t.has(e) ? t.delete(e) : t.add(e), c.value = t;
|
|
2095
|
+
}
|
|
2096
|
+
function m(e) {
|
|
2097
|
+
u.value = e, i("select", e);
|
|
2098
|
+
}
|
|
2099
|
+
return (t, n) => {
|
|
2100
|
+
let i = C("KbTree");
|
|
2101
|
+
return _(), o("div", mr, [(_(!0), o(e, null, x(r.data, (t, n) => (_(), o(e, { key: `${t.label}-${n}` }, [s("div", hr, [t.children && t.children.length ? (_(), o("span", {
|
|
2102
|
+
key: 0,
|
|
2103
|
+
class: p(["kb-tree__toggle", { "kb-tree__toggle--open": d(t) }]),
|
|
2104
|
+
role: "button",
|
|
2105
|
+
onClick: (e) => f(t)
|
|
2106
|
+
}, " ▸ ", 10, gr)) : (_(), o("span", _r)), s("span", {
|
|
2107
|
+
class: p(["kb-tree__label", { "kb-tree__label--selected": u.value === t }]),
|
|
2108
|
+
onClick: (e) => m(t)
|
|
2109
|
+
}, w(t.label), 11, vr)]), t.children && t.children.length && d(t) ? (_(), o("div", yr, [l(i, {
|
|
2110
|
+
data: t.children,
|
|
2111
|
+
onSelect: m
|
|
2112
|
+
}, null, 8, ["data"])])) : a("", !0)], 64))), 128))]);
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
}), xr = { class: "kb-colorpicker" }, Sr = { class: "kb-colorpicker__presets" }, Cr = ["aria-label", "onClick"], $ = /* @__PURE__ */ u({
|
|
2116
|
+
name: "KbColorPicker",
|
|
2117
|
+
__name: "ColorPicker",
|
|
2118
|
+
props: { modelValue: { default: "" } },
|
|
2119
|
+
emits: ["update:modelValue"],
|
|
2120
|
+
setup(t, { emit: n }) {
|
|
2121
|
+
let r = n, i = [
|
|
2122
|
+
"#3b82f6",
|
|
2123
|
+
"#ef4444",
|
|
2124
|
+
"#f59e0b",
|
|
2125
|
+
"#10b981",
|
|
2126
|
+
"#8b5cf6",
|
|
2127
|
+
"#ec4899",
|
|
2128
|
+
"#06b6d4",
|
|
2129
|
+
"#84cc16",
|
|
2130
|
+
"#f97316",
|
|
2131
|
+
"#6366f1"
|
|
2132
|
+
];
|
|
2133
|
+
function a(e) {
|
|
2134
|
+
r("update:modelValue", e);
|
|
2135
|
+
}
|
|
2136
|
+
return (n, r) => (_(), o("div", xr, [s("span", {
|
|
2137
|
+
class: "kb-colorpicker__value",
|
|
2138
|
+
style: m({ background: t.modelValue || "#fff" })
|
|
2139
|
+
}, null, 4), s("div", Sr, [(_(), o(e, null, x(i, (e) => s("button", {
|
|
2140
|
+
key: e,
|
|
2141
|
+
class: p(["kb-colorpicker__swatch", { "kb-colorpicker__swatch--active": t.modelValue === e }]),
|
|
2142
|
+
type: "button",
|
|
2143
|
+
style: m({ background: e }),
|
|
2144
|
+
"aria-label": `选择颜色 ${e}`,
|
|
2145
|
+
onClick: (t) => a(e)
|
|
2146
|
+
}, null, 14, Cr)), 64))])]));
|
|
2147
|
+
}
|
|
2148
|
+
}), wr = { class: "kb-input-password" }, Tr = [
|
|
2149
|
+
"type",
|
|
2150
|
+
"value",
|
|
2151
|
+
"placeholder"
|
|
2152
|
+
], Er = ["aria-label"], Dr = /* @__PURE__ */ u({
|
|
2153
|
+
name: "KbInputPassword",
|
|
2154
|
+
__name: "InputPassword",
|
|
2155
|
+
props: {
|
|
2156
|
+
modelValue: { default: "" },
|
|
2157
|
+
placeholder: { default: "" },
|
|
2158
|
+
size: { default: "medium" }
|
|
2159
|
+
},
|
|
2160
|
+
emits: ["update:modelValue"],
|
|
2161
|
+
setup(e, { emit: t }) {
|
|
2162
|
+
let n = t, r = b(!1);
|
|
2163
|
+
function i(e) {
|
|
2164
|
+
n("update:modelValue", e.target.value);
|
|
2165
|
+
}
|
|
2166
|
+
return (t, n) => (_(), o("div", wr, [s("input", {
|
|
2167
|
+
class: "kb-input-password__inner",
|
|
2168
|
+
type: r.value ? "text" : "password",
|
|
2169
|
+
value: e.modelValue,
|
|
2170
|
+
placeholder: e.placeholder,
|
|
2171
|
+
onInput: i
|
|
2172
|
+
}, null, 40, Tr), s("button", {
|
|
2173
|
+
class: "kb-input-password__toggle",
|
|
2174
|
+
type: "button",
|
|
2175
|
+
"aria-label": r.value ? "隐藏密码" : "显示密码",
|
|
2176
|
+
onClick: n[0] ||= (e) => r.value = !r.value
|
|
2177
|
+
}, [l(T(N), {
|
|
2178
|
+
name: r.value ? "info" : "warning",
|
|
2179
|
+
size: 16
|
|
2180
|
+
}, null, 8, ["name"])], 8, Er)]));
|
|
2181
|
+
}
|
|
2182
|
+
}), Or = { class: "kb-countup" }, kr = /* @__PURE__ */ u({
|
|
2183
|
+
name: "KbCountUp",
|
|
2184
|
+
__name: "CountUp",
|
|
2185
|
+
props: {
|
|
2186
|
+
end: {},
|
|
2187
|
+
start: { default: 0 },
|
|
2188
|
+
duration: { default: 1500 },
|
|
2189
|
+
prefix: { default: "" },
|
|
2190
|
+
suffix: { default: "" },
|
|
2191
|
+
decimals: { default: 0 }
|
|
2192
|
+
},
|
|
2193
|
+
setup(e) {
|
|
2194
|
+
let t = e, n = b(t.start), r = 0;
|
|
2195
|
+
function i() {
|
|
2196
|
+
let e = null, i = t.start, a = t.end - i, o = (s) => {
|
|
2197
|
+
e === null && (e = s);
|
|
2198
|
+
let c = Math.min(1, Math.max(0, (s - e) / t.duration)), l = 1 - (1 - c) ** 3;
|
|
2199
|
+
n.value = i + a * l, c < 1 ? r = requestAnimationFrame(o) : n.value = t.end;
|
|
2200
|
+
};
|
|
2201
|
+
r = requestAnimationFrame(o);
|
|
2202
|
+
}
|
|
2203
|
+
return g(i), h(() => cancelAnimationFrame(r)), (t, r) => (_(), o("span", Or, w(e.prefix) + w(n.value.toFixed(e.decimals)) + w(e.suffix), 1));
|
|
2204
|
+
}
|
|
2205
|
+
}), Ar = { key: 0 }, jr = {
|
|
2206
|
+
key: 1,
|
|
2207
|
+
class: "kb-list__empty"
|
|
2208
|
+
}, Mr = /* @__PURE__ */ u({
|
|
2209
|
+
name: "KbList",
|
|
2210
|
+
__name: "List",
|
|
2211
|
+
props: {
|
|
2212
|
+
items: { default: () => [] },
|
|
2213
|
+
empty: { default: "暂无数据" },
|
|
2214
|
+
bordered: {
|
|
2215
|
+
type: Boolean,
|
|
2216
|
+
default: !1
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2219
|
+
setup(t) {
|
|
2220
|
+
let r = t, i = n(() => ["kb-list", { "kb-list--bordered": r.bordered }]);
|
|
2221
|
+
return (n, r) => (_(), o("div", {
|
|
2222
|
+
class: p(i.value),
|
|
2223
|
+
role: "list"
|
|
2224
|
+
}, [t.items.length ? (_(), o("div", Ar, [(_(!0), o(e, null, x(t.items, (e, t) => (_(), o("div", {
|
|
2225
|
+
key: t,
|
|
2226
|
+
class: "kb-list__item",
|
|
2227
|
+
role: "listitem"
|
|
2228
|
+
}, [S(n.$slots, "item", {
|
|
2229
|
+
item: e,
|
|
2230
|
+
index: t
|
|
2231
|
+
}, () => [c(w(e), 1)])]))), 128))])) : (_(), o("div", jr, w(t.empty), 1))], 2));
|
|
2232
|
+
}
|
|
2233
|
+
}), Nr = { class: "kb-transfer" }, Pr = { class: "kb-transfer__box kb-transfer__left" }, Fr = ["onClick"], Ir = { class: "kb-transfer__actions" }, Lr = ["disabled"], Rr = ["disabled"], zr = { class: "kb-transfer__box kb-transfer__right" }, Br = ["onClick"], Vr = /* @__PURE__ */ u({
|
|
2234
|
+
name: "KbTransfer",
|
|
2235
|
+
__name: "Transfer",
|
|
2236
|
+
props: {
|
|
2237
|
+
data: { default: () => [] },
|
|
2238
|
+
modelValue: { default: () => [] }
|
|
2239
|
+
},
|
|
2240
|
+
emits: ["update:modelValue"],
|
|
2241
|
+
setup(t, { emit: r }) {
|
|
2242
|
+
let i = t, a = r, c = b([]), l = b([]), u = n(() => i.data.filter((e) => !i.modelValue.includes(e.key))), d = n(() => i.data.filter((e) => i.modelValue.includes(e.key)));
|
|
2243
|
+
function f(e, t) {
|
|
2244
|
+
let n = t === "left" ? c : l, r = new Set(n.value);
|
|
2245
|
+
r.has(e) ? r.delete(e) : r.add(e), n.value = [...r];
|
|
2246
|
+
}
|
|
2247
|
+
function m(e) {
|
|
2248
|
+
let t = e ? c.value : l.value, n = e ? [...i.modelValue, ...t] : i.modelValue.filter((e) => !t.includes(e));
|
|
2249
|
+
a("update:modelValue", n), c.value = [], l.value = [];
|
|
2250
|
+
}
|
|
2251
|
+
return (t, n) => (_(), o("div", Nr, [
|
|
2252
|
+
s("div", Pr, [n[2] ||= s("div", { class: "kb-transfer__title" }, "待选", -1), (_(!0), o(e, null, x(u.value, (e) => (_(), o("div", {
|
|
2253
|
+
key: e.key,
|
|
2254
|
+
class: p(["kb-transfer__item", { "kb-transfer__item--selected": c.value.includes(e.key) }]),
|
|
2255
|
+
onClick: (t) => f(e.key, "left")
|
|
2256
|
+
}, w(e.label), 11, Fr))), 128))]),
|
|
2257
|
+
s("div", Ir, [s("button", {
|
|
2258
|
+
class: "kb-transfer__move kb-transfer__move--right",
|
|
2259
|
+
type: "button",
|
|
2260
|
+
disabled: !c.value.length,
|
|
2261
|
+
onClick: n[0] ||= (e) => m(!0)
|
|
2262
|
+
}, " → ", 8, Lr), s("button", {
|
|
2263
|
+
class: "kb-transfer__move kb-transfer__move--left",
|
|
2264
|
+
type: "button",
|
|
2265
|
+
disabled: !l.value.length,
|
|
2266
|
+
onClick: n[1] ||= (e) => m(!1)
|
|
2267
|
+
}, " ← ", 8, Rr)]),
|
|
2268
|
+
s("div", zr, [n[3] ||= s("div", { class: "kb-transfer__title" }, "已选", -1), (_(!0), o(e, null, x(d.value, (e) => (_(), o("div", {
|
|
2269
|
+
key: e.key,
|
|
2270
|
+
class: p(["kb-transfer__item", { "kb-transfer__item--selected": l.value.includes(e.key) }]),
|
|
2271
|
+
onClick: (t) => f(e.key, "right")
|
|
2272
|
+
}, w(e.label), 11, Br))), 128))])
|
|
2273
|
+
]));
|
|
2274
|
+
}
|
|
2275
|
+
}), Hr = { class: "kb-cascader" }, Ur = ["aria-expanded"], Wr = ["aria-label"], Gr = ["aria-selected", "onClick"], Kr = {
|
|
2276
|
+
key: 0,
|
|
2277
|
+
class: "kb-cascader__more"
|
|
2278
|
+
}, qr = /* @__PURE__ */ u({
|
|
2279
|
+
name: "KbCascader",
|
|
2280
|
+
__name: "Cascader",
|
|
2281
|
+
props: {
|
|
2282
|
+
options: { default: () => [] },
|
|
2283
|
+
modelValue: { default: () => [] },
|
|
2284
|
+
placeholder: { default: "请选择" }
|
|
2285
|
+
},
|
|
2286
|
+
emits: ["update:modelValue"],
|
|
2287
|
+
setup(t, { emit: r }) {
|
|
2288
|
+
let i = t, l = r, u = b(!1), d = b([]), f = `kb-cascader-${Math.random().toString(36).slice(2, 8)}`;
|
|
2289
|
+
function m() {
|
|
2290
|
+
u.value = !1;
|
|
2291
|
+
}
|
|
2292
|
+
function h(e) {
|
|
2293
|
+
e.key === "Escape" && (e.preventDefault(), m());
|
|
2294
|
+
}
|
|
2295
|
+
let g = n(() => {
|
|
2296
|
+
let e = [], t = i.options;
|
|
2297
|
+
for (let n of i.modelValue) {
|
|
2298
|
+
let r = t.find((e) => e.value === n);
|
|
2299
|
+
if (!r) break;
|
|
2300
|
+
e.push(r.label), t = r.children ?? [];
|
|
2301
|
+
}
|
|
2302
|
+
return e.join(" / ") || i.placeholder;
|
|
2303
|
+
});
|
|
2304
|
+
function v(e) {
|
|
2305
|
+
if (e === 0) d.value = [i.options];
|
|
2306
|
+
else {
|
|
2307
|
+
let t = i.options, n = [];
|
|
2308
|
+
for (let r of i.modelValue.slice(0, e)) t = t.find((e) => e.value === r)?.children ?? [], n.push(t);
|
|
2309
|
+
d.value = n.length ? n : [i.options];
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
function y(e, t) {
|
|
2313
|
+
let n = [...i.modelValue.slice(0, t), e.value];
|
|
2314
|
+
l("update:modelValue", n), e.children?.length ? (d.value = d.value.slice(0, t + 1), d.value.push(e.children)) : u.value = !1;
|
|
2315
|
+
}
|
|
2316
|
+
return (n, r) => (_(), o("div", Hr, [s("div", {
|
|
2317
|
+
class: "kb-cascader__trigger",
|
|
2318
|
+
tabindex: "0",
|
|
2319
|
+
role: "combobox",
|
|
2320
|
+
"aria-haspopup": "true",
|
|
2321
|
+
"aria-expanded": u.value,
|
|
2322
|
+
"aria-controls": f,
|
|
2323
|
+
onClick: r[0] ||= (e) => {
|
|
2324
|
+
u.value = !u.value, v(0);
|
|
2325
|
+
},
|
|
2326
|
+
onKeydown: h
|
|
2327
|
+
}, [s("span", { class: p({ "kb-cascader__placeholder": g.value === t.placeholder }) }, w(g.value), 3), r[1] ||= s("span", { class: "kb-cascader__arrow" }, "▾", -1)], 40, Ur), u.value ? (_(), o("div", {
|
|
2328
|
+
key: 0,
|
|
2329
|
+
id: f,
|
|
2330
|
+
class: "kb-cascader__panel",
|
|
2331
|
+
role: "dialog",
|
|
2332
|
+
"aria-label": "级联选择"
|
|
2333
|
+
}, [(_(!0), o(e, null, x(d.value, (t, n) => (_(), o("div", {
|
|
2334
|
+
key: n,
|
|
2335
|
+
class: "kb-cascader__column",
|
|
2336
|
+
role: "listbox",
|
|
2337
|
+
"aria-label": `第 ${n + 1} 级`
|
|
2338
|
+
}, [(_(!0), o(e, null, x(t, (e) => (_(), o("div", {
|
|
2339
|
+
key: e.value,
|
|
2340
|
+
class: p(["kb-cascader__option", { "kb-cascader__option--active": i.modelValue[n] === e.value }]),
|
|
2341
|
+
role: "option",
|
|
2342
|
+
"aria-selected": i.modelValue[n] === e.value,
|
|
2343
|
+
onClick: (t) => y(e, n)
|
|
2344
|
+
}, [c(w(e.label) + " ", 1), e.children?.length ? (_(), o("span", Kr, "›")) : a("", !0)], 10, Gr))), 128))], 8, Wr))), 128))])) : a("", !0)]));
|
|
2345
|
+
}
|
|
2346
|
+
}), Jr = [
|
|
2347
|
+
j,
|
|
2348
|
+
N,
|
|
2349
|
+
ne,
|
|
2350
|
+
re,
|
|
2351
|
+
ae,
|
|
2352
|
+
P,
|
|
2353
|
+
F,
|
|
2354
|
+
I,
|
|
2355
|
+
L,
|
|
2356
|
+
R,
|
|
2357
|
+
z,
|
|
2358
|
+
B,
|
|
2359
|
+
V,
|
|
2360
|
+
H,
|
|
2361
|
+
G,
|
|
2362
|
+
K,
|
|
2363
|
+
q,
|
|
2364
|
+
J,
|
|
2365
|
+
Y,
|
|
2366
|
+
Pe,
|
|
2367
|
+
Fe,
|
|
2368
|
+
Be,
|
|
2369
|
+
Ge,
|
|
2370
|
+
Xe,
|
|
2371
|
+
tt,
|
|
2372
|
+
ct,
|
|
2373
|
+
dt,
|
|
2374
|
+
ht,
|
|
2375
|
+
bt,
|
|
2376
|
+
Ct,
|
|
2377
|
+
Et,
|
|
2378
|
+
jt,
|
|
2379
|
+
Rt,
|
|
2380
|
+
Jt,
|
|
2381
|
+
tn,
|
|
2382
|
+
fn,
|
|
2383
|
+
hn,
|
|
2384
|
+
vn,
|
|
2385
|
+
xn,
|
|
2386
|
+
wn,
|
|
2387
|
+
On,
|
|
2388
|
+
Pn,
|
|
2389
|
+
Rn,
|
|
2390
|
+
Q,
|
|
2391
|
+
qn,
|
|
2392
|
+
Jn,
|
|
2393
|
+
Qn,
|
|
2394
|
+
nr,
|
|
2395
|
+
pr,
|
|
2396
|
+
br,
|
|
2397
|
+
$,
|
|
2398
|
+
Dr,
|
|
2399
|
+
kr,
|
|
2400
|
+
Mr,
|
|
2401
|
+
Vr,
|
|
2402
|
+
qr
|
|
2403
|
+
], Yr = {
|
|
2404
|
+
install: (e) => {
|
|
2405
|
+
Jr.forEach((t) => e.component(t.name, t));
|
|
2406
|
+
},
|
|
2407
|
+
version: "0.2.0"
|
|
2408
|
+
};
|
|
2409
|
+
//#endregion
|
|
2410
|
+
export { Pe as Alert, Pe as KbAlert, q as Avatar, q as KbAvatar, K as Badge, K as KbBadge, Ge as Breadcrumb, Ge as KbBreadcrumb, j as Button, j as KbButton, Q as Calendar, Q as KbCalendar, Y as Card, Y as KbCard, Pn as Carousel, Pn as KbCarousel, qr as Cascader, qr as KbCascader, L as Checkbox, L as KbCheckbox, F as Col, F as KbCol, Xe as Collapse, Xe as KbCollapse, $ as ColorPicker, $ as KbColorPicker, kr as CountUp, kr as KbCountUp, nr as DatePicker, nr as KbDatePicker, Rn as Descriptions, Rn as KbDescriptions, H as Dialog, H as KbDialog, ae as Divider, ae as KbDivider, ht as Drawer, ht as KbDrawer, dt as Dropdown, dt as KbDropdown, Be as Empty, Be as KbEmpty, Jn as Form, Jn as KbForm, Qn as FormItem, Qn as KbFormItem, N as Icon, N as KbIcon, I as Input, I as KbInput, fn as InputNumber, fn as KbInputNumber, Dr as InputPassword, Dr as KbInputPassword, Mr as KbList, Mr as List, qn as KbLoading, qn as Loading, ct as KbPagination, ct as Pagination, On as KbPopconfirm, On as Popconfirm, bt as KbPopover, bt as Popover, J as KbProgress, J as Progress, R as KbRadio, R as Radio, Ct as KbRate, Ct as Rate, jt as KbResult, jt as Result, P as KbRow, P as Row, vn as KbSearch, vn as Search, xn as KbSegmented, xn as Segmented, B as KbSelect, B as Select, Fe as KbSkeleton, Fe as Skeleton, Et as KbSlider, Et as Slider, re as KbSpace, re as Space, Rt as KbStatistic, Rt as Statistic, Jt as KbSteps, Jt as Steps, z as KbSwitch, z as Switch, G as KbTable, G as Table, tt as KbTabs, tt as Tabs, ne as KbTag, ne as Tag, hn as KbTextarea, hn as Textarea, tn as KbTimeline, tn as Timeline, V as KbTooltip, V as Tooltip, Vr as KbTransfer, Vr as Transfer, br as KbTree, br as Tree, pr as KbUpload, pr as Upload, wn as KbWatermark, wn as Watermark, be as Message, on as Notification, Yr as default, Se as message, cn as notification };
|