@opengis/table 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CodeTabs.vue.d.ts +14 -0
- package/dist/components/CodeTabs.vue.d.ts.map +1 -0
- package/dist/components/Column.vue.d.ts +16 -0
- package/dist/components/Column.vue.d.ts.map +1 -0
- package/dist/components/DataTable.vue.d.ts +73 -0
- package/dist/components/DataTable.vue.d.ts.map +1 -0
- package/dist/components/Pagination.vue.d.ts +18 -0
- package/dist/components/Pagination.vue.d.ts.map +1 -0
- package/dist/components/SelectionInfo.vue.d.ts +7 -0
- package/dist/components/SelectionInfo.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/formats/ArrayFormat.vue.d.ts +4 -0
- package/dist/formats/ArrayFormat.vue.d.ts.map +1 -0
- package/dist/formats/BadgeFormat.vue.d.ts +4 -0
- package/dist/formats/BadgeFormat.vue.d.ts.map +1 -0
- package/dist/formats/DateFormat.vue.d.ts +4 -0
- package/dist/formats/DateFormat.vue.d.ts.map +1 -0
- package/dist/formats/LinkFormat.vue.d.ts +13 -0
- package/dist/formats/LinkFormat.vue.d.ts.map +1 -0
- package/dist/formats/NumberFormat.vue.d.ts +4 -0
- package/dist/formats/NumberFormat.vue.d.ts.map +1 -0
- package/dist/formats/SelectFormat.vue.d.ts +4 -0
- package/dist/formats/SelectFormat.vue.d.ts.map +1 -0
- package/dist/formats/TextFormat.vue.d.ts +4 -0
- package/dist/formats/TextFormat.vue.d.ts.map +1 -0
- package/dist/formats/index.d.ts +16 -0
- package/dist/formats/index.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +351 -377
- package/dist/index.umd.js +1 -1
- package/dist/types/index.d.ts +143 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +7 -9
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const De = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as F, computed as m, createElementBlock as i, openBlock as o, toDisplayString as x, normalizeStyle as ve, normalizeClass as f, Fragment as R, renderList as z, createElementVNode as d, createTextVNode as M, ref as _, useSlots as pe, watch as L, onMounted as fe, provide as $e, createCommentVNode as B, createBlock as ee, renderSlot as j, unref as te, resolveDynamicComponent as ce, inject as Te, withDirectives as Se, vShow as Fe } from "vue";
|
|
2
|
+
const De = /* @__PURE__ */ F({
|
|
3
3
|
name: "NumberFormat",
|
|
4
4
|
__name: "NumberFormat",
|
|
5
5
|
props: {
|
|
@@ -8,12 +8,12 @@ const De = /* @__PURE__ */ S({
|
|
|
8
8
|
column: {}
|
|
9
9
|
},
|
|
10
10
|
setup(b) {
|
|
11
|
-
const
|
|
11
|
+
const n = b, e = m(() => n.value === null || n.value === void 0 ? "" : typeof n.value == "number" ? n.value.toFixed(2) : Intl.NumberFormat("uk-UA", {
|
|
12
12
|
maximumFractionDigits: 2
|
|
13
|
-
}).format(Number(
|
|
14
|
-
return (
|
|
13
|
+
}).format(Number(n.value)));
|
|
14
|
+
return (v, s) => (o(), i("span", null, x(e.value || "-"), 1));
|
|
15
15
|
}
|
|
16
|
-
}), Ae = /* @__PURE__ */
|
|
16
|
+
}), Ae = /* @__PURE__ */ F({
|
|
17
17
|
name: "DateFormat",
|
|
18
18
|
__name: "DateFormat",
|
|
19
19
|
props: {
|
|
@@ -22,17 +22,17 @@ const De = /* @__PURE__ */ S({
|
|
|
22
22
|
column: {}
|
|
23
23
|
},
|
|
24
24
|
setup(b) {
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
25
|
+
const n = b, e = m(() => {
|
|
26
|
+
if (!n.value) return "";
|
|
27
27
|
try {
|
|
28
|
-
return new Date(
|
|
28
|
+
return new Date(n.value).toLocaleDateString();
|
|
29
29
|
} catch {
|
|
30
|
-
return
|
|
30
|
+
return n.value;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
return (
|
|
33
|
+
return (v, s) => (o(), i("span", null, x(e.value || "-"), 1));
|
|
34
34
|
}
|
|
35
|
-
}), Ie = /* @__PURE__ */
|
|
35
|
+
}), Ie = /* @__PURE__ */ F({
|
|
36
36
|
name: "TextFormat",
|
|
37
37
|
__name: "TextFormat",
|
|
38
38
|
props: {
|
|
@@ -41,10 +41,10 @@ const De = /* @__PURE__ */ S({
|
|
|
41
41
|
column: {}
|
|
42
42
|
},
|
|
43
43
|
setup(b) {
|
|
44
|
-
const
|
|
45
|
-
return (
|
|
44
|
+
const n = b, { value: e } = n, v = m(() => Array.isArray(e) ? e.map((s) => s.text || s).join(",") : e?.text || e);
|
|
45
|
+
return (s, l) => (o(), i("span", null, x(v.value || "-"), 1));
|
|
46
46
|
}
|
|
47
|
-
}),
|
|
47
|
+
}), Be = /* @__PURE__ */ F({
|
|
48
48
|
name: "BadgeFormat",
|
|
49
49
|
__name: "BadgeFormat",
|
|
50
50
|
props: {
|
|
@@ -53,37 +53,37 @@ const De = /* @__PURE__ */ S({
|
|
|
53
53
|
column: {}
|
|
54
54
|
},
|
|
55
55
|
setup(b) {
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
return
|
|
56
|
+
const n = b, e = m(() => {
|
|
57
|
+
const l = String(n.value || "").toLowerCase(), u = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";
|
|
58
|
+
return l.includes("success") || l.includes("active") || l.includes("completed") ? `${u} bg-green-100 text-green-800` : l.includes("error") || l.includes("failed") || l.includes("inactive") ? `${u} bg-red-100 text-red-800` : l.includes("warning") || l.includes("pending") ? `${u} bg-yellow-100 text-yellow-800` : l.includes("info") || l.includes("processing") ? `${u} bg-blue-100 text-blue-800` : n.value?.color && !/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(n.value.color) ? `${u} bg-${n.value.color}-100 text-${n.value.color}-800` : `${u} bg-gray-100 text-gray-800`;
|
|
59
59
|
});
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
return `rgba(${
|
|
60
|
+
function v(l, u = 1) {
|
|
61
|
+
const C = parseInt(l.slice(1, 3), 16), S = parseInt(l.slice(3, 5), 16), $ = parseInt(l.slice(5, 7), 16);
|
|
62
|
+
return `rgba(${C}, ${S}, ${$}, ${u})`;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
const
|
|
64
|
+
const s = m(() => {
|
|
65
|
+
const l = {
|
|
66
66
|
minWidth: "60px",
|
|
67
67
|
textAlign: "center",
|
|
68
68
|
display: "inline-block"
|
|
69
69
|
};
|
|
70
|
-
return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(
|
|
71
|
-
...
|
|
72
|
-
backgroundColor:
|
|
73
|
-
color:
|
|
74
|
-
} :
|
|
70
|
+
return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(n.value?.color) ? {
|
|
71
|
+
...l,
|
|
72
|
+
backgroundColor: v(n.value.color, 0.1),
|
|
73
|
+
color: v(n.value.color, 0.8)
|
|
74
|
+
} : l;
|
|
75
75
|
});
|
|
76
|
-
return (
|
|
77
|
-
class:
|
|
78
|
-
style:
|
|
79
|
-
},
|
|
76
|
+
return (l, u) => (o(), i("span", {
|
|
77
|
+
class: f(["badge", e.value]),
|
|
78
|
+
style: ve(s.value)
|
|
79
|
+
}, x(l.value?.text || l.value || "-"), 7));
|
|
80
80
|
}
|
|
81
|
-
}),
|
|
81
|
+
}), Re = (b, n) => {
|
|
82
82
|
const e = b.__vccOpts || b;
|
|
83
|
-
for (const [
|
|
84
|
-
e[
|
|
83
|
+
for (const [v, s] of n)
|
|
84
|
+
e[v] = s;
|
|
85
85
|
return e;
|
|
86
|
-
},
|
|
86
|
+
}, je = /* @__PURE__ */ Re(Be, [["__scopeId", "data-v-f4b15092"]]), ze = { class: "flex flex-wrap gap-1" }, Pe = /* @__PURE__ */ F({
|
|
87
87
|
name: "ArrayFormat",
|
|
88
88
|
__name: "ArrayFormat",
|
|
89
89
|
props: {
|
|
@@ -92,42 +92,15 @@ const De = /* @__PURE__ */ S({
|
|
|
92
92
|
column: {}
|
|
93
93
|
},
|
|
94
94
|
setup(b) {
|
|
95
|
-
const
|
|
96
|
-
return (
|
|
97
|
-
(o(!0),
|
|
98
|
-
key:
|
|
95
|
+
const n = b, e = m(() => n.value ? Array.isArray(n.value) ? n.value : [n.value] : []), v = (s) => s ? typeof s == "object" && s.name ? s.name : typeof s == "string" || typeof s == "number" ? String(s) : JSON.stringify(s) : "";
|
|
96
|
+
return (s, l) => (o(), i("div", ze, [
|
|
97
|
+
(o(!0), i(R, null, z(e.value, (u, C) => (o(), i("span", {
|
|
98
|
+
key: C,
|
|
99
99
|
class: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 hover:bg-blue-200 transition-colors"
|
|
100
|
-
},
|
|
100
|
+
}, x(v(u)), 1))), 128))
|
|
101
101
|
]));
|
|
102
102
|
}
|
|
103
|
-
}),
|
|
104
|
-
__name: "LinkFormat",
|
|
105
|
-
props: {
|
|
106
|
-
href: { default: "" },
|
|
107
|
-
target: { default: "_self" },
|
|
108
|
-
onClick: { type: Function, default: void 0 },
|
|
109
|
-
value: {},
|
|
110
|
-
row: {},
|
|
111
|
-
column: {}
|
|
112
|
-
},
|
|
113
|
-
setup(b) {
|
|
114
|
-
const a = b, e = f(() => typeof a.value == "string" || typeof a.value == "number" ? a.value : a.value?.text || a.value?.label || "Link"), c = f(() => a.href ? a.href : typeof a.value == "object" && a.value?.href ? a.value.href : ""), l = f(() => a.target ? a.target : typeof a.value == "object" && a.value?.target ? a.value.target : "_self"), n = f(() => "text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer"), i = (_) => {
|
|
115
|
-
a.onClick && a.row && (_.preventDefault(), a.onClick(a.row, a.value));
|
|
116
|
-
};
|
|
117
|
-
return (_, $) => c.value ? (o(), u("a", {
|
|
118
|
-
key: 0,
|
|
119
|
-
href: c.value,
|
|
120
|
-
target: l.value,
|
|
121
|
-
class: m(n.value),
|
|
122
|
-
onClick: i
|
|
123
|
-
}, h(e.value), 11, Le)) : (o(), u("button", {
|
|
124
|
-
key: 1,
|
|
125
|
-
type: "button",
|
|
126
|
-
class: m(n.value),
|
|
127
|
-
onClick: i
|
|
128
|
-
}, h(e.value), 3));
|
|
129
|
-
}
|
|
130
|
-
}), Ve = /* @__PURE__ */ S({
|
|
103
|
+
}), Ne = /* @__PURE__ */ F({
|
|
131
104
|
name: "TextFormat",
|
|
132
105
|
__name: "SelectFormat",
|
|
133
106
|
props: {
|
|
@@ -136,18 +109,17 @@ const De = /* @__PURE__ */ S({
|
|
|
136
109
|
column: {}
|
|
137
110
|
},
|
|
138
111
|
setup(b) {
|
|
139
|
-
const
|
|
140
|
-
return (
|
|
112
|
+
const n = b, { value: e } = n, v = m(() => Array.isArray(e) ? e.map((s) => s.text || s).filter((s, l) => l < 2).join(", ") + (e.length > 2 ? ` +${e.length - 2}` : "") : e?.text || e);
|
|
113
|
+
return (s, l) => (o(), i("span", null, x(v.value || "-"), 1));
|
|
141
114
|
}
|
|
142
115
|
}), de = {
|
|
143
116
|
number: De,
|
|
144
117
|
date: Ae,
|
|
145
118
|
text: Ie,
|
|
146
|
-
badge:
|
|
119
|
+
badge: je,
|
|
147
120
|
array: Pe,
|
|
148
|
-
select:
|
|
149
|
-
|
|
150
|
-
}, Me = { class: "flex items-center space-x-4" }, Ee = { class: "font-medium" }, He = { class: "font-medium" }, We = { class: "font-medium" }, Ue = { class: "flex items-center space-x-2" }, Oe = ["disabled"], Je = { class: "flex items-center space-x-1" }, qe = ["onClick"], Ge = ["disabled"], me = /* @__PURE__ */ S({
|
|
121
|
+
select: Ne
|
|
122
|
+
}, Le = { class: "flex items-center space-x-4" }, Me = { class: "font-medium" }, Ve = { class: "font-medium" }, Ee = { class: "font-medium" }, He = { class: "flex items-center space-x-2" }, We = ["disabled"], Ue = { class: "flex items-center space-x-1" }, Oe = ["onClick"], Je = ["disabled"], me = /* @__PURE__ */ F({
|
|
151
123
|
name: "Pagination",
|
|
152
124
|
__name: "Pagination",
|
|
153
125
|
props: {
|
|
@@ -158,8 +130,8 @@ const De = /* @__PURE__ */ S({
|
|
|
158
130
|
size: { default: "medium" }
|
|
159
131
|
},
|
|
160
132
|
emits: ["update:page"],
|
|
161
|
-
setup(b, { emit:
|
|
162
|
-
const e = b,
|
|
133
|
+
setup(b, { emit: n }) {
|
|
134
|
+
const e = b, v = m(() => ({
|
|
163
135
|
small: {
|
|
164
136
|
text: "text-xs",
|
|
165
137
|
button: "px-2 h-7 text-xs min-w-[28px] flex items-center justify-center",
|
|
@@ -175,7 +147,7 @@ const De = /* @__PURE__ */ S({
|
|
|
175
147
|
button: "px-4 h-11 text-base min-w-[44px] flex items-center justify-center",
|
|
176
148
|
icon: "w-5 h-5"
|
|
177
149
|
}
|
|
178
|
-
})[e.size]),
|
|
150
|
+
})[e.size]), s = m(() => {
|
|
179
151
|
const { theme: p } = e;
|
|
180
152
|
return p === "dark" ? {
|
|
181
153
|
container: "bg-gray-900 border-gray-700",
|
|
@@ -199,122 +171,119 @@ const De = /* @__PURE__ */ S({
|
|
|
199
171
|
buttonActive: "bg-blue-600 text-white",
|
|
200
172
|
ellipsis: "text-gray-500 dark:text-gray-400"
|
|
201
173
|
};
|
|
202
|
-
}),
|
|
174
|
+
}), l = n, u = m(() => Math.ceil(e.total / e.limit)), C = m(() => e.total === 0 ? 0 : (e.page - 1) * e.limit + 1), S = m(() => Math.min(e.page * e.limit, e.total)), $ = m(() => {
|
|
203
175
|
const p = [];
|
|
204
|
-
if (
|
|
205
|
-
for (let k = 1; k <=
|
|
176
|
+
if (u.value <= 7)
|
|
177
|
+
for (let k = 1; k <= u.value; k += 1)
|
|
206
178
|
p.push(k);
|
|
207
179
|
else {
|
|
208
180
|
p.push(1), e.page > 4 && p.push("...");
|
|
209
|
-
const k = Math.max(2, e.page - 1),
|
|
210
|
-
for (let A = k; A <=
|
|
211
|
-
A !== 1 && A !==
|
|
212
|
-
e.page <
|
|
181
|
+
const k = Math.max(2, e.page - 1), T = Math.min(u.value - 1, e.page + 1);
|
|
182
|
+
for (let A = k; A <= T; A += 1)
|
|
183
|
+
A !== 1 && A !== u.value && p.push(A);
|
|
184
|
+
e.page < u.value - 3 && p.push("..."), u.value > 1 && p.push(u.value);
|
|
213
185
|
}
|
|
214
186
|
return p;
|
|
215
187
|
}), D = (p) => {
|
|
216
|
-
p >= 1 && p <=
|
|
188
|
+
p >= 1 && p <= u.value && p !== e.page && l("update:page", p);
|
|
217
189
|
};
|
|
218
|
-
return (p, y) => (o(),
|
|
219
|
-
class:
|
|
190
|
+
return (p, y) => (o(), i("div", {
|
|
191
|
+
class: f(["flex items-center justify-between py-3 border-t", s.value.container])
|
|
220
192
|
}, [
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
class:
|
|
193
|
+
d("div", Le, [
|
|
194
|
+
d("div", {
|
|
195
|
+
class: f(["flex items-center text-sm", s.value.text, v.value.text])
|
|
224
196
|
}, [
|
|
225
|
-
|
|
226
|
-
y[2] || (y[2] =
|
|
227
|
-
|
|
228
|
-
y[3] || (y[3] =
|
|
229
|
-
|
|
230
|
-
y[4] || (y[4] =
|
|
231
|
-
|
|
232
|
-
y[5] || (y[5] =
|
|
197
|
+
d("span", null, [
|
|
198
|
+
y[2] || (y[2] = M(" Показано ", -1)),
|
|
199
|
+
d("span", Me, x(C.value), 1),
|
|
200
|
+
y[3] || (y[3] = M(" до ", -1)),
|
|
201
|
+
d("span", Ve, x(S.value), 1),
|
|
202
|
+
y[4] || (y[4] = M(" з ", -1)),
|
|
203
|
+
d("span", Ee, x(p.total), 1),
|
|
204
|
+
y[5] || (y[5] = M(" результатів ", -1))
|
|
233
205
|
])
|
|
234
206
|
], 2)
|
|
235
207
|
]),
|
|
236
|
-
|
|
237
|
-
|
|
208
|
+
d("div", He, [
|
|
209
|
+
d("button", {
|
|
238
210
|
onClick: y[0] || (y[0] = (k) => D(p.page - 1)),
|
|
239
211
|
disabled: p.page <= 1,
|
|
240
|
-
class:
|
|
212
|
+
class: f([
|
|
241
213
|
"relative font-medium rounded-md",
|
|
242
|
-
|
|
243
|
-
p.page <= 1 ?
|
|
214
|
+
v.value.button,
|
|
215
|
+
p.page <= 1 ? s.value.buttonDisabled : s.value.button
|
|
244
216
|
])
|
|
245
217
|
}, [
|
|
246
|
-
(o(),
|
|
247
|
-
class:
|
|
218
|
+
(o(), i("svg", {
|
|
219
|
+
class: f(v.value.icon),
|
|
248
220
|
fill: "none",
|
|
249
221
|
stroke: "currentColor",
|
|
250
222
|
viewBox: "0 0 24 24"
|
|
251
223
|
}, y[6] || (y[6] = [
|
|
252
|
-
|
|
224
|
+
d("path", {
|
|
253
225
|
"stroke-linecap": "round",
|
|
254
226
|
"stroke-linejoin": "round",
|
|
255
227
|
"stroke-width": "2",
|
|
256
228
|
d: "M15 19l-7-7 7-7"
|
|
257
229
|
}, null, -1)
|
|
258
230
|
]), 2))
|
|
259
|
-
], 10,
|
|
260
|
-
|
|
261
|
-
(o(!0),
|
|
262
|
-
k === "..." ? (o(),
|
|
231
|
+
], 10, We),
|
|
232
|
+
d("div", Ue, [
|
|
233
|
+
(o(!0), i(R, null, z($.value, (k) => (o(), i(R, { key: k }, [
|
|
234
|
+
k === "..." ? (o(), i("span", {
|
|
263
235
|
key: 0,
|
|
264
|
-
class:
|
|
265
|
-
}, " ... ", 2)) : (o(),
|
|
236
|
+
class: f(["font-medium", v.value.button, s.value.ellipsis])
|
|
237
|
+
}, " ... ", 2)) : (o(), i("button", {
|
|
266
238
|
key: 1,
|
|
267
|
-
onClick: (
|
|
268
|
-
class:
|
|
239
|
+
onClick: (T) => D(k),
|
|
240
|
+
class: f([
|
|
269
241
|
"relative font-medium rounded-md",
|
|
270
|
-
|
|
271
|
-
k === p.page ?
|
|
242
|
+
v.value.button,
|
|
243
|
+
k === p.page ? s.value.buttonActive : s.value.button
|
|
272
244
|
])
|
|
273
|
-
},
|
|
245
|
+
}, x(k), 11, Oe))
|
|
274
246
|
], 64))), 128))
|
|
275
247
|
]),
|
|
276
|
-
|
|
248
|
+
d("button", {
|
|
277
249
|
onClick: y[1] || (y[1] = (k) => D(p.page + 1)),
|
|
278
|
-
disabled: p.page >=
|
|
279
|
-
class:
|
|
250
|
+
disabled: p.page >= u.value,
|
|
251
|
+
class: f([
|
|
280
252
|
"relative font-medium rounded-md",
|
|
281
|
-
|
|
282
|
-
p.page >=
|
|
253
|
+
v.value.button,
|
|
254
|
+
p.page >= u.value ? s.value.buttonDisabled : s.value.button
|
|
283
255
|
])
|
|
284
256
|
}, [
|
|
285
|
-
(o(),
|
|
286
|
-
class:
|
|
257
|
+
(o(), i("svg", {
|
|
258
|
+
class: f(v.value.icon),
|
|
287
259
|
fill: "none",
|
|
288
260
|
stroke: "currentColor",
|
|
289
261
|
viewBox: "0 0 24 24"
|
|
290
262
|
}, y[7] || (y[7] = [
|
|
291
|
-
|
|
263
|
+
d("path", {
|
|
292
264
|
"stroke-linecap": "round",
|
|
293
265
|
"stroke-linejoin": "round",
|
|
294
266
|
"stroke-width": "2",
|
|
295
267
|
d: "M9 5l7 7-7 7"
|
|
296
268
|
}, null, -1)
|
|
297
269
|
]), 2))
|
|
298
|
-
], 10,
|
|
270
|
+
], 10, Je)
|
|
299
271
|
])
|
|
300
272
|
], 2));
|
|
301
273
|
}
|
|
302
|
-
}),
|
|
274
|
+
}), qe = {
|
|
303
275
|
key: 0,
|
|
304
276
|
class: "text-center py-8"
|
|
305
|
-
},
|
|
277
|
+
}, Ge = { class: "inline-flex items-center space-x-2" }, Ke = {
|
|
306
278
|
key: 2,
|
|
307
279
|
class: "overflow-x-auto"
|
|
308
|
-
},
|
|
280
|
+
}, Qe = ["checked", "indeterminate"], Xe = ["onClick"], Ye = { class: "flex items-center justify-between" }, Ze = {
|
|
309
281
|
key: 0,
|
|
310
282
|
class: "ml-1 text-xs"
|
|
311
|
-
}, at = {
|
|
312
|
-
key: 1,
|
|
313
|
-
class: "w-[100px]"
|
|
314
|
-
}, rt = ["onClick"], lt = ["checked", "onChange"], st = ["onClick"], nt = {
|
|
283
|
+
}, et = ["onClick"], tt = ["checked", "onChange"], at = ["onClick"], rt = {
|
|
315
284
|
key: 1,
|
|
316
285
|
class: "text-center"
|
|
317
|
-
},
|
|
286
|
+
}, ge = /* @__PURE__ */ F({
|
|
318
287
|
name: "DataTable",
|
|
319
288
|
__name: "DataTable",
|
|
320
289
|
props: {
|
|
@@ -345,8 +314,8 @@ const De = /* @__PURE__ */ S({
|
|
|
345
314
|
getCellData: { type: Function, default: void 0 }
|
|
346
315
|
},
|
|
347
316
|
emits: ["update:page", "update:selectedRows", "row-click", "sort"],
|
|
348
|
-
setup(b, { emit:
|
|
349
|
-
const e = b,
|
|
317
|
+
setup(b, { emit: n }) {
|
|
318
|
+
const e = b, v = n, s = _(e.selectedRows || []), l = _([]), u = _([]), C = _([]), S = _(!1), $ = _(null), D = _(e.router), p = pe(), y = m(() => p.action);
|
|
350
319
|
function k(t) {
|
|
351
320
|
if (D.value) {
|
|
352
321
|
D.value.push(t);
|
|
@@ -354,20 +323,20 @@ const De = /* @__PURE__ */ S({
|
|
|
354
323
|
}
|
|
355
324
|
location.href = t;
|
|
356
325
|
}
|
|
357
|
-
const
|
|
326
|
+
const T = m(() => {
|
|
358
327
|
if (e.api)
|
|
359
|
-
return
|
|
360
|
-
if (e.sortable &&
|
|
328
|
+
return u.value;
|
|
329
|
+
if (e.sortable && l.value.length > 0) {
|
|
361
330
|
const t = [...e.rows];
|
|
362
|
-
return t.sort((
|
|
363
|
-
for (const g of
|
|
331
|
+
return t.sort((c, a) => {
|
|
332
|
+
for (const g of l.value) {
|
|
364
333
|
if (!g.direction)
|
|
365
334
|
return 0;
|
|
366
|
-
const
|
|
367
|
-
if (
|
|
368
|
-
if (
|
|
335
|
+
const r = c[g.field], h = a[g.field];
|
|
336
|
+
if (r == null) return 1;
|
|
337
|
+
if (h == null) return -1;
|
|
369
338
|
let I = 0;
|
|
370
|
-
typeof
|
|
339
|
+
typeof r == "string" && typeof h == "string" ? I = r.localeCompare(h) : r < h ? I = -1 : r > h ? I = 1 : I = 0;
|
|
371
340
|
const O = g.direction === "desc" ? -I : I;
|
|
372
341
|
if (O !== 0) return O;
|
|
373
342
|
}
|
|
@@ -377,34 +346,34 @@ const De = /* @__PURE__ */ S({
|
|
|
377
346
|
return e.rows;
|
|
378
347
|
});
|
|
379
348
|
L(() => e.selectedRows, (t) => {
|
|
380
|
-
|
|
349
|
+
s.value = t || [];
|
|
381
350
|
});
|
|
382
|
-
const A = (t) =>
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
351
|
+
const A = (t) => s.value.some((c) => c === t), ae = (t) => {
|
|
352
|
+
const c = s.value.findIndex((a) => a === t);
|
|
353
|
+
c > -1 ? s.value.splice(c, 1) : s.value.push(t), v("update:selectedRows", [...s.value]);
|
|
354
|
+
}, J = m(() => T.value.length > 0 && s.value.length === T.value.length), V = m(() => s.value.length > 0 && s.value.length < T.value.length), q = () => {
|
|
355
|
+
J.value ? s.value = [] : s.value = [...T.value], v("update:selectedRows", [...s.value]);
|
|
387
356
|
}, be = (t) => {
|
|
388
357
|
if (!e.sortable) return;
|
|
389
|
-
const
|
|
390
|
-
if (
|
|
391
|
-
const g =
|
|
392
|
-
g.direction === "asc" ? g.direction = "desc" : g.direction === "desc" &&
|
|
358
|
+
const c = l.value.findIndex((g) => g.field === t);
|
|
359
|
+
if (c >= 0) {
|
|
360
|
+
const g = l.value[c];
|
|
361
|
+
g.direction === "asc" ? g.direction = "desc" : g.direction === "desc" && l.value.splice(c, 1);
|
|
393
362
|
} else
|
|
394
|
-
|
|
363
|
+
l.value.unshift({
|
|
395
364
|
field: t,
|
|
396
365
|
direction: "asc"
|
|
397
366
|
});
|
|
398
|
-
const
|
|
367
|
+
const a = l.value.filter((g) => g.direction).map((g) => ({
|
|
399
368
|
name: g.field,
|
|
400
369
|
asc: g.direction === "asc"
|
|
401
370
|
}));
|
|
402
|
-
|
|
403
|
-
}, ye = (t) =>
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
371
|
+
v("sort", a), e.api && W();
|
|
372
|
+
}, ye = (t) => l.value.find((a) => a.field === t)?.direction === "asc", he = (t) => {
|
|
373
|
+
const c = l.value.find((a) => a.field === t);
|
|
374
|
+
if (!c)
|
|
406
375
|
return "↑↓";
|
|
407
|
-
switch (
|
|
376
|
+
switch (c.direction) {
|
|
408
377
|
case "asc":
|
|
409
378
|
return "↑";
|
|
410
379
|
// Up arrow for ascending
|
|
@@ -414,26 +383,26 @@ const De = /* @__PURE__ */ S({
|
|
|
414
383
|
default:
|
|
415
384
|
return "↕️";
|
|
416
385
|
}
|
|
417
|
-
},
|
|
418
|
-
e.clickable &&
|
|
419
|
-
},
|
|
420
|
-
const
|
|
386
|
+
}, G = (t) => e.sortable && t.sortable !== !1, xe = (t) => {
|
|
387
|
+
e.clickable && v("row-click", t);
|
|
388
|
+
}, P = (t, c) => {
|
|
389
|
+
const a = c[t.name];
|
|
421
390
|
if (e.getCellData || t.getCellData) {
|
|
422
391
|
const g = t.getCellData || e.getCellData;
|
|
423
392
|
if (g) {
|
|
424
|
-
const
|
|
393
|
+
const r = {
|
|
425
394
|
name: t.name,
|
|
426
|
-
row:
|
|
427
|
-
value:
|
|
395
|
+
row: c,
|
|
396
|
+
value: a
|
|
428
397
|
};
|
|
429
|
-
return g(
|
|
398
|
+
return g(r);
|
|
430
399
|
}
|
|
431
400
|
}
|
|
432
401
|
return ["_data", "_text"].map((g) => {
|
|
433
|
-
const
|
|
434
|
-
return
|
|
435
|
-
}).find((g) => g) ||
|
|
436
|
-
},
|
|
402
|
+
const r = `${t.name}${g}`;
|
|
403
|
+
return c[r] ? c[r] : null;
|
|
404
|
+
}).find((g) => g) || a;
|
|
405
|
+
}, re = (t) => t.width ? t.width === "w-full" ? "w-full" : typeof t.width == "string" ? `w-[${t.width}px]` : typeof t.width == "number" ? `w-[${t.width}px]` : "" : "", K = _(e.page), se = _(e.limit), Q = _(e.total), E = _(1), X = _(10), H = _(0), le = m(() => e.api ? E.value : K.value), ne = m(() => e.api ? X.value : se.value), oe = m(() => e.api ? H.value : Q.value), w = m(() => {
|
|
437
406
|
const { theme: t } = e;
|
|
438
407
|
return t === "dark" ? {
|
|
439
408
|
container: "dark",
|
|
@@ -474,36 +443,36 @@ const De = /* @__PURE__ */ S({
|
|
|
474
443
|
};
|
|
475
444
|
});
|
|
476
445
|
L(() => e.page, (t) => {
|
|
477
|
-
|
|
446
|
+
K.value = t;
|
|
478
447
|
}), L(() => e.limit, (t) => {
|
|
479
448
|
se.value = t;
|
|
480
449
|
}), L(() => e.total, (t) => {
|
|
481
|
-
|
|
450
|
+
Q.value = t;
|
|
482
451
|
});
|
|
483
|
-
async function
|
|
452
|
+
async function W() {
|
|
484
453
|
if (e.api) {
|
|
485
|
-
|
|
454
|
+
S.value = !0, $.value = null;
|
|
486
455
|
try {
|
|
487
456
|
const t = new URL(e.api, window.location.origin);
|
|
488
|
-
if (t.searchParams.set("page",
|
|
489
|
-
const g =
|
|
457
|
+
if (t.searchParams.set("page", le.value.toString()), t.searchParams.set("limit", ne.value.toString()), l.value.length > 0) {
|
|
458
|
+
const g = l.value.filter((r) => r.direction).map((r) => `${r.field}:${r.direction}`).join(",");
|
|
490
459
|
g && t.searchParams.set("sort", g);
|
|
491
460
|
}
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
494
|
-
throw new Error(`HTTP error! status: ${
|
|
495
|
-
const
|
|
496
|
-
|
|
461
|
+
const c = await fetch(t.toString());
|
|
462
|
+
if (!c.ok)
|
|
463
|
+
throw new Error(`HTTP error! status: ${c.status}`);
|
|
464
|
+
const a = await c.json();
|
|
465
|
+
a.rows && Array.isArray(a.rows) && (u.value = a.rows), a.columns && Array.isArray(a.columns) && (C.value = a.columns), a.total !== void 0 && (e.api ? H.value = a.total : Q.value = a.total);
|
|
497
466
|
} catch (t) {
|
|
498
|
-
|
|
467
|
+
$.value = t instanceof Error ? t.message : "Failed to fetch data", console.error("Error fetching data:", t);
|
|
499
468
|
} finally {
|
|
500
|
-
|
|
469
|
+
S.value = !1;
|
|
501
470
|
}
|
|
502
471
|
}
|
|
503
472
|
}
|
|
504
473
|
const ke = (t) => {
|
|
505
|
-
e.api ?
|
|
506
|
-
}, _e =
|
|
474
|
+
e.api ? E.value = t : (K.value = t, v("update:page", t)), e.api && W();
|
|
475
|
+
}, _e = m(() => e.showPagination && oe.value > 0), N = m(() => ({
|
|
507
476
|
small: {
|
|
508
477
|
header: "px-3 py-2 text-xs",
|
|
509
478
|
cell: "px-3 py-2 text-xs"
|
|
@@ -518,199 +487,205 @@ const De = /* @__PURE__ */ S({
|
|
|
518
487
|
}
|
|
519
488
|
})[e.size]);
|
|
520
489
|
fe(() => {
|
|
521
|
-
e.api && (e.page && (
|
|
490
|
+
e.api && (e.page && (E.value = e.page), e.limit && (X.value = e.limit), e.total && (H.value = e.total), W());
|
|
522
491
|
}), L(() => e.api, (t) => {
|
|
523
|
-
t && (
|
|
492
|
+
t && (E.value = e.page || 1, X.value = e.limit || 10, H.value = e.total || 0, W());
|
|
524
493
|
});
|
|
525
|
-
const we =
|
|
526
|
-
$e("registerColumn", (t,
|
|
527
|
-
|
|
494
|
+
const we = m(() => e.api ? C.value : e.columns), Y = _([]), U = _({});
|
|
495
|
+
$e("registerColumn", (t, c) => {
|
|
496
|
+
Y.value.push(t), c && t.slotName && (U.value[t.name] = c);
|
|
528
497
|
});
|
|
529
|
-
const
|
|
530
|
-
const t = we.value || [],
|
|
531
|
-
if (
|
|
532
|
-
const g =
|
|
533
|
-
const
|
|
498
|
+
const ie = m(() => {
|
|
499
|
+
const t = we.value || [], c = [], a = p.default?.();
|
|
500
|
+
if (a) {
|
|
501
|
+
const g = a.filter((r) => r.type?.name === "Column" || r.type === "Column" || r.type && typeof r.type == "object" && r.type.name === "Column").map((r) => {
|
|
502
|
+
const h = r.props || r.componentProps || {}, I = h.field || h.name || "", O = h.header || h.label || "", ue = r.children && r.children.body, Z = {
|
|
534
503
|
name: I,
|
|
535
504
|
// Use field as the name for data access
|
|
536
505
|
ua: O,
|
|
537
506
|
// Use header as the display name
|
|
538
|
-
format:
|
|
539
|
-
slotName:
|
|
540
|
-
...
|
|
507
|
+
format: h.format || "text",
|
|
508
|
+
slotName: ue ? "body" : void 0,
|
|
509
|
+
...h
|
|
541
510
|
};
|
|
542
|
-
return
|
|
511
|
+
return ue && Z.name && (U.value[Z.name] = r.children.body), Z;
|
|
543
512
|
});
|
|
544
|
-
|
|
513
|
+
c.push(...g);
|
|
545
514
|
}
|
|
546
|
-
if (
|
|
547
|
-
const g = [],
|
|
548
|
-
return t.forEach((
|
|
549
|
-
|
|
550
|
-
}), g.push(...
|
|
515
|
+
if (Y.value.length > 0 && c.push(...Y.value), c.length > 0) {
|
|
516
|
+
const g = [], r = new Set(c.map((h) => h.name));
|
|
517
|
+
return t.forEach((h) => {
|
|
518
|
+
r.has(h.name) || g.push(h);
|
|
519
|
+
}), g.push(...c), console.log("Combined columns:", {
|
|
551
520
|
default: t.length,
|
|
552
|
-
custom:
|
|
521
|
+
custom: c.length,
|
|
553
522
|
combined: g.length
|
|
554
523
|
}), g;
|
|
555
524
|
}
|
|
556
525
|
return t.length > 0 ? (console.log("Using default columns:", t.length), t) : [];
|
|
557
526
|
}), Ce = (t = "text") => de[t.toLowerCase()] || de.text;
|
|
558
|
-
return (t,
|
|
559
|
-
class:
|
|
527
|
+
return (t, c) => (o(), i("div", {
|
|
528
|
+
class: f(["w-full", w.value.container])
|
|
560
529
|
}, [
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
class:
|
|
530
|
+
S.value || e.loading ? (o(), i("div", qe, [
|
|
531
|
+
d("div", Ge, [
|
|
532
|
+
c[0] || (c[0] = d("div", { class: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600" }, null, -1)),
|
|
533
|
+
d("span", {
|
|
534
|
+
class: f(w.value.loading)
|
|
566
535
|
}, "Loading...", 2)
|
|
567
536
|
])
|
|
568
|
-
])) :
|
|
537
|
+
])) : $.value ? (o(), i("div", {
|
|
569
538
|
key: 1,
|
|
570
|
-
class:
|
|
571
|
-
},
|
|
572
|
-
|
|
573
|
-
class:
|
|
539
|
+
class: f(["text-center py-8", w.value.error])
|
|
540
|
+
}, x($.value), 3)) : !e.loading && T.value.length > 0 ? (o(), i("div", Ke, [
|
|
541
|
+
d("div", {
|
|
542
|
+
class: f(t.classWrapper ? t.classWrapper : "relative w-full overflow-auto")
|
|
574
543
|
}, [
|
|
575
|
-
|
|
576
|
-
class:
|
|
577
|
-
style:
|
|
544
|
+
d("table", {
|
|
545
|
+
class: f(t.classTable),
|
|
546
|
+
style: ve(t.tableStyle)
|
|
578
547
|
}, [
|
|
579
|
-
|
|
580
|
-
class:
|
|
548
|
+
d("thead", {
|
|
549
|
+
class: f(t.classThead || w.value.thead)
|
|
581
550
|
}, [
|
|
582
|
-
|
|
583
|
-
t.selectable ? (o(),
|
|
551
|
+
d("tr", null, [
|
|
552
|
+
t.selectable ? (o(), i("th", {
|
|
584
553
|
key: 0,
|
|
585
|
-
class:
|
|
554
|
+
class: f(["text-left font-medium uppercase tracking-wider", w.value.th, N.value.header, e.classTh, "w-12"])
|
|
586
555
|
}, [
|
|
587
|
-
|
|
556
|
+
d("input", {
|
|
588
557
|
type: "checkbox",
|
|
589
|
-
checked:
|
|
558
|
+
checked: J.value,
|
|
590
559
|
indeterminate: V.value,
|
|
591
|
-
onChange:
|
|
592
|
-
class:
|
|
593
|
-
}, null, 42,
|
|
594
|
-
], 2)) :
|
|
595
|
-
(o(!0),
|
|
596
|
-
key:
|
|
597
|
-
class:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
560
|
+
onChange: q,
|
|
561
|
+
class: f(["h-4 w-4 focus:ring-blue-500 rounded", w.value.checkbox])
|
|
562
|
+
}, null, 42, Qe)
|
|
563
|
+
], 2)) : B("", !0),
|
|
564
|
+
(o(!0), i(R, null, z(ie.value.filter((a) => !a.hidden), (a) => (o(), i("th", {
|
|
565
|
+
key: a.name,
|
|
566
|
+
class: f([
|
|
567
|
+
a.align ? `text-${a.align}` : "",
|
|
568
|
+
G(a) ? ["cursor-pointer", w.value.thHover] : "",
|
|
569
|
+
re(a)
|
|
601
570
|
].concat(
|
|
602
571
|
e.classTh || [
|
|
603
572
|
"text-left font-medium uppercase tracking-wider",
|
|
604
|
-
|
|
605
|
-
|
|
573
|
+
w.value.th,
|
|
574
|
+
N.value.header
|
|
606
575
|
]
|
|
607
576
|
)),
|
|
608
|
-
onClick: (g) =>
|
|
577
|
+
onClick: (g) => G(a) ? be(a.name) : void 0
|
|
609
578
|
}, [
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
asc: ye(
|
|
579
|
+
d("div", Ye, [
|
|
580
|
+
d("span", null, x(a.ua || a.header || a.name), 1),
|
|
581
|
+
G(a) ? (o(), i("span", Ze, [
|
|
582
|
+
j(t.$slots, "sort", {
|
|
583
|
+
asc: ye(a.name)
|
|
615
584
|
}, () => [
|
|
616
|
-
|
|
585
|
+
M(x(he(a.name)), 1)
|
|
617
586
|
])
|
|
618
|
-
])) :
|
|
587
|
+
])) : B("", !0)
|
|
619
588
|
])
|
|
620
|
-
], 10,
|
|
621
|
-
y.value ? (o(),
|
|
589
|
+
], 10, Xe))), 128)),
|
|
590
|
+
y.value ? (o(), i("th", {
|
|
591
|
+
key: 1,
|
|
592
|
+
class: f(["w-[100px]", e.classTh || [
|
|
593
|
+
"text-left font-medium uppercase tracking-wider",
|
|
594
|
+
w.value.th,
|
|
595
|
+
N.value.header
|
|
596
|
+
]])
|
|
597
|
+
}, "Дії", 2)) : B("", !0)
|
|
622
598
|
])
|
|
623
599
|
], 2),
|
|
624
|
-
|
|
625
|
-
class:
|
|
600
|
+
d("tbody", {
|
|
601
|
+
class: f(t.classTbody || w.value.tbody)
|
|
626
602
|
}, [
|
|
627
|
-
(o(!0),
|
|
603
|
+
(o(!0), i(R, null, z(T.value, (a, g) => (o(), i("tr", {
|
|
628
604
|
key: g,
|
|
629
|
-
class:
|
|
630
|
-
|
|
605
|
+
class: f(e.classTr || [
|
|
606
|
+
w.value.tr,
|
|
631
607
|
e.clickable ? "cursor-pointer" : ""
|
|
632
608
|
]),
|
|
633
|
-
onClick: (
|
|
609
|
+
onClick: (r) => e.clickable ? xe(a) : void 0
|
|
634
610
|
}, [
|
|
635
|
-
t.selectable ? (o(),
|
|
611
|
+
t.selectable ? (o(), i("td", {
|
|
636
612
|
key: 0,
|
|
637
|
-
class:
|
|
613
|
+
class: f(["whitespace-nowrap", w.value.td, N.value.cell, e.classTd, "w-12"])
|
|
638
614
|
}, [
|
|
639
|
-
|
|
615
|
+
d("input", {
|
|
640
616
|
type: "checkbox",
|
|
641
|
-
checked: A(
|
|
642
|
-
onChange: (
|
|
643
|
-
class:
|
|
644
|
-
}, null, 42,
|
|
645
|
-
], 2)) :
|
|
646
|
-
(o(!0),
|
|
647
|
-
key:
|
|
648
|
-
class:
|
|
617
|
+
checked: A(a),
|
|
618
|
+
onChange: (r) => ae(a),
|
|
619
|
+
class: f(["h-4 w-4 focus:ring-blue-500 rounded", w.value.checkbox])
|
|
620
|
+
}, null, 42, tt)
|
|
621
|
+
], 2)) : B("", !0),
|
|
622
|
+
(o(!0), i(R, null, z(ie.value.filter((r) => !r.hidden), (r) => (o(), i("td", {
|
|
623
|
+
key: r.name,
|
|
624
|
+
class: f(e.classTd || [
|
|
649
625
|
"whitespace-nowrap",
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
626
|
+
w.value.td,
|
|
627
|
+
N.value.cell,
|
|
628
|
+
r.align ? `text-${r.align}` : "",
|
|
629
|
+
re(r)
|
|
654
630
|
])
|
|
655
631
|
}, [
|
|
656
|
-
|
|
632
|
+
r.action && y.value ? j(t.$slots, "action", {
|
|
657
633
|
key: 0,
|
|
658
|
-
row:
|
|
659
|
-
|
|
660
|
-
}, null, 8, ["row", "value"])) : ae(p).number && s.format === "number" ? P(t.$slots, "number", {
|
|
634
|
+
row: a
|
|
635
|
+
}) : te(p).number && r.format === "number" ? j(t.$slots, "number", {
|
|
661
636
|
key: 1,
|
|
662
|
-
row:
|
|
663
|
-
value:
|
|
664
|
-
}) :
|
|
637
|
+
row: a,
|
|
638
|
+
value: P(r, a)
|
|
639
|
+
}) : te(p).badge && r.format === "badge" ? j(t.$slots, "badge", {
|
|
665
640
|
key: 2,
|
|
666
|
-
row:
|
|
667
|
-
value:
|
|
668
|
-
}) :
|
|
641
|
+
row: a,
|
|
642
|
+
value: P(r, a)
|
|
643
|
+
}) : te(p).array && r.format === "array" ? j(t.$slots, "array", {
|
|
669
644
|
key: 3,
|
|
670
|
-
row:
|
|
671
|
-
value:
|
|
672
|
-
}) :
|
|
645
|
+
row: a,
|
|
646
|
+
value: P(r, a)
|
|
647
|
+
}) : r.slotName && U.value[r.name] ? (o(), ee(ce(U.value[r.name]), {
|
|
673
648
|
key: 4,
|
|
674
|
-
data:
|
|
675
|
-
value:
|
|
676
|
-
row:
|
|
677
|
-
column:
|
|
678
|
-
}, null, 8, ["data", "value", "row", "column"])) :
|
|
649
|
+
data: a,
|
|
650
|
+
value: P(r, a),
|
|
651
|
+
row: a,
|
|
652
|
+
column: r
|
|
653
|
+
}, null, 8, ["data", "value", "row", "column"])) : r.link ? (o(), i("a", {
|
|
679
654
|
key: 5,
|
|
680
|
-
class:
|
|
681
|
-
onClick: (
|
|
682
|
-
},
|
|
655
|
+
class: f(t.classLink || "hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),
|
|
656
|
+
onClick: (h) => k(r.link.replace("{id}", a.id))
|
|
657
|
+
}, x(P(r, a)), 11, at)) : (o(), ee(ce(Ce(r.format)), {
|
|
683
658
|
key: 6,
|
|
684
|
-
value:
|
|
685
|
-
row:
|
|
686
|
-
column:
|
|
687
|
-
href:
|
|
659
|
+
value: P(r, a),
|
|
660
|
+
row: a,
|
|
661
|
+
column: r,
|
|
662
|
+
href: r.link
|
|
688
663
|
}, null, 8, ["value", "row", "column", "href"]))
|
|
689
664
|
], 2))), 128)),
|
|
690
|
-
y.value ? (o(),
|
|
691
|
-
|
|
692
|
-
])) :
|
|
693
|
-
], 10,
|
|
665
|
+
y.value ? (o(), i("td", rt, [
|
|
666
|
+
j(t.$slots, "action", { row: a })
|
|
667
|
+
])) : B("", !0)
|
|
668
|
+
], 10, et))), 128))
|
|
694
669
|
], 2)
|
|
695
670
|
], 6)
|
|
696
671
|
], 2)
|
|
697
|
-
])) :
|
|
698
|
-
_e.value &&
|
|
672
|
+
])) : B("", !0),
|
|
673
|
+
_e.value && !S.value && !e.loading && !$.value ? (o(), ee(me, {
|
|
699
674
|
key: 3,
|
|
700
|
-
page:
|
|
701
|
-
limit:
|
|
702
|
-
total:
|
|
675
|
+
page: le.value,
|
|
676
|
+
limit: ne.value,
|
|
677
|
+
total: oe.value,
|
|
703
678
|
theme: e.theme,
|
|
704
679
|
size: e.size,
|
|
705
680
|
"onUpdate:page": ke
|
|
706
|
-
}, null, 8, ["page", "limit", "total", "theme", "size"])) :
|
|
707
|
-
|
|
681
|
+
}, null, 8, ["page", "limit", "total", "theme", "size"])) : B("", !0),
|
|
682
|
+
!S.value && !e.loading && !$.value && T.value.length === 0 ? (o(), i("div", {
|
|
708
683
|
key: 4,
|
|
709
|
-
class:
|
|
710
|
-
}, " Дані відсутні ", 2)) :
|
|
684
|
+
class: f(["text-center py-8", w.value.empty])
|
|
685
|
+
}, " Дані відсутні ", 2)) : B("", !0)
|
|
711
686
|
], 2));
|
|
712
687
|
}
|
|
713
|
-
}),
|
|
688
|
+
}), st = { style: { display: "none" } }, lt = /* @__PURE__ */ F({
|
|
714
689
|
name: "Column",
|
|
715
690
|
__name: "Column",
|
|
716
691
|
props: {
|
|
@@ -731,134 +706,133 @@ const De = /* @__PURE__ */ S({
|
|
|
731
706
|
suffix: {}
|
|
732
707
|
},
|
|
733
708
|
setup(b) {
|
|
734
|
-
const
|
|
709
|
+
const n = b, e = pe(), v = Te("registerColumn");
|
|
735
710
|
return fe(() => {
|
|
736
|
-
if (
|
|
711
|
+
if (v) {
|
|
737
712
|
const {
|
|
738
|
-
field:
|
|
739
|
-
name:
|
|
740
|
-
header:
|
|
741
|
-
label:
|
|
742
|
-
format:
|
|
743
|
-
slotName:
|
|
713
|
+
field: s,
|
|
714
|
+
name: l,
|
|
715
|
+
header: u,
|
|
716
|
+
label: C,
|
|
717
|
+
format: S,
|
|
718
|
+
slotName: $,
|
|
744
719
|
link: D,
|
|
745
720
|
action: p,
|
|
746
721
|
getCellData: y,
|
|
747
722
|
suffix: k,
|
|
748
|
-
...
|
|
749
|
-
} =
|
|
750
|
-
name:
|
|
751
|
-
ua:
|
|
752
|
-
format:
|
|
753
|
-
slotName:
|
|
723
|
+
...T
|
|
724
|
+
} = n, V = {
|
|
725
|
+
name: s || l || "",
|
|
726
|
+
ua: u || C || "",
|
|
727
|
+
format: S || "text",
|
|
728
|
+
slotName: $ || (e.body ? "body" : void 0),
|
|
754
729
|
// Use 'body' slot if it exists
|
|
755
730
|
link: D,
|
|
756
731
|
action: p,
|
|
757
732
|
getCellData: y,
|
|
758
733
|
suffix: k,
|
|
759
|
-
...
|
|
734
|
+
...T
|
|
760
735
|
};
|
|
761
736
|
console.log("Registering column:", V);
|
|
762
|
-
const
|
|
763
|
-
|
|
737
|
+
const q = e.body;
|
|
738
|
+
v(V, q);
|
|
764
739
|
}
|
|
765
|
-
}), (
|
|
766
|
-
|
|
740
|
+
}), (s, l) => (o(), i("div", st, [
|
|
741
|
+
j(s.$slots, "body", { data: {} })
|
|
767
742
|
]));
|
|
768
743
|
}
|
|
769
|
-
}),
|
|
744
|
+
}), nt = { class: "mt-4" }, ot = { class: "text-sm text-gray-600 dark:text-gray-300" }, it = /* @__PURE__ */ F({
|
|
770
745
|
__name: "SelectionInfo",
|
|
771
746
|
props: {
|
|
772
747
|
selectedRows: {},
|
|
773
748
|
totalCount: {}
|
|
774
749
|
},
|
|
775
750
|
setup(b) {
|
|
776
|
-
const
|
|
777
|
-
return (
|
|
778
|
-
|
|
751
|
+
const n = b, e = m(() => n.selectedRows.length);
|
|
752
|
+
return (v, s) => (o(), i("div", nt, [
|
|
753
|
+
d("div", ot, " Обрано: " + x(e.value) + " з " + x(v.totalCount) + " записів ", 1)
|
|
779
754
|
]));
|
|
780
755
|
}
|
|
781
|
-
}),
|
|
756
|
+
}), ut = { class: "mt-4" }, ct = { class: "border-b border-gray-200 dark:border-gray-700" }, dt = { class: "-mb-px flex space-x-8" }, gt = ["onClick"], vt = { class: "mt-4" }, pt = { class: "bg-gray-900 rounded-lg overflow-hidden" }, ft = { class: "flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700" }, mt = { class: "text-sm text-gray-300" }, bt = ["onClick"], yt = { class: "p-4 text-sm text-gray-100 overflow-x-auto" }, ht = /* @__PURE__ */ F({
|
|
782
757
|
__name: "CodeTabs",
|
|
783
758
|
props: {
|
|
784
759
|
tabs: {},
|
|
785
760
|
defaultTab: { default: void 0 }
|
|
786
761
|
},
|
|
787
762
|
setup(b) {
|
|
788
|
-
const
|
|
763
|
+
const n = b, e = _(n.defaultTab || n.tabs[0]?.id || ""), v = async (s) => {
|
|
789
764
|
try {
|
|
790
|
-
await navigator.clipboard.writeText(
|
|
791
|
-
} catch (
|
|
792
|
-
console.error("Помилка копіювання:",
|
|
765
|
+
await navigator.clipboard.writeText(s), console.log("Код скопійовано!");
|
|
766
|
+
} catch (l) {
|
|
767
|
+
console.error("Помилка копіювання:", l);
|
|
793
768
|
}
|
|
794
769
|
};
|
|
795
|
-
return (
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
(o(!0),
|
|
799
|
-
key:
|
|
800
|
-
onClick: (
|
|
801
|
-
class:
|
|
770
|
+
return (s, l) => (o(), i("div", ut, [
|
|
771
|
+
d("div", ct, [
|
|
772
|
+
d("nav", dt, [
|
|
773
|
+
(o(!0), i(R, null, z(s.tabs, (u) => (o(), i("button", {
|
|
774
|
+
key: u.id,
|
|
775
|
+
onClick: (C) => e.value = u.id,
|
|
776
|
+
class: f([
|
|
802
777
|
"py-2 px-1 border-b-2 font-medium text-sm transition-colors",
|
|
803
|
-
e.value ===
|
|
778
|
+
e.value === u.id ? "border-blue-500 text-blue-600 dark:text-blue-400" : "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"
|
|
804
779
|
])
|
|
805
|
-
},
|
|
780
|
+
}, x(u.label), 11, gt))), 128))
|
|
806
781
|
])
|
|
807
782
|
]),
|
|
808
|
-
|
|
809
|
-
(o(!0),
|
|
810
|
-
key:
|
|
783
|
+
d("div", vt, [
|
|
784
|
+
(o(!0), i(R, null, z(s.tabs, (u) => Se((o(), i("div", {
|
|
785
|
+
key: u.id
|
|
811
786
|
}, [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
onClick: (
|
|
787
|
+
d("div", pt, [
|
|
788
|
+
d("div", ft, [
|
|
789
|
+
d("span", mt, x(u.label), 1),
|
|
790
|
+
d("button", {
|
|
791
|
+
onClick: (C) => v(u.content),
|
|
817
792
|
class: "text-gray-400 hover:text-white transition-colors",
|
|
818
793
|
title: "Копіювати код"
|
|
819
|
-
},
|
|
820
|
-
|
|
794
|
+
}, l[0] || (l[0] = [
|
|
795
|
+
d("svg", {
|
|
821
796
|
class: "w-4 h-4",
|
|
822
797
|
fill: "none",
|
|
823
798
|
stroke: "currentColor",
|
|
824
799
|
viewBox: "0 0 24 24"
|
|
825
800
|
}, [
|
|
826
|
-
|
|
801
|
+
d("path", {
|
|
827
802
|
"stroke-linecap": "round",
|
|
828
803
|
"stroke-linejoin": "round",
|
|
829
804
|
"stroke-width": "2",
|
|
830
805
|
d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
831
806
|
})
|
|
832
807
|
], -1)
|
|
833
|
-
]), 8,
|
|
808
|
+
]), 8, bt)
|
|
834
809
|
]),
|
|
835
|
-
|
|
836
|
-
|
|
810
|
+
d("pre", yt, [
|
|
811
|
+
d("code", null, x(u.content), 1)
|
|
837
812
|
])
|
|
838
813
|
])
|
|
839
814
|
])), [
|
|
840
|
-
[
|
|
815
|
+
[Fe, e.value === u.id]
|
|
841
816
|
])), 128))
|
|
842
817
|
])
|
|
843
818
|
]));
|
|
844
819
|
}
|
|
845
820
|
});
|
|
846
|
-
|
|
847
|
-
|
|
821
|
+
ge.install = function(n) {
|
|
822
|
+
n.component("DataTable", ge), n.component("Column", lt), n.component("Pagination", me), n.component("SelectionInfo", it), n.component("CodeTabs", ht);
|
|
848
823
|
};
|
|
849
824
|
export {
|
|
850
825
|
Pe as ArrayFormat,
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
826
|
+
je as BadgeFormat,
|
|
827
|
+
ht as CodeTabs,
|
|
828
|
+
lt as Column,
|
|
829
|
+
ge as DataTable,
|
|
855
830
|
Ae as DateFormat,
|
|
856
|
-
Ne as LinkFormat,
|
|
857
831
|
De as NumberFormat,
|
|
858
832
|
me as Pagination,
|
|
859
|
-
|
|
860
|
-
|
|
833
|
+
Ne as SelectFormat,
|
|
834
|
+
it as SelectionInfo,
|
|
861
835
|
Ie as TextFormat,
|
|
862
|
-
|
|
836
|
+
ge as default,
|
|
863
837
|
de as formatComponents
|
|
864
838
|
};
|