@kernel4632/kima 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +166 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
- package/dist/kima-elements-core.js +53209 -0
- package/dist/kima-elements.js +126371 -0
- package/dist/kima-theme.js +1583 -0
- package/dist/kima.js +141 -0
- package/dist/style.css +2 -0
- package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
- package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
- package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
- package/dist/vue/components/advanced-input/editable.ce.js +160 -0
- package/dist/vue/components/advanced-input/mention.ce.js +181 -0
- package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
- package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
- package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
- package/dist/vue/components/content/chart.ce.js +282 -0
- package/dist/vue/components/content/code-editor.ce.js +309 -0
- package/dist/vue/components/content/equation.ce.js +69 -0
- package/dist/vue/components/content/heatmap.ce.js +148 -0
- package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
- package/dist/vue/components/core/badge.ce.js +66 -0
- package/dist/vue/components/core/button-group.ce.js +142 -0
- package/dist/vue/components/core/button.ce.js +73 -0
- package/dist/vue/components/core/card.ce.js +73 -0
- package/dist/vue/components/core/cascader.ce.js +329 -0
- package/dist/vue/components/core/checkbox.ce.js +116 -0
- package/dist/vue/components/core/code-block.ce.js +108 -0
- package/dist/vue/components/core/combobox.ce.js +354 -0
- package/dist/vue/components/core/date-picker.ce.js +433 -0
- package/dist/vue/components/core/dialog.ce.js +118 -0
- package/dist/vue/components/core/divider.ce.js +49 -0
- package/dist/vue/components/core/drawer.ce.js +235 -0
- package/dist/vue/components/core/empty-state.ce.js +58 -0
- package/dist/vue/components/core/icon-button.ce.js +93 -0
- package/dist/vue/components/core/icon.ce.js +42 -0
- package/dist/vue/components/core/layout.ce.js +68 -0
- package/dist/vue/components/core/menu.ce.js +178 -0
- package/dist/vue/components/core/notification.ce.js +158 -0
- package/dist/vue/components/core/pagination.ce.js +158 -0
- package/dist/vue/components/core/progress.ce.js +49 -0
- package/dist/vue/components/core/select.ce.js +325 -0
- package/dist/vue/components/core/slider.ce.js +116 -0
- package/dist/vue/components/core/switch.ce.js +100 -0
- package/dist/vue/components/core/tabs.ce.js +193 -0
- package/dist/vue/components/core/text-field.ce.js +194 -0
- package/dist/vue/components/core/time-picker.ce.js +486 -0
- package/dist/vue/components/core/tooltip.ce.js +125 -0
- package/dist/vue/components/core/tree.ce.js +248 -0
- package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
- package/dist/vue/components/data/copy-button.ce.js +75 -0
- package/dist/vue/components/data/image-preview.ce.js +226 -0
- package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
- package/dist/vue/components/data/long-text.ce.js +70 -0
- package/dist/vue/components/data/relative-time.ce.js +77 -0
- package/dist/vue/components/data/ring-progress.ce.js +87 -0
- package/dist/vue/components/data/table.ce.js +491 -0
- package/dist/vue/components/data/virtual-table.ce.js +178 -0
- package/dist/vue/components/data/virtual-tree.ce.js +213 -0
- package/dist/vue/components/display/alert.ce.js +101 -0
- package/dist/vue/components/display/avatar-group.ce.js +65 -0
- package/dist/vue/components/display/avatar.ce.js +84 -0
- package/dist/vue/components/display/blockquote.ce.js +44 -0
- package/dist/vue/components/display/countdown.ce.js +77 -0
- package/dist/vue/components/display/descriptions.ce.js +43 -0
- package/dist/vue/components/display/highlight.ce.js +48 -0
- package/dist/vue/components/display/image.ce.js +146 -0
- package/dist/vue/components/display/list.ce.js +68 -0
- package/dist/vue/components/display/result.ce.js +57 -0
- package/dist/vue/components/display/skeleton.ce.js +67 -0
- package/dist/vue/components/display/spinner.ce.js +42 -0
- package/dist/vue/components/display/statistic.ce.js +71 -0
- package/dist/vue/components/display/timeline.ce.js +59 -0
- package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
- package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
- package/dist/vue/components/form-completion/date-field.ce.js +131 -0
- package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
- package/dist/vue/components/form-completion/form.ce.js +248 -0
- package/dist/vue/components/form-completion/json-input.ce.js +114 -0
- package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
- package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
- package/dist/vue/components/form-completion/time-field.ce.js +120 -0
- package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
- package/dist/vue/components/foundation/banner.ce.js +106 -0
- package/dist/vue/components/foundation/error-state.ce.js +108 -0
- package/dist/vue/components/foundation/field-group.ce.js +146 -0
- package/dist/vue/components/foundation/flex.ce.js +60 -0
- package/dist/vue/components/foundation/grid.ce.js +52 -0
- package/dist/vue/components/foundation/input-group.ce.js +34 -0
- package/dist/vue/components/foundation/page-header.ce.js +55 -0
- package/dist/vue/components/foundation/time-display.ce.js +129 -0
- package/dist/vue/components/foundation/typography.ce.js +71 -0
- package/dist/vue/components/input/checkbox-group.ce.js +93 -0
- package/dist/vue/components/input/field.ce.js +74 -0
- package/dist/vue/components/input/file-upload.ce.js +142 -0
- package/dist/vue/components/input/number-field.ce.js +103 -0
- package/dist/vue/components/input/pin-input.ce.js +112 -0
- package/dist/vue/components/input/radio-group.ce.js +96 -0
- package/dist/vue/components/input/rating.ce.js +115 -0
- package/dist/vue/components/input/tags-input.ce.js +153 -0
- package/dist/vue/components/input/textarea.ce.js +180 -0
- package/dist/vue/components/input/toggle.ce.js +58 -0
- package/dist/vue/components/interaction/chip.ce.js +95 -0
- package/dist/vue/components/interaction/command.ce.js +161 -0
- package/dist/vue/components/interaction/context-menu.ce.js +113 -0
- package/dist/vue/components/interaction/hover-card.ce.js +92 -0
- package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
- package/dist/vue/components/interaction/menubar.ce.js +134 -0
- package/dist/vue/components/interaction/multi-select.ce.js +264 -0
- package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
- package/dist/vue/components/interaction/popover.ce.js +83 -0
- package/dist/vue/components/interaction/tree-select.ce.js +195 -0
- package/dist/vue/components/navigation/accordion.ce.js +114 -0
- package/dist/vue/components/navigation/anchor.ce.js +125 -0
- package/dist/vue/components/navigation/back-top.ce.js +67 -0
- package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
- package/dist/vue/components/navigation/carousel.ce.js +114 -0
- package/dist/vue/components/navigation/collapsible.ce.js +57 -0
- package/dist/vue/components/navigation/link.ce.js +62 -0
- package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
- package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
- package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
- package/dist/vue/components/navigation/splitter.ce.js +131 -0
- package/dist/vue/components/navigation/stepper.ce.js +74 -0
- package/dist/vue/components/navigation/toolbar.ce.js +93 -0
- package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
- package/dist/vue/components/shell/app-shell.ce.js +87 -0
- package/dist/vue/components/shell/config-provider.ce.js +110 -0
- package/dist/vue/components/shell/marquee.ce.js +92 -0
- package/dist/vue/components/shell/masonry.ce.js +50 -0
- package/dist/vue/components/shell/sidebar.ce.js +125 -0
- package/dist/vue/components/utility/affix.ce.js +64 -0
- package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
- package/dist/vue/components/utility/animated-number.ce.js +66 -0
- package/dist/vue/components/utility/float-button.ce.js +104 -0
- package/dist/vue/components/utility/listbox.ce.js +81 -0
- package/dist/vue/components/utility/loading-bar.ce.js +85 -0
- package/dist/vue/components/utility/log-viewer.ce.js +124 -0
- package/dist/vue/components/utility/notification-queue.ce.js +109 -0
- package/dist/vue/components/utility/progress-group.ce.js +59 -0
- package/dist/vue/components/utility/qr-code.ce.js +62 -0
- package/dist/vue/components/utility/tag-group.ce.js +124 -0
- package/dist/vue/components/utility/tour.ce.js +214 -0
- package/dist/vue/components/utility/virtual-select.ce.js +207 -0
- package/dist/vue/components/utility/watermark.ce.js +44 -0
- package/dist/vue/internal/menu-items.js +184 -0
- package/dist/vue/internal/navigation-items.js +110 -0
- package/dist/vue/utils/code-highlight.js +142 -0
- package/dist/vue/utils/config.js +47 -0
- package/dist/vue/utils/content-motion.js +37 -0
- package/dist/vue/utils/content.js +83 -0
- package/dist/vue/utils/display-status.js +31 -0
- package/dist/vue/utils/foundation.js +65 -0
- package/dist/vue/utils/input-state.js +38 -0
- package/dist/vue/utils/interaction.js +103 -0
- package/dist/vue/utils/local-date.js +48 -0
- package/dist/vue/utils/motion.js +80 -0
- package/dist/vue/utils/native-slots.js +30 -0
- package/dist/vue/utils/navigation.js +44 -0
- package/dist/vue/utils/notifications.js +60 -0
- package/dist/vue/utils/qr.js +20 -0
- package/dist/vue/utils/remote-options.js +65 -0
- package/dist/vue/utils/ripple.js +20 -0
- package/dist/vue/utils/scoped-slots.js +22 -0
- package/dist/vue/utils/shell.js +43 -0
- package/dist/vue/utils/theme.js +50 -0
- package/dist/vue/utils/utility-choice.js +56 -0
- package/package.json +99 -4
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./icon.ce.js";
|
|
3
|
+
import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Fragment as i, TransitionGroup as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, getCurrentInstance as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeStyle as g, openBlock as _, ref as v, renderList as ee, renderSlot as y, shallowRef as b, toDisplayString as te, unref as x, useAttrs as S, useHost as ne, useId as re, watch as C, withCtx as w, withModifiers as T } from "vue";
|
|
6
|
+
import { ArrowRight01Icon as E } from "@hugeicons/core-free-icons";
|
|
7
|
+
// src/components/core/tree.ce.vue
|
|
8
|
+
var D = ["aria-multiselectable", "aria-disabled"], O = [
|
|
9
|
+
"id",
|
|
10
|
+
"aria-level",
|
|
11
|
+
"aria-posinset",
|
|
12
|
+
"aria-setsize",
|
|
13
|
+
"aria-expanded",
|
|
14
|
+
"aria-selected",
|
|
15
|
+
"aria-disabled",
|
|
16
|
+
"tabindex",
|
|
17
|
+
"onClick",
|
|
18
|
+
"onFocus",
|
|
19
|
+
"onKeydown"
|
|
20
|
+
], k = [
|
|
21
|
+
"disabled",
|
|
22
|
+
"aria-label",
|
|
23
|
+
"aria-expanded",
|
|
24
|
+
"onClick"
|
|
25
|
+
], ie = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "kima-tree__toggle kima-tree__toggle--empty",
|
|
28
|
+
"aria-hidden": "true"
|
|
29
|
+
}, ae = { class: "kima-tree__label" }, oe = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "kima-tree__empty",
|
|
32
|
+
role: "status"
|
|
33
|
+
}, A = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
34
|
+
__name: "tree.ce",
|
|
35
|
+
props: {
|
|
36
|
+
items: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: [
|
|
42
|
+
String,
|
|
43
|
+
Number,
|
|
44
|
+
Boolean,
|
|
45
|
+
Object,
|
|
46
|
+
Array
|
|
47
|
+
],
|
|
48
|
+
default: null
|
|
49
|
+
},
|
|
50
|
+
expanded: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => []
|
|
53
|
+
},
|
|
54
|
+
multiple: Boolean,
|
|
55
|
+
selectable: Boolean,
|
|
56
|
+
disabled: Boolean
|
|
57
|
+
},
|
|
58
|
+
emits: [
|
|
59
|
+
"update:modelValue",
|
|
60
|
+
"update:expanded",
|
|
61
|
+
"select"
|
|
62
|
+
],
|
|
63
|
+
setup(e, { emit: A }) {
|
|
64
|
+
let j = e, M = A, N = S(), P = f()?.ce ? ne() : null, F = o(() => P ? {
|
|
65
|
+
...N,
|
|
66
|
+
id: void 0
|
|
67
|
+
} : N), I = `kima-tree-${re()}`, L = b(j.modelValue), R = v([...j.expanded]), z = v(0), B = b(null), V = v(!1), H = v([]), U = o(() => new Set(R.value)), W = o(() => {
|
|
68
|
+
let e = [], t = [];
|
|
69
|
+
for (let e = j.items.length - 1; e >= 0; --e) t.push({
|
|
70
|
+
item: j.items[e],
|
|
71
|
+
level: 1,
|
|
72
|
+
parentValue: null,
|
|
73
|
+
position: e + 1,
|
|
74
|
+
setSize: j.items.length
|
|
75
|
+
});
|
|
76
|
+
for (; t.length;) {
|
|
77
|
+
let n = t.pop(), r = n.item || {}, i = Array.isArray(r.children) ? r.children : [], a = {
|
|
78
|
+
...n,
|
|
79
|
+
item: r,
|
|
80
|
+
value: r.value,
|
|
81
|
+
children: i,
|
|
82
|
+
hasChildren: i.length > 0,
|
|
83
|
+
expanded: U.value.has(r.value)
|
|
84
|
+
};
|
|
85
|
+
if (e.push(a), a.expanded && i.length) for (let e = i.length - 1; e >= 0; --e) t.push({
|
|
86
|
+
item: i[e],
|
|
87
|
+
level: n.level + 1,
|
|
88
|
+
parentValue: r.value,
|
|
89
|
+
position: e + 1,
|
|
90
|
+
setSize: i.length
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return e;
|
|
94
|
+
}), G = o(() => j.multiple ? new Set(Array.isArray(L.value) ? L.value : []) : null);
|
|
95
|
+
function K(e) {
|
|
96
|
+
return `${I}-node-${encodeURIComponent(String(e))}`;
|
|
97
|
+
}
|
|
98
|
+
function q(e) {
|
|
99
|
+
return j.multiple ? G.value.has(e.value) : Object.is(L.value, e.value);
|
|
100
|
+
}
|
|
101
|
+
function J(e) {
|
|
102
|
+
return !j.disabled && !e.item.disabled;
|
|
103
|
+
}
|
|
104
|
+
function Y(e, t) {
|
|
105
|
+
let n = W.value.length;
|
|
106
|
+
if (!n) return -1;
|
|
107
|
+
let r = e;
|
|
108
|
+
for (let e = 0; e < n; e += 1) {
|
|
109
|
+
if (r >= 0 && r < n && J(W.value[r])) return r;
|
|
110
|
+
r += t;
|
|
111
|
+
}
|
|
112
|
+
return -1;
|
|
113
|
+
}
|
|
114
|
+
function X(e, t = !1) {
|
|
115
|
+
let n = W.value[e];
|
|
116
|
+
n && (z.value = e, B.value = n.value, V.value = !0, t && m(() => H.value[e]?.focus()));
|
|
117
|
+
}
|
|
118
|
+
function Z(e, t) {
|
|
119
|
+
e && (H.value[t] = e);
|
|
120
|
+
}
|
|
121
|
+
function Q(e, t) {
|
|
122
|
+
if (!(!j.selectable || j.disabled || t.disabled)) {
|
|
123
|
+
if (j.multiple) {
|
|
124
|
+
let t = new Set(G.value);
|
|
125
|
+
t.has(e) ? t.delete(e) : t.add(e);
|
|
126
|
+
let n = [...t];
|
|
127
|
+
L.value = n, M("update:modelValue", n);
|
|
128
|
+
} else Object.is(L.value, e) || (L.value = e, M("update:modelValue", e));
|
|
129
|
+
M("select", e, t);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function $(e) {
|
|
133
|
+
if (!e.hasChildren || !J(e)) return;
|
|
134
|
+
let t = new Set(R.value);
|
|
135
|
+
t.has(e.value) ? t.delete(e.value) : t.add(e.value), R.value = [...t], M("update:expanded", R.value);
|
|
136
|
+
}
|
|
137
|
+
function se(e, t, n) {
|
|
138
|
+
X(t), n.currentTarget.focus(), Q(e.value, e.item);
|
|
139
|
+
}
|
|
140
|
+
function ce(e, t, n) {
|
|
141
|
+
if (n.isComposing || n.altKey || n.ctrlKey || n.metaKey || !J(e) && ![
|
|
142
|
+
"ArrowUp",
|
|
143
|
+
"ArrowDown",
|
|
144
|
+
"Home",
|
|
145
|
+
"End"
|
|
146
|
+
].includes(n.key)) return;
|
|
147
|
+
let r = W.value, i = -1;
|
|
148
|
+
if (n.key === "ArrowRight") {
|
|
149
|
+
if (n.preventDefault(), e.hasChildren && !e.expanded) {
|
|
150
|
+
$(e);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
i = t + 1;
|
|
154
|
+
} else if (n.key === "ArrowLeft") {
|
|
155
|
+
if (n.preventDefault(), e.hasChildren && e.expanded) {
|
|
156
|
+
$(e);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
i = r.findIndex((t) => Object.is(t.value, e.parentValue));
|
|
160
|
+
} else if (n.key === "ArrowDown") n.preventDefault(), i = t + 1;
|
|
161
|
+
else if (n.key === "ArrowUp") n.preventDefault(), i = t - 1;
|
|
162
|
+
else if (n.key === "Home") n.preventDefault(), i = 0;
|
|
163
|
+
else if (n.key === "End") n.preventDefault(), i = r.length - 1;
|
|
164
|
+
else if (n.key === "Enter" || n.key === " ") {
|
|
165
|
+
n.preventDefault(), Q(e.value, e.item);
|
|
166
|
+
return;
|
|
167
|
+
} else return;
|
|
168
|
+
let a = Y(i, n.key === "ArrowUp" || n.key === "ArrowLeft" ? -1 : 1);
|
|
169
|
+
a >= 0 && X(a, !0);
|
|
170
|
+
}
|
|
171
|
+
return C(() => j.modelValue, (e) => {
|
|
172
|
+
L.value = e;
|
|
173
|
+
}), C(() => j.expanded, (e) => {
|
|
174
|
+
R.value = [...e];
|
|
175
|
+
}, { deep: !0 }), C([W, () => j.modelValue], () => {
|
|
176
|
+
let e = V.value ? W.value.findIndex((e) => Object.is(e.value, B.value)) : -1;
|
|
177
|
+
if (e >= 0) {
|
|
178
|
+
z.value = e;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let t = W.value.findIndex((e) => q(e) && J(e)), n = t >= 0 ? t : Y(0, 1);
|
|
182
|
+
z.value = n >= 0 ? n : 0, W.value[z.value] && X(z.value);
|
|
183
|
+
}, {
|
|
184
|
+
deep: !0,
|
|
185
|
+
immediate: !0
|
|
186
|
+
}), (o, f) => (_(), c("div", p(F.value, {
|
|
187
|
+
class: ["kima-tree", { "kima-tree--disabled": e.disabled }],
|
|
188
|
+
role: "tree",
|
|
189
|
+
"aria-multiselectable": e.multiple || void 0,
|
|
190
|
+
"aria-disabled": e.disabled || void 0
|
|
191
|
+
}), [d(a, p({
|
|
192
|
+
tag: "div",
|
|
193
|
+
class: "kima-tree__group",
|
|
194
|
+
role: "group",
|
|
195
|
+
css: !1
|
|
196
|
+
}, {
|
|
197
|
+
...x(n),
|
|
198
|
+
...x(r)
|
|
199
|
+
}), {
|
|
200
|
+
default: w(() => [(_(!0), c(i, null, ee(W.value, (n, r) => (_(), c("div", {
|
|
201
|
+
key: n.value,
|
|
202
|
+
class: "kima-tree__motion-row"
|
|
203
|
+
}, [l("div", {
|
|
204
|
+
id: K(n.value),
|
|
205
|
+
ref_for: !0,
|
|
206
|
+
ref: (e) => Z(e, r),
|
|
207
|
+
class: h(["kima-tree__item", {
|
|
208
|
+
"kima-tree__item--selected": q(n),
|
|
209
|
+
"kima-tree__item--disabled": n.item.disabled
|
|
210
|
+
}]),
|
|
211
|
+
role: "treeitem",
|
|
212
|
+
"aria-level": n.level,
|
|
213
|
+
"aria-posinset": n.position,
|
|
214
|
+
"aria-setsize": n.setSize,
|
|
215
|
+
"aria-expanded": n.hasChildren ? n.expanded : void 0,
|
|
216
|
+
"aria-selected": e.selectable ? q(n) : void 0,
|
|
217
|
+
"aria-disabled": n.item.disabled || void 0,
|
|
218
|
+
tabindex: r === z.value && J(n) ? 0 : -1,
|
|
219
|
+
style: g({ "--kima-tree-level": n.level - 1 }),
|
|
220
|
+
onClick: (e) => se(n, r, e),
|
|
221
|
+
onFocus: (e) => X(r),
|
|
222
|
+
onKeydown: (e) => ce(n, r, e)
|
|
223
|
+
}, [n.hasChildren ? (_(), c("button", {
|
|
224
|
+
key: 0,
|
|
225
|
+
class: "kima-tree__toggle",
|
|
226
|
+
type: "button",
|
|
227
|
+
disabled: e.disabled || n.item.disabled,
|
|
228
|
+
"aria-label": `${n.expanded ? "收起" : "展开"} ${n.item.label}`,
|
|
229
|
+
"aria-expanded": n.expanded,
|
|
230
|
+
onClick: T((e) => $(n), ["stop"])
|
|
231
|
+
}, [d(t, {
|
|
232
|
+
class: "kima-tree__toggle-icon",
|
|
233
|
+
icon: x(E),
|
|
234
|
+
size: 18,
|
|
235
|
+
"aria-hidden": "true"
|
|
236
|
+
}, null, 8, ["icon"])], 8, k)) : (_(), c("span", ie)), l("span", ae, [y(o.$slots, "default", {
|
|
237
|
+
item: n.item,
|
|
238
|
+
value: n.value,
|
|
239
|
+
level: n.level,
|
|
240
|
+
selected: q(n),
|
|
241
|
+
expanded: n.expanded,
|
|
242
|
+
disabled: n.item.disabled
|
|
243
|
+
}, () => [u(te(n.item.label), 1)], !0)])], 46, O)]))), 128))]),
|
|
244
|
+
_: 3
|
|
245
|
+
}, 16), W.value.length ? s("", !0) : (_(), c("div", oe, [y(o.$slots, "empty", {}, () => [f[0] ||= u("暂无数据", -1)], !0)]))], 16, D));
|
|
246
|
+
}
|
|
247
|
+
}), [["__scopeId", "data-v-5401eef6"]]);
|
|
248
|
+
export { A as default };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { Fragment as t, computed as n, createElementBlock as r, createElementVNode as i, createTextVNode as ee, getCurrentInstance as a, mergeProps as o, normalizeClass as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as u, openBlock as d, ref as f, renderList as p, renderSlot as m, shallowRef as h, toDisplayString as g, useAttrs as _, useHost as v, useId as y, watch as b } from "vue";
|
|
4
|
+
// src/components/core/virtual-scroll.ce.vue
|
|
5
|
+
var x = ["aria-activedescendant"], S = [
|
|
6
|
+
"id",
|
|
7
|
+
"aria-posinset",
|
|
8
|
+
"aria-setsize",
|
|
9
|
+
"aria-selected",
|
|
10
|
+
"onClick"
|
|
11
|
+
], C = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
12
|
+
__name: "virtual-scroll.ce",
|
|
13
|
+
props: {
|
|
14
|
+
items: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
itemHeight: {
|
|
19
|
+
type: Number,
|
|
20
|
+
default: 40
|
|
21
|
+
},
|
|
22
|
+
height: {
|
|
23
|
+
type: [Number, String],
|
|
24
|
+
default: 320
|
|
25
|
+
},
|
|
26
|
+
overscan: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 4
|
|
29
|
+
},
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: [
|
|
32
|
+
String,
|
|
33
|
+
Number,
|
|
34
|
+
Boolean,
|
|
35
|
+
Object,
|
|
36
|
+
Array
|
|
37
|
+
],
|
|
38
|
+
default: void 0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["update:modelValue", "item-click"],
|
|
42
|
+
setup(e, { emit: C }) {
|
|
43
|
+
let w = e, T = C, E = _(), D = a()?.ce ? v() : null, te = n(() => D ? {
|
|
44
|
+
...E,
|
|
45
|
+
id: void 0
|
|
46
|
+
} : E), O = f(null), k = f(0), A = f(0), j = f(-1), M = h(w.modelValue), N, P = `kima-virtual-scroll-${y()}`, F = n(() => {
|
|
47
|
+
let e = Number(w.itemHeight);
|
|
48
|
+
return Number.isFinite(e) && e > 0 ? Math.max(1, Math.floor(e)) : 40;
|
|
49
|
+
}), I = n(() => {
|
|
50
|
+
let e = Number(w.overscan);
|
|
51
|
+
return Number.isFinite(e) && e > 0 ? Math.floor(e) : 0;
|
|
52
|
+
}), L = n(() => typeof w.height == "number" ? `${Math.max(0, w.height)}px` : typeof w.height == "string" && /^\d+(?:\.\d+)?$/.test(w.height.trim()) ? `${w.height}px` : w.height || "320px"), R = n(() => w.items.length * F.value), z = n(() => M.value !== void 0 && M.value !== null), B = n(() => z.value ? w.items.findIndex((e) => Object.is(q(e), M.value)) : -1), V = n(() => {
|
|
53
|
+
if (A.value > 0) return A.value;
|
|
54
|
+
let e = Number.parseFloat(w.height);
|
|
55
|
+
return Number.isFinite(e) && e > 0 ? e : F.value * 8;
|
|
56
|
+
}), H = n(() => {
|
|
57
|
+
if (!w.items.length) return {
|
|
58
|
+
start: 0,
|
|
59
|
+
end: -1
|
|
60
|
+
};
|
|
61
|
+
let e = Math.floor(k.value / F.value) - I.value, t = Math.ceil((k.value + V.value) / F.value) + I.value - 1;
|
|
62
|
+
return {
|
|
63
|
+
start: Math.max(0, e),
|
|
64
|
+
end: Math.min(w.items.length - 1, Math.max(0, t))
|
|
65
|
+
};
|
|
66
|
+
}), U = n(() => {
|
|
67
|
+
let e = [];
|
|
68
|
+
for (let t = H.value.start; t <= H.value.end; t += 1) e.push({
|
|
69
|
+
item: w.items[t],
|
|
70
|
+
index: t,
|
|
71
|
+
key: Y(w.items[t])
|
|
72
|
+
});
|
|
73
|
+
return e;
|
|
74
|
+
}), W = n(() => H.value.start * F.value), G = n(() => Math.max(0, R.value - (H.value.end + 1) * F.value)), K = n(() => {
|
|
75
|
+
let { start: e, end: t } = H.value;
|
|
76
|
+
return j.value >= e && j.value <= t ? X(j.value) : void 0;
|
|
77
|
+
});
|
|
78
|
+
function q(e) {
|
|
79
|
+
return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "value") ? e.value : e;
|
|
80
|
+
}
|
|
81
|
+
function J(e) {
|
|
82
|
+
return e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "label") ? e.label : e;
|
|
83
|
+
}
|
|
84
|
+
function Y(e) {
|
|
85
|
+
return e && typeof e == "object" ? e.key ?? e.value ?? e.id ?? e : e;
|
|
86
|
+
}
|
|
87
|
+
function X(e) {
|
|
88
|
+
return `${P}-item-${e}`;
|
|
89
|
+
}
|
|
90
|
+
function Z(e) {
|
|
91
|
+
O.value = e, A.value = e?.clientHeight || 0;
|
|
92
|
+
}
|
|
93
|
+
function ne(e) {
|
|
94
|
+
k.value = e.currentTarget.scrollTop;
|
|
95
|
+
}
|
|
96
|
+
function re(e) {
|
|
97
|
+
if (!O.value) return;
|
|
98
|
+
let t = e * F.value, n = t + F.value, r = O.value.scrollTop;
|
|
99
|
+
t < r ? r = t : n > r + O.value.clientHeight && (r = n - O.value.clientHeight), r !== O.value.scrollTop && (O.value.scrollTop = Math.max(0, r), k.value = O.value.scrollTop);
|
|
100
|
+
}
|
|
101
|
+
function Q(e, t = !1) {
|
|
102
|
+
e < 0 || e >= w.items.length || (j.value = e, t && re(e));
|
|
103
|
+
}
|
|
104
|
+
function $(e, t) {
|
|
105
|
+
Q(t);
|
|
106
|
+
let n = q(e);
|
|
107
|
+
z.value && Object.is(n, M.value) || (M.value = n, T("update:modelValue", n)), T("item-click", e, t);
|
|
108
|
+
}
|
|
109
|
+
function ie(e) {
|
|
110
|
+
if (e.isComposing || e.altKey || e.ctrlKey || e.metaKey || !w.items.length || ![
|
|
111
|
+
"ArrowDown",
|
|
112
|
+
"ArrowUp",
|
|
113
|
+
"Home",
|
|
114
|
+
"End",
|
|
115
|
+
"Enter",
|
|
116
|
+
" "
|
|
117
|
+
].includes(e.key)) return;
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
let t = j.value >= 0 ? j.value : B.value >= 0 ? B.value : 0, n = t;
|
|
120
|
+
e.key === "ArrowDown" ? n = Math.min(w.items.length - 1, t + 1) : e.key === "ArrowUp" ? n = Math.max(0, t - 1) : e.key === "Home" ? n = 0 : e.key === "End" && (n = w.items.length - 1), Q(n, !0), (e.key === "Enter" || e.key === " ") && $(w.items[n], n);
|
|
121
|
+
}
|
|
122
|
+
return b(() => w.modelValue, (e) => {
|
|
123
|
+
M.value = e;
|
|
124
|
+
let t = e == null ? -1 : w.items.findIndex((t) => Object.is(q(t), e));
|
|
125
|
+
t >= 0 && (j.value = t);
|
|
126
|
+
}), b(() => w.items.length, (e) => {
|
|
127
|
+
e ? (j.value >= e && (j.value = e - 1), j.value < 0 && (j.value = B.value >= 0 ? B.value : 0)) : j.value = -1;
|
|
128
|
+
}), b(F, () => {
|
|
129
|
+
O.value && (O.value.scrollTop = Math.min(O.value.scrollTop, Math.max(0, R.value - O.value.clientHeight))), k.value = O.value?.scrollTop || 0;
|
|
130
|
+
}), u(() => {
|
|
131
|
+
A.value = O.value?.clientHeight || 0, typeof ResizeObserver < "u" && O.value && (N = new ResizeObserver((e) => {
|
|
132
|
+
A.value = e[0]?.contentRect.height || O.value.clientHeight;
|
|
133
|
+
}), N.observe(O.value));
|
|
134
|
+
}), l(() => N?.disconnect()), (n, a) => (d(), r("div", o({ ref: Z }, te.value, {
|
|
135
|
+
class: "kima-virtual-scroll",
|
|
136
|
+
style: { height: L.value },
|
|
137
|
+
role: "list",
|
|
138
|
+
tabindex: "0",
|
|
139
|
+
"aria-activedescendant": K.value,
|
|
140
|
+
onScroll: ne,
|
|
141
|
+
onKeydown: ie
|
|
142
|
+
}), [i("div", {
|
|
143
|
+
class: "kima-virtual-scroll__content",
|
|
144
|
+
style: c({ height: `${R.value}px` })
|
|
145
|
+
}, [
|
|
146
|
+
i("div", {
|
|
147
|
+
class: "kima-virtual-scroll__spacer",
|
|
148
|
+
style: c({ height: `${W.value}px` }),
|
|
149
|
+
"aria-hidden": "true"
|
|
150
|
+
}, null, 4),
|
|
151
|
+
(d(!0), r(t, null, p(U.value, (t) => (d(), r("div", {
|
|
152
|
+
id: X(t.index),
|
|
153
|
+
key: t.key,
|
|
154
|
+
class: s(["kima-virtual-scroll__item", {
|
|
155
|
+
"kima-virtual-scroll__item--active": t.index === j.value,
|
|
156
|
+
"kima-virtual-scroll__item--selected": z.value && Object.is(q(t.item), M.value)
|
|
157
|
+
}]),
|
|
158
|
+
role: "listitem",
|
|
159
|
+
"aria-posinset": t.index + 1,
|
|
160
|
+
"aria-setsize": e.items.length,
|
|
161
|
+
"aria-selected": z.value ? Object.is(q(t.item), M.value) : void 0,
|
|
162
|
+
style: c({ height: `${F.value}px` }),
|
|
163
|
+
onClick: (e) => $(t.item, t.index)
|
|
164
|
+
}, [m(n.$slots, "default", {
|
|
165
|
+
item: t.item,
|
|
166
|
+
index: t.index
|
|
167
|
+
}, () => [ee(g(J(t.item)), 1)], !0)], 14, S))), 128)),
|
|
168
|
+
i("div", {
|
|
169
|
+
class: "kima-virtual-scroll__spacer",
|
|
170
|
+
style: c({ height: `${G.value}px` }),
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
}, null, 4)
|
|
173
|
+
], 4)], 16, x));
|
|
174
|
+
}
|
|
175
|
+
}), [["__scopeId", "data-v-8f7f579b"]]);
|
|
176
|
+
export { C as default };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/button.ce.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Transition as r, computed as i, createElementBlock as a, createElementVNode as o, createVNode as s, getCurrentInstance as c, mergeProps as l, onBeforeUnmount as u, openBlock as d, ref as f, toDisplayString as p, unref as m, useAttrs as h, useHost as g, withCtx as _ } from "vue";
|
|
6
|
+
// src/components/data/copy-button.ce.vue
|
|
7
|
+
var v = ["aria-label"], y = { class: "kima-copy-button__visual" }, b = {
|
|
8
|
+
class: "kima-copy-button__status",
|
|
9
|
+
role: "status",
|
|
10
|
+
"aria-live": "polite"
|
|
11
|
+
}, x = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
12
|
+
__name: "copy-button.ce",
|
|
13
|
+
props: {
|
|
14
|
+
text: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
value: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ""
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "复制"
|
|
25
|
+
},
|
|
26
|
+
successLabel: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "已复制"
|
|
29
|
+
},
|
|
30
|
+
errorLabel: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "复制失败"
|
|
33
|
+
},
|
|
34
|
+
timeout: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 1800
|
|
37
|
+
},
|
|
38
|
+
variant: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "text"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: ["copy", "copy-error"],
|
|
44
|
+
setup(e, { emit: x }) {
|
|
45
|
+
let S = e, C = x, w = h(), T = c()?.ce ? g() : null, E = f(!1), D = f(!1), O, k = i(() => S.text || S.value || (T?.textContent || "").trim()), A = i(() => D.value ? S.errorLabel : E.value ? S.successLabel : "");
|
|
46
|
+
async function j() {
|
|
47
|
+
if (!k.value) D.value = !0, C("copy-error", /* @__PURE__ */ Error("No text to copy"));
|
|
48
|
+
else {
|
|
49
|
+
D.value = !1;
|
|
50
|
+
try {
|
|
51
|
+
await navigator.clipboard.writeText(k.value), E.value = !0, C("copy", k.value), clearTimeout(O), O = setTimeout(() => {
|
|
52
|
+
E.value = !1;
|
|
53
|
+
}, Math.max(0, S.timeout));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
D.value = !0, C("copy-error", e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return u(() => clearTimeout(O)), (i, c) => (d(), a("span", {
|
|
60
|
+
class: "kima-copy-button",
|
|
61
|
+
"aria-label": m(w)["aria-label"] || void 0
|
|
62
|
+
}, [s(t, l(m(w), {
|
|
63
|
+
variant: e.variant,
|
|
64
|
+
"aria-label": m(w)["aria-label"] || e.label,
|
|
65
|
+
onClick: j
|
|
66
|
+
}), {
|
|
67
|
+
default: _(() => [o("span", y, [s(r, l({ name: "kima-fade" }, m(n)), {
|
|
68
|
+
default: _(() => [(d(), a("span", { key: E.value ? "copied" : "idle" }, p(E.value ? e.successLabel : e.label), 1))]),
|
|
69
|
+
_: 1
|
|
70
|
+
}, 16)])]),
|
|
71
|
+
_: 1
|
|
72
|
+
}, 16, ["variant", "aria-label"]), o("span", b, p(A.value), 1)], 8, v));
|
|
73
|
+
}
|
|
74
|
+
}), [["__scopeId", "data-v-701ad4fb"]]);
|
|
75
|
+
export { x as default };
|