@guoyg578/k-ui 0.1.4 → 0.1.6
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/KAutoComplete.vue.d.ts +2 -0
- package/dist/components/KAutoComplete.vue.js +1 -1
- package/dist/components/KAutoComplete.vue_vue_type_script_setup_true_lang.js +89 -29
- package/dist/components/KCalendar.vue.js +1 -1
- package/dist/components/KCalendar.vue_vue_type_script_setup_true_lang.js +132 -39
- package/dist/components/KCascader.vue.d.ts +2 -0
- package/dist/components/KCascader.vue.js +1 -1
- package/dist/components/KCascader.vue_vue_type_script_setup_true_lang.js +45 -43
- package/dist/components/KCheckbox.vue.d.ts +6 -2
- package/dist/components/KCheckbox.vue.js +1 -1
- package/dist/components/KCheckbox.vue_vue_type_script_setup_true_lang.js +38 -18
- package/dist/components/KCheckboxGroup.vue.d.ts +2 -0
- package/dist/components/KCheckboxGroup.vue.js +1 -1
- package/dist/components/KCheckboxGroup.vue_vue_type_script_setup_true_lang.js +23 -15
- package/dist/components/KCollapse.vue.d.ts +3 -1
- package/dist/components/KCollapse.vue.js +1 -1
- package/dist/components/KCollapse.vue_vue_type_script_setup_true_lang.js +27 -16
- package/dist/components/KCombobox.vue.js +1 -1
- package/dist/components/KCombobox.vue_vue_type_script_setup_true_lang.js +48 -47
- package/dist/components/KDataTable.vue.d.ts +48 -1
- package/dist/components/KDataTable.vue.js +1 -1
- package/dist/components/KDataTable.vue_vue_type_script_setup_true_lang.js +305 -74
- package/dist/components/KDatePicker.vue.d.ts +8 -0
- package/dist/components/KDatePicker.vue_vue_type_script_setup_true_lang.js +32 -22
- package/dist/components/KDialog.vue.d.ts +4 -4
- package/dist/components/KDialog.vue.js +1 -1
- package/dist/components/KDialog.vue_vue_type_script_setup_true_lang.js +83 -73
- package/dist/components/KDrawer.vue.js +1 -1
- package/dist/components/KDrawer.vue_vue_type_script_setup_true_lang.js +36 -35
- package/dist/components/KDropdown.vue.d.ts +4 -3
- package/dist/components/KDropdown.vue_vue_type_script_setup_true_lang.js +48 -30
- package/dist/components/KDynamicInput.vue.d.ts +2 -0
- package/dist/components/KDynamicInput.vue.js +1 -1
- package/dist/components/KDynamicInput.vue_vue_type_script_setup_true_lang.js +17 -6
- package/dist/components/KDynamicTags.vue.d.ts +2 -0
- package/dist/components/KDynamicTags.vue.js +1 -1
- package/dist/components/KDynamicTags.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/components/KForm.vue.d.ts +12 -0
- package/dist/components/KForm.vue.js +1 -1
- package/dist/components/KForm.vue_vue_type_script_setup_true_lang.js +26 -4
- package/dist/components/KFormField.vue.d.ts +3 -1
- package/dist/components/KFormField.vue.js +1 -1
- package/dist/components/KFormField.vue_vue_type_script_setup_true_lang.js +124 -61
- package/dist/components/KInputNumber.vue.js +1 -1
- package/dist/components/KInputNumber.vue_vue_type_script_setup_true_lang.js +35 -29
- package/dist/components/KMention.vue.d.ts +2 -0
- package/dist/components/KMention.vue.js +1 -1
- package/dist/components/KMention.vue_vue_type_script_setup_true_lang.js +34 -33
- package/dist/components/KMenu.vue.js +1 -1
- package/dist/components/KMenu.vue_vue_type_script_setup_true_lang.js +132 -51
- package/dist/components/KMenuItem.vue.js +1 -1
- package/dist/components/KMenuItem.vue_vue_type_script_setup_true_lang.js +21 -6
- package/dist/components/KMessage.d.ts +5 -0
- package/dist/components/KMessage.js +36 -23
- package/dist/components/KNotification.d.ts +8 -0
- package/dist/components/KNotification.js +45 -29
- package/dist/components/KNotificationProvider.vue.js +3 -8
- package/dist/components/KNotificationProvider.vue_vue_type_script_setup_true_lang.js +11 -0
- package/dist/components/KPagination.vue.d.ts +4 -1
- package/dist/components/KPagination.vue.js +1 -1
- package/dist/components/KPagination.vue_vue_type_script_setup_true_lang.js +36 -33
- package/dist/components/KPopover.vue_vue_type_script_setup_true_lang.js +15 -14
- package/dist/components/KRadio.vue.d.ts +1 -0
- package/dist/components/KRadio.vue.js +1 -1
- package/dist/components/KRadio.vue_vue_type_script_setup_true_lang.js +22 -14
- package/dist/components/KRadioGroup.vue.d.ts +4 -2
- package/dist/components/KRadioGroup.vue.js +1 -1
- package/dist/components/KRadioGroup.vue_vue_type_script_setup_true_lang.js +16 -4
- package/dist/components/KRate.vue.d.ts +5 -0
- package/dist/components/KRate.vue.js +1 -1
- package/dist/components/KRate.vue_vue_type_script_setup_true_lang.js +72 -24
- package/dist/components/KSelect.vue.d.ts +2 -2
- package/dist/components/KSelect.vue.js +1 -1
- package/dist/components/KSelect.vue_vue_type_script_setup_true_lang.js +60 -59
- package/dist/components/KSlider.vue.d.ts +2 -0
- package/dist/components/KSlider.vue.js +1 -1
- package/dist/components/KSlider.vue_vue_type_script_setup_true_lang.js +17 -16
- package/dist/components/KTextarea.vue.d.ts +2 -0
- package/dist/components/KTextarea.vue.js +1 -1
- package/dist/components/KTextarea.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/components/KTimePicker.vue.d.ts +2 -0
- package/dist/components/KTimePicker.vue.js +1 -1
- package/dist/components/KTimePicker.vue_vue_type_script_setup_true_lang.js +63 -49
- package/dist/components/KTooltip.vue_vue_type_script_setup_true_lang.js +13 -12
- package/dist/components/KTransfer.vue.d.ts +2 -0
- package/dist/components/KTransfer.vue.js +1 -1
- package/dist/components/KTransfer.vue_vue_type_script_setup_true_lang.js +35 -34
- package/dist/components/KTreeSelect.vue.d.ts +2 -0
- package/dist/components/KTreeSelect.vue.js +1 -1
- package/dist/components/KTreeSelect.vue_vue_type_script_setup_true_lang.js +20 -18
- package/dist/components/KUpload.vue.d.ts +14 -0
- package/dist/components/KUpload.vue.js +1 -1
- package/dist/components/KUpload.vue_vue_type_script_setup_true_lang.js +159 -117
- package/dist/components/checkbox-context.d.ts +10 -0
- package/dist/components/checkbox-context.js +4 -0
- package/dist/components/form-context.d.ts +19 -2
- package/dist/components/form-context.js +31 -1
- package/dist/components/menu-context.d.ts +4 -0
- package/dist/components/radio-context.d.ts +6 -1
- package/dist/k-ui.css +1 -1
- package/dist/styles/tokens.css +40 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { MENU_KEY as e } from "./menu-context.js";
|
|
2
2
|
import t from "./KMenuItem.vue.js";
|
|
3
|
-
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u,
|
|
4
|
-
import { HoverCardContent as
|
|
3
|
+
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, normalizeStyle as p, openBlock as m, provide as h, ref as g, renderList as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, watch as x, watchEffect as S, withCtx as C } from "vue";
|
|
4
|
+
import { HoverCardContent as w, HoverCardPortal as T, HoverCardRoot as E, HoverCardTrigger as D } from "reka-ui";
|
|
5
5
|
//#region components/KMenu.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var O = ["role"], k = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "k-menu-tree__divider"
|
|
9
|
-
},
|
|
9
|
+
}, A = ["aria-label"], j = ["disabled", "onClick"], M = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "k-menu-tree-flyout__icon"
|
|
12
|
-
},
|
|
12
|
+
}, N = { class: "k-menu-tree-flyout__label" }, P = [
|
|
13
13
|
"disabled",
|
|
14
14
|
"aria-label",
|
|
15
15
|
"onClick"
|
|
16
|
-
],
|
|
16
|
+
], F = /* @__PURE__ */ u({
|
|
17
17
|
__name: "KMenu",
|
|
18
18
|
props: {
|
|
19
19
|
value: {},
|
|
@@ -31,104 +31,185 @@ var E = {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
emits: ["update:value", "select"],
|
|
34
|
-
setup(u, { emit:
|
|
35
|
-
let
|
|
34
|
+
setup(u, { emit: F }) {
|
|
35
|
+
let I = u, L = F, R = g(/* @__PURE__ */ new Set()), z = r(() => {
|
|
36
36
|
let e = [], t = (n, r) => {
|
|
37
37
|
for (let i of n) if (i.type !== "divider") {
|
|
38
|
-
if (i.key ===
|
|
38
|
+
if (i.key === I.value) return e.push(...r), !0;
|
|
39
39
|
if (i.children?.length && t(i.children, [...r, i.key])) return !0;
|
|
40
40
|
}
|
|
41
41
|
return !1;
|
|
42
42
|
};
|
|
43
|
-
return t(
|
|
43
|
+
return t(I.options, []), e;
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
x(z, (e) => {
|
|
46
46
|
if (!e.length) return;
|
|
47
|
-
let t = new Set(
|
|
48
|
-
e.forEach((e) => t.add(e)),
|
|
47
|
+
let t = new Set(R.value);
|
|
48
|
+
e.forEach((e) => t.add(e)), R.value = t;
|
|
49
49
|
}, { immediate: !0 });
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
let B = r(() => {
|
|
51
|
+
let e = [], t = (n, r) => {
|
|
52
|
+
for (let i of n) {
|
|
53
|
+
if (i.type === "divider" || !i.key) continue;
|
|
54
|
+
let n = !!i.children?.length, a = R.value.has(i.key);
|
|
55
|
+
e.push({
|
|
56
|
+
key: i.key,
|
|
57
|
+
option: i,
|
|
58
|
+
depth: r,
|
|
59
|
+
isParent: n,
|
|
60
|
+
expanded: a
|
|
61
|
+
}), n && a && t(i.children, r + 1);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return t(I.options, 0), e;
|
|
65
|
+
}), V = g(), H = g(null);
|
|
66
|
+
S(() => {
|
|
67
|
+
let e = B.value;
|
|
68
|
+
if (!e.length) {
|
|
69
|
+
H.value = null;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
(!H.value || !e.some((e) => e.key === H.value)) && (H.value = I.value && e.some((e) => e.key === I.value) ? I.value : e[0].key);
|
|
73
|
+
});
|
|
74
|
+
function U(e) {
|
|
75
|
+
d(() => {
|
|
76
|
+
let t = `[data-menu-key="${typeof CSS < "u" ? CSS.escape(e) : e}"]`;
|
|
77
|
+
V.value?.querySelector(t)?.focus();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function W(e, t) {
|
|
81
|
+
let n = B.value, r = e;
|
|
82
|
+
for (; r >= 0 && r < n.length && n[r].option.disabled;) r += t;
|
|
83
|
+
r < 0 || r >= n.length || (H.value = n[r].key, U(n[r].key));
|
|
84
|
+
}
|
|
85
|
+
function G(e) {
|
|
86
|
+
if (I.collapsed) return;
|
|
87
|
+
let t = B.value;
|
|
88
|
+
if (!t.length) return;
|
|
89
|
+
let n = t.findIndex((e) => e.key === H.value);
|
|
90
|
+
n < 0 && (n = 0);
|
|
91
|
+
let r = t[n];
|
|
92
|
+
switch (e.key) {
|
|
93
|
+
case "ArrowDown":
|
|
94
|
+
e.preventDefault(), W(n + 1, 1);
|
|
95
|
+
break;
|
|
96
|
+
case "ArrowUp":
|
|
97
|
+
e.preventDefault(), W(n - 1, -1);
|
|
98
|
+
break;
|
|
99
|
+
case "Home":
|
|
100
|
+
e.preventDefault(), W(0, 1);
|
|
101
|
+
break;
|
|
102
|
+
case "End":
|
|
103
|
+
e.preventDefault(), W(t.length - 1, -1);
|
|
104
|
+
break;
|
|
105
|
+
case "ArrowRight":
|
|
106
|
+
e.preventDefault(), r.isParent && !r.expanded ? K.toggle(r.key) : r.isParent && r.expanded && W(n + 1, 1);
|
|
107
|
+
break;
|
|
108
|
+
case "ArrowLeft":
|
|
109
|
+
if (e.preventDefault(), r.isParent && r.expanded) K.toggle(r.key);
|
|
110
|
+
else for (let e = n - 1; e >= 0; e--) if (t[e].depth < r.depth) {
|
|
111
|
+
H.value = t[e].key, U(t[e].key);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case "Enter":
|
|
116
|
+
case " ":
|
|
117
|
+
if (e.preventDefault(), r.option.disabled) break;
|
|
118
|
+
r.isParent ? K.toggle(r.key) : K.select(r.option);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
let K = {
|
|
123
|
+
isActive: (e) => e === I.value,
|
|
124
|
+
inActiveTrail: (e) => z.value.includes(e),
|
|
125
|
+
isExpanded: (e) => R.value.has(e),
|
|
54
126
|
toggle: (e) => {
|
|
55
|
-
let t = new Set(
|
|
56
|
-
t.has(e) ? t.delete(e) : (
|
|
127
|
+
let t = new Set(R.value);
|
|
128
|
+
t.has(e) ? t.delete(e) : (I.accordion && t.clear(), t.add(e)), R.value = t;
|
|
57
129
|
},
|
|
58
130
|
select: (e) => {
|
|
59
|
-
|
|
131
|
+
L("update:value", e.key), L("select", e.key, e);
|
|
132
|
+
},
|
|
133
|
+
isFocused: (e) => H.value === e,
|
|
134
|
+
setFocus: (e) => {
|
|
135
|
+
H.value = e;
|
|
60
136
|
},
|
|
61
137
|
get indent() {
|
|
62
|
-
return
|
|
138
|
+
return I.indent;
|
|
63
139
|
},
|
|
64
140
|
get rootIndent() {
|
|
65
|
-
return
|
|
141
|
+
return I.rootIndent;
|
|
66
142
|
}
|
|
67
143
|
};
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
function
|
|
71
|
-
e.disabled || (
|
|
144
|
+
h(e, K);
|
|
145
|
+
let q = (e) => typeof e == "function";
|
|
146
|
+
function J(e) {
|
|
147
|
+
e.disabled || (L("update:value", e.key), L("select", e.key, e));
|
|
72
148
|
}
|
|
73
|
-
return (e, r) => (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
149
|
+
return (e, r) => (m(), o("nav", {
|
|
150
|
+
ref_key: "navEl",
|
|
151
|
+
ref: V,
|
|
152
|
+
class: f(["k-menu-tree", { "k-menu-tree--collapsed": u.collapsed }]),
|
|
153
|
+
style: p(u.collapsed ? { width: `${u.collapsedWidth}px` } : void 0),
|
|
154
|
+
role: u.collapsed ? void 0 : "tree",
|
|
155
|
+
onKeydown: G
|
|
156
|
+
}, [u.collapsed ? (m(!0), o(n, { key: 1 }, _(u.options, (e, t) => (m(), o(n, { key: e.key || `_div${t}` }, [e.type === "divider" ? (m(), o("div", k)) : e.children?.length ? (m(), i(b(E), {
|
|
77
157
|
key: 1,
|
|
78
158
|
"open-delay": 0,
|
|
79
159
|
"close-delay": 120
|
|
80
160
|
}, {
|
|
81
|
-
default:
|
|
82
|
-
default:
|
|
161
|
+
default: C(() => [l(b(D), { "as-child": "" }, {
|
|
162
|
+
default: C(() => [s("button", {
|
|
83
163
|
type: "button",
|
|
84
|
-
class:
|
|
85
|
-
"aria-label": typeof e.label == "string" ? e.label : void 0
|
|
86
|
-
|
|
164
|
+
class: f(["k-menu-tree__icon-btn", { "k-menu-tree__icon-btn--trail": K.inActiveTrail(e.key) }]),
|
|
165
|
+
"aria-label": typeof e.label == "string" ? e.label : void 0,
|
|
166
|
+
"aria-haspopup": "menu"
|
|
167
|
+
}, [e.icon ? (m(), i(v(e.icon), {
|
|
87
168
|
key: 0,
|
|
88
169
|
size: 20
|
|
89
|
-
})) : a("", !0)], 10,
|
|
170
|
+
})) : a("", !0)], 10, A)]),
|
|
90
171
|
_: 2
|
|
91
|
-
}, 1024), l(
|
|
92
|
-
default:
|
|
172
|
+
}, 1024), l(b(T), null, {
|
|
173
|
+
default: C(() => [l(b(w), {
|
|
93
174
|
class: "k-menu-surface k-menu-tree-flyout",
|
|
94
175
|
side: "right",
|
|
95
176
|
align: "start",
|
|
96
177
|
"side-offset": 10
|
|
97
178
|
}, {
|
|
98
|
-
default:
|
|
179
|
+
default: C(() => [(m(!0), o(n, null, _(e.children, (e) => (m(), o("button", {
|
|
99
180
|
key: e.key,
|
|
100
181
|
type: "button",
|
|
101
|
-
class:
|
|
102
|
-
"k-menu-tree-flyout__item--active":
|
|
182
|
+
class: f(["k-menu-tree-flyout__item", {
|
|
183
|
+
"k-menu-tree-flyout__item--active": K.isActive(e.key),
|
|
103
184
|
"k-menu-tree-flyout__item--disabled": e.disabled
|
|
104
185
|
}]),
|
|
105
186
|
disabled: e.disabled,
|
|
106
|
-
onClick: (t) =>
|
|
107
|
-
}, [e.icon ? (
|
|
187
|
+
onClick: (t) => J(e)
|
|
188
|
+
}, [e.icon ? (m(), o("span", M, [(m(), i(v(e.icon), { size: 16 }))])) : a("", !0), s("span", N, [q(e.label) ? (m(), i(v(e.label), { key: 0 })) : (m(), o(n, { key: 1 }, [c(y(e.label), 1)], 64))])], 10, j))), 128))]),
|
|
108
189
|
_: 2
|
|
109
190
|
}, 1024)]),
|
|
110
191
|
_: 2
|
|
111
192
|
}, 1024)]),
|
|
112
193
|
_: 2
|
|
113
|
-
}, 1024)) : (
|
|
194
|
+
}, 1024)) : (m(), o("button", {
|
|
114
195
|
key: 2,
|
|
115
196
|
type: "button",
|
|
116
|
-
class:
|
|
117
|
-
"k-menu-tree__icon-btn--active":
|
|
197
|
+
class: f(["k-menu-tree__icon-btn", {
|
|
198
|
+
"k-menu-tree__icon-btn--active": K.isActive(e.key),
|
|
118
199
|
"k-menu-tree__icon-btn--disabled": e.disabled
|
|
119
200
|
}]),
|
|
120
201
|
disabled: e.disabled,
|
|
121
202
|
"aria-label": typeof e.label == "string" ? e.label : void 0,
|
|
122
|
-
onClick: (t) =>
|
|
123
|
-
}, [e.icon ? (
|
|
203
|
+
onClick: (t) => J(e)
|
|
204
|
+
}, [e.icon ? (m(), i(v(e.icon), {
|
|
124
205
|
key: 0,
|
|
125
206
|
size: 20
|
|
126
|
-
})) : a("", !0)], 10,
|
|
207
|
+
})) : a("", !0)], 10, P))], 64))), 128)) : (m(!0), o(n, { key: 0 }, _(u.options, (e, n) => (m(), i(t, {
|
|
127
208
|
key: e.key || `_div${n}`,
|
|
128
209
|
option: e,
|
|
129
210
|
depth: 0
|
|
130
|
-
}, null, 8, ["option"]))), 128))],
|
|
211
|
+
}, null, 8, ["option"]))), 128))], 46, O));
|
|
131
212
|
}
|
|
132
213
|
});
|
|
133
214
|
//#endregion
|
|
134
|
-
export {
|
|
215
|
+
export { F as default };
|
|
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
|
2
2
|
import t from "./KMenuItem.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region components/KMenuItem.vue
|
|
5
|
-
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-e9fa44e5"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { n as default };
|
|
@@ -4,16 +4,25 @@ import { ChevronDown as b } from "lucide-vue-next";
|
|
|
4
4
|
//#region components/KMenuItem.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var x = {
|
|
6
6
|
key: 0,
|
|
7
|
-
class: "k-menu-tree__divider"
|
|
7
|
+
class: "k-menu-tree__divider",
|
|
8
|
+
role: "separator"
|
|
8
9
|
}, S = {
|
|
9
10
|
key: 1,
|
|
10
|
-
class: "k-menu-tree__node"
|
|
11
|
-
|
|
11
|
+
class: "k-menu-tree__node",
|
|
12
|
+
role: "none"
|
|
13
|
+
}, C = [
|
|
14
|
+
"data-menu-key",
|
|
15
|
+
"tabindex",
|
|
16
|
+
"aria-expanded",
|
|
17
|
+
"aria-current",
|
|
18
|
+
"disabled"
|
|
19
|
+
], w = {
|
|
12
20
|
key: 0,
|
|
13
21
|
class: "k-menu-tree__icon"
|
|
14
22
|
}, T = { class: "k-menu-tree__label" }, E = {
|
|
15
23
|
key: 0,
|
|
16
|
-
class: "k-menu-tree__children"
|
|
24
|
+
class: "k-menu-tree__children",
|
|
25
|
+
role: "group"
|
|
17
26
|
}, D = /* @__PURE__ */ c({
|
|
18
27
|
name: "KMenuItem",
|
|
19
28
|
__name: "KMenuItem",
|
|
@@ -35,9 +44,15 @@ var x = {
|
|
|
35
44
|
"k-menu-tree__item--trail": k.value && _(O).inActiveTrail(c.option.key),
|
|
36
45
|
"k-menu-tree__item--disabled": c.option.disabled
|
|
37
46
|
}]),
|
|
47
|
+
role: "treeitem",
|
|
48
|
+
"data-menu-key": c.option.key,
|
|
49
|
+
tabindex: _(O).isFocused(c.option.key) ? 0 : -1,
|
|
50
|
+
"aria-expanded": k.value ? _(O).isExpanded(c.option.key) : void 0,
|
|
51
|
+
"aria-current": !k.value && _(O).isActive(c.option.key) ? "page" : void 0,
|
|
38
52
|
style: d({ paddingLeft: j.value }),
|
|
39
53
|
disabled: c.option.disabled,
|
|
40
|
-
onClick: M
|
|
54
|
+
onClick: M,
|
|
55
|
+
onFocus: n[0] ||= (e) => _(O).setFocus(c.option.key)
|
|
41
56
|
}, [
|
|
42
57
|
c.option.icon ? (f(), a("span", w, [(f(), r(h(c.option.icon), { size: 18 }))])) : i("", !0),
|
|
43
58
|
o("span", T, [A(c.option.label) ? (f(), r(h(c.option.label), { key: 0 })) : (f(), a(t, { key: 1 }, [s(g(c.option.label), 1)], 64))]),
|
|
@@ -46,7 +61,7 @@ var x = {
|
|
|
46
61
|
size: 14,
|
|
47
62
|
class: u(["k-menu-tree__arrow", { "k-menu-tree__arrow--open": _(O).isExpanded(c.option.key) }])
|
|
48
63
|
}, null, 8, ["class"])) : i("", !0)
|
|
49
|
-
],
|
|
64
|
+
], 46, C), k.value ? y((f(), a("div", E, [(f(!0), a(t, null, p(c.option.children, (e) => (f(), r(l, {
|
|
50
65
|
key: e.key,
|
|
51
66
|
option: e,
|
|
52
67
|
depth: c.depth + 1
|
|
@@ -7,11 +7,16 @@ export interface MessageOptions {
|
|
|
7
7
|
declare function open(opts: MessageOptions): number;
|
|
8
8
|
declare function close(id: number): void;
|
|
9
9
|
declare function closeAll(): void;
|
|
10
|
+
/** 全局配置, 目前支持 max(最大同时显示条数, 0=不限) */
|
|
11
|
+
declare function config(opts: {
|
|
12
|
+
max?: number;
|
|
13
|
+
}): void;
|
|
10
14
|
type ShortHand = (content: string, opts?: Partial<MessageOptions>) => number;
|
|
11
15
|
export declare const KMessage: {
|
|
12
16
|
open: typeof open;
|
|
13
17
|
close: typeof close;
|
|
14
18
|
closeAll: typeof closeAll;
|
|
19
|
+
config: typeof config;
|
|
15
20
|
success: ShortHand;
|
|
16
21
|
error: ShortHand;
|
|
17
22
|
warning: ShortHand;
|
|
@@ -1,55 +1,68 @@
|
|
|
1
1
|
import e from "./KMessageContainer.vue.js";
|
|
2
2
|
import { createApp as t, h as n, ref as r } from "vue";
|
|
3
3
|
//#region components/KMessage.ts
|
|
4
|
-
var i = null, a = null, o = null;
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
var i = null, a = null, o = null, s = /* @__PURE__ */ new Map(), c = 0;
|
|
5
|
+
function l(e) {
|
|
6
|
+
let t = s.get(e);
|
|
7
|
+
t && (clearTimeout(t), s.delete(e));
|
|
8
|
+
}
|
|
9
|
+
function u() {
|
|
10
|
+
i || typeof document > "u" || (o = document.createElement("div"), document.body.appendChild(o), a = r([]), i = t({ setup() {
|
|
7
11
|
return () => n(e, {
|
|
8
12
|
messages: a.value,
|
|
9
|
-
onRemove:
|
|
13
|
+
onRemove: p
|
|
10
14
|
});
|
|
11
15
|
} }), i.mount(o));
|
|
12
16
|
}
|
|
13
|
-
var
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
var d = 0;
|
|
18
|
+
function f(e) {
|
|
19
|
+
if (typeof document > "u") return -1;
|
|
20
|
+
u();
|
|
21
|
+
let t = ++d, n = e.duration ?? 3e3, r = {
|
|
17
22
|
id: t,
|
|
18
23
|
...e,
|
|
19
24
|
duration: n
|
|
20
|
-
};
|
|
21
|
-
|
|
25
|
+
}, i = [...a.value, r];
|
|
26
|
+
if (c > 0 && i.length > c) {
|
|
27
|
+
for (let e of i.slice(0, i.length - c)) l(e.id);
|
|
28
|
+
i = i.slice(i.length - c);
|
|
29
|
+
}
|
|
30
|
+
return a.value = i, n > 0 && s.set(t, setTimeout(() => p(t), n)), t;
|
|
31
|
+
}
|
|
32
|
+
function p(e) {
|
|
33
|
+
l(e), a && (a.value = a.value.filter((t) => t.id !== e));
|
|
22
34
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
35
|
+
function m() {
|
|
36
|
+
s.forEach((e) => clearTimeout(e)), s.clear(), a && (a.value = []);
|
|
25
37
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
38
|
+
function h(e) {
|
|
39
|
+
typeof e.max == "number" && (c = Math.max(0, e.max));
|
|
28
40
|
}
|
|
29
|
-
var
|
|
30
|
-
open:
|
|
31
|
-
close:
|
|
32
|
-
closeAll:
|
|
33
|
-
|
|
41
|
+
var g = {
|
|
42
|
+
open: f,
|
|
43
|
+
close: p,
|
|
44
|
+
closeAll: m,
|
|
45
|
+
config: h,
|
|
46
|
+
success: (e, t = {}) => f({
|
|
34
47
|
...t,
|
|
35
48
|
type: "success",
|
|
36
49
|
content: e
|
|
37
50
|
}),
|
|
38
|
-
error: (e, t = {}) =>
|
|
51
|
+
error: (e, t = {}) => f({
|
|
39
52
|
...t,
|
|
40
53
|
type: "error",
|
|
41
54
|
content: e
|
|
42
55
|
}),
|
|
43
|
-
warning: (e, t = {}) =>
|
|
56
|
+
warning: (e, t = {}) => f({
|
|
44
57
|
...t,
|
|
45
58
|
type: "warning",
|
|
46
59
|
content: e
|
|
47
60
|
}),
|
|
48
|
-
info: (e, t = {}) =>
|
|
61
|
+
info: (e, t = {}) => f({
|
|
49
62
|
...t,
|
|
50
63
|
type: "info",
|
|
51
64
|
content: e
|
|
52
65
|
})
|
|
53
66
|
};
|
|
54
67
|
//#endregion
|
|
55
|
-
export {
|
|
68
|
+
export { g as KMessage };
|
|
@@ -14,11 +14,18 @@ export interface NotificationReactive {
|
|
|
14
14
|
declare function create(options: NotificationOptions): NotificationReactive;
|
|
15
15
|
declare function close(id: number): void;
|
|
16
16
|
declare function closeAll(): void;
|
|
17
|
+
/** 全局配置, 目前支持 max(最大同时显示条数, 0=不限) */
|
|
18
|
+
declare function config(opts: {
|
|
19
|
+
max?: number;
|
|
20
|
+
}): void;
|
|
21
|
+
/** 预热通知容器 (供 KNotificationProvider 在挂载时调用, 消除首条通知的挂载延迟) */
|
|
22
|
+
export declare function ensureMounted(): void;
|
|
17
23
|
type ShortHand = (options: Omit<NotificationOptions, 'type'> | string) => NotificationReactive;
|
|
18
24
|
export declare const KNotification: {
|
|
19
25
|
create: typeof create;
|
|
20
26
|
close: typeof close;
|
|
21
27
|
closeAll: typeof closeAll;
|
|
28
|
+
config: typeof config;
|
|
22
29
|
success: ShortHand;
|
|
23
30
|
error: ShortHand;
|
|
24
31
|
warning: ShortHand;
|
|
@@ -28,6 +35,7 @@ export declare function useNotification(): {
|
|
|
28
35
|
create: typeof create;
|
|
29
36
|
close: typeof close;
|
|
30
37
|
closeAll: typeof closeAll;
|
|
38
|
+
config: typeof config;
|
|
31
39
|
success: ShortHand;
|
|
32
40
|
error: ShortHand;
|
|
33
41
|
warning: ShortHand;
|
|
@@ -1,55 +1,71 @@
|
|
|
1
1
|
import e from "./KNotificationContainer.vue.js";
|
|
2
2
|
import { createApp as t, h as n, ref as r } from "vue";
|
|
3
3
|
//#region components/KNotification.ts
|
|
4
|
-
var i = null, a = null, o = null, s = 0;
|
|
5
|
-
function
|
|
6
|
-
|
|
4
|
+
var i = null, a = null, o = null, s = 0, c = /* @__PURE__ */ new Map(), l = 0;
|
|
5
|
+
function u(e) {
|
|
6
|
+
let t = c.get(e);
|
|
7
|
+
t && (clearTimeout(t), c.delete(e));
|
|
8
|
+
}
|
|
9
|
+
function d() {
|
|
10
|
+
i || typeof document > "u" || (o = document.createElement("div"), document.body.appendChild(o), a = r([]), i = t({ setup() {
|
|
7
11
|
return () => n(e, {
|
|
8
12
|
notifications: a.value,
|
|
9
|
-
onRemove:
|
|
13
|
+
onRemove: p
|
|
10
14
|
});
|
|
11
15
|
} }), i.mount(o));
|
|
12
16
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
function f(e) {
|
|
18
|
+
if (typeof document > "u") return { destroy: () => {} };
|
|
19
|
+
d();
|
|
20
|
+
let t = ++s, n = e.duration ?? 4500, r = [...a.value, {
|
|
17
21
|
id: t,
|
|
18
22
|
...e
|
|
19
|
-
}]
|
|
23
|
+
}];
|
|
24
|
+
if (l > 0 && r.length > l) {
|
|
25
|
+
for (let e of r.slice(0, r.length - l)) u(e.id);
|
|
26
|
+
r = r.slice(r.length - l);
|
|
27
|
+
}
|
|
28
|
+
return a.value = r, n > 0 && c.set(t, setTimeout(() => p(t), n)), { destroy: () => p(t) };
|
|
20
29
|
}
|
|
21
|
-
function
|
|
22
|
-
a && (a.value = a.value.filter((t) => t.id !== e));
|
|
30
|
+
function p(e) {
|
|
31
|
+
u(e), a && (a.value = a.value.filter((t) => t.id !== e));
|
|
23
32
|
}
|
|
24
|
-
function
|
|
25
|
-
a && (a.value = []);
|
|
33
|
+
function m() {
|
|
34
|
+
c.forEach((e) => clearTimeout(e)), c.clear(), a && (a.value = []);
|
|
26
35
|
}
|
|
27
|
-
function
|
|
36
|
+
function h(e) {
|
|
37
|
+
typeof e.max == "number" && (l = Math.max(0, e.max));
|
|
38
|
+
}
|
|
39
|
+
function g() {
|
|
40
|
+
d();
|
|
41
|
+
}
|
|
42
|
+
function _(e) {
|
|
28
43
|
return typeof e == "string" ? { content: e } : e;
|
|
29
44
|
}
|
|
30
|
-
var
|
|
31
|
-
create:
|
|
32
|
-
close:
|
|
33
|
-
closeAll:
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
var v = {
|
|
46
|
+
create: f,
|
|
47
|
+
close: p,
|
|
48
|
+
closeAll: m,
|
|
49
|
+
config: h,
|
|
50
|
+
success: ((e) => f({
|
|
51
|
+
..._(e),
|
|
36
52
|
type: "success"
|
|
37
53
|
})),
|
|
38
|
-
error: ((e) =>
|
|
39
|
-
...
|
|
54
|
+
error: ((e) => f({
|
|
55
|
+
..._(e),
|
|
40
56
|
type: "error"
|
|
41
57
|
})),
|
|
42
|
-
warning: ((e) =>
|
|
43
|
-
...
|
|
58
|
+
warning: ((e) => f({
|
|
59
|
+
..._(e),
|
|
44
60
|
type: "warning"
|
|
45
61
|
})),
|
|
46
|
-
info: ((e) =>
|
|
47
|
-
...
|
|
62
|
+
info: ((e) => f({
|
|
63
|
+
..._(e),
|
|
48
64
|
type: "info"
|
|
49
65
|
}))
|
|
50
66
|
};
|
|
51
|
-
function
|
|
52
|
-
return
|
|
67
|
+
function y() {
|
|
68
|
+
return v;
|
|
53
69
|
}
|
|
54
70
|
//#endregion
|
|
55
|
-
export {
|
|
71
|
+
export { v as KNotification, g as ensureMounted, y as useNotification };
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import { renderSlot as t } from "vue";
|
|
1
|
+
import e from "./KNotificationProvider.vue_vue_type_script_setup_true_lang.js";
|
|
3
2
|
//#region components/KNotificationProvider.vue
|
|
4
|
-
var
|
|
5
|
-
function r(e, n) {
|
|
6
|
-
return t(e.$slots, "default");
|
|
7
|
-
}
|
|
8
|
-
var i = /* @__PURE__ */ e(n, [["render", r]]);
|
|
3
|
+
var t = e;
|
|
9
4
|
//#endregion
|
|
10
|
-
export {
|
|
5
|
+
export { t as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ensureMounted as e } from "./KNotification.js";
|
|
2
|
+
import { defineComponent as t, onMounted as n, renderSlot as r } from "vue";
|
|
3
|
+
//#region components/KNotificationProvider.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var i = /* @__PURE__ */ t({
|
|
5
|
+
__name: "KNotificationProvider",
|
|
6
|
+
setup(t) {
|
|
7
|
+
return n(e), (e, t) => r(e.$slots, "default");
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { i as default };
|
|
@@ -4,11 +4,14 @@ type __VLS_Props = {
|
|
|
4
4
|
total: number;
|
|
5
5
|
/** 左侧显示 "start–end / total" 摘要 */
|
|
6
6
|
showSummary?: boolean;
|
|
7
|
+
size?: 'small' | 'sm' | 'medium' | 'md' | 'large' | 'lg';
|
|
7
8
|
};
|
|
8
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
10
|
"update:page": (value: number) => any;
|
|
10
11
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
12
|
"onUpdate:page"?: ((value: number) => any) | undefined;
|
|
12
|
-
}>, {
|
|
13
|
+
}>, {
|
|
14
|
+
size: "small" | "sm" | "medium" | "md" | "large" | "lg";
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
16
|
declare const _default: typeof __VLS_export;
|
|
14
17
|
export default _default;
|
|
@@ -2,6 +2,6 @@ import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
|
2
2
|
import t from "./KPagination.vue_vue_type_script_setup_true_lang.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region components/KPagination.vue
|
|
5
|
-
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-
|
|
5
|
+
var n = /* @__PURE__ */ e(t, [["__scopeId", "data-v-6b13fba6"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { n as default };
|