@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,491 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/icon.ce.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Fragment as r, Transition as i, TransitionGroup as a, computed as o, createBlock as ee, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, getCurrentInstance as f, mergeProps as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as te, openBlock as g, ref as _, renderList as v, renderSlot as y, toDisplayString as b, unref as x, useAttrs as ne, useHost as re, vModelText as ie, watch as S, withCtx as C, withDirectives as ae, withKeys as w, withModifiers as oe } from "vue";
|
|
6
|
+
import { ArrowDown01Icon as se, ArrowRight01Icon as ce, ArrowUp01Icon as le, ArrowUpDownIcon as ue, CheckmarkSquare02Icon as de, MinusSignSquareIcon as fe, SquareIcon as pe } from "@hugeicons/core-free-icons";
|
|
7
|
+
// src/components/data/table.ce.vue
|
|
8
|
+
var me = ["aria-label"], he = ["aria-busy"], ge = { key: 0 }, _e = {
|
|
9
|
+
key: 0,
|
|
10
|
+
scope: "col",
|
|
11
|
+
class: "kima-table__expand-column"
|
|
12
|
+
}, ve = {
|
|
13
|
+
key: 1,
|
|
14
|
+
scope: "col",
|
|
15
|
+
class: "kima-table__select-column"
|
|
16
|
+
}, ye = [
|
|
17
|
+
"aria-checked",
|
|
18
|
+
"aria-label",
|
|
19
|
+
"title",
|
|
20
|
+
"disabled"
|
|
21
|
+
], be = ["aria-sort"], xe = [
|
|
22
|
+
"aria-label",
|
|
23
|
+
"title",
|
|
24
|
+
"disabled",
|
|
25
|
+
"onClick"
|
|
26
|
+
], Se = { key: 1 }, Ce = [
|
|
27
|
+
"aria-label",
|
|
28
|
+
"aria-valuenow",
|
|
29
|
+
"aria-valuemin",
|
|
30
|
+
"aria-valuemax",
|
|
31
|
+
"onPointerdown",
|
|
32
|
+
"onKeydown"
|
|
33
|
+
], we = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "kima-table__filter-row"
|
|
36
|
+
}, Te = {
|
|
37
|
+
key: 0,
|
|
38
|
+
class: "kima-table__expand-column",
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
}, Ee = {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "kima-table__select-column",
|
|
43
|
+
"aria-hidden": "true"
|
|
44
|
+
}, De = [
|
|
45
|
+
"value",
|
|
46
|
+
"aria-label",
|
|
47
|
+
"placeholder",
|
|
48
|
+
"onInput"
|
|
49
|
+
], Oe = { key: "loading" }, ke = ["colspan"], Ae = { role: "status" }, je = ["onClick", "onKeydown"], Me = {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "kima-table__expand-column"
|
|
52
|
+
}, Ne = [
|
|
53
|
+
"aria-expanded",
|
|
54
|
+
"aria-label",
|
|
55
|
+
"onClick"
|
|
56
|
+
], Pe = {
|
|
57
|
+
key: 1,
|
|
58
|
+
class: "kima-table__select-column"
|
|
59
|
+
}, Fe = [
|
|
60
|
+
"aria-checked",
|
|
61
|
+
"aria-label",
|
|
62
|
+
"title",
|
|
63
|
+
"onClick"
|
|
64
|
+
], Ie = ["onDblclick"], Le = [
|
|
65
|
+
"aria-label",
|
|
66
|
+
"onKeydown",
|
|
67
|
+
"onBlur"
|
|
68
|
+
], Re = {
|
|
69
|
+
key: 0,
|
|
70
|
+
class: "kima-table__expanded-row"
|
|
71
|
+
}, ze = ["colspan"], Be = { key: "empty" }, Ve = ["colspan"], He = { role: "status" }, Ue = {
|
|
72
|
+
key: 1,
|
|
73
|
+
class: "kima-table__summary"
|
|
74
|
+
}, We = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "kima-table__expand-column",
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
}, Ge = {
|
|
79
|
+
key: 1,
|
|
80
|
+
class: "kima-table__select-column",
|
|
81
|
+
"aria-hidden": "true"
|
|
82
|
+
}, Ke = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
83
|
+
__name: "table.ce",
|
|
84
|
+
props: {
|
|
85
|
+
columns: {
|
|
86
|
+
type: Array,
|
|
87
|
+
default: () => []
|
|
88
|
+
},
|
|
89
|
+
rows: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default: () => []
|
|
92
|
+
},
|
|
93
|
+
items: {
|
|
94
|
+
type: Array,
|
|
95
|
+
default: void 0
|
|
96
|
+
},
|
|
97
|
+
caption: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: ""
|
|
100
|
+
},
|
|
101
|
+
striped: Boolean,
|
|
102
|
+
hoverable: Boolean,
|
|
103
|
+
selectable: Boolean,
|
|
104
|
+
expandable: Boolean,
|
|
105
|
+
editable: Boolean,
|
|
106
|
+
modelValue: {
|
|
107
|
+
type: Array,
|
|
108
|
+
default: () => []
|
|
109
|
+
},
|
|
110
|
+
filterValues: {
|
|
111
|
+
type: Object,
|
|
112
|
+
default: () => ({})
|
|
113
|
+
},
|
|
114
|
+
expandedRows: {
|
|
115
|
+
type: Array,
|
|
116
|
+
default: () => []
|
|
117
|
+
},
|
|
118
|
+
rowKey: {
|
|
119
|
+
type: [String, Function],
|
|
120
|
+
default: void 0
|
|
121
|
+
},
|
|
122
|
+
sortKey: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: void 0
|
|
125
|
+
},
|
|
126
|
+
sortDirection: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: void 0
|
|
129
|
+
},
|
|
130
|
+
sortable: Boolean,
|
|
131
|
+
resizable: Boolean,
|
|
132
|
+
summary: Boolean,
|
|
133
|
+
loading: Boolean
|
|
134
|
+
},
|
|
135
|
+
emits: [
|
|
136
|
+
"update:modelValue",
|
|
137
|
+
"row-click",
|
|
138
|
+
"sort-change",
|
|
139
|
+
"update:filterValues",
|
|
140
|
+
"filter-change",
|
|
141
|
+
"update:expandedRows",
|
|
142
|
+
"expand",
|
|
143
|
+
"cell-edit"
|
|
144
|
+
],
|
|
145
|
+
setup(e, { emit: Ke }) {
|
|
146
|
+
let T = e, E = Ke, D = ne(), qe = f().ce ? re() : null, Je = o(() => qe ? {
|
|
147
|
+
...D,
|
|
148
|
+
id: void 0
|
|
149
|
+
} : D), O = _(T.modelValue), k = _({ ...T.filterValues }), A = _([...T.expandedRows]), j = _(T.sortKey ?? ""), M = _(T.sortDirection ?? ""), N = _(Object.fromEntries(T.columns.filter((e) => e.width).map((e) => [e.key, e.width]))), P = _(null), F;
|
|
150
|
+
S(() => T.modelValue, (e) => {
|
|
151
|
+
O.value = e;
|
|
152
|
+
}, { deep: !0 }), S(() => T.filterValues, (e) => {
|
|
153
|
+
k.value = { ...e };
|
|
154
|
+
}, { deep: !0 }), S(() => T.expandedRows, (e) => {
|
|
155
|
+
A.value = [...e];
|
|
156
|
+
}, { deep: !0 }), S(() => T.sortKey, (e) => {
|
|
157
|
+
e !== void 0 && (j.value = e || "");
|
|
158
|
+
}), S(() => T.sortDirection, (e) => {
|
|
159
|
+
e !== void 0 && (M.value = e || "");
|
|
160
|
+
}), S(() => T.columns, (e) => {
|
|
161
|
+
let t = { ...N.value };
|
|
162
|
+
e.forEach((e) => {
|
|
163
|
+
t[e.key] === void 0 && e.width !== void 0 && (t[e.key] = e.width);
|
|
164
|
+
}), N.value = t;
|
|
165
|
+
}, { deep: !0 });
|
|
166
|
+
let Ye = o(() => T.items === void 0 ? T.rows : T.items), I = o(() => T.columns.filter((e) => !e.hidden)), L = o(() => Ye.value.filter((e) => T.columns.every((t) => {
|
|
167
|
+
let n = String(k.value[t.key] ?? "").trim().toLowerCase();
|
|
168
|
+
return !n || String(e[t.key] ?? "").toLowerCase().includes(n);
|
|
169
|
+
}))), R = o(() => T.sortKey !== void 0 || T.sortDirection !== void 0), z = o(() => R.value ? T.sortKey || "" : j.value), B = o(() => {
|
|
170
|
+
let e = R.value ? T.sortDirection : M.value;
|
|
171
|
+
return ["asc", "desc"].includes(e) ? e : "";
|
|
172
|
+
}), V = o(() => {
|
|
173
|
+
let e = T.columns.find((e) => e.key === z.value);
|
|
174
|
+
if (!e || !B.value) return L.value;
|
|
175
|
+
let t = B.value === "asc" ? 1 : -1;
|
|
176
|
+
return L.value.map((e, t) => ({
|
|
177
|
+
row: e,
|
|
178
|
+
index: t
|
|
179
|
+
})).sort((n, r) => {
|
|
180
|
+
if (typeof e.sorter == "function") return e.sorter(n.row, r.row) * t;
|
|
181
|
+
let i = n.row[e.key], a = r.row[e.key];
|
|
182
|
+
return i === a ? n.index - r.index : i == null ? 1 : a == null ? -1 : typeof i == "number" && typeof a == "number" ? (i - a) * t : String(i).localeCompare(String(a), void 0, {
|
|
183
|
+
numeric: !0,
|
|
184
|
+
sensitivity: "base"
|
|
185
|
+
}) * t;
|
|
186
|
+
}).map(({ row: e }) => e);
|
|
187
|
+
}), H = o(() => new Set(O.value)), U = o(() => V.value.map(Y)), W = o(() => new Set(A.value)), G = o(() => U.value.length > 0 && U.value.every((e) => H.value.has(e))), K = o(() => U.value.some((e) => H.value.has(e))), Xe = o(() => G.value ? "true" : K.value ? "mixed" : "false"), q = o(() => G.value ? "取消选择全部行" : "选择全部行"), Ze = o(() => T.columns.some((e) => e.filterable)), Qe = o(() => T.summary || T.columns.some((e) => typeof e.summary == "function")), J = o(() => Math.max(1, I.value.length + +!!T.selectable + +!!T.expandable));
|
|
188
|
+
function Y(e, t) {
|
|
189
|
+
return typeof T.rowKey == "function" ? T.rowKey(e) : typeof T.rowKey == "string" ? e[T.rowKey] : e.id ?? e.key ?? `row-${t}`;
|
|
190
|
+
}
|
|
191
|
+
function X(e, t) {
|
|
192
|
+
let n = Y(e, t), r = new Set(H.value);
|
|
193
|
+
r.has(n) ? r.delete(n) : r.add(n), O.value = [...r], E("update:modelValue", O.value);
|
|
194
|
+
}
|
|
195
|
+
function $e() {
|
|
196
|
+
let e = new Set(H.value);
|
|
197
|
+
for (let t of U.value) G.value ? e.delete(t) : e.add(t);
|
|
198
|
+
O.value = [...e], E("update:modelValue", O.value);
|
|
199
|
+
}
|
|
200
|
+
function et(e, t) {
|
|
201
|
+
let n = t.target.closest?.("button, a, input, select, textarea, label, summary, [contenteditable]:not([contenteditable='false']), [role='button'], [role='checkbox'], [tabindex]");
|
|
202
|
+
n && n !== t.currentTarget || E("row-click", e, t);
|
|
203
|
+
}
|
|
204
|
+
function tt(e, t) {
|
|
205
|
+
let n = t.target.value;
|
|
206
|
+
k.value = {
|
|
207
|
+
...k.value,
|
|
208
|
+
[e.key]: n
|
|
209
|
+
}, E("update:filterValues", k.value), E("filter-change", {
|
|
210
|
+
...k.value,
|
|
211
|
+
key: e.key,
|
|
212
|
+
value: n
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function nt(e, t) {
|
|
216
|
+
let n = Y(e, t), r = new Set(A.value);
|
|
217
|
+
r.has(n) ? r.delete(n) : r.add(n), A.value = [...r], E("update:expandedRows", A.value), E("expand", {
|
|
218
|
+
row: e,
|
|
219
|
+
key: n,
|
|
220
|
+
expanded: r.has(n)
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function rt(e, t, n) {
|
|
224
|
+
T.editable && n.editable && (P.value = {
|
|
225
|
+
rowKey: Y(e, t),
|
|
226
|
+
columnKey: n.key,
|
|
227
|
+
value: e[n.key] ?? "",
|
|
228
|
+
oldValue: e[n.key]
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function it(e, t, n) {
|
|
232
|
+
if (!P.value) return;
|
|
233
|
+
let r = P.value;
|
|
234
|
+
P.value = null, E("cell-edit", {
|
|
235
|
+
row: e,
|
|
236
|
+
rowKey: Y(e, t),
|
|
237
|
+
column: n,
|
|
238
|
+
key: n.key,
|
|
239
|
+
value: r.value,
|
|
240
|
+
oldValue: r.oldValue
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function at() {
|
|
244
|
+
P.value = null;
|
|
245
|
+
}
|
|
246
|
+
function ot(e, t, n) {
|
|
247
|
+
return P.value?.rowKey === Y(e, t) && P.value?.columnKey === n.key;
|
|
248
|
+
}
|
|
249
|
+
function st(e, t, n) {
|
|
250
|
+
if (n.target !== n.currentTarget || n.repeat || ![
|
|
251
|
+
"Enter",
|
|
252
|
+
" ",
|
|
253
|
+
"ArrowUp",
|
|
254
|
+
"ArrowDown",
|
|
255
|
+
"Home",
|
|
256
|
+
"End"
|
|
257
|
+
].includes(n.key)) return;
|
|
258
|
+
if (n.preventDefault(), n.key === "Enter" || n.key === " " && !T.selectable) {
|
|
259
|
+
E("row-click", e, n);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (n.key === " ") {
|
|
263
|
+
X(e, t);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let r = n.currentTarget.parentElement.rows, i = t + (n.key === "ArrowUp" ? -1 : 1);
|
|
267
|
+
n.key === "Home" && (i = 0), n.key === "End" && (i = r.length - 1), r[Math.max(0, Math.min(r.length - 1, i))].focus();
|
|
268
|
+
}
|
|
269
|
+
function Z(e) {
|
|
270
|
+
return T.sortable && e.sortable !== !1 || e.sortable === !0;
|
|
271
|
+
}
|
|
272
|
+
function Q(e) {
|
|
273
|
+
return T.resizable && e.resizable !== !1 || e.resizable === !0;
|
|
274
|
+
}
|
|
275
|
+
function $(e) {
|
|
276
|
+
let t = N.value[e.key] ?? e.width;
|
|
277
|
+
return t ? typeof t == "number" ? `${t}px` : t : void 0;
|
|
278
|
+
}
|
|
279
|
+
function ct(e) {
|
|
280
|
+
if (!Z(e)) return;
|
|
281
|
+
let t = z.value !== e.key || B.value !== "asc" ? "asc" : "desc";
|
|
282
|
+
R.value || (j.value = e.key, M.value = t), E("sort-change", {
|
|
283
|
+
key: e.key,
|
|
284
|
+
direction: t
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function lt(e) {
|
|
288
|
+
let t = z.value === e.key && B.value === "asc";
|
|
289
|
+
return `${e.label}:按${t ? "降" : "升"}序排列`;
|
|
290
|
+
}
|
|
291
|
+
function ut(e, t) {
|
|
292
|
+
let n = Number(e.minWidth) || 72, r = Number(e.maxWidth) || 1200, i = Math.max(n, Math.min(r, Math.round(t)));
|
|
293
|
+
N.value = {
|
|
294
|
+
...N.value,
|
|
295
|
+
[e.key]: i
|
|
296
|
+
}, E("column-resize", {
|
|
297
|
+
key: e.key,
|
|
298
|
+
width: i
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function dt(e, t) {
|
|
302
|
+
Q(e) && t.button === 0 && (t.preventDefault(), F = {
|
|
303
|
+
column: e,
|
|
304
|
+
startX: t.clientX,
|
|
305
|
+
startWidth: Number(N.value[e.key] ?? e.width) || t.currentTarget.parentElement.offsetWidth
|
|
306
|
+
}, document.addEventListener("pointermove", ft), document.addEventListener("pointerup", pt, { once: !0 }));
|
|
307
|
+
}
|
|
308
|
+
function ft(e) {
|
|
309
|
+
F && ut(F.column, F.startWidth + e.clientX - F.startX);
|
|
310
|
+
}
|
|
311
|
+
function pt() {
|
|
312
|
+
F = null, document.removeEventListener("pointermove", ft);
|
|
313
|
+
}
|
|
314
|
+
function mt(e, t) {
|
|
315
|
+
if (!Q(e) || ![
|
|
316
|
+
"ArrowLeft",
|
|
317
|
+
"ArrowRight",
|
|
318
|
+
"Home",
|
|
319
|
+
"End"
|
|
320
|
+
].includes(t.key)) return;
|
|
321
|
+
t.preventDefault();
|
|
322
|
+
let n = Number(N.value[e.key] ?? e.width) || 160, r = Number(e.minWidth) || 72, i = Number(e.maxWidth) || 1200;
|
|
323
|
+
ut(e, t.key === "Home" ? r : t.key === "End" ? i : n + (t.key === "ArrowRight" ? 8 : -8));
|
|
324
|
+
}
|
|
325
|
+
return te(pt), (o, f) => (g(), c("div", { class: m(["kima-table", {
|
|
326
|
+
"kima-table--striped": e.striped,
|
|
327
|
+
"kima-table--hoverable": e.hoverable
|
|
328
|
+
}]) }, [l("div", {
|
|
329
|
+
class: "kima-table__scroll",
|
|
330
|
+
tabindex: "0",
|
|
331
|
+
role: "region",
|
|
332
|
+
"aria-label": e.caption || x(D)["aria-label"] || "表格区域"
|
|
333
|
+
}, [l("table", p(Je.value, { "aria-busy": e.loading }), [
|
|
334
|
+
e.caption ? (g(), c("caption", ge, b(e.caption), 1)) : s("", !0),
|
|
335
|
+
l("thead", null, [l("tr", null, [
|
|
336
|
+
e.expandable ? (g(), c("th", _e, "展开")) : s("", !0),
|
|
337
|
+
e.selectable ? (g(), c("th", ve, [l("button", {
|
|
338
|
+
type: "button",
|
|
339
|
+
role: "checkbox",
|
|
340
|
+
class: "kima-table__select-button",
|
|
341
|
+
"aria-checked": Xe.value,
|
|
342
|
+
"aria-label": q.value,
|
|
343
|
+
title: q.value,
|
|
344
|
+
disabled: e.loading || !Ye.value.length,
|
|
345
|
+
onClick: $e
|
|
346
|
+
}, [d(t, {
|
|
347
|
+
icon: G.value ? x(de) : K.value ? x(fe) : x(pe),
|
|
348
|
+
size: 20,
|
|
349
|
+
"aria-hidden": "true"
|
|
350
|
+
}, null, 8, ["icon"])], 8, ye)])) : s("", !0),
|
|
351
|
+
(g(!0), c(r, null, v(I.value, (n) => (g(), c("th", {
|
|
352
|
+
key: n.key,
|
|
353
|
+
scope: "col",
|
|
354
|
+
class: m(`kima-table__align--${n.align || "start"}`),
|
|
355
|
+
style: h({
|
|
356
|
+
width: $(n),
|
|
357
|
+
minWidth: n.minWidth ? typeof n.minWidth == "number" ? `${n.minWidth}px` : n.minWidth : void 0
|
|
358
|
+
}),
|
|
359
|
+
"aria-sort": Z(n) ? z.value === n.key && B.value ? B.value === "asc" ? "ascending" : "descending" : "none" : void 0
|
|
360
|
+
}, [Z(n) ? (g(), c("button", {
|
|
361
|
+
key: 0,
|
|
362
|
+
type: "button",
|
|
363
|
+
class: "kima-table__sort-button",
|
|
364
|
+
"aria-label": lt(n),
|
|
365
|
+
title: lt(n),
|
|
366
|
+
disabled: e.loading,
|
|
367
|
+
onClick: (e) => ct(n)
|
|
368
|
+
}, [l("span", null, b(n.label), 1), d(t, {
|
|
369
|
+
icon: z.value === n.key && B.value ? B.value === "asc" ? x(le) : x(se) : x(ue),
|
|
370
|
+
size: 16,
|
|
371
|
+
"aria-hidden": "true"
|
|
372
|
+
}, null, 8, ["icon"])], 8, xe)) : (g(), c("span", Se, b(n.label), 1)), Q(n) ? (g(), c("button", {
|
|
373
|
+
key: 2,
|
|
374
|
+
type: "button",
|
|
375
|
+
class: "kima-table__resize",
|
|
376
|
+
role: "separator",
|
|
377
|
+
"aria-label": `调整${n.label}列宽`,
|
|
378
|
+
"aria-valuenow": Number(N.value[n.key] ?? n.width) || void 0,
|
|
379
|
+
"aria-valuemin": Number(n.minWidth) || 72,
|
|
380
|
+
"aria-valuemax": Number(n.maxWidth) || 1200,
|
|
381
|
+
onPointerdown: (e) => dt(n, e),
|
|
382
|
+
onKeydown: (e) => mt(n, e)
|
|
383
|
+
}, null, 40, Ce)) : s("", !0)], 14, be))), 128))
|
|
384
|
+
]), Ze.value ? (g(), c("tr", we, [
|
|
385
|
+
e.expandable ? (g(), c("th", Te)) : s("", !0),
|
|
386
|
+
e.selectable ? (g(), c("th", Ee)) : s("", !0),
|
|
387
|
+
(g(!0), c(r, null, v(I.value, (e) => (g(), c("th", {
|
|
388
|
+
key: e.key,
|
|
389
|
+
class: m(`kima-table__align--${e.align || "start"}`)
|
|
390
|
+
}, [e.filterable ? (g(), c("input", {
|
|
391
|
+
key: 0,
|
|
392
|
+
class: "kima-table__filter",
|
|
393
|
+
type: "search",
|
|
394
|
+
value: k.value[e.key] || "",
|
|
395
|
+
"aria-label": `过滤${e.label}`,
|
|
396
|
+
placeholder: e.filterPlaceholder || `过滤${e.label}`,
|
|
397
|
+
onInput: (t) => tt(e, t)
|
|
398
|
+
}, null, 40, De)) : s("", !0)], 2))), 128))
|
|
399
|
+
])) : s("", !0)]),
|
|
400
|
+
d(i, p({ name: "kima-fade" }, x(n)), {
|
|
401
|
+
default: C(() => [e.loading ? (g(), c("tbody", Oe, [l("tr", null, [l("td", {
|
|
402
|
+
class: "kima-table__message",
|
|
403
|
+
colspan: J.value
|
|
404
|
+
}, [l("div", Ae, [y(o.$slots, "loading", {}, () => [f[1] ||= u("加载中", -1)], !0)])], 8, ke)])])) : V.value.length ? (g(), ee(a, p({
|
|
405
|
+
key: "rows",
|
|
406
|
+
tag: "tbody",
|
|
407
|
+
name: "kima-list"
|
|
408
|
+
}, x(n)), {
|
|
409
|
+
default: C(() => [(g(!0), c(r, null, v(V.value, (n, i) => (g(), c(r, { key: Y(n, i) }, [l("tr", {
|
|
410
|
+
class: m({ "kima-table__row--selected": e.selectable && H.value.has(Y(n, i)) }),
|
|
411
|
+
tabindex: "0",
|
|
412
|
+
onClick: (e) => et(n, e),
|
|
413
|
+
onKeydown: (e) => st(n, i, e)
|
|
414
|
+
}, [
|
|
415
|
+
e.expandable ? (g(), c("td", Me, [l("button", {
|
|
416
|
+
type: "button",
|
|
417
|
+
class: "kima-table__expand-button",
|
|
418
|
+
"aria-expanded": W.value.has(Y(n, i)),
|
|
419
|
+
"aria-label": `${W.value.has(Y(n, i)) ? "收起" : "展开"}第 ${i + 1} 行`,
|
|
420
|
+
onClick: oe((e) => nt(n, i), ["stop"])
|
|
421
|
+
}, [d(t, {
|
|
422
|
+
icon: x(ce),
|
|
423
|
+
size: 18,
|
|
424
|
+
"aria-hidden": "true"
|
|
425
|
+
}, null, 8, ["icon"])], 8, Ne)])) : s("", !0),
|
|
426
|
+
e.selectable ? (g(), c("td", Pe, [l("button", {
|
|
427
|
+
type: "button",
|
|
428
|
+
class: "kima-table__select-button",
|
|
429
|
+
role: "checkbox",
|
|
430
|
+
"aria-checked": H.value.has(Y(n, i)),
|
|
431
|
+
"aria-label": `${H.value.has(Y(n, i)) ? "取消选择" : "选择"}第 ${i + 1} 行`,
|
|
432
|
+
title: `${H.value.has(Y(n, i)) ? "取消选择" : "选择"}第 ${i + 1} 行`,
|
|
433
|
+
onClick: oe((e) => X(n, i), ["stop"])
|
|
434
|
+
}, [d(t, {
|
|
435
|
+
icon: H.value.has(Y(n, i)) ? x(de) : x(pe),
|
|
436
|
+
size: 20,
|
|
437
|
+
"aria-hidden": "true"
|
|
438
|
+
}, null, 8, ["icon"])], 8, Fe)])) : s("", !0),
|
|
439
|
+
(g(!0), c(r, null, v(I.value, (e) => (g(), c("td", {
|
|
440
|
+
key: e.key,
|
|
441
|
+
class: m(`kima-table__align--${e.align || "start"}`),
|
|
442
|
+
style: h({
|
|
443
|
+
width: $(e),
|
|
444
|
+
minWidth: e.minWidth ? typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth : void 0
|
|
445
|
+
}),
|
|
446
|
+
onDblclick: (t) => rt(n, i, e)
|
|
447
|
+
}, [ot(n, i, e) ? ae((g(), c("input", {
|
|
448
|
+
key: 0,
|
|
449
|
+
"onUpdate:modelValue": f[0] ||= (e) => P.value.value = e,
|
|
450
|
+
class: "kima-table__edit-input",
|
|
451
|
+
"aria-label": `编辑${e.label}`,
|
|
452
|
+
onKeydown: [w((t) => it(n, i, e), ["enter"]), w(at, ["esc"])],
|
|
453
|
+
onBlur: (t) => it(n, i, e)
|
|
454
|
+
}, null, 40, Le)), [[ie, P.value.value]]) : y(o.$slots, `cell-${e.key}`, {
|
|
455
|
+
row: n,
|
|
456
|
+
value: n[e.key],
|
|
457
|
+
column: e
|
|
458
|
+
}, () => [u(b(n[e.key]), 1)], !0, 1)], 46, Ie))), 128))
|
|
459
|
+
], 42, je), e.expandable && W.value.has(Y(n, i)) ? (g(), c("tr", Re, [l("td", { colspan: J.value }, [y(o.$slots, "expanded", {
|
|
460
|
+
row: n,
|
|
461
|
+
index: i
|
|
462
|
+
}, () => [u(b(n), 1)], !0)], 8, ze)])) : s("", !0)], 64))), 128))]),
|
|
463
|
+
_: 3
|
|
464
|
+
}, 16)) : (g(), c("tbody", Be, [l("tr", null, [l("td", {
|
|
465
|
+
class: "kima-table__message",
|
|
466
|
+
colspan: J.value
|
|
467
|
+
}, [l("div", He, [y(o.$slots, "empty", {}, () => [f[2] ||= u("暂无数据", -1)], !0)])], 8, Ve)])]))]),
|
|
468
|
+
_: 3
|
|
469
|
+
}, 16),
|
|
470
|
+
Qe.value ? (g(), c("tfoot", Ue, [l("tr", null, [
|
|
471
|
+
e.expandable ? (g(), c("th", We)) : s("", !0),
|
|
472
|
+
e.selectable ? (g(), c("th", Ge)) : s("", !0),
|
|
473
|
+
(g(!0), c(r, null, v(I.value, (e) => (g(), c("th", {
|
|
474
|
+
key: e.key,
|
|
475
|
+
class: m(`kima-table__align--${e.align || "start"}`),
|
|
476
|
+
style: h({
|
|
477
|
+
width: $(e),
|
|
478
|
+
minWidth: e.minWidth ? typeof e.minWidth == "number" ? `${e.minWidth}px` : e.minWidth : void 0
|
|
479
|
+
})
|
|
480
|
+
}, [y(o.$slots, `summary-${e.key}`, {
|
|
481
|
+
column: e,
|
|
482
|
+
rows: V.value
|
|
483
|
+
}, () => [u(b(typeof e.summary == "function" ? e.summary(V.value, {
|
|
484
|
+
column: e,
|
|
485
|
+
rows: V.value
|
|
486
|
+
}) : ""), 1)], !0)], 6))), 128))
|
|
487
|
+
])])) : s("", !0)
|
|
488
|
+
], 16, he)], 8, me)], 2));
|
|
489
|
+
}
|
|
490
|
+
}), [["__scopeId", "data-v-44836eb1"]]);
|
|
491
|
+
export { Ke as default };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/checkbox.ce.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, getCurrentInstance as l, mergeProps as u, normalizeClass as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useAttrs as x, useHost as S, useId as C, watch as w, withModifiers as T } from "vue";
|
|
5
|
+
// src/components/data/virtual-table.ce.vue
|
|
6
|
+
var E = ["aria-label"], ee = ["aria-busy"], te = { key: 0 }, ne = {
|
|
7
|
+
key: 0,
|
|
8
|
+
scope: "col",
|
|
9
|
+
class: "kima-virtual-table__select"
|
|
10
|
+
}, re = { key: 1 }, ie = ["colspan"], ae = { key: 2 }, oe = {
|
|
11
|
+
class: "kima-virtual-table__spacer",
|
|
12
|
+
"aria-hidden": "true"
|
|
13
|
+
}, se = ["colspan"], D = [
|
|
14
|
+
"id",
|
|
15
|
+
"aria-rowindex",
|
|
16
|
+
"aria-selected",
|
|
17
|
+
"onClick",
|
|
18
|
+
"onKeydown"
|
|
19
|
+
], O = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "kima-virtual-table__select"
|
|
22
|
+
}, k = {
|
|
23
|
+
class: "kima-virtual-table__spacer",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
}, A = ["colspan"], j = { key: 3 }, M = ["colspan"], N = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
26
|
+
__name: "virtual-table.ce",
|
|
27
|
+
props: {
|
|
28
|
+
columns: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => []
|
|
31
|
+
},
|
|
32
|
+
rows: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: () => []
|
|
35
|
+
},
|
|
36
|
+
items: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: void 0
|
|
39
|
+
},
|
|
40
|
+
rowKey: {
|
|
41
|
+
type: [String, Function],
|
|
42
|
+
default: void 0
|
|
43
|
+
},
|
|
44
|
+
itemHeight: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 56
|
|
47
|
+
},
|
|
48
|
+
height: {
|
|
49
|
+
type: [Number, String],
|
|
50
|
+
default: 360
|
|
51
|
+
},
|
|
52
|
+
overscan: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 4
|
|
55
|
+
},
|
|
56
|
+
caption: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ""
|
|
59
|
+
},
|
|
60
|
+
selectable: Boolean,
|
|
61
|
+
modelValue: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: () => []
|
|
64
|
+
},
|
|
65
|
+
loading: Boolean
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:modelValue", "row-click"],
|
|
68
|
+
setup(e, { emit: N }) {
|
|
69
|
+
let P = e, F = N, I = x(), L = l()?.ce ? S() : null, R = g(null), z = g(0), B = g(0), V = g(-1), H, U = r(() => P.items === void 0 ? P.rows : P.items), W = r(() => Math.max(1, Math.floor(Number(P.itemHeight) || 56))), G = r(() => z.value || Number.parseFloat(P.height) || W.value * 6), ce = r(() => U.value.length * W.value), K = r(() => {
|
|
70
|
+
if (!U.value.length) return {
|
|
71
|
+
start: 0,
|
|
72
|
+
end: -1
|
|
73
|
+
};
|
|
74
|
+
let e = Math.max(0, Math.floor(Number(P.overscan) || 0));
|
|
75
|
+
return {
|
|
76
|
+
start: Math.max(0, Math.floor(B.value / W.value) - e),
|
|
77
|
+
end: Math.min(U.value.length - 1, Math.ceil((B.value + G.value) / W.value) + e - 1)
|
|
78
|
+
};
|
|
79
|
+
}), q = r(() => U.value.slice(K.value.start, K.value.end + 1).map((e, t) => ({
|
|
80
|
+
row: e,
|
|
81
|
+
index: K.value.start + t,
|
|
82
|
+
key: X(e, K.value.start + t)
|
|
83
|
+
}))), J = r(() => new Set(P.modelValue)), Y = r(() => Math.max(1, P.columns.length + +!!P.selectable)), le = r(() => typeof P.height == "number" ? `${Math.max(0, P.height)}px` : P.height || "360px"), ue = r(() => L ? {
|
|
84
|
+
...I,
|
|
85
|
+
id: void 0
|
|
86
|
+
} : I);
|
|
87
|
+
function X(e, t) {
|
|
88
|
+
return typeof P.rowKey == "function" ? P.rowKey(e) : typeof P.rowKey == "string" ? e?.[P.rowKey] : e?.id ?? e?.key ?? `row-${t}`;
|
|
89
|
+
}
|
|
90
|
+
function Z(e, t) {
|
|
91
|
+
let n = X(e, t), r = new Set(J.value);
|
|
92
|
+
r.has(n) ? r.delete(n) : r.add(n), F("update:modelValue", [...r]);
|
|
93
|
+
}
|
|
94
|
+
function Q(e, t, n) {
|
|
95
|
+
if (n.target === n.currentTarget) {
|
|
96
|
+
if (n.key === " " && P.selectable) n.preventDefault(), Z(e, t);
|
|
97
|
+
else if (n.key === "Enter") F("row-click", e, n);
|
|
98
|
+
else if (["ArrowUp", "ArrowDown"].includes(n.key)) {
|
|
99
|
+
n.preventDefault();
|
|
100
|
+
let e = Math.max(0, Math.min(U.value.length - 1, t + (n.key === "ArrowUp" ? -1 : 1)));
|
|
101
|
+
document.getElementById(`${$}-row-${e}`)?.focus();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let $ = `kima-virtual-table-${C()}`;
|
|
106
|
+
function de(e) {
|
|
107
|
+
B.value = e.currentTarget.scrollTop;
|
|
108
|
+
}
|
|
109
|
+
return m(() => {
|
|
110
|
+
z.value = R.value?.clientHeight || 0, typeof ResizeObserver < "u" && R.value && (H = new ResizeObserver((e) => {
|
|
111
|
+
z.value = e[0]?.contentRect.height || R.value.clientHeight;
|
|
112
|
+
}), H.observe(R.value));
|
|
113
|
+
}), p(() => H?.disconnect()), w(() => U.value.length, (e) => {
|
|
114
|
+
V.value >= e && (V.value = e - 1);
|
|
115
|
+
}), (r, l) => (h(), a("div", u({
|
|
116
|
+
ref_key: "root",
|
|
117
|
+
ref: R
|
|
118
|
+
}, ue.value, {
|
|
119
|
+
class: "kima-virtual-table",
|
|
120
|
+
style: { height: le.value },
|
|
121
|
+
role: "region",
|
|
122
|
+
"aria-label": e.caption || b(I)["aria-label"] || "虚拟表格区域",
|
|
123
|
+
onScroll: de
|
|
124
|
+
}), [o("table", { "aria-busy": e.loading || void 0 }, [
|
|
125
|
+
e.caption ? (h(), a("caption", te, y(e.caption), 1)) : i("", !0),
|
|
126
|
+
o("thead", null, [o("tr", null, [e.selectable ? (h(), a("th", ne, "选择")) : i("", !0), (h(!0), a(n, null, _(e.columns, (e) => (h(), a("th", {
|
|
127
|
+
key: e.key,
|
|
128
|
+
scope: "col",
|
|
129
|
+
class: d(`kima-virtual-table__align--${e.align || "start"}`)
|
|
130
|
+
}, y(e.label), 3))), 128))])]),
|
|
131
|
+
e.loading ? (h(), a("tbody", re, [o("tr", null, [o("td", {
|
|
132
|
+
colspan: Y.value,
|
|
133
|
+
class: "kima-virtual-table__message",
|
|
134
|
+
role: "status"
|
|
135
|
+
}, [v(r.$slots, "loading", {}, () => [l[1] ||= s("加载中", -1)], !0)], 8, ie)])])) : q.value.length ? (h(), a("tbody", ae, [
|
|
136
|
+
o("tr", oe, [o("td", {
|
|
137
|
+
colspan: Y.value,
|
|
138
|
+
style: f({ height: `${K.value.start * W.value}px` })
|
|
139
|
+
}, null, 12, se)]),
|
|
140
|
+
(h(!0), a(n, null, _(q.value, (o) => (h(), a("tr", {
|
|
141
|
+
id: `${$}-row-${o.index}`,
|
|
142
|
+
key: o.key,
|
|
143
|
+
class: d({ "kima-virtual-table__row--selected": J.value.has(o.key) }),
|
|
144
|
+
tabindex: "0",
|
|
145
|
+
"aria-rowindex": o.index + 2,
|
|
146
|
+
"aria-selected": P.selectable ? J.value.has(o.key) : void 0,
|
|
147
|
+
onClick: (e) => F("row-click", o.row, e),
|
|
148
|
+
onKeydown: (e) => Q(o.row, o.index, e)
|
|
149
|
+
}, [e.selectable ? (h(), a("td", O, [c(t, {
|
|
150
|
+
"model-value": J.value.has(o.key),
|
|
151
|
+
"aria-label": `选择第 ${o.index + 1} 行`,
|
|
152
|
+
"onUpdate:modelValue": (e) => Z(o.row, o.index),
|
|
153
|
+
onClick: l[0] ||= T(() => {}, ["stop"])
|
|
154
|
+
}, null, 8, [
|
|
155
|
+
"model-value",
|
|
156
|
+
"aria-label",
|
|
157
|
+
"onUpdate:modelValue"
|
|
158
|
+
])])) : i("", !0), (h(!0), a(n, null, _(e.columns, (e) => (h(), a("td", {
|
|
159
|
+
key: e.key,
|
|
160
|
+
class: d(`kima-virtual-table__align--${e.align || "start"}`)
|
|
161
|
+
}, [v(r.$slots, `cell-${e.key}`, {
|
|
162
|
+
row: o.row,
|
|
163
|
+
value: o.row[e.key],
|
|
164
|
+
column: e
|
|
165
|
+
}, () => [s(y(o.row[e.key]), 1)], !0)], 2))), 128))], 42, D))), 128)),
|
|
166
|
+
o("tr", k, [o("td", {
|
|
167
|
+
colspan: Y.value,
|
|
168
|
+
style: f({ height: `${Math.max(0, ce.value - (K.value.end + 1) * W.value)}px` })
|
|
169
|
+
}, null, 12, A)])
|
|
170
|
+
])) : (h(), a("tbody", j, [o("tr", null, [o("td", {
|
|
171
|
+
colspan: Y.value,
|
|
172
|
+
class: "kima-virtual-table__message",
|
|
173
|
+
role: "status"
|
|
174
|
+
}, [v(r.$slots, "empty", {}, () => [l[2] ||= s("暂无数据", -1)], !0)], 8, M)])]))
|
|
175
|
+
], 8, ee)], 16, E));
|
|
176
|
+
}
|
|
177
|
+
}), [["__scopeId", "data-v-bc80a44c"]]);
|
|
178
|
+
export { N as default };
|