vlite3 0.2.7 → 0.2.9
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/components/Carousel/Carousel.vue.d.ts +14 -0
- package/components/DataTable/DataTable.vue.js +317 -5
- package/components/DataTable/DataTable.vue2.js +2 -314
- package/components/DataTable/DataTableRow.vue.js +47 -44
- package/components/Kanban/Kanban.vue.d.ts +60 -0
- package/components/Kanban/Kanban.vue.js +7 -0
- package/components/Kanban/Kanban.vue2.js +62 -0
- package/components/Kanban/KanbanBoard.vue.d.ts +59 -0
- package/components/Kanban/KanbanBoard.vue.js +7 -0
- package/components/Kanban/KanbanBoard.vue2.js +134 -0
- package/components/Kanban/index.d.ts +4 -0
- package/components/Kanban/types.d.ts +32 -0
- package/components/Kanban/useKanbanBoard.d.ts +13 -0
- package/components/Kanban/useKanbanBoard.js +43 -0
- package/components/Workbook/Workbook.vue.d.ts +0 -2
- package/components/Workbook/Workbook.vue.js +152 -5
- package/components/Workbook/Workbook.vue2.js +2 -152
- package/index.d.ts +1 -1
- package/index.js +120 -114
- package/package.json +3 -3
- package/style.css +26 -11
|
@@ -1,316 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import oe from "../Icon.vue.js";
|
|
3
|
-
import ne from "../CheckBox.vue.js";
|
|
4
|
-
import re from "../Button.vue.js";
|
|
5
|
-
import ie from "../ConfirmationModal.vue.js";
|
|
6
|
-
import de from "../Pagination/Pagination.vue.js";
|
|
7
|
-
import ue from "./DataTableHeader.vue.js";
|
|
8
|
-
import ce from "./DataTableRow.vue.js";
|
|
9
|
-
import me from "./DataTableToolbar.vue.js";
|
|
10
|
-
const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve = { class: "hover:bg-transparent" }, ge = {
|
|
11
|
-
key: 0,
|
|
12
|
-
scope: "col",
|
|
13
|
-
class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
|
|
14
|
-
style: { width: "48px" }
|
|
15
|
-
}, pe = { class: "flex items-center justify-center" }, we = { class: "[&_tr:last-child]:border-0" }, ye = {
|
|
16
|
-
key: 0,
|
|
17
|
-
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
18
|
-
style: { width: "48px" }
|
|
19
|
-
}, be = { key: 2 }, ke = ["colspan"], Pe = { class: "flex flex-col items-center justify-center gap-2 text-muted-foreground p-8" }, xe = { class: "flex h-12 w-12 items-center justify-center rounded-full bg-muted" }, Ce = { class: "mt-1 text-base font-semibold text-foreground" }, Se = { class: "text-sm max-w-sm mx-auto" }, Ie = {
|
|
20
|
-
key: 0,
|
|
21
|
-
class: "mt-4"
|
|
22
|
-
}, $e = { key: 0 }, Ve = /* @__PURE__ */ ee({
|
|
23
|
-
__name: "DataTable",
|
|
24
|
-
props: {
|
|
25
|
-
rows: { default: () => [] },
|
|
26
|
-
selectedRows: { default: () => [] },
|
|
27
|
-
search: { default: "" },
|
|
28
|
-
showSearch: { type: Boolean, default: !0 },
|
|
29
|
-
searchPlaceholder: { default: "Search..." },
|
|
30
|
-
headers: { default: () => [] },
|
|
31
|
-
keyField: { default: "_id" },
|
|
32
|
-
loading: { type: Boolean, default: !1 },
|
|
33
|
-
selectable: { type: Boolean, default: !1 },
|
|
34
|
-
emptyTitle: { default: "No data available" },
|
|
35
|
-
emptyDescription: { default: "No results found. Try adjusting your filters or search terms." },
|
|
36
|
-
emptyIcon: { default: "lucide:inbox" },
|
|
37
|
-
showPagination: { type: Boolean, default: !0 },
|
|
38
|
-
paginationPosition: {},
|
|
39
|
-
pageInfo: {},
|
|
40
|
-
itemsPerPage: { default: 10 },
|
|
41
|
-
itemsPerPageOptions: { default: () => [10, 25, 50, 100] },
|
|
42
|
-
showItemsPerPage: { type: Boolean, default: !0 },
|
|
43
|
-
striped: { type: Boolean, default: !1 },
|
|
44
|
-
hoverable: { type: Boolean, default: !0 },
|
|
45
|
-
bordered: { type: Boolean, default: !0 },
|
|
46
|
-
compact: { type: Boolean, default: !1 },
|
|
47
|
-
tableClass: {},
|
|
48
|
-
class: {},
|
|
49
|
-
sortable: { type: Boolean, default: !1 },
|
|
50
|
-
variant: { default: "default" }
|
|
51
|
-
},
|
|
52
|
-
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
53
|
-
setup(a, { emit: U }) {
|
|
54
|
-
const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, d = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
|
|
55
|
-
p(
|
|
56
|
-
() => l.loading,
|
|
57
|
-
(e, t) => {
|
|
58
|
-
!e && t && (v.value = "idle");
|
|
59
|
-
}
|
|
60
|
-
), p(
|
|
61
|
-
() => l.search,
|
|
62
|
-
(e) => {
|
|
63
|
-
e !== void 0 && e !== y.value && (y.value = e);
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
let F = null;
|
|
67
|
-
p(y, (e) => {
|
|
68
|
-
F && clearTimeout(F), F = setTimeout(() => {
|
|
69
|
-
h.value = 1, v.value = "search", x();
|
|
70
|
-
}, 300);
|
|
71
|
-
}), p(
|
|
72
|
-
() => l.itemsPerPage,
|
|
73
|
-
(e) => {
|
|
74
|
-
k.value = e;
|
|
75
|
-
}
|
|
76
|
-
), p(
|
|
77
|
-
() => l.pageInfo?.currentPage,
|
|
78
|
-
(e) => {
|
|
79
|
-
e && (h.value = e);
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
const j = (e) => u(e, l.keyField), o = g(/* @__PURE__ */ new Set());
|
|
83
|
-
p(
|
|
84
|
-
() => l.selectedRows,
|
|
85
|
-
(e) => {
|
|
86
|
-
const t = new Set((e || []).map((s) => u(s, l.keyField)));
|
|
87
|
-
(t.size !== o.value.size || [...t].some((s) => !o.value.has(s))) && (o.value = t);
|
|
88
|
-
},
|
|
89
|
-
{ immediate: !0, deep: !0 }
|
|
90
|
-
);
|
|
91
|
-
const z = b(() => l.rows.length === 0 ? !1 : l.rows.every((e) => o.value.has(u(e, l.keyField)))), E = b(() => o.value.size > 0 && !z.value), W = b(() => {
|
|
92
|
-
const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
|
|
93
|
-
return e.forEach((s) => t.set(u(s, l.keyField), s)), Array.from(o.value).map((s) => t.get(s)).filter(Boolean);
|
|
94
|
-
}), q = (e) => {
|
|
95
|
-
e ? l.rows.forEach((t) => o.value.add(u(t, l.keyField))) : o.value.size > 0 && l.rows.forEach((t) => o.value.delete(u(t, l.keyField))), N();
|
|
96
|
-
}, G = (e) => {
|
|
97
|
-
o.value.has(e) ? o.value.delete(e) : o.value.add(e), N();
|
|
98
|
-
}, N = () => {
|
|
99
|
-
const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), s = [];
|
|
100
|
-
l.rows.forEach((m) => {
|
|
101
|
-
const f = u(m, l.keyField);
|
|
102
|
-
o.value.has(f) && (s.push(m), t.add(f));
|
|
103
|
-
}), e.forEach((m) => {
|
|
104
|
-
const f = u(m, l.keyField);
|
|
105
|
-
!t.has(f) && o.value.has(f) && (s.push(m), t.add(f));
|
|
106
|
-
});
|
|
107
|
-
const c = {
|
|
108
|
-
selected: s,
|
|
109
|
-
all: z.value,
|
|
110
|
-
indeterminate: E.value
|
|
111
|
-
};
|
|
112
|
-
w("select", c), w("update:selectedRows", s);
|
|
113
|
-
}, H = (e) => {
|
|
114
|
-
d.value.field === e ? d.value.order === "asc" ? d.value.order = "desc" : d.value.order === "desc" ? (d.value.order = "", d.value.field = "") : d.value.order = "asc" : (d.value.field = e, d.value.order = "asc"), h.value = 1, v.value = "sort", x();
|
|
115
|
-
}, J = (e) => {
|
|
116
|
-
h.value = e, v.value = "page", x();
|
|
117
|
-
}, K = (e) => {
|
|
118
|
-
k.value = e, h.value = 1, v.value = "limit", w("update:itemsPerPage", e), x();
|
|
119
|
-
}, Q = (e) => {
|
|
120
|
-
w("rowClick", e);
|
|
121
|
-
}, X = () => {
|
|
122
|
-
const e = W.value;
|
|
123
|
-
w("delete", e), P.value = !1;
|
|
124
|
-
}, x = () => {
|
|
125
|
-
w("change", {
|
|
126
|
-
pagination: {
|
|
127
|
-
page: h.value,
|
|
128
|
-
limit: k.value
|
|
129
|
-
},
|
|
130
|
-
sorting: { ...d.value },
|
|
131
|
-
search: y.value
|
|
132
|
-
});
|
|
133
|
-
}, Y = b(() => [
|
|
134
|
-
"w-full flex flex-col",
|
|
135
|
-
l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
|
|
136
|
-
"overflow-hidden",
|
|
137
|
-
l.bordered ? "border border-border/60" : "",
|
|
138
|
-
l.class
|
|
139
|
-
].join(" ")), Z = b(() => ["w-full caption-bottom text-sm", l.tableClass].join(" ")), _ = (e) => e.width ? e.width : "auto";
|
|
140
|
-
return p(
|
|
141
|
-
() => l.rows,
|
|
142
|
-
() => {
|
|
143
|
-
const e = new Set(l.rows.map((t) => u(t, l.keyField)));
|
|
144
|
-
o.value = new Set([...o.value].filter((t) => e.has(t)));
|
|
145
|
-
}
|
|
146
|
-
), te(() => {
|
|
147
|
-
x();
|
|
148
|
-
}), (e, t) => (n(), i("div", fe, [
|
|
149
|
-
C(me, {
|
|
150
|
-
modelValue: y.value,
|
|
151
|
-
"onUpdate:modelValue": t[1] || (t[1] = (s) => y.value = s),
|
|
152
|
-
"show-search": a.showSearch,
|
|
153
|
-
placeholder: a.searchPlaceholder
|
|
154
|
-
}, V({ _: 2 }, [
|
|
155
|
-
e.$slots?.["toolbar-left"] ? {
|
|
156
|
-
name: "left",
|
|
157
|
-
fn: T(() => [
|
|
158
|
-
S(e.$slots, "toolbar-left", {}, void 0, !0)
|
|
159
|
-
]),
|
|
160
|
-
key: "0"
|
|
161
|
-
} : void 0,
|
|
162
|
-
e.$slots?.["toolbar-right"] || o.value.size > 0 ? {
|
|
163
|
-
name: "right",
|
|
164
|
-
fn: T(() => [
|
|
165
|
-
o.value.size > 0 ? (n(), D(re, {
|
|
166
|
-
key: 0,
|
|
167
|
-
rounded: "full",
|
|
168
|
-
variant: "ghost",
|
|
169
|
-
icon: "lucide:trash-2",
|
|
170
|
-
class: "text-destructive! bg-destructive/10 hover:bg-destructive/15",
|
|
171
|
-
onClick: t[0] || (t[0] = (s) => P.value = !0)
|
|
172
|
-
})) : I("", !0),
|
|
173
|
-
S(e.$slots, "toolbar-right", {}, void 0, !0)
|
|
174
|
-
]),
|
|
175
|
-
key: "1"
|
|
176
|
-
} : void 0
|
|
177
|
-
]), 1032, ["modelValue", "show-search", "placeholder"]),
|
|
178
|
-
r("div", {
|
|
179
|
-
class: B(Y.value)
|
|
180
|
-
}, [
|
|
181
|
-
r("div", he, [
|
|
182
|
-
r("table", {
|
|
183
|
-
class: B([Z.value, ""])
|
|
184
|
-
}, [
|
|
185
|
-
r("thead", {
|
|
186
|
-
class: B([
|
|
187
|
-
"[&_tr]:border-b [&_tr]:border-border/70! bg-muted",
|
|
188
|
-
a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
189
|
-
])
|
|
190
|
-
}, [
|
|
191
|
-
r("tr", ve, [
|
|
192
|
-
a.selectable ? (n(), i("th", ge, [
|
|
193
|
-
r("div", pe, [
|
|
194
|
-
C(ne, {
|
|
195
|
-
"model-value": z.value,
|
|
196
|
-
indeterminate: E.value,
|
|
197
|
-
size: "xs",
|
|
198
|
-
"onUpdate:modelValue": q
|
|
199
|
-
}, null, 8, ["model-value", "indeterminate"])
|
|
200
|
-
])
|
|
201
|
-
])) : I("", !0),
|
|
202
|
-
(n(!0), i(R, null, $(a.headers, (s) => (n(), D(ue, {
|
|
203
|
-
key: s.field,
|
|
204
|
-
header: s,
|
|
205
|
-
"sort-config": d.value,
|
|
206
|
-
compact: a.compact,
|
|
207
|
-
"table-sortable": a.sortable,
|
|
208
|
-
onSort: H,
|
|
209
|
-
class: "last:pr-5!",
|
|
210
|
-
style: A({
|
|
211
|
-
width: _(s)
|
|
212
|
-
})
|
|
213
|
-
}, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
|
|
214
|
-
])
|
|
215
|
-
], 2),
|
|
216
|
-
r("tbody", we, [
|
|
217
|
-
L.value ? (n(!0), i(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (n(), i("tr", {
|
|
218
|
-
key: "skeleton-" + s,
|
|
219
|
-
class: "border-b border-border/50 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
220
|
-
}, [
|
|
221
|
-
a.selectable ? (n(), i("td", ye, [...t[4] || (t[4] = [
|
|
222
|
-
r("div", { class: "flex items-center justify-center" }, [
|
|
223
|
-
r("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
224
|
-
], -1)
|
|
225
|
-
])])) : I("", !0),
|
|
226
|
-
(n(!0), i(R, null, $(a.headers, (c) => (n(), i("td", {
|
|
227
|
-
key: c.field,
|
|
228
|
-
class: B(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
|
|
229
|
-
}, [
|
|
230
|
-
r("div", {
|
|
231
|
-
class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
|
|
232
|
-
style: A({
|
|
233
|
-
width: `${50 + Math.random() * 40}%`
|
|
234
|
-
})
|
|
235
|
-
}, null, 4)
|
|
236
|
-
], 2))), 128))
|
|
237
|
-
]))), 128)) : a.rows.length > 0 ? (n(!0), i(R, { key: 1 }, $(a.rows, (s, c) => (n(), D(ce, {
|
|
238
|
-
key: j(s),
|
|
239
|
-
row: s,
|
|
240
|
-
headers: a.headers,
|
|
241
|
-
index: c,
|
|
242
|
-
"key-field": a.keyField,
|
|
243
|
-
selectable: a.selectable,
|
|
244
|
-
"is-selected": o.value.has(j(s)),
|
|
245
|
-
hoverable: a.hoverable,
|
|
246
|
-
striped: a.striped,
|
|
247
|
-
compact: a.compact,
|
|
248
|
-
onSelect: G,
|
|
249
|
-
onRowClick: Q,
|
|
250
|
-
class: "[&_td:last-child]:pr-3.5!"
|
|
251
|
-
}, V({ _: 2 }, [
|
|
252
|
-
$(a.headers, (m) => ({
|
|
253
|
-
name: m.field,
|
|
254
|
-
fn: T((f) => [
|
|
255
|
-
S(e.$slots, m.field, le({ ref_for: !0 }, f), void 0, !0)
|
|
256
|
-
])
|
|
257
|
-
}))
|
|
258
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (n(), i("tr", be, [
|
|
259
|
-
r("td", {
|
|
260
|
-
colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
|
|
261
|
-
class: "h-96 text-center align-middle hover:bg-transparent"
|
|
262
|
-
}, [
|
|
263
|
-
r("div", Pe, [
|
|
264
|
-
r("div", xe, [
|
|
265
|
-
C(oe, {
|
|
266
|
-
icon: a.emptyIcon,
|
|
267
|
-
class: "h-6 w-6 text-muted-foreground/80"
|
|
268
|
-
}, null, 8, ["icon"])
|
|
269
|
-
]),
|
|
270
|
-
r("h3", Ce, M(a.emptyTitle), 1),
|
|
271
|
-
r("p", Se, [
|
|
272
|
-
S(e.$slots, "empty-description", {}, () => [
|
|
273
|
-
ae(M(a.emptyDescription), 1)
|
|
274
|
-
], !0)
|
|
275
|
-
]),
|
|
276
|
-
e.$slots["empty-action"] ? (n(), i("div", Ie, [
|
|
277
|
-
S(e.$slots, "empty-action", {}, void 0, !0)
|
|
278
|
-
])) : I("", !0)
|
|
279
|
-
])
|
|
280
|
-
], 8, ke)
|
|
281
|
-
]))
|
|
282
|
-
])
|
|
283
|
-
], 2)
|
|
284
|
-
])
|
|
285
|
-
], 2),
|
|
286
|
-
a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (n(), i("div", $e, [
|
|
287
|
-
C(se(de), {
|
|
288
|
-
"current-page": h.value,
|
|
289
|
-
"total-pages": a.pageInfo.totalPages,
|
|
290
|
-
"show-page-info": !1,
|
|
291
|
-
"show-items-per-page": a.showItemsPerPage,
|
|
292
|
-
"items-per-page": k.value,
|
|
293
|
-
"items-per-page-options": a.itemsPerPageOptions,
|
|
294
|
-
"nav-type": "icon",
|
|
295
|
-
alignment: l.paginationPosition,
|
|
296
|
-
onChange: J,
|
|
297
|
-
"onUpdate:itemsPerPage": K
|
|
298
|
-
}, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options", "alignment"])
|
|
299
|
-
])) : I("", !0),
|
|
300
|
-
C(ie, {
|
|
301
|
-
show: P.value,
|
|
302
|
-
"onUpdate:show": t[2] || (t[2] = (s) => P.value = s),
|
|
303
|
-
title: "Confirm Deletion",
|
|
304
|
-
description: "Are you sure you want to delete the selected items?",
|
|
305
|
-
"confirm-text": "Delete",
|
|
306
|
-
"cancel-text": "Cancel",
|
|
307
|
-
variant: "danger",
|
|
308
|
-
onConfirm: X,
|
|
309
|
-
onCancel: t[3] || (t[3] = (s) => P.value = !1)
|
|
310
|
-
}, null, 8, ["show"])
|
|
311
|
-
]));
|
|
312
|
-
}
|
|
313
|
-
});
|
|
1
|
+
import f from "./DataTable.vue.js";
|
|
314
2
|
export {
|
|
315
|
-
|
|
3
|
+
f as default
|
|
316
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as k, computed as p, openBlock as c, createElementBlock as d, normalizeClass as u, withModifiers as v, createElementVNode as m, createVNode as N, createCommentVNode as B, Fragment as M, renderList as V, renderSlot as z } from "vue";
|
|
2
|
+
import F from "../CheckBox.vue.js";
|
|
3
|
+
const L = ["data-state"], U = { class: "flex items-center justify-center" }, h = ["title", "innerHTML"], T = /* @__PURE__ */ k({
|
|
4
4
|
__name: "DataTableRow",
|
|
5
5
|
props: {
|
|
6
6
|
row: {},
|
|
@@ -14,27 +14,30 @@ const F = ["data-state"], L = { class: "flex items-center justify-center" }, U =
|
|
|
14
14
|
compact: { type: Boolean, default: !1 }
|
|
15
15
|
},
|
|
16
16
|
emits: ["select", "rowClick"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
17
|
+
setup(i, { emit: f }) {
|
|
18
|
+
const r = i, a = f, o = (e, t) => {
|
|
19
|
+
if (!(!e || !t))
|
|
20
|
+
return t.includes(".") ? t.split(".").reduce((n, l) => n?.[l], e) : e[t];
|
|
21
|
+
}, g = (e, t, n) => e.format ? e.format(t, n) : t == null ? "-" : e.type === "price" ? new Intl.NumberFormat("en-US", {
|
|
19
22
|
style: "currency",
|
|
20
23
|
currency: "USD"
|
|
21
|
-
}).format(Number(
|
|
24
|
+
}).format(Number(t)) : e.type === "date" ? new Date(t).toLocaleDateString("en-US", {
|
|
22
25
|
year: "numeric",
|
|
23
26
|
month: "short",
|
|
24
27
|
day: "numeric"
|
|
25
|
-
}) : e.type === "number" ? new Intl.NumberFormat("en-US").format(Number(
|
|
28
|
+
}) : e.type === "number" ? new Intl.NumberFormat("en-US").format(Number(t)) : String(t), x = (e, t, n) => {
|
|
26
29
|
const l = [];
|
|
27
30
|
if (e.capitalize && l.push("capitalize"), e.addStatusColor) {
|
|
28
|
-
const
|
|
29
|
-
|
|
31
|
+
const s = w(t);
|
|
32
|
+
s && l.push(s);
|
|
30
33
|
}
|
|
31
34
|
if (typeof e.class == "function") {
|
|
32
|
-
const
|
|
33
|
-
|
|
35
|
+
const s = e.class(t, n);
|
|
36
|
+
s && l.push(s);
|
|
34
37
|
} else e.class && l.push(e.class);
|
|
35
38
|
return l.join(" ");
|
|
36
39
|
}, w = (e) => {
|
|
37
|
-
const
|
|
40
|
+
const t = {
|
|
38
41
|
active: "text-success font-medium",
|
|
39
42
|
inactive: "text-muted-foreground",
|
|
40
43
|
pending: "text-warning font-medium",
|
|
@@ -48,65 +51,65 @@ const F = ["data-state"], L = { class: "flex items-center justify-center" }, U =
|
|
|
48
51
|
high: "text-destructive font-medium",
|
|
49
52
|
medium: "text-warning font-medium",
|
|
50
53
|
low: "text-muted-foreground"
|
|
51
|
-
},
|
|
52
|
-
return n
|
|
53
|
-
},
|
|
54
|
+
}, n = String(e).toLowerCase().replace(/[-_\s]/g, "");
|
|
55
|
+
return t[n] || "";
|
|
56
|
+
}, y = (e) => ({
|
|
54
57
|
left: "text-left",
|
|
55
58
|
center: "text-center",
|
|
56
59
|
right: "text-right"
|
|
57
|
-
})[e.align || "left"],
|
|
58
|
-
|
|
60
|
+
})[e.align || "left"], b = p(() => o(r.row, r.keyField)), C = () => {
|
|
61
|
+
a("rowClick", { row: r.row, index: r.index });
|
|
59
62
|
}, S = () => {
|
|
60
|
-
|
|
63
|
+
a("select", b.value);
|
|
61
64
|
};
|
|
62
|
-
return (e,
|
|
65
|
+
return (e, t) => (c(), d("tr", {
|
|
63
66
|
class: u(["border-b border-border/70 transition-colors data-[state=selected]:bg-muted h-full", [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
i.hoverable ? "hover:bg-muted/50" : "",
|
|
68
|
+
i.striped && i.index % 2 === 1 ? "bg-muted/20" : "bg-background",
|
|
69
|
+
i.isSelected ? "bg-muted! hover:bg-muted/30" : "",
|
|
67
70
|
"group"
|
|
68
71
|
]]),
|
|
69
|
-
"data-state":
|
|
72
|
+
"data-state": i.isSelected ? "selected" : void 0,
|
|
70
73
|
onClick: C
|
|
71
74
|
}, [
|
|
72
|
-
|
|
75
|
+
i.selectable ? (c(), d("td", {
|
|
73
76
|
key: 0,
|
|
74
77
|
class: "w-[48px] px-0 py-3 align-middle text-center",
|
|
75
78
|
style: { width: "48px" },
|
|
76
|
-
onClick:
|
|
79
|
+
onClick: t[0] || (t[0] = v(() => {
|
|
77
80
|
}, ["stop"]))
|
|
78
81
|
}, [
|
|
79
|
-
m("div",
|
|
80
|
-
|
|
81
|
-
"model-value":
|
|
82
|
+
m("div", U, [
|
|
83
|
+
N(F, {
|
|
84
|
+
"model-value": i.isSelected,
|
|
82
85
|
size: "xs",
|
|
83
86
|
"onUpdate:modelValue": S
|
|
84
87
|
}, null, 8, ["model-value"])
|
|
85
88
|
])
|
|
86
|
-
])) :
|
|
87
|
-
(c(!0),
|
|
88
|
-
key:
|
|
89
|
+
])) : B("", !0),
|
|
90
|
+
(c(!0), d(M, null, V(i.headers, (n) => (c(), d("td", {
|
|
91
|
+
key: n.field,
|
|
89
92
|
class: u(["align-middle overflow-hidden", [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
x(
|
|
93
|
+
i.compact ? "p-2 text-xs" : "py-3! px-3 text-sm",
|
|
94
|
+
y(n),
|
|
95
|
+
n.hideOnMobile ? "hidden md:table-cell" : "",
|
|
96
|
+
x(n, o(i.row, n.field), i.row)
|
|
94
97
|
]])
|
|
95
98
|
}, [
|
|
96
|
-
|
|
97
|
-
value:
|
|
98
|
-
row:
|
|
99
|
-
index:
|
|
100
|
-
field:
|
|
99
|
+
z(e.$slots, n.field, {
|
|
100
|
+
value: o(i.row, n.field),
|
|
101
|
+
row: i.row,
|
|
102
|
+
index: i.index,
|
|
103
|
+
field: n.field
|
|
101
104
|
}, () => [
|
|
102
105
|
m("span", {
|
|
103
106
|
class: "truncate block",
|
|
104
|
-
title: String(
|
|
105
|
-
innerHTML: g(
|
|
106
|
-
}, null, 8,
|
|
107
|
+
title: String(o(i.row, n.field)),
|
|
108
|
+
innerHTML: g(n, o(i.row, n.field), i.row)
|
|
109
|
+
}, null, 8, h)
|
|
107
110
|
])
|
|
108
111
|
], 2))), 128))
|
|
109
|
-
], 10,
|
|
112
|
+
], 10, L));
|
|
110
113
|
}
|
|
111
114
|
});
|
|
112
115
|
export {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { KanbanColumn, KanbanLoadDataResult, KanbanChangeEvent } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
columns: KanbanColumn[];
|
|
4
|
+
group?: string;
|
|
5
|
+
itemKey?: string;
|
|
6
|
+
loadData?: (columnId: string | number, page: number) => Promise<KanbanLoadDataResult>;
|
|
7
|
+
data?: Record<string | number, any[]>;
|
|
8
|
+
boardClass?: string;
|
|
9
|
+
headerClass?: string;
|
|
10
|
+
bodyClass?: string;
|
|
11
|
+
draggableClass?: string;
|
|
12
|
+
ghostClass?: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
declare function __VLS_template(): {
|
|
16
|
+
attrs: Partial<{}>;
|
|
17
|
+
slots: {
|
|
18
|
+
'column-header'?(_: {
|
|
19
|
+
column: KanbanColumn;
|
|
20
|
+
pageInfo: {
|
|
21
|
+
currentPage: number;
|
|
22
|
+
totalPages: number;
|
|
23
|
+
totalItems: number;
|
|
24
|
+
};
|
|
25
|
+
}): any;
|
|
26
|
+
'prepend-item'?(_: {
|
|
27
|
+
column: KanbanColumn;
|
|
28
|
+
items: any[];
|
|
29
|
+
}): any;
|
|
30
|
+
item?(_: {
|
|
31
|
+
item: any;
|
|
32
|
+
column: KanbanColumn;
|
|
33
|
+
}): any;
|
|
34
|
+
'append-item'?(_: {
|
|
35
|
+
column: KanbanColumn;
|
|
36
|
+
items: any[];
|
|
37
|
+
}): any;
|
|
38
|
+
};
|
|
39
|
+
refs: {};
|
|
40
|
+
rootEl: HTMLDivElement;
|
|
41
|
+
};
|
|
42
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
43
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
44
|
+
change: (payload: KanbanChangeEvent) => any;
|
|
45
|
+
"update:data": (val: Record<string | number, any[]>) => any;
|
|
46
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
47
|
+
onChange?: (payload: KanbanChangeEvent) => any;
|
|
48
|
+
"onUpdate:data"?: (val: Record<string | number, any[]>) => any;
|
|
49
|
+
}>, {
|
|
50
|
+
class: string;
|
|
51
|
+
group: string;
|
|
52
|
+
itemKey: string;
|
|
53
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
54
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
55
|
+
export default _default;
|
|
56
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
57
|
+
new (): {
|
|
58
|
+
$slots: S;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineComponent as b, openBlock as n, createElementBlock as m, normalizeClass as C, Fragment as p, renderList as y, createBlock as k, withCtx as o, renderSlot as d, mergeProps as r } from "vue";
|
|
2
|
+
import v from "./KanbanBoard.vue.js";
|
|
3
|
+
const K = /* @__PURE__ */ b({
|
|
4
|
+
__name: "Kanban",
|
|
5
|
+
props: {
|
|
6
|
+
columns: {},
|
|
7
|
+
group: { default: "kanban-group" },
|
|
8
|
+
itemKey: { default: "id" },
|
|
9
|
+
loadData: {},
|
|
10
|
+
data: {},
|
|
11
|
+
boardClass: {},
|
|
12
|
+
headerClass: {},
|
|
13
|
+
bodyClass: {},
|
|
14
|
+
draggableClass: {},
|
|
15
|
+
ghostClass: {},
|
|
16
|
+
class: { default: "h-full w-full" }
|
|
17
|
+
},
|
|
18
|
+
emits: ["change", "update:data"],
|
|
19
|
+
setup(a, { emit: i }) {
|
|
20
|
+
const s = a, u = i, g = (e) => {
|
|
21
|
+
u("change", e);
|
|
22
|
+
}, f = (e, c) => {
|
|
23
|
+
s.data && u("update:data", { ...s.data, [e]: c });
|
|
24
|
+
}, h = (e) => s.data ? s.data[e] || [] : [];
|
|
25
|
+
return (e, c) => (n(), m("div", {
|
|
26
|
+
class: C(["flex gap-4 overflow-x-auto p-1 custom-scrollbar-x", s.class])
|
|
27
|
+
}, [
|
|
28
|
+
(n(!0), m(p, null, y(a.columns, (l) => (n(), k(v, {
|
|
29
|
+
key: l.id,
|
|
30
|
+
column: l,
|
|
31
|
+
group: a.group,
|
|
32
|
+
"item-key": a.itemKey,
|
|
33
|
+
"load-data": a.loadData,
|
|
34
|
+
"column-data": h(l.id),
|
|
35
|
+
"board-class": a.boardClass,
|
|
36
|
+
"header-class": a.headerClass,
|
|
37
|
+
"body-class": a.bodyClass,
|
|
38
|
+
"draggable-class": a.draggableClass,
|
|
39
|
+
"ghost-class": a.ghostClass,
|
|
40
|
+
onChange: g,
|
|
41
|
+
"onUpdate:columnData": (t) => f(l.id, t)
|
|
42
|
+
}, {
|
|
43
|
+
header: o((t) => [
|
|
44
|
+
d(e.$slots, "column-header", r({ ref_for: !0 }, t), void 0, !0)
|
|
45
|
+
]),
|
|
46
|
+
"prepend-item": o((t) => [
|
|
47
|
+
d(e.$slots, "prepend-item", r({ ref_for: !0 }, t), void 0, !0)
|
|
48
|
+
]),
|
|
49
|
+
item: o((t) => [
|
|
50
|
+
d(e.$slots, "item", r({ ref_for: !0 }, t), void 0, !0)
|
|
51
|
+
]),
|
|
52
|
+
"append-item": o((t) => [
|
|
53
|
+
d(e.$slots, "append-item", r({ ref_for: !0 }, t), void 0, !0)
|
|
54
|
+
]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 8, ["column", "group", "item-key", "load-data", "column-data", "board-class", "header-class", "body-class", "draggable-class", "ghost-class", "onUpdate:columnData"]))), 128))
|
|
57
|
+
], 2));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
K as default
|
|
62
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { KanbanColumn, KanbanLoadDataResult, KanbanChangeEvent } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
column: KanbanColumn;
|
|
4
|
+
group?: string;
|
|
5
|
+
itemKey?: string;
|
|
6
|
+
loadData?: (columnId: string | number, page: number) => Promise<KanbanLoadDataResult>;
|
|
7
|
+
columnData?: any[];
|
|
8
|
+
boardClass?: string;
|
|
9
|
+
headerClass?: string;
|
|
10
|
+
bodyClass?: string;
|
|
11
|
+
draggableClass?: string;
|
|
12
|
+
ghostClass?: string;
|
|
13
|
+
};
|
|
14
|
+
declare function __VLS_template(): {
|
|
15
|
+
attrs: Partial<{}>;
|
|
16
|
+
slots: {
|
|
17
|
+
header?(_: {
|
|
18
|
+
column: KanbanColumn;
|
|
19
|
+
pageInfo: {
|
|
20
|
+
currentPage: number;
|
|
21
|
+
totalPages: number;
|
|
22
|
+
totalItems: number;
|
|
23
|
+
};
|
|
24
|
+
}): any;
|
|
25
|
+
'prepend-item'?(_: {
|
|
26
|
+
column: KanbanColumn;
|
|
27
|
+
items: any[];
|
|
28
|
+
}): any;
|
|
29
|
+
item?(_: {
|
|
30
|
+
item: any;
|
|
31
|
+
column: KanbanColumn;
|
|
32
|
+
}): any;
|
|
33
|
+
'append-item'?(_: {
|
|
34
|
+
column: KanbanColumn;
|
|
35
|
+
items: any[];
|
|
36
|
+
}): any;
|
|
37
|
+
};
|
|
38
|
+
refs: {
|
|
39
|
+
scrollContainer: HTMLDivElement;
|
|
40
|
+
};
|
|
41
|
+
rootEl: HTMLDivElement;
|
|
42
|
+
};
|
|
43
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
44
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
45
|
+
change: (payload: KanbanChangeEvent) => any;
|
|
46
|
+
"update:columnData": (items: any[]) => any;
|
|
47
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
48
|
+
onChange?: (payload: KanbanChangeEvent) => any;
|
|
49
|
+
"onUpdate:columnData"?: (items: any[]) => any;
|
|
50
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
51
|
+
scrollContainer: HTMLDivElement;
|
|
52
|
+
}, HTMLDivElement>;
|
|
53
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
54
|
+
export default _default;
|
|
55
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
56
|
+
new (): {
|
|
57
|
+
$slots: S;
|
|
58
|
+
};
|
|
59
|
+
};
|