@opengis/table 0.0.21 → 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.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +348 -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 +57 -59
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,119 +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
|
-
},
|
|
252
|
-
|
|
223
|
+
}, y[6] || (y[6] = [
|
|
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
|
-
])
|
|
259
|
-
], 10,
|
|
260
|
-
|
|
261
|
-
(o(!0),
|
|
262
|
-
k === "..." ? (o(),
|
|
230
|
+
]), 2))
|
|
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
|
-
},
|
|
291
|
-
|
|
262
|
+
}, y[7] || (y[7] = [
|
|
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
|
-
])
|
|
298
|
-
], 10,
|
|
269
|
+
]), 2))
|
|
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
|
-
},
|
|
283
|
+
}, et = ["onClick"], tt = ["checked", "onChange"], at = ["onClick"], rt = {
|
|
312
284
|
key: 1,
|
|
313
285
|
class: "text-center"
|
|
314
|
-
},
|
|
286
|
+
}, ge = /* @__PURE__ */ F({
|
|
315
287
|
name: "DataTable",
|
|
316
288
|
__name: "DataTable",
|
|
317
289
|
props: {
|
|
@@ -342,8 +314,8 @@ const De = /* @__PURE__ */ S({
|
|
|
342
314
|
getCellData: { type: Function, default: void 0 }
|
|
343
315
|
},
|
|
344
316
|
emits: ["update:page", "update:selectedRows", "row-click", "sort"],
|
|
345
|
-
setup(b, { emit:
|
|
346
|
-
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);
|
|
347
319
|
function k(t) {
|
|
348
320
|
if (D.value) {
|
|
349
321
|
D.value.push(t);
|
|
@@ -351,20 +323,20 @@ const De = /* @__PURE__ */ S({
|
|
|
351
323
|
}
|
|
352
324
|
location.href = t;
|
|
353
325
|
}
|
|
354
|
-
const
|
|
326
|
+
const T = m(() => {
|
|
355
327
|
if (e.api)
|
|
356
|
-
return
|
|
357
|
-
if (e.sortable &&
|
|
328
|
+
return u.value;
|
|
329
|
+
if (e.sortable && l.value.length > 0) {
|
|
358
330
|
const t = [...e.rows];
|
|
359
|
-
return t.sort((
|
|
360
|
-
for (const g of
|
|
331
|
+
return t.sort((c, a) => {
|
|
332
|
+
for (const g of l.value) {
|
|
361
333
|
if (!g.direction)
|
|
362
334
|
return 0;
|
|
363
|
-
const
|
|
364
|
-
if (
|
|
365
|
-
if (
|
|
335
|
+
const r = c[g.field], h = a[g.field];
|
|
336
|
+
if (r == null) return 1;
|
|
337
|
+
if (h == null) return -1;
|
|
366
338
|
let I = 0;
|
|
367
|
-
typeof
|
|
339
|
+
typeof r == "string" && typeof h == "string" ? I = r.localeCompare(h) : r < h ? I = -1 : r > h ? I = 1 : I = 0;
|
|
368
340
|
const O = g.direction === "desc" ? -I : I;
|
|
369
341
|
if (O !== 0) return O;
|
|
370
342
|
}
|
|
@@ -373,35 +345,35 @@ const De = /* @__PURE__ */ S({
|
|
|
373
345
|
}
|
|
374
346
|
return e.rows;
|
|
375
347
|
});
|
|
376
|
-
|
|
377
|
-
|
|
348
|
+
L(() => e.selectedRows, (t) => {
|
|
349
|
+
s.value = t || [];
|
|
378
350
|
});
|
|
379
|
-
const A = (t) =>
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
}, J =
|
|
383
|
-
J.value ?
|
|
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]);
|
|
384
356
|
}, be = (t) => {
|
|
385
357
|
if (!e.sortable) return;
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
const g =
|
|
389
|
-
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);
|
|
390
362
|
} else
|
|
391
|
-
|
|
363
|
+
l.value.unshift({
|
|
392
364
|
field: t,
|
|
393
365
|
direction: "asc"
|
|
394
366
|
});
|
|
395
|
-
const
|
|
367
|
+
const a = l.value.filter((g) => g.direction).map((g) => ({
|
|
396
368
|
name: g.field,
|
|
397
369
|
asc: g.direction === "asc"
|
|
398
370
|
}));
|
|
399
|
-
|
|
400
|
-
}, ye = (t) =>
|
|
401
|
-
const
|
|
402
|
-
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)
|
|
403
375
|
return "↑↓";
|
|
404
|
-
switch (
|
|
376
|
+
switch (c.direction) {
|
|
405
377
|
case "asc":
|
|
406
378
|
return "↑";
|
|
407
379
|
// Up arrow for ascending
|
|
@@ -412,25 +384,25 @@ const De = /* @__PURE__ */ S({
|
|
|
412
384
|
return "↕️";
|
|
413
385
|
}
|
|
414
386
|
}, G = (t) => e.sortable && t.sortable !== !1, xe = (t) => {
|
|
415
|
-
e.clickable &&
|
|
416
|
-
}, P = (t,
|
|
417
|
-
const
|
|
387
|
+
e.clickable && v("row-click", t);
|
|
388
|
+
}, P = (t, c) => {
|
|
389
|
+
const a = c[t.name];
|
|
418
390
|
if (e.getCellData || t.getCellData) {
|
|
419
391
|
const g = t.getCellData || e.getCellData;
|
|
420
392
|
if (g) {
|
|
421
|
-
const
|
|
393
|
+
const r = {
|
|
422
394
|
name: t.name,
|
|
423
|
-
row:
|
|
424
|
-
value:
|
|
395
|
+
row: c,
|
|
396
|
+
value: a
|
|
425
397
|
};
|
|
426
|
-
return g(
|
|
398
|
+
return g(r);
|
|
427
399
|
}
|
|
428
400
|
}
|
|
429
401
|
return ["_data", "_text"].map((g) => {
|
|
430
|
-
const
|
|
431
|
-
return
|
|
432
|
-
}).find((g) => g) ||
|
|
433
|
-
}, 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 =
|
|
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(() => {
|
|
434
406
|
const { theme: t } = e;
|
|
435
407
|
return t === "dark" ? {
|
|
436
408
|
container: "dark",
|
|
@@ -470,37 +442,37 @@ const De = /* @__PURE__ */ S({
|
|
|
470
442
|
checkbox: "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400"
|
|
471
443
|
};
|
|
472
444
|
});
|
|
473
|
-
|
|
445
|
+
L(() => e.page, (t) => {
|
|
474
446
|
K.value = t;
|
|
475
|
-
}),
|
|
476
|
-
|
|
477
|
-
}),
|
|
447
|
+
}), L(() => e.limit, (t) => {
|
|
448
|
+
se.value = t;
|
|
449
|
+
}), L(() => e.total, (t) => {
|
|
478
450
|
Q.value = t;
|
|
479
451
|
});
|
|
480
452
|
async function W() {
|
|
481
453
|
if (e.api) {
|
|
482
|
-
|
|
454
|
+
S.value = !0, $.value = null;
|
|
483
455
|
try {
|
|
484
456
|
const t = new URL(e.api, window.location.origin);
|
|
485
|
-
if (t.searchParams.set("page",
|
|
486
|
-
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(",");
|
|
487
459
|
g && t.searchParams.set("sort", g);
|
|
488
460
|
}
|
|
489
|
-
const
|
|
490
|
-
if (!
|
|
491
|
-
throw new Error(`HTTP error! status: ${
|
|
492
|
-
const
|
|
493
|
-
|
|
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);
|
|
494
466
|
} catch (t) {
|
|
495
|
-
|
|
467
|
+
$.value = t instanceof Error ? t.message : "Failed to fetch data", console.error("Error fetching data:", t);
|
|
496
468
|
} finally {
|
|
497
|
-
|
|
469
|
+
S.value = !1;
|
|
498
470
|
}
|
|
499
471
|
}
|
|
500
472
|
}
|
|
501
473
|
const ke = (t) => {
|
|
502
|
-
e.api ? E.value = t : (K.value = t,
|
|
503
|
-
}, _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(() => ({
|
|
504
476
|
small: {
|
|
505
477
|
header: "px-3 py-2 text-xs",
|
|
506
478
|
cell: "px-3 py-2 text-xs"
|
|
@@ -516,204 +488,204 @@ const De = /* @__PURE__ */ S({
|
|
|
516
488
|
})[e.size]);
|
|
517
489
|
fe(() => {
|
|
518
490
|
e.api && (e.page && (E.value = e.page), e.limit && (X.value = e.limit), e.total && (H.value = e.total), W());
|
|
519
|
-
}),
|
|
491
|
+
}), L(() => e.api, (t) => {
|
|
520
492
|
t && (E.value = e.page || 1, X.value = e.limit || 10, H.value = e.total || 0, W());
|
|
521
493
|
});
|
|
522
|
-
const we =
|
|
523
|
-
$e("registerColumn", (t,
|
|
524
|
-
Y.value.push(t),
|
|
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);
|
|
525
497
|
});
|
|
526
|
-
const ie =
|
|
527
|
-
const t = we.value || [],
|
|
528
|
-
if (
|
|
529
|
-
const g =
|
|
530
|
-
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 = {
|
|
531
503
|
name: I,
|
|
532
504
|
// Use field as the name for data access
|
|
533
505
|
ua: O,
|
|
534
506
|
// Use header as the display name
|
|
535
|
-
format:
|
|
507
|
+
format: h.format || "text",
|
|
536
508
|
slotName: ue ? "body" : void 0,
|
|
537
|
-
...
|
|
509
|
+
...h
|
|
538
510
|
};
|
|
539
|
-
return ue && Z.name && (U.value[Z.name] =
|
|
511
|
+
return ue && Z.name && (U.value[Z.name] = r.children.body), Z;
|
|
540
512
|
});
|
|
541
|
-
|
|
513
|
+
c.push(...g);
|
|
542
514
|
}
|
|
543
|
-
if (Y.value.length > 0 &&
|
|
544
|
-
const g = [],
|
|
545
|
-
return t.forEach((
|
|
546
|
-
|
|
547
|
-
}), 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:", {
|
|
548
520
|
default: t.length,
|
|
549
|
-
custom:
|
|
521
|
+
custom: c.length,
|
|
550
522
|
combined: g.length
|
|
551
523
|
}), g;
|
|
552
524
|
}
|
|
553
525
|
return t.length > 0 ? (console.log("Using default columns:", t.length), t) : [];
|
|
554
526
|
}), Ce = (t = "text") => de[t.toLowerCase()] || de.text;
|
|
555
|
-
return (t,
|
|
556
|
-
class:
|
|
527
|
+
return (t, c) => (o(), i("div", {
|
|
528
|
+
class: f(["w-full", w.value.container])
|
|
557
529
|
}, [
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
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)
|
|
563
535
|
}, "Loading...", 2)
|
|
564
536
|
])
|
|
565
|
-
])) :
|
|
537
|
+
])) : $.value ? (o(), i("div", {
|
|
566
538
|
key: 1,
|
|
567
|
-
class:
|
|
568
|
-
},
|
|
569
|
-
|
|
570
|
-
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")
|
|
571
543
|
}, [
|
|
572
|
-
|
|
573
|
-
class:
|
|
574
|
-
style:
|
|
544
|
+
d("table", {
|
|
545
|
+
class: f(t.classTable),
|
|
546
|
+
style: ve(t.tableStyle)
|
|
575
547
|
}, [
|
|
576
|
-
|
|
577
|
-
class:
|
|
548
|
+
d("thead", {
|
|
549
|
+
class: f(t.classThead || w.value.thead)
|
|
578
550
|
}, [
|
|
579
|
-
|
|
580
|
-
t.selectable ? (o(),
|
|
551
|
+
d("tr", null, [
|
|
552
|
+
t.selectable ? (o(), i("th", {
|
|
581
553
|
key: 0,
|
|
582
|
-
class:
|
|
554
|
+
class: f(["text-left font-medium uppercase tracking-wider", w.value.th, N.value.header, e.classTh, "w-12"])
|
|
583
555
|
}, [
|
|
584
|
-
|
|
556
|
+
d("input", {
|
|
585
557
|
type: "checkbox",
|
|
586
558
|
checked: J.value,
|
|
587
|
-
indeterminate:
|
|
559
|
+
indeterminate: V.value,
|
|
588
560
|
onChange: q,
|
|
589
|
-
class:
|
|
590
|
-
}, null, 42,
|
|
591
|
-
], 2)) :
|
|
592
|
-
(o(!0),
|
|
593
|
-
key:
|
|
594
|
-
class:
|
|
595
|
-
|
|
596
|
-
G(
|
|
597
|
-
re(
|
|
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)
|
|
598
570
|
].concat(
|
|
599
571
|
e.classTh || [
|
|
600
572
|
"text-left font-medium uppercase tracking-wider",
|
|
601
|
-
|
|
602
|
-
|
|
573
|
+
w.value.th,
|
|
574
|
+
N.value.header
|
|
603
575
|
]
|
|
604
576
|
)),
|
|
605
|
-
onClick: (g) => G(
|
|
577
|
+
onClick: (g) => G(a) ? be(a.name) : void 0
|
|
606
578
|
}, [
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
G(
|
|
610
|
-
|
|
611
|
-
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)
|
|
612
584
|
}, () => [
|
|
613
|
-
|
|
585
|
+
M(x(he(a.name)), 1)
|
|
614
586
|
])
|
|
615
|
-
])) :
|
|
587
|
+
])) : B("", !0)
|
|
616
588
|
])
|
|
617
|
-
], 10,
|
|
618
|
-
y.value ? (o(),
|
|
589
|
+
], 10, Xe))), 128)),
|
|
590
|
+
y.value ? (o(), i("th", {
|
|
619
591
|
key: 1,
|
|
620
|
-
class:
|
|
592
|
+
class: f(["w-[100px]", e.classTh || [
|
|
621
593
|
"text-left font-medium uppercase tracking-wider",
|
|
622
|
-
|
|
623
|
-
|
|
594
|
+
w.value.th,
|
|
595
|
+
N.value.header
|
|
624
596
|
]])
|
|
625
|
-
}, "Дії", 2)) :
|
|
597
|
+
}, "Дії", 2)) : B("", !0)
|
|
626
598
|
])
|
|
627
599
|
], 2),
|
|
628
|
-
|
|
629
|
-
class:
|
|
600
|
+
d("tbody", {
|
|
601
|
+
class: f(t.classTbody || w.value.tbody)
|
|
630
602
|
}, [
|
|
631
|
-
(o(!0),
|
|
603
|
+
(o(!0), i(R, null, z(T.value, (a, g) => (o(), i("tr", {
|
|
632
604
|
key: g,
|
|
633
|
-
class:
|
|
634
|
-
|
|
605
|
+
class: f(e.classTr || [
|
|
606
|
+
w.value.tr,
|
|
635
607
|
e.clickable ? "cursor-pointer" : ""
|
|
636
608
|
]),
|
|
637
|
-
onClick: (
|
|
609
|
+
onClick: (r) => e.clickable ? xe(a) : void 0
|
|
638
610
|
}, [
|
|
639
|
-
t.selectable ? (o(),
|
|
611
|
+
t.selectable ? (o(), i("td", {
|
|
640
612
|
key: 0,
|
|
641
|
-
class:
|
|
613
|
+
class: f(["whitespace-nowrap", w.value.td, N.value.cell, e.classTd, "w-12"])
|
|
642
614
|
}, [
|
|
643
|
-
|
|
615
|
+
d("input", {
|
|
644
616
|
type: "checkbox",
|
|
645
|
-
checked: A(
|
|
646
|
-
onChange: (
|
|
647
|
-
class:
|
|
648
|
-
}, null, 42,
|
|
649
|
-
], 2)) :
|
|
650
|
-
(o(!0),
|
|
651
|
-
key:
|
|
652
|
-
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 || [
|
|
653
625
|
"whitespace-nowrap",
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
re(
|
|
626
|
+
w.value.td,
|
|
627
|
+
N.value.cell,
|
|
628
|
+
r.align ? `text-${r.align}` : "",
|
|
629
|
+
re(r)
|
|
658
630
|
])
|
|
659
631
|
}, [
|
|
660
|
-
|
|
632
|
+
r.action && y.value ? j(t.$slots, "action", {
|
|
661
633
|
key: 0,
|
|
662
|
-
row:
|
|
663
|
-
}) : te(p).number &&
|
|
634
|
+
row: a
|
|
635
|
+
}) : te(p).number && r.format === "number" ? j(t.$slots, "number", {
|
|
664
636
|
key: 1,
|
|
665
|
-
row:
|
|
666
|
-
value: P(
|
|
667
|
-
}) : te(p).badge &&
|
|
637
|
+
row: a,
|
|
638
|
+
value: P(r, a)
|
|
639
|
+
}) : te(p).badge && r.format === "badge" ? j(t.$slots, "badge", {
|
|
668
640
|
key: 2,
|
|
669
|
-
row:
|
|
670
|
-
value: P(
|
|
671
|
-
}) : te(p).array &&
|
|
641
|
+
row: a,
|
|
642
|
+
value: P(r, a)
|
|
643
|
+
}) : te(p).array && r.format === "array" ? j(t.$slots, "array", {
|
|
672
644
|
key: 3,
|
|
673
|
-
row:
|
|
674
|
-
value: P(
|
|
675
|
-
}) :
|
|
645
|
+
row: a,
|
|
646
|
+
value: P(r, a)
|
|
647
|
+
}) : r.slotName && U.value[r.name] ? (o(), ee(ce(U.value[r.name]), {
|
|
676
648
|
key: 4,
|
|
677
|
-
data:
|
|
678
|
-
value: P(
|
|
679
|
-
row:
|
|
680
|
-
column:
|
|
681
|
-
}, 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", {
|
|
682
654
|
key: 5,
|
|
683
|
-
class:
|
|
684
|
-
onClick: (
|
|
685
|
-
},
|
|
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)), {
|
|
686
658
|
key: 6,
|
|
687
|
-
value: P(
|
|
688
|
-
row:
|
|
689
|
-
column:
|
|
690
|
-
href:
|
|
659
|
+
value: P(r, a),
|
|
660
|
+
row: a,
|
|
661
|
+
column: r,
|
|
662
|
+
href: r.link
|
|
691
663
|
}, null, 8, ["value", "row", "column", "href"]))
|
|
692
664
|
], 2))), 128)),
|
|
693
|
-
y.value ? (o(),
|
|
694
|
-
|
|
695
|
-
])) :
|
|
696
|
-
], 10,
|
|
665
|
+
y.value ? (o(), i("td", rt, [
|
|
666
|
+
j(t.$slots, "action", { row: a })
|
|
667
|
+
])) : B("", !0)
|
|
668
|
+
], 10, et))), 128))
|
|
697
669
|
], 2)
|
|
698
670
|
], 6)
|
|
699
671
|
], 2)
|
|
700
|
-
])) :
|
|
701
|
-
_e.value &&
|
|
672
|
+
])) : B("", !0),
|
|
673
|
+
_e.value && !S.value && !e.loading && !$.value ? (o(), ee(me, {
|
|
702
674
|
key: 3,
|
|
703
|
-
page:
|
|
675
|
+
page: le.value,
|
|
704
676
|
limit: ne.value,
|
|
705
677
|
total: oe.value,
|
|
706
678
|
theme: e.theme,
|
|
707
679
|
size: e.size,
|
|
708
680
|
"onUpdate:page": ke
|
|
709
|
-
}, null, 8, ["page", "limit", "total", "theme", "size"])) :
|
|
710
|
-
|
|
681
|
+
}, null, 8, ["page", "limit", "total", "theme", "size"])) : B("", !0),
|
|
682
|
+
!S.value && !e.loading && !$.value && T.value.length === 0 ? (o(), i("div", {
|
|
711
683
|
key: 4,
|
|
712
|
-
class:
|
|
713
|
-
}, " Дані відсутні ", 2)) :
|
|
684
|
+
class: f(["text-center py-8", w.value.empty])
|
|
685
|
+
}, " Дані відсутні ", 2)) : B("", !0)
|
|
714
686
|
], 2));
|
|
715
687
|
}
|
|
716
|
-
}),
|
|
688
|
+
}), st = { style: { display: "none" } }, lt = /* @__PURE__ */ F({
|
|
717
689
|
name: "Column",
|
|
718
690
|
__name: "Column",
|
|
719
691
|
props: {
|
|
@@ -734,134 +706,133 @@ const De = /* @__PURE__ */ S({
|
|
|
734
706
|
suffix: {}
|
|
735
707
|
},
|
|
736
708
|
setup(b) {
|
|
737
|
-
const
|
|
709
|
+
const n = b, e = pe(), v = Te("registerColumn");
|
|
738
710
|
return fe(() => {
|
|
739
|
-
if (
|
|
711
|
+
if (v) {
|
|
740
712
|
const {
|
|
741
|
-
field:
|
|
742
|
-
name:
|
|
743
|
-
header:
|
|
744
|
-
label:
|
|
745
|
-
format:
|
|
746
|
-
slotName:
|
|
713
|
+
field: s,
|
|
714
|
+
name: l,
|
|
715
|
+
header: u,
|
|
716
|
+
label: C,
|
|
717
|
+
format: S,
|
|
718
|
+
slotName: $,
|
|
747
719
|
link: D,
|
|
748
720
|
action: p,
|
|
749
721
|
getCellData: y,
|
|
750
722
|
suffix: k,
|
|
751
|
-
...
|
|
752
|
-
} =
|
|
753
|
-
name:
|
|
754
|
-
ua:
|
|
755
|
-
format:
|
|
756
|
-
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),
|
|
757
729
|
// Use 'body' slot if it exists
|
|
758
730
|
link: D,
|
|
759
731
|
action: p,
|
|
760
732
|
getCellData: y,
|
|
761
733
|
suffix: k,
|
|
762
|
-
...
|
|
734
|
+
...T
|
|
763
735
|
};
|
|
764
|
-
console.log("Registering column:",
|
|
736
|
+
console.log("Registering column:", V);
|
|
765
737
|
const q = e.body;
|
|
766
|
-
|
|
738
|
+
v(V, q);
|
|
767
739
|
}
|
|
768
|
-
}), (
|
|
769
|
-
|
|
740
|
+
}), (s, l) => (o(), i("div", st, [
|
|
741
|
+
j(s.$slots, "body", { data: {} })
|
|
770
742
|
]));
|
|
771
743
|
}
|
|
772
|
-
}),
|
|
744
|
+
}), nt = { class: "mt-4" }, ot = { class: "text-sm text-gray-600 dark:text-gray-300" }, it = /* @__PURE__ */ F({
|
|
773
745
|
__name: "SelectionInfo",
|
|
774
746
|
props: {
|
|
775
747
|
selectedRows: {},
|
|
776
748
|
totalCount: {}
|
|
777
749
|
},
|
|
778
750
|
setup(b) {
|
|
779
|
-
const
|
|
780
|
-
return (
|
|
781
|
-
|
|
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)
|
|
782
754
|
]));
|
|
783
755
|
}
|
|
784
|
-
}),
|
|
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({
|
|
785
757
|
__name: "CodeTabs",
|
|
786
758
|
props: {
|
|
787
759
|
tabs: {},
|
|
788
760
|
defaultTab: { default: void 0 }
|
|
789
761
|
},
|
|
790
762
|
setup(b) {
|
|
791
|
-
const
|
|
763
|
+
const n = b, e = _(n.defaultTab || n.tabs[0]?.id || ""), v = async (s) => {
|
|
792
764
|
try {
|
|
793
|
-
await navigator.clipboard.writeText(
|
|
794
|
-
} catch (
|
|
795
|
-
console.error("Помилка копіювання:",
|
|
765
|
+
await navigator.clipboard.writeText(s), console.log("Код скопійовано!");
|
|
766
|
+
} catch (l) {
|
|
767
|
+
console.error("Помилка копіювання:", l);
|
|
796
768
|
}
|
|
797
769
|
};
|
|
798
|
-
return (
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
(o(!0),
|
|
802
|
-
key:
|
|
803
|
-
onClick: (
|
|
804
|
-
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([
|
|
805
777
|
"py-2 px-1 border-b-2 font-medium text-sm transition-colors",
|
|
806
|
-
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"
|
|
807
779
|
])
|
|
808
|
-
},
|
|
780
|
+
}, x(u.label), 11, gt))), 128))
|
|
809
781
|
])
|
|
810
782
|
]),
|
|
811
|
-
|
|
812
|
-
(o(!0),
|
|
813
|
-
key:
|
|
783
|
+
d("div", vt, [
|
|
784
|
+
(o(!0), i(R, null, z(s.tabs, (u) => Se((o(), i("div", {
|
|
785
|
+
key: u.id
|
|
814
786
|
}, [
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
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),
|
|
820
792
|
class: "text-gray-400 hover:text-white transition-colors",
|
|
821
793
|
title: "Копіювати код"
|
|
822
|
-
}, [
|
|
823
|
-
|
|
794
|
+
}, l[0] || (l[0] = [
|
|
795
|
+
d("svg", {
|
|
824
796
|
class: "w-4 h-4",
|
|
825
797
|
fill: "none",
|
|
826
798
|
stroke: "currentColor",
|
|
827
799
|
viewBox: "0 0 24 24"
|
|
828
800
|
}, [
|
|
829
|
-
|
|
801
|
+
d("path", {
|
|
830
802
|
"stroke-linecap": "round",
|
|
831
803
|
"stroke-linejoin": "round",
|
|
832
804
|
"stroke-width": "2",
|
|
833
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"
|
|
834
806
|
})
|
|
835
807
|
], -1)
|
|
836
|
-
])
|
|
808
|
+
]), 8, bt)
|
|
837
809
|
]),
|
|
838
|
-
|
|
839
|
-
|
|
810
|
+
d("pre", yt, [
|
|
811
|
+
d("code", null, x(u.content), 1)
|
|
840
812
|
])
|
|
841
813
|
])
|
|
842
814
|
])), [
|
|
843
|
-
[
|
|
815
|
+
[Fe, e.value === u.id]
|
|
844
816
|
])), 128))
|
|
845
817
|
])
|
|
846
818
|
]));
|
|
847
819
|
}
|
|
848
820
|
});
|
|
849
|
-
|
|
850
|
-
|
|
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);
|
|
851
823
|
};
|
|
852
824
|
export {
|
|
853
825
|
Pe as ArrayFormat,
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
826
|
+
je as BadgeFormat,
|
|
827
|
+
ht as CodeTabs,
|
|
828
|
+
lt as Column,
|
|
829
|
+
ge as DataTable,
|
|
858
830
|
Ae as DateFormat,
|
|
859
|
-
Ne as LinkFormat,
|
|
860
831
|
De as NumberFormat,
|
|
861
832
|
me as Pagination,
|
|
862
|
-
|
|
863
|
-
|
|
833
|
+
Ne as SelectFormat,
|
|
834
|
+
it as SelectionInfo,
|
|
864
835
|
Ie as TextFormat,
|
|
865
|
-
|
|
836
|
+
ge as default,
|
|
866
837
|
de as formatComponents
|
|
867
838
|
};
|