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