vlite3 0.7.6 → 0.7.7
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/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/DataTable/DataTable.vue.js +168 -206
- package/components/DataTable/types.d.ts +11 -7
- package/components/Screen/Screen.vue.js +216 -220
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Screen/types.d.ts +4 -0
- package/package.json +1 -1
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -5,8 +5,8 @@ import O from "../Input.vue.js";
|
|
|
5
5
|
/* empty css */
|
|
6
6
|
import "../../core/config.js";
|
|
7
7
|
import y from "../Button.vue.js";
|
|
8
|
-
import E from "./ColorIro.
|
|
9
|
-
/* empty css
|
|
8
|
+
import E from "./ColorIro.vue2.js";
|
|
9
|
+
/* empty css */
|
|
10
10
|
import { useEyeDropper as P } from "@vueuse/core";
|
|
11
11
|
const I = {
|
|
12
12
|
key: 0,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { defineComponent as me, inject as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { $t as
|
|
11
|
-
import { SCREEN_CONTEXT_KEY as
|
|
12
|
-
const
|
|
1
|
+
import { defineComponent as me, inject as fe, computed as r, ref as b, watch as v, openBlock as i, createElementBlock as u, createBlock as A, normalizeClass as C, createSlots as N, withCtx as k, renderSlot as I, createVNode as S, createCommentVNode as $, createElementVNode as m, Fragment as B, renderList as T, normalizeStyle as O, mergeProps as K, unref as L } from "vue";
|
|
2
|
+
import ve from "../CheckBox.vue.js";
|
|
3
|
+
import he from "../Button.vue.js";
|
|
4
|
+
import ge from "../ConfirmationModal.vue.js";
|
|
5
|
+
import pe from "../Pagination/Pagination.vue.js";
|
|
6
|
+
import be from "../Empty/Empty.vue.js";
|
|
7
|
+
import ye from "./DataTableHeader.vue.js";
|
|
8
|
+
import we from "./DataTableRow.vue.js";
|
|
9
|
+
import Pe from "./DataTableToolbar.vue.js";
|
|
10
|
+
import { $t as y } from "../../utils/i18n.js";
|
|
11
|
+
import { SCREEN_CONTEXT_KEY as Ce } from "./types.js";
|
|
12
|
+
const ke = { class: "space-y-6.5" }, Ie = { class: "overflow-x-auto w-full" }, Se = { class: "hover:bg-transparent" }, Te = {
|
|
13
13
|
key: 0,
|
|
14
14
|
scope: "col",
|
|
15
15
|
class: "w-[48px] px-0 text-center font-medium text-muted-foreground",
|
|
16
16
|
style: { width: "48px" }
|
|
17
|
-
},
|
|
17
|
+
}, De = { class: "flex items-center justify-center" }, xe = { class: "[&_tr:last-child]:border-0" }, $e = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "w-[48px] px-0 py-4 align-middle text-center",
|
|
20
20
|
style: { width: "48px" }
|
|
21
|
-
},
|
|
21
|
+
}, Be = { key: 2 }, Ee = ["colspan"], Re = { key: 1 }, Ye = /* @__PURE__ */ me({
|
|
22
22
|
__name: "DataTable",
|
|
23
23
|
props: {
|
|
24
24
|
rows: { default: () => [] },
|
|
@@ -57,321 +57,283 @@ const Ie = { class: "space-y-6.5" }, Se = { class: "overflow-x-auto w-full" }, T
|
|
|
57
57
|
variant: { default: "default" }
|
|
58
58
|
},
|
|
59
59
|
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
60
|
-
setup(o, { emit:
|
|
61
|
-
const
|
|
60
|
+
setup(o, { emit: Y }) {
|
|
61
|
+
const W = (e, t) => {
|
|
62
62
|
if (!(!e || !t))
|
|
63
|
-
return t.includes(".") ? t.split(".").reduce((a,
|
|
64
|
-
},
|
|
63
|
+
return t.includes(".") ? t.split(".").reduce((a, n) => a?.[n], e) : e[t];
|
|
64
|
+
}, f = (e, t) => W(e, t), X = (e, t) => {
|
|
65
65
|
const a = ["id", "_id"];
|
|
66
66
|
if (t && t !== "auto") return t;
|
|
67
67
|
if (e && e.length > 0) {
|
|
68
|
-
for (const
|
|
69
|
-
if (
|
|
68
|
+
for (const n of a)
|
|
69
|
+
if (n in e[0]) return n;
|
|
70
70
|
}
|
|
71
71
|
return "_id";
|
|
72
|
-
}, l = o,
|
|
72
|
+
}, l = o, g = Y, E = fe(Ce, null), U = r(() => E?.disableSearch ? !1 : l.showSearch), D = r(() => l.selectable || !!E?.forceSelectable), d = r(() => X(l.rows, l.keyField)), c = b({ field: "", order: "" }), w = b(
|
|
73
73
|
l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10
|
|
74
|
-
),
|
|
75
|
-
|
|
74
|
+
), h = b(l.pageInfo?.currentPage || 1), p = b(l.search || ""), P = b(!1), q = r(() => l.loading);
|
|
75
|
+
v(
|
|
76
76
|
() => l.loading,
|
|
77
77
|
(e, t) => {
|
|
78
|
-
!e && t && (I.value = "idle");
|
|
79
78
|
}
|
|
80
|
-
),
|
|
79
|
+
), v(
|
|
81
80
|
() => l.search,
|
|
82
81
|
(e) => {
|
|
83
|
-
e !== void 0 && e !==
|
|
82
|
+
e !== void 0 && e !== p.value && (p.value = e);
|
|
84
83
|
}
|
|
85
84
|
);
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
let R = null;
|
|
86
|
+
v(p, () => {
|
|
87
|
+
R && clearTimeout(R), R = setTimeout(() => {
|
|
88
|
+
h.value = 1, x();
|
|
90
89
|
}, 300);
|
|
91
|
-
}),
|
|
92
|
-
(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
(e) => {
|
|
99
|
-
e !== void 0 && (C.value = e);
|
|
100
|
-
}
|
|
101
|
-
), g(
|
|
102
|
-
() => l.pageInfo?.currentPage,
|
|
103
|
-
(e) => {
|
|
104
|
-
e && (p.value = e);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
90
|
+
}), v(() => l.pageInfo?.itemsPerPage, (e) => {
|
|
91
|
+
e !== void 0 && (w.value = e);
|
|
92
|
+
}), v(() => l.paginationProps?.itemsPerPage, (e) => {
|
|
93
|
+
e !== void 0 && (w.value = e);
|
|
94
|
+
}), v(() => l.pageInfo?.currentPage, (e) => {
|
|
95
|
+
e && (h.value = e);
|
|
96
|
+
});
|
|
107
97
|
const s = b(/* @__PURE__ */ new Set());
|
|
108
|
-
|
|
98
|
+
v(
|
|
109
99
|
() => l.selectedRows,
|
|
110
100
|
(e) => {
|
|
111
|
-
const t = new Set(
|
|
112
|
-
(e || []).map((a) => m(a, i.value))
|
|
113
|
-
);
|
|
101
|
+
const t = new Set((e || []).map((a) => f(a, d.value)));
|
|
114
102
|
(t.size !== s.value.size || [...t].some((a) => !s.value.has(a))) && (s.value = t);
|
|
115
103
|
},
|
|
116
104
|
{ immediate: !0, deep: !0 }
|
|
117
105
|
);
|
|
118
|
-
const
|
|
119
|
-
(e) => s.value.has(
|
|
120
|
-
)),
|
|
121
|
-
() => s.value.size > 0 && !U.value
|
|
122
|
-
), J = n(() => {
|
|
106
|
+
const z = r(
|
|
107
|
+
() => l.rows.length > 0 && l.rows.every((e) => s.value.has(f(e, d.value)))
|
|
108
|
+
), F = r(() => s.value.size > 0 && !z.value), G = r(() => {
|
|
123
109
|
const e = [...l.selectedRows || [], ...l.rows], t = /* @__PURE__ */ new Map();
|
|
124
|
-
return e.forEach((a) => t.set(
|
|
125
|
-
}),
|
|
126
|
-
e ? l.rows.forEach(
|
|
127
|
-
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
),
|
|
110
|
+
return e.forEach((a) => t.set(f(a, d.value), a)), Array.from(s.value).map((a) => t.get(a)).filter(Boolean);
|
|
111
|
+
}), H = (e) => {
|
|
112
|
+
e ? l.rows.forEach((t) => s.value.add(f(t, d.value))) : l.rows.forEach((t) => s.value.delete(f(t, d.value))), M();
|
|
113
|
+
}, J = (e) => {
|
|
114
|
+
s.value.has(e) ? s.value.delete(e) : s.value.add(e), M();
|
|
115
|
+
}, M = () => {
|
|
116
|
+
const e = /* @__PURE__ */ new Set(), t = [];
|
|
117
|
+
l.rows.forEach((a) => {
|
|
118
|
+
const n = f(a, d.value);
|
|
119
|
+
s.value.has(n) && (t.push(a), e.add(n));
|
|
120
|
+
}), (l.selectedRows || []).forEach((a) => {
|
|
121
|
+
const n = f(a, d.value);
|
|
122
|
+
!e.has(n) && s.value.has(n) && (t.push(a), e.add(n));
|
|
123
|
+
}), g("select", { selected: t, all: z.value, indeterminate: F.value }), g("update:selectedRows", t);
|
|
124
|
+
}, Q = (e) => {
|
|
125
|
+
c.value.field === e ? c.value.order === "asc" ? c.value.order = "desc" : c.value.order === "desc" ? (c.value.order = "", c.value.field = "") : c.value.order = "asc" : (c.value.field = e, c.value.order = "asc"), h.value = 1, x();
|
|
131
126
|
}, Z = (e) => {
|
|
132
|
-
|
|
133
|
-
}, K = () => {
|
|
134
|
-
const e = l.selectedRows || [], t = /* @__PURE__ */ new Set(), a = [];
|
|
135
|
-
l.rows.forEach((v) => {
|
|
136
|
-
const h = m(v, i.value);
|
|
137
|
-
s.value.has(h) && (a.push(v), t.add(h));
|
|
138
|
-
}), e.forEach((v) => {
|
|
139
|
-
const h = m(v, i.value);
|
|
140
|
-
!t.has(h) && s.value.has(h) && (a.push(v), t.add(h));
|
|
141
|
-
});
|
|
142
|
-
const c = {
|
|
143
|
-
selected: a,
|
|
144
|
-
all: U.value,
|
|
145
|
-
indeterminate: V.value
|
|
146
|
-
};
|
|
147
|
-
y("select", c), y("update:selectedRows", a);
|
|
127
|
+
h.value = e, x();
|
|
148
128
|
}, _ = (e) => {
|
|
149
|
-
|
|
150
|
-
}, ee = (e) => {
|
|
151
|
-
|
|
152
|
-
}, te = (e) => {
|
|
153
|
-
C.value = e, p.value = 1, I.value = "limit", y("update:itemsPerPage", e), E();
|
|
154
|
-
}, le = (e) => {
|
|
155
|
-
y("rowClick", e);
|
|
156
|
-
}, ae = () => {
|
|
157
|
-
const e = J.value;
|
|
158
|
-
y("delete", e), k.value = !1;
|
|
129
|
+
w.value = e, h.value = 1, g("update:itemsPerPage", e), x();
|
|
130
|
+
}, ee = (e) => g("rowClick", e), te = () => {
|
|
131
|
+
g("delete", G.value), P.value = !1;
|
|
159
132
|
};
|
|
160
|
-
let
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
pagination: {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
sort: { ...d.value },
|
|
169
|
-
search: w.value,
|
|
133
|
+
let V = null;
|
|
134
|
+
const x = () => {
|
|
135
|
+
V && clearTimeout(V), V = setTimeout(() => {
|
|
136
|
+
const e = {
|
|
137
|
+
pagination: { page: h.value, limit: w.value },
|
|
138
|
+
sort: { ...c.value },
|
|
139
|
+
search: p.value,
|
|
170
140
|
filter: {}
|
|
171
|
-
}
|
|
141
|
+
};
|
|
142
|
+
g("change", e), E?.onTableChange?.(e);
|
|
172
143
|
}, 10);
|
|
173
144
|
};
|
|
174
|
-
|
|
145
|
+
v(
|
|
175
146
|
() => l.rows,
|
|
176
147
|
() => {
|
|
177
|
-
const e = new Set(
|
|
178
|
-
l.rows.map((t) => m(t, i.value))
|
|
179
|
-
);
|
|
148
|
+
const e = new Set(l.rows.map((t) => f(t, d.value)));
|
|
180
149
|
s.value = new Set([...s.value].filter((t) => e.has(t)));
|
|
181
150
|
}
|
|
182
151
|
);
|
|
183
|
-
const
|
|
152
|
+
const le = r(() => [
|
|
184
153
|
"w-full flex flex-col",
|
|
185
154
|
l.variant === "raised" ? "bg-background shadow-sm p-2 rounded-lg" : "bg-background rounded",
|
|
186
155
|
"overflow-hidden",
|
|
187
156
|
l.bordered ? "border border-border" : "",
|
|
188
157
|
l.class
|
|
189
|
-
].join(" ")), se =
|
|
190
|
-
|
|
191
|
-
), ne = (e) => e.width || "auto", re = n(
|
|
192
|
-
() => l.emptyTitleI18n ? P(l.emptyTitleI18n) : l.emptyTitle
|
|
193
|
-
), ie = n(
|
|
194
|
-
() => l.emptyDescriptionI18n ? P(l.emptyDescriptionI18n) : l.emptyDescription
|
|
195
|
-
), de = n(() => {
|
|
196
|
-
const e = P("vlite.dataTable.confirmDeleteTitle");
|
|
158
|
+
].join(" ")), ae = r(() => ["w-full caption-bottom -text-fs-1", l.tableClass].join(" ")), oe = (e) => e.width || "auto", se = r(() => l.emptyTitleI18n ? y(l.emptyTitleI18n) : l.emptyTitle), ne = r(() => l.emptyDescriptionI18n ? y(l.emptyDescriptionI18n) : l.emptyDescription), re = r(() => {
|
|
159
|
+
const e = y("vlite.dataTable.confirmDeleteTitle");
|
|
197
160
|
return e !== "vlite.dataTable.confirmDeleteTitle" ? e : "Confirm Deletion";
|
|
198
|
-
}),
|
|
199
|
-
const e =
|
|
161
|
+
}), ie = r(() => {
|
|
162
|
+
const e = y("vlite.dataTable.confirmDeleteDesc");
|
|
200
163
|
return e !== "vlite.dataTable.confirmDeleteDesc" ? e : "Are you sure you want to delete the selected items?";
|
|
201
|
-
}),
|
|
202
|
-
const e =
|
|
164
|
+
}), de = r(() => {
|
|
165
|
+
const e = y("vlite.dataTable.deleteBtn");
|
|
203
166
|
return e !== "vlite.dataTable.deleteBtn" ? e : "Delete";
|
|
204
|
-
}),
|
|
205
|
-
const e =
|
|
167
|
+
}), ce = r(() => {
|
|
168
|
+
const e = y("vlite.dataTable.cancelBtn");
|
|
206
169
|
return e !== "vlite.dataTable.cancelBtn" ? e : "Cancel";
|
|
207
170
|
});
|
|
208
|
-
return (e, t) => (
|
|
209
|
-
|
|
171
|
+
return (e, t) => (i(), u("div", ke, [
|
|
172
|
+
U.value || e.$slots?.["toolbar-left"] || e.$slots?.["toolbar-right"] ? (i(), A(Pe, {
|
|
210
173
|
key: 0,
|
|
211
|
-
modelValue:
|
|
212
|
-
"onUpdate:modelValue": t[1] || (t[1] = (a) =>
|
|
213
|
-
"show-search":
|
|
174
|
+
modelValue: p.value,
|
|
175
|
+
"onUpdate:modelValue": t[1] || (t[1] = (a) => p.value = a),
|
|
176
|
+
"show-search": U.value,
|
|
214
177
|
placeholder: o.searchPlaceholder,
|
|
215
178
|
placeholderI18n: o.searchPlaceholderI18n,
|
|
216
|
-
class:
|
|
179
|
+
class: C(o.toolbarClass),
|
|
217
180
|
"search-class": o.toolbarSearchClass
|
|
218
|
-
},
|
|
181
|
+
}, N({ _: 2 }, [
|
|
219
182
|
e.$slots?.["toolbar-left"] ? {
|
|
220
183
|
name: "left",
|
|
221
|
-
fn:
|
|
222
|
-
|
|
184
|
+
fn: k(() => [
|
|
185
|
+
I(e.$slots, "toolbar-left")
|
|
223
186
|
]),
|
|
224
187
|
key: "0"
|
|
225
188
|
} : void 0,
|
|
226
189
|
s.value.size > 0 ? {
|
|
227
190
|
name: "delete",
|
|
228
|
-
fn:
|
|
229
|
-
|
|
230
|
-
key: 0,
|
|
191
|
+
fn: k(() => [
|
|
192
|
+
S(he, {
|
|
231
193
|
rounded: "full",
|
|
232
194
|
variant: "outline",
|
|
233
195
|
size: "lg",
|
|
234
196
|
icon: "lucide:trash-2",
|
|
235
|
-
onClick: t[0] || (t[0] = (a) =>
|
|
236
|
-
})
|
|
197
|
+
onClick: t[0] || (t[0] = (a) => P.value = !0)
|
|
198
|
+
})
|
|
237
199
|
]),
|
|
238
200
|
key: "1"
|
|
239
201
|
} : void 0,
|
|
240
202
|
e.$slots?.["toolbar-right"] ? {
|
|
241
203
|
name: "right",
|
|
242
|
-
fn:
|
|
243
|
-
|
|
204
|
+
fn: k(() => [
|
|
205
|
+
I(e.$slots, "toolbar-right")
|
|
244
206
|
]),
|
|
245
207
|
key: "2"
|
|
246
208
|
} : void 0
|
|
247
|
-
]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) :
|
|
248
|
-
|
|
249
|
-
class:
|
|
209
|
+
]), 1032, ["modelValue", "show-search", "placeholder", "placeholderI18n", "class", "search-class"])) : $("", !0),
|
|
210
|
+
m("div", {
|
|
211
|
+
class: C(le.value)
|
|
250
212
|
}, [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
class:
|
|
213
|
+
m("div", Ie, [
|
|
214
|
+
m("table", {
|
|
215
|
+
class: C([ae.value, "data-table"])
|
|
254
216
|
}, [
|
|
255
|
-
|
|
256
|
-
class:
|
|
217
|
+
m("thead", {
|
|
218
|
+
class: C([
|
|
257
219
|
"[&_tr]:border-b [&_tr]:border-border bg-muted",
|
|
258
220
|
o.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
259
221
|
])
|
|
260
222
|
}, [
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
"model-value":
|
|
266
|
-
indeterminate:
|
|
223
|
+
m("tr", Se, [
|
|
224
|
+
D.value ? (i(), u("th", Te, [
|
|
225
|
+
m("div", De, [
|
|
226
|
+
S(ve, {
|
|
227
|
+
"model-value": z.value,
|
|
228
|
+
indeterminate: F.value,
|
|
267
229
|
size: "xs",
|
|
268
|
-
"onUpdate:modelValue":
|
|
230
|
+
"onUpdate:modelValue": H
|
|
269
231
|
}, null, 8, ["model-value", "indeterminate"])
|
|
270
232
|
])
|
|
271
|
-
])) :
|
|
272
|
-
(
|
|
233
|
+
])) : $("", !0),
|
|
234
|
+
(i(!0), u(B, null, T(o.headers, (a) => (i(), A(ye, {
|
|
273
235
|
key: a.field,
|
|
274
236
|
header: a,
|
|
275
|
-
"sort-config":
|
|
237
|
+
"sort-config": c.value,
|
|
276
238
|
compact: o.compact,
|
|
277
239
|
"table-sortable": o.sortable,
|
|
278
|
-
onSort:
|
|
240
|
+
onSort: Q,
|
|
279
241
|
class: "last:pr-5!",
|
|
280
|
-
style:
|
|
242
|
+
style: O({ width: oe(a) })
|
|
281
243
|
}, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
|
|
282
244
|
])
|
|
283
245
|
], 2),
|
|
284
|
-
|
|
285
|
-
|
|
246
|
+
m("tbody", xe, [
|
|
247
|
+
q.value ? (i(!0), u(B, { key: 0 }, T(Math.min(w.value, 15), (a) => (i(), u("tr", {
|
|
286
248
|
key: "skeleton-" + a,
|
|
287
249
|
class: "border-b border-border/70 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
288
250
|
}, [
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
251
|
+
D.value ? (i(), u("td", $e, [...t[4] || (t[4] = [
|
|
252
|
+
m("div", { class: "flex items-center justify-center" }, [
|
|
253
|
+
m("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
292
254
|
], -1)
|
|
293
|
-
])])) :
|
|
294
|
-
(
|
|
295
|
-
key:
|
|
296
|
-
class:
|
|
255
|
+
])])) : $("", !0),
|
|
256
|
+
(i(!0), u(B, null, T(o.headers, (n) => (i(), u("td", {
|
|
257
|
+
key: n.field,
|
|
258
|
+
class: C(["p-5! align-middle last:pr-6!", [n.hideOnMobile ? "hidden md:table-cell" : ""]])
|
|
297
259
|
}, [
|
|
298
|
-
|
|
299
|
-
class: "rounded-md bg-muted/50 animate-pulse h-4
|
|
300
|
-
style:
|
|
260
|
+
m("div", {
|
|
261
|
+
class: "rounded-md bg-muted/50 animate-pulse h-4",
|
|
262
|
+
style: O({ width: `${50 + Math.random() * 40}%` })
|
|
301
263
|
}, null, 4)
|
|
302
264
|
], 2))), 128))
|
|
303
|
-
]))), 128)) : o.rows.length > 0 ? (
|
|
304
|
-
key:
|
|
265
|
+
]))), 128)) : o.rows.length > 0 ? (i(!0), u(B, { key: 1 }, T(o.rows, (a, n) => (i(), A(we, {
|
|
266
|
+
key: f(a, d.value),
|
|
305
267
|
row: a,
|
|
306
268
|
headers: o.headers,
|
|
307
|
-
index:
|
|
308
|
-
"key-field":
|
|
309
|
-
selectable:
|
|
310
|
-
"is-selected": s.value.has(
|
|
269
|
+
index: n,
|
|
270
|
+
"key-field": d.value,
|
|
271
|
+
selectable: D.value,
|
|
272
|
+
"is-selected": s.value.has(f(a, d.value)),
|
|
311
273
|
hoverable: o.hoverable,
|
|
312
274
|
striped: o.striped,
|
|
313
275
|
compact: o.compact,
|
|
314
|
-
onSelect:
|
|
315
|
-
onRowClick:
|
|
276
|
+
onSelect: J,
|
|
277
|
+
onRowClick: ee,
|
|
316
278
|
class: "[&_td:last-child]:pr-3.5!"
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
name:
|
|
320
|
-
fn:
|
|
321
|
-
|
|
279
|
+
}, N({ _: 2 }, [
|
|
280
|
+
T(o.headers, (j) => ({
|
|
281
|
+
name: j.field,
|
|
282
|
+
fn: k((ue) => [
|
|
283
|
+
I(e.$slots, j.field, K({ ref_for: !0 }, ue))
|
|
322
284
|
])
|
|
323
285
|
}))
|
|
324
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (
|
|
325
|
-
|
|
326
|
-
colspan:
|
|
286
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (i(), u("tr", Be, [
|
|
287
|
+
m("td", {
|
|
288
|
+
colspan: D.value ? o.headers.length + 1 : o.headers.length,
|
|
327
289
|
class: "align-middle hover:bg-transparent"
|
|
328
290
|
}, [
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
title:
|
|
332
|
-
description:
|
|
291
|
+
I(e.$slots, "empty", {}, () => [
|
|
292
|
+
S(L(be), {
|
|
293
|
+
title: se.value,
|
|
294
|
+
description: ne.value,
|
|
333
295
|
icon: o.emptyIcon,
|
|
334
296
|
class: "border-none! bg-transparent! py-16!"
|
|
335
|
-
},
|
|
297
|
+
}, N({ _: 2 }, [
|
|
336
298
|
e.$slots["empty-action"] ? {
|
|
337
299
|
name: "action",
|
|
338
|
-
fn:
|
|
339
|
-
|
|
300
|
+
fn: k(() => [
|
|
301
|
+
I(e.$slots, "empty-action")
|
|
340
302
|
]),
|
|
341
303
|
key: "0"
|
|
342
304
|
} : void 0
|
|
343
305
|
]), 1032, ["title", "description", "icon"])
|
|
344
306
|
])
|
|
345
|
-
], 8,
|
|
307
|
+
], 8, Ee)
|
|
346
308
|
]))
|
|
347
309
|
])
|
|
348
310
|
], 2)
|
|
349
311
|
])
|
|
350
312
|
], 2),
|
|
351
|
-
o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (
|
|
352
|
-
|
|
353
|
-
"current-page":
|
|
313
|
+
o.showPagination && o.pageInfo && o.pageInfo.totalPages > 1 ? (i(), u("div", Re, [
|
|
314
|
+
S(L(pe), K({
|
|
315
|
+
"current-page": h.value,
|
|
354
316
|
"total-pages": o.pageInfo.totalPages,
|
|
355
317
|
"total-items": o.pageInfo.totalItems
|
|
356
318
|
}, o.paginationProps, {
|
|
357
|
-
onChange:
|
|
358
|
-
"onUpdate:itemsPerPage":
|
|
319
|
+
onChange: Z,
|
|
320
|
+
"onUpdate:itemsPerPage": _
|
|
359
321
|
}), null, 16, ["current-page", "total-pages", "total-items"])
|
|
360
|
-
])) :
|
|
361
|
-
|
|
362
|
-
show:
|
|
363
|
-
"onUpdate:show": t[2] || (t[2] = (a) =>
|
|
364
|
-
title:
|
|
365
|
-
description:
|
|
366
|
-
"confirm-text":
|
|
367
|
-
"cancel-text":
|
|
322
|
+
])) : $("", !0),
|
|
323
|
+
S(ge, {
|
|
324
|
+
show: P.value,
|
|
325
|
+
"onUpdate:show": t[2] || (t[2] = (a) => P.value = a),
|
|
326
|
+
title: re.value,
|
|
327
|
+
description: ie.value,
|
|
328
|
+
"confirm-text": de.value,
|
|
329
|
+
"cancel-text": ce.value,
|
|
368
330
|
variant: "danger",
|
|
369
|
-
onConfirm:
|
|
370
|
-
onCancel: t[3] || (t[3] = (a) =>
|
|
331
|
+
onConfirm: te,
|
|
332
|
+
onCancel: t[3] || (t[3] = (a) => P.value = !1)
|
|
371
333
|
}, null, 8, ["show", "title", "description", "confirm-text", "cancel-text"])
|
|
372
334
|
]));
|
|
373
335
|
}
|
|
374
336
|
});
|
|
375
337
|
export {
|
|
376
|
-
|
|
338
|
+
Ye as default
|
|
377
339
|
};
|
|
@@ -50,10 +50,7 @@ export interface DataTableProps {
|
|
|
50
50
|
headers: TableHeader[];
|
|
51
51
|
/**
|
|
52
52
|
* Unique row identifier field.
|
|
53
|
-
*
|
|
54
|
-
* automatically pick the first matching key from ['id', '_id'] found on the
|
|
55
|
-
* first row. Explicitly passing 'id' or '_id' (or any other string) pins the
|
|
56
|
-
* field to that exact value.
|
|
53
|
+
* 'auto' → picks first of ['id','_id'] found on first row, fallback '_id'.
|
|
57
54
|
*/
|
|
58
55
|
keyField?: string;
|
|
59
56
|
loading?: boolean;
|
|
@@ -84,11 +81,18 @@ export interface RowClickPayload {
|
|
|
84
81
|
row: any;
|
|
85
82
|
index: number;
|
|
86
83
|
}
|
|
87
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* Shape provided by Screen to all deeply nested components via provide/inject.
|
|
86
|
+
*
|
|
87
|
+
* - disableSearch → DataTable hides its own search toolbar (Screen owns search)
|
|
88
|
+
* - forceSelectable → DataTable enables row selection for bulk-delete
|
|
89
|
+
* - onTableChange → DataTable calls this whenever sort/pagination/search changes
|
|
90
|
+
* so Screen can merge the state and call its own refetch.
|
|
91
|
+
* Undefined when DataTable is used standalone (outside Screen).
|
|
92
|
+
*/
|
|
88
93
|
export interface ScreenContext {
|
|
89
|
-
/** When true, DataTable should hide its own search toolbar */
|
|
90
94
|
disableSearch: boolean;
|
|
91
|
-
/** When true, DataTable should enable row selection */
|
|
92
95
|
forceSelectable: boolean;
|
|
96
|
+
onTableChange?: (state: TableState) => void;
|
|
93
97
|
}
|
|
94
98
|
export declare const SCREEN_CONTEXT_KEY: unique symbol;
|