@opengis/table 0.0.19 → 0.0.21
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.css +1 -1
- package/dist/index.mjs +115 -112
- package/dist/index.umd.js +1 -1
- package/package.json +59 -59
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.badge[data-v-
|
|
1
|
+
.badge[data-v-f4b15092]{transition:all .2s ease-in-out}.badge[data-v-f4b15092]:hover{transform:scale(1.05)}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as S, computed as f, createElementBlock as u, openBlock as o, toDisplayString as h, normalizeStyle as ge, normalizeClass as m, Fragment as B, renderList as z, createElementVNode as v, createTextVNode as
|
|
1
|
+
import { defineComponent as S, computed as f, createElementBlock as u, openBlock as o, toDisplayString as h, normalizeStyle as ge, normalizeClass as m, Fragment as B, renderList as z, createElementVNode as v, createTextVNode as V, ref as w, useSlots as pe, watch as N, onMounted as fe, provide as $e, createCommentVNode as j, createBlock as ee, renderSlot as R, unref as te, resolveDynamicComponent as ce, inject as Te, withDirectives as Fe, vShow as Se } from "vue";
|
|
2
2
|
const De = /* @__PURE__ */ S({
|
|
3
3
|
name: "NumberFormat",
|
|
4
4
|
__name: "NumberFormat",
|
|
@@ -11,7 +11,7 @@ const De = /* @__PURE__ */ S({
|
|
|
11
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", {
|
|
12
12
|
maximumFractionDigits: 2
|
|
13
13
|
}).format(Number(a.value)));
|
|
14
|
-
return (c, l) => (o(), u("span", null, h(e.value), 1));
|
|
14
|
+
return (c, l) => (o(), u("span", null, h(e.value || "-"), 1));
|
|
15
15
|
}
|
|
16
16
|
}), Ae = /* @__PURE__ */ S({
|
|
17
17
|
name: "DateFormat",
|
|
@@ -30,7 +30,7 @@ const De = /* @__PURE__ */ S({
|
|
|
30
30
|
return a.value;
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
-
return (c, l) => (o(), u("span", null, h(e.value), 1));
|
|
33
|
+
return (c, l) => (o(), u("span", null, h(e.value || "-"), 1));
|
|
34
34
|
}
|
|
35
35
|
}), Ie = /* @__PURE__ */ S({
|
|
36
36
|
name: "TextFormat",
|
|
@@ -42,7 +42,7 @@ const De = /* @__PURE__ */ S({
|
|
|
42
42
|
},
|
|
43
43
|
setup(b) {
|
|
44
44
|
const a = b, { value: e } = a, c = f(() => Array.isArray(e) ? e.map((l) => l.text || l).join(",") : e?.text || e);
|
|
45
|
-
return (l, n) => (o(), u("span", null, h(c.value), 1));
|
|
45
|
+
return (l, n) => (o(), u("span", null, h(c.value || "-"), 1));
|
|
46
46
|
}
|
|
47
47
|
}), je = /* @__PURE__ */ S({
|
|
48
48
|
name: "BadgeFormat",
|
|
@@ -76,14 +76,14 @@ const De = /* @__PURE__ */ S({
|
|
|
76
76
|
return (n, i) => (o(), u("span", {
|
|
77
77
|
class: m(["badge", e.value]),
|
|
78
78
|
style: ge(l.value)
|
|
79
|
-
}, h(n.value?.text || n.value), 7));
|
|
79
|
+
}, h(n.value?.text || n.value || "-"), 7));
|
|
80
80
|
}
|
|
81
81
|
}), Be = (b, a) => {
|
|
82
82
|
const e = b.__vccOpts || b;
|
|
83
83
|
for (const [c, l] of a)
|
|
84
84
|
e[c] = l;
|
|
85
85
|
return e;
|
|
86
|
-
}, Re = /* @__PURE__ */ Be(je, [["__scopeId", "data-v-
|
|
86
|
+
}, Re = /* @__PURE__ */ Be(je, [["__scopeId", "data-v-f4b15092"]]), ze = { class: "flex flex-wrap gap-1" }, Pe = /* @__PURE__ */ S({
|
|
87
87
|
name: "ArrayFormat",
|
|
88
88
|
__name: "ArrayFormat",
|
|
89
89
|
props: {
|
|
@@ -137,7 +137,7 @@ const De = /* @__PURE__ */ S({
|
|
|
137
137
|
},
|
|
138
138
|
setup(b) {
|
|
139
139
|
const a = b, { value: e } = a, c = f(() => Array.isArray(e) ? e.map((l) => l.text || l).filter((l, n) => n < 2).join(", ") + (e.length > 2 ? ` +${e.length - 2}` : "") : e?.text || e);
|
|
140
|
-
return (l, n) => (o(), u("span", null, h(c.value), 1));
|
|
140
|
+
return (l, n) => (o(), u("span", null, h(c.value || "-"), 1));
|
|
141
141
|
}
|
|
142
142
|
}), de = {
|
|
143
143
|
number: De,
|
|
@@ -223,13 +223,13 @@ const De = /* @__PURE__ */ S({
|
|
|
223
223
|
class: m(["flex items-center text-sm", l.value.text, c.value.text])
|
|
224
224
|
}, [
|
|
225
225
|
v("span", null, [
|
|
226
|
-
y[2] || (y[2] =
|
|
226
|
+
y[2] || (y[2] = V(" Показано ", -1)),
|
|
227
227
|
v("span", Ee, h(_.value), 1),
|
|
228
|
-
y[3] || (y[3] =
|
|
228
|
+
y[3] || (y[3] = V(" до ", -1)),
|
|
229
229
|
v("span", He, h($.value), 1),
|
|
230
|
-
y[4] || (y[4] =
|
|
230
|
+
y[4] || (y[4] = V(" з ", -1)),
|
|
231
231
|
v("span", We, h(p.total), 1),
|
|
232
|
-
y[5] || (y[5] =
|
|
232
|
+
y[5] || (y[5] = V(" результатів ", -1))
|
|
233
233
|
])
|
|
234
234
|
], 2)
|
|
235
235
|
]),
|
|
@@ -248,14 +248,14 @@ const De = /* @__PURE__ */ S({
|
|
|
248
248
|
fill: "none",
|
|
249
249
|
stroke: "currentColor",
|
|
250
250
|
viewBox: "0 0 24 24"
|
|
251
|
-
}, y[6] || (y[6] = [
|
|
251
|
+
}, [...y[6] || (y[6] = [
|
|
252
252
|
v("path", {
|
|
253
253
|
"stroke-linecap": "round",
|
|
254
254
|
"stroke-linejoin": "round",
|
|
255
255
|
"stroke-width": "2",
|
|
256
256
|
d: "M15 19l-7-7 7-7"
|
|
257
257
|
}, null, -1)
|
|
258
|
-
]), 2))
|
|
258
|
+
])], 2))
|
|
259
259
|
], 10, Oe),
|
|
260
260
|
v("div", Je, [
|
|
261
261
|
(o(!0), u(B, null, z(T.value, (k) => (o(), u(B, { key: k }, [
|
|
@@ -287,14 +287,14 @@ const De = /* @__PURE__ */ S({
|
|
|
287
287
|
fill: "none",
|
|
288
288
|
stroke: "currentColor",
|
|
289
289
|
viewBox: "0 0 24 24"
|
|
290
|
-
}, y[7] || (y[7] = [
|
|
290
|
+
}, [...y[7] || (y[7] = [
|
|
291
291
|
v("path", {
|
|
292
292
|
"stroke-linecap": "round",
|
|
293
293
|
"stroke-linejoin": "round",
|
|
294
294
|
"stroke-width": "2",
|
|
295
295
|
d: "M9 5l7 7-7 7"
|
|
296
296
|
}, null, -1)
|
|
297
|
-
]), 2))
|
|
297
|
+
])], 2))
|
|
298
298
|
], 10, Ge)
|
|
299
299
|
])
|
|
300
300
|
], 2));
|
|
@@ -308,10 +308,7 @@ const De = /* @__PURE__ */ S({
|
|
|
308
308
|
}, Ye = ["checked", "indeterminate"], Ze = ["onClick"], et = { class: "flex items-center justify-between" }, tt = {
|
|
309
309
|
key: 0,
|
|
310
310
|
class: "ml-1 text-xs"
|
|
311
|
-
}, at = {
|
|
312
|
-
key: 1,
|
|
313
|
-
class: "w-[100px]"
|
|
314
|
-
}, rt = ["onClick"], lt = ["checked", "onChange"], st = ["onClick"], nt = {
|
|
311
|
+
}, at = ["onClick"], rt = ["checked", "onChange"], lt = ["onClick"], st = {
|
|
315
312
|
key: 1,
|
|
316
313
|
class: "text-center"
|
|
317
314
|
}, ve = /* @__PURE__ */ S({
|
|
@@ -376,14 +373,14 @@ const De = /* @__PURE__ */ S({
|
|
|
376
373
|
}
|
|
377
374
|
return e.rows;
|
|
378
375
|
});
|
|
379
|
-
|
|
376
|
+
N(() => e.selectedRows, (t) => {
|
|
380
377
|
l.value = t || [];
|
|
381
378
|
});
|
|
382
|
-
const A = (t) => l.value.some((d) => d === t),
|
|
379
|
+
const A = (t) => l.value.some((d) => d === t), ae = (t) => {
|
|
383
380
|
const d = l.value.findIndex((r) => r === t);
|
|
384
381
|
d > -1 ? l.value.splice(d, 1) : l.value.push(t), c("update:selectedRows", [...l.value]);
|
|
385
|
-
},
|
|
386
|
-
|
|
382
|
+
}, J = f(() => F.value.length > 0 && l.value.length === F.value.length), M = f(() => l.value.length > 0 && l.value.length < F.value.length), q = () => {
|
|
383
|
+
J.value ? l.value = [] : l.value = [...F.value], c("update:selectedRows", [...l.value]);
|
|
387
384
|
}, be = (t) => {
|
|
388
385
|
if (!e.sortable) return;
|
|
389
386
|
const d = n.value.findIndex((g) => g.field === t);
|
|
@@ -399,7 +396,7 @@ const De = /* @__PURE__ */ S({
|
|
|
399
396
|
name: g.field,
|
|
400
397
|
asc: g.direction === "asc"
|
|
401
398
|
}));
|
|
402
|
-
c("sort", r), e.api &&
|
|
399
|
+
c("sort", r), e.api && W();
|
|
403
400
|
}, ye = (t) => n.value.find((r) => r.field === t)?.direction === "asc", he = (t) => {
|
|
404
401
|
const d = n.value.find((r) => r.field === t);
|
|
405
402
|
if (!d)
|
|
@@ -414,9 +411,9 @@ const De = /* @__PURE__ */ S({
|
|
|
414
411
|
default:
|
|
415
412
|
return "↕️";
|
|
416
413
|
}
|
|
417
|
-
},
|
|
414
|
+
}, G = (t) => e.sortable && t.sortable !== !1, xe = (t) => {
|
|
418
415
|
e.clickable && c("row-click", t);
|
|
419
|
-
},
|
|
416
|
+
}, P = (t, d) => {
|
|
420
417
|
const r = d[t.name];
|
|
421
418
|
if (e.getCellData || t.getCellData) {
|
|
422
419
|
const g = t.getCellData || e.getCellData;
|
|
@@ -433,7 +430,7 @@ const De = /* @__PURE__ */ S({
|
|
|
433
430
|
const s = `${t.name}${g}`;
|
|
434
431
|
return d[s] ? d[s] : null;
|
|
435
432
|
}).find((g) => g) || r;
|
|
436
|
-
},
|
|
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 = w(e.page), le = w(e.limit), Q = w(e.total), E = w(1), X = w(10), H = w(0), se = f(() => e.api ? E.value : K.value), ne = f(() => e.api ? X.value : le.value), oe = f(() => e.api ? H.value : Q.value), C = f(() => {
|
|
437
434
|
const { theme: t } = e;
|
|
438
435
|
return t === "dark" ? {
|
|
439
436
|
container: "dark",
|
|
@@ -473,19 +470,19 @@ const De = /* @__PURE__ */ S({
|
|
|
473
470
|
checkbox: "border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400"
|
|
474
471
|
};
|
|
475
472
|
});
|
|
476
|
-
|
|
473
|
+
N(() => e.page, (t) => {
|
|
474
|
+
K.value = t;
|
|
475
|
+
}), N(() => e.limit, (t) => {
|
|
476
|
+
le.value = t;
|
|
477
|
+
}), N(() => e.total, (t) => {
|
|
477
478
|
Q.value = t;
|
|
478
|
-
}), L(() => e.limit, (t) => {
|
|
479
|
-
se.value = t;
|
|
480
|
-
}), L(() => e.total, (t) => {
|
|
481
|
-
X.value = t;
|
|
482
479
|
});
|
|
483
|
-
async function
|
|
480
|
+
async function W() {
|
|
484
481
|
if (e.api) {
|
|
485
482
|
$.value = !0, T.value = null;
|
|
486
483
|
try {
|
|
487
484
|
const t = new URL(e.api, window.location.origin);
|
|
488
|
-
if (t.searchParams.set("page",
|
|
485
|
+
if (t.searchParams.set("page", se.value.toString()), t.searchParams.set("limit", ne.value.toString()), n.value.length > 0) {
|
|
489
486
|
const g = n.value.filter((s) => s.direction).map((s) => `${s.field}:${s.direction}`).join(",");
|
|
490
487
|
g && t.searchParams.set("sort", g);
|
|
491
488
|
}
|
|
@@ -493,7 +490,7 @@ const De = /* @__PURE__ */ S({
|
|
|
493
490
|
if (!d.ok)
|
|
494
491
|
throw new Error(`HTTP error! status: ${d.status}`);
|
|
495
492
|
const r = await d.json();
|
|
496
|
-
r.rows && Array.isArray(r.rows) && (i.value = r.rows), r.columns && Array.isArray(r.columns) && (_.value = r.columns), r.total !== void 0 && (e.api ?
|
|
493
|
+
r.rows && Array.isArray(r.rows) && (i.value = r.rows), r.columns && Array.isArray(r.columns) && (_.value = r.columns), r.total !== void 0 && (e.api ? H.value = r.total : Q.value = r.total);
|
|
497
494
|
} catch (t) {
|
|
498
495
|
T.value = t instanceof Error ? t.message : "Failed to fetch data", console.error("Error fetching data:", t);
|
|
499
496
|
} finally {
|
|
@@ -502,8 +499,8 @@ const De = /* @__PURE__ */ S({
|
|
|
502
499
|
}
|
|
503
500
|
}
|
|
504
501
|
const ke = (t) => {
|
|
505
|
-
e.api ?
|
|
506
|
-
}, _e = f(() => e.showPagination &&
|
|
502
|
+
e.api ? E.value = t : (K.value = t, c("update:page", t)), e.api && W();
|
|
503
|
+
}, _e = f(() => e.showPagination && oe.value > 0), L = f(() => ({
|
|
507
504
|
small: {
|
|
508
505
|
header: "px-3 py-2 text-xs",
|
|
509
506
|
cell: "px-3 py-2 text-xs"
|
|
@@ -518,32 +515,32 @@ const De = /* @__PURE__ */ S({
|
|
|
518
515
|
}
|
|
519
516
|
})[e.size]);
|
|
520
517
|
fe(() => {
|
|
521
|
-
e.api && (e.page && (
|
|
522
|
-
}),
|
|
523
|
-
t && (
|
|
518
|
+
e.api && (e.page && (E.value = e.page), e.limit && (X.value = e.limit), e.total && (H.value = e.total), W());
|
|
519
|
+
}), N(() => e.api, (t) => {
|
|
520
|
+
t && (E.value = e.page || 1, X.value = e.limit || 10, H.value = e.total || 0, W());
|
|
524
521
|
});
|
|
525
|
-
const we = f(() => e.api ? _.value : e.columns),
|
|
522
|
+
const we = f(() => e.api ? _.value : e.columns), Y = w([]), U = w({});
|
|
526
523
|
$e("registerColumn", (t, d) => {
|
|
527
|
-
|
|
524
|
+
Y.value.push(t), d && t.slotName && (U.value[t.name] = d);
|
|
528
525
|
});
|
|
529
|
-
const
|
|
526
|
+
const ie = f(() => {
|
|
530
527
|
const t = we.value || [], d = [], r = p.default?.();
|
|
531
528
|
if (r) {
|
|
532
529
|
const g = r.filter((s) => s.type?.name === "Column" || s.type === "Column" || s.type && typeof s.type == "object" && s.type.name === "Column").map((s) => {
|
|
533
|
-
const x = s.props || s.componentProps || {}, I = x.field || x.name || "", O = x.header || x.label || "",
|
|
530
|
+
const x = s.props || s.componentProps || {}, I = x.field || x.name || "", O = x.header || x.label || "", ue = s.children && s.children.body, Z = {
|
|
534
531
|
name: I,
|
|
535
532
|
// Use field as the name for data access
|
|
536
533
|
ua: O,
|
|
537
534
|
// Use header as the display name
|
|
538
535
|
format: x.format || "text",
|
|
539
|
-
slotName:
|
|
536
|
+
slotName: ue ? "body" : void 0,
|
|
540
537
|
...x
|
|
541
538
|
};
|
|
542
|
-
return
|
|
539
|
+
return ue && Z.name && (U.value[Z.name] = s.children.body), Z;
|
|
543
540
|
});
|
|
544
541
|
d.push(...g);
|
|
545
542
|
}
|
|
546
|
-
if (
|
|
543
|
+
if (Y.value.length > 0 && d.push(...Y.value), d.length > 0) {
|
|
547
544
|
const g = [], s = new Set(d.map((x) => x.name));
|
|
548
545
|
return t.forEach((x) => {
|
|
549
546
|
s.has(x.name) || g.push(x);
|
|
@@ -582,43 +579,50 @@ const De = /* @__PURE__ */ S({
|
|
|
582
579
|
v("tr", null, [
|
|
583
580
|
t.selectable ? (o(), u("th", {
|
|
584
581
|
key: 0,
|
|
585
|
-
class: m(["text-left font-medium uppercase tracking-wider", C.value.th,
|
|
582
|
+
class: m(["text-left font-medium uppercase tracking-wider", C.value.th, L.value.header, e.classTh, "w-12"])
|
|
586
583
|
}, [
|
|
587
584
|
v("input", {
|
|
588
585
|
type: "checkbox",
|
|
589
|
-
checked:
|
|
590
|
-
indeterminate:
|
|
591
|
-
onChange:
|
|
586
|
+
checked: J.value,
|
|
587
|
+
indeterminate: M.value,
|
|
588
|
+
onChange: q,
|
|
592
589
|
class: m(["h-4 w-4 focus:ring-blue-500 rounded", C.value.checkbox])
|
|
593
590
|
}, null, 42, Ye)
|
|
594
591
|
], 2)) : j("", !0),
|
|
595
|
-
(o(!0), u(B, null, z(
|
|
592
|
+
(o(!0), u(B, null, z(ie.value.filter((r) => !r.hidden), (r) => (o(), u("th", {
|
|
596
593
|
key: r.name,
|
|
597
594
|
class: m([
|
|
598
595
|
r.align ? `text-${r.align}` : "",
|
|
599
|
-
|
|
600
|
-
|
|
596
|
+
G(r) ? ["cursor-pointer", C.value.thHover] : "",
|
|
597
|
+
re(r)
|
|
601
598
|
].concat(
|
|
602
599
|
e.classTh || [
|
|
603
600
|
"text-left font-medium uppercase tracking-wider",
|
|
604
601
|
C.value.th,
|
|
605
|
-
|
|
602
|
+
L.value.header
|
|
606
603
|
]
|
|
607
604
|
)),
|
|
608
|
-
onClick: (g) =>
|
|
605
|
+
onClick: (g) => G(r) ? be(r.name) : void 0
|
|
609
606
|
}, [
|
|
610
607
|
v("div", et, [
|
|
611
608
|
v("span", null, h(r.ua || r.header || r.name), 1),
|
|
612
|
-
|
|
613
|
-
|
|
609
|
+
G(r) ? (o(), u("span", tt, [
|
|
610
|
+
R(t.$slots, "sort", {
|
|
614
611
|
asc: ye(r.name)
|
|
615
612
|
}, () => [
|
|
616
|
-
|
|
613
|
+
V(h(he(r.name)), 1)
|
|
617
614
|
])
|
|
618
615
|
])) : j("", !0)
|
|
619
616
|
])
|
|
620
617
|
], 10, Ze))), 128)),
|
|
621
|
-
y.value ? (o(), u("th",
|
|
618
|
+
y.value ? (o(), u("th", {
|
|
619
|
+
key: 1,
|
|
620
|
+
class: m(["w-[100px]", e.classTh || [
|
|
621
|
+
"text-left font-medium uppercase tracking-wider",
|
|
622
|
+
C.value.th,
|
|
623
|
+
L.value.header
|
|
624
|
+
]])
|
|
625
|
+
}, "Дії", 2)) : j("", !0)
|
|
622
626
|
])
|
|
623
627
|
], 2),
|
|
624
628
|
v("tbody", {
|
|
@@ -634,72 +638,71 @@ const De = /* @__PURE__ */ S({
|
|
|
634
638
|
}, [
|
|
635
639
|
t.selectable ? (o(), u("td", {
|
|
636
640
|
key: 0,
|
|
637
|
-
class: m(["whitespace-nowrap", C.value.td,
|
|
641
|
+
class: m(["whitespace-nowrap", C.value.td, L.value.cell, e.classTd, "w-12"])
|
|
638
642
|
}, [
|
|
639
643
|
v("input", {
|
|
640
644
|
type: "checkbox",
|
|
641
645
|
checked: A(r),
|
|
642
|
-
onChange: (s) =>
|
|
646
|
+
onChange: (s) => ae(r),
|
|
643
647
|
class: m(["h-4 w-4 focus:ring-blue-500 rounded", C.value.checkbox])
|
|
644
|
-
}, null, 42,
|
|
648
|
+
}, null, 42, rt)
|
|
645
649
|
], 2)) : j("", !0),
|
|
646
|
-
(o(!0), u(B, null, z(
|
|
650
|
+
(o(!0), u(B, null, z(ie.value.filter((s) => !s.hidden), (s) => (o(), u("td", {
|
|
647
651
|
key: s.name,
|
|
648
652
|
class: m(e.classTd || [
|
|
649
653
|
"whitespace-nowrap",
|
|
650
654
|
C.value.td,
|
|
651
|
-
|
|
655
|
+
L.value.cell,
|
|
652
656
|
s.align ? `text-${s.align}` : "",
|
|
653
|
-
|
|
657
|
+
re(s)
|
|
654
658
|
])
|
|
655
659
|
}, [
|
|
656
|
-
s.action && y.value ? (
|
|
660
|
+
s.action && y.value ? R(t.$slots, "action", {
|
|
657
661
|
key: 0,
|
|
658
|
-
row: r
|
|
659
|
-
|
|
660
|
-
}, null, 8, ["row", "value"])) : ae(p).number && s.format === "number" ? P(t.$slots, "number", {
|
|
662
|
+
row: r
|
|
663
|
+
}) : te(p).number && s.format === "number" ? R(t.$slots, "number", {
|
|
661
664
|
key: 1,
|
|
662
665
|
row: r,
|
|
663
|
-
value:
|
|
664
|
-
}) :
|
|
666
|
+
value: P(s, r)
|
|
667
|
+
}) : te(p).badge && s.format === "badge" ? R(t.$slots, "badge", {
|
|
665
668
|
key: 2,
|
|
666
669
|
row: r,
|
|
667
|
-
value:
|
|
668
|
-
}) :
|
|
670
|
+
value: P(s, r)
|
|
671
|
+
}) : te(p).array && s.format === "array" ? R(t.$slots, "array", {
|
|
669
672
|
key: 3,
|
|
670
673
|
row: r,
|
|
671
|
-
value:
|
|
672
|
-
}) : s.slotName && U.value[s.name] ? (o(),
|
|
674
|
+
value: P(s, r)
|
|
675
|
+
}) : s.slotName && U.value[s.name] ? (o(), ee(ce(U.value[s.name]), {
|
|
673
676
|
key: 4,
|
|
674
677
|
data: r,
|
|
675
|
-
value:
|
|
678
|
+
value: P(s, r),
|
|
676
679
|
row: r,
|
|
677
680
|
column: s
|
|
678
681
|
}, null, 8, ["data", "value", "row", "column"])) : s.link ? (o(), u("a", {
|
|
679
682
|
key: 5,
|
|
680
683
|
class: m(t.classLink || "hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),
|
|
681
684
|
onClick: (x) => k(s.link.replace("{id}", r.id))
|
|
682
|
-
}, h(
|
|
685
|
+
}, h(P(s, r)), 11, lt)) : (o(), ee(ce(Ce(s.format)), {
|
|
683
686
|
key: 6,
|
|
684
|
-
value:
|
|
687
|
+
value: P(s, r),
|
|
685
688
|
row: r,
|
|
686
689
|
column: s,
|
|
687
690
|
href: s.link
|
|
688
691
|
}, null, 8, ["value", "row", "column", "href"]))
|
|
689
692
|
], 2))), 128)),
|
|
690
|
-
y.value ? (o(), u("td",
|
|
691
|
-
|
|
693
|
+
y.value ? (o(), u("td", st, [
|
|
694
|
+
R(t.$slots, "action", { row: r })
|
|
692
695
|
])) : j("", !0)
|
|
693
|
-
], 10,
|
|
696
|
+
], 10, at))), 128))
|
|
694
697
|
], 2)
|
|
695
698
|
], 6)
|
|
696
699
|
], 2)
|
|
697
700
|
])) : j("", !0),
|
|
698
|
-
_e.value && !$.value && !e.loading && !T.value ? (o(),
|
|
701
|
+
_e.value && !$.value && !e.loading && !T.value ? (o(), ee(me, {
|
|
699
702
|
key: 3,
|
|
700
|
-
page:
|
|
701
|
-
limit:
|
|
702
|
-
total:
|
|
703
|
+
page: se.value,
|
|
704
|
+
limit: ne.value,
|
|
705
|
+
total: oe.value,
|
|
703
706
|
theme: e.theme,
|
|
704
707
|
size: e.size,
|
|
705
708
|
"onUpdate:page": ke
|
|
@@ -710,7 +713,7 @@ const De = /* @__PURE__ */ S({
|
|
|
710
713
|
}, " Дані відсутні ", 2)) : j("", !0)
|
|
711
714
|
], 2));
|
|
712
715
|
}
|
|
713
|
-
}),
|
|
716
|
+
}), nt = { style: { display: "none" } }, ot = /* @__PURE__ */ S({
|
|
714
717
|
name: "Column",
|
|
715
718
|
__name: "Column",
|
|
716
719
|
props: {
|
|
@@ -746,7 +749,7 @@ const De = /* @__PURE__ */ S({
|
|
|
746
749
|
getCellData: y,
|
|
747
750
|
suffix: k,
|
|
748
751
|
...F
|
|
749
|
-
} = a,
|
|
752
|
+
} = a, M = {
|
|
750
753
|
name: l || n || "",
|
|
751
754
|
ua: i || _ || "",
|
|
752
755
|
format: $ || "text",
|
|
@@ -758,15 +761,15 @@ const De = /* @__PURE__ */ S({
|
|
|
758
761
|
suffix: k,
|
|
759
762
|
...F
|
|
760
763
|
};
|
|
761
|
-
console.log("Registering column:",
|
|
762
|
-
const
|
|
763
|
-
c(
|
|
764
|
+
console.log("Registering column:", M);
|
|
765
|
+
const q = e.body;
|
|
766
|
+
c(M, q);
|
|
764
767
|
}
|
|
765
|
-
}), (l, n) => (o(), u("div",
|
|
766
|
-
|
|
768
|
+
}), (l, n) => (o(), u("div", nt, [
|
|
769
|
+
R(l.$slots, "body", { data: {} })
|
|
767
770
|
]));
|
|
768
771
|
}
|
|
769
|
-
}),
|
|
772
|
+
}), it = { class: "mt-4" }, ut = { class: "text-sm text-gray-600 dark:text-gray-300" }, ct = /* @__PURE__ */ S({
|
|
770
773
|
__name: "SelectionInfo",
|
|
771
774
|
props: {
|
|
772
775
|
selectedRows: {},
|
|
@@ -774,11 +777,11 @@ const De = /* @__PURE__ */ S({
|
|
|
774
777
|
},
|
|
775
778
|
setup(b) {
|
|
776
779
|
const a = b, e = f(() => a.selectedRows.length);
|
|
777
|
-
return (c, l) => (o(), u("div",
|
|
778
|
-
v("div",
|
|
780
|
+
return (c, l) => (o(), u("div", it, [
|
|
781
|
+
v("div", ut, " Обрано: " + h(e.value) + " з " + h(c.totalCount) + " записів ", 1)
|
|
779
782
|
]));
|
|
780
783
|
}
|
|
781
|
-
}),
|
|
784
|
+
}), 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
785
|
__name: "CodeTabs",
|
|
783
786
|
props: {
|
|
784
787
|
tabs: {},
|
|
@@ -792,9 +795,9 @@ const De = /* @__PURE__ */ S({
|
|
|
792
795
|
console.error("Помилка копіювання:", n);
|
|
793
796
|
}
|
|
794
797
|
};
|
|
795
|
-
return (l, n) => (o(), u("div",
|
|
796
|
-
v("div",
|
|
797
|
-
v("nav",
|
|
798
|
+
return (l, n) => (o(), u("div", dt, [
|
|
799
|
+
v("div", vt, [
|
|
800
|
+
v("nav", gt, [
|
|
798
801
|
(o(!0), u(B, null, z(l.tabs, (i) => (o(), u("button", {
|
|
799
802
|
key: i.id,
|
|
800
803
|
onClick: (_) => e.value = i.id,
|
|
@@ -802,21 +805,21 @@ const De = /* @__PURE__ */ S({
|
|
|
802
805
|
"py-2 px-1 border-b-2 font-medium text-sm transition-colors",
|
|
803
806
|
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
807
|
])
|
|
805
|
-
}, h(i.label), 11,
|
|
808
|
+
}, h(i.label), 11, pt))), 128))
|
|
806
809
|
])
|
|
807
810
|
]),
|
|
808
|
-
v("div",
|
|
811
|
+
v("div", ft, [
|
|
809
812
|
(o(!0), u(B, null, z(l.tabs, (i) => Fe((o(), u("div", {
|
|
810
813
|
key: i.id
|
|
811
814
|
}, [
|
|
812
|
-
v("div",
|
|
813
|
-
v("div",
|
|
814
|
-
v("span",
|
|
815
|
+
v("div", mt, [
|
|
816
|
+
v("div", bt, [
|
|
817
|
+
v("span", yt, h(i.label), 1),
|
|
815
818
|
v("button", {
|
|
816
819
|
onClick: (_) => c(i.content),
|
|
817
820
|
class: "text-gray-400 hover:text-white transition-colors",
|
|
818
821
|
title: "Копіювати код"
|
|
819
|
-
}, n[0] || (n[0] = [
|
|
822
|
+
}, [...n[0] || (n[0] = [
|
|
820
823
|
v("svg", {
|
|
821
824
|
class: "w-4 h-4",
|
|
822
825
|
fill: "none",
|
|
@@ -830,9 +833,9 @@ const De = /* @__PURE__ */ S({
|
|
|
830
833
|
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
834
|
})
|
|
832
835
|
], -1)
|
|
833
|
-
]), 8,
|
|
836
|
+
])], 8, ht)
|
|
834
837
|
]),
|
|
835
|
-
v("pre",
|
|
838
|
+
v("pre", xt, [
|
|
836
839
|
v("code", null, h(i.content), 1)
|
|
837
840
|
])
|
|
838
841
|
])
|
|
@@ -844,20 +847,20 @@ const De = /* @__PURE__ */ S({
|
|
|
844
847
|
}
|
|
845
848
|
});
|
|
846
849
|
ve.install = function(a) {
|
|
847
|
-
a.component("DataTable", ve), a.component("Column",
|
|
850
|
+
a.component("DataTable", ve), a.component("Column", ot), a.component("Pagination", me), a.component("SelectionInfo", ct), a.component("CodeTabs", kt);
|
|
848
851
|
};
|
|
849
852
|
export {
|
|
850
853
|
Pe as ArrayFormat,
|
|
851
854
|
Re as BadgeFormat,
|
|
852
|
-
|
|
853
|
-
|
|
855
|
+
kt as CodeTabs,
|
|
856
|
+
ot as Column,
|
|
854
857
|
ve as DataTable,
|
|
855
858
|
Ae as DateFormat,
|
|
856
859
|
Ne as LinkFormat,
|
|
857
860
|
De as NumberFormat,
|
|
858
861
|
me as Pagination,
|
|
859
862
|
Ve as SelectFormat,
|
|
860
|
-
|
|
863
|
+
ct as SelectionInfo,
|
|
861
864
|
Ie as TextFormat,
|
|
862
865
|
ve as default,
|
|
863
866
|
de as formatComponents
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.filter={},f.Vue))})(this,function(f,e){"use strict";const O=e.defineComponent({name:"NumberFormat",__name:"NumberFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>o.value===null||o.value===void 0?"":typeof o.value=="number"?o.value.toFixed(2):Intl.NumberFormat("uk-UA",{maximumFractionDigits:2}).format(Number(o.value)));return(c,n)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value),1))}}),q=e.defineComponent({name:"DateFormat",__name:"DateFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>{if(!o.value)return"";try{return new Date(o.value).toLocaleDateString()}catch{return o.value}});return(c,n)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value),1))}}),J=e.defineComponent({name:"TextFormat",__name:"TextFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,{value:t}=o,c=e.computed(()=>Array.isArray(t)?t.map(n=>n.text||n).join(","):t?.text||t);return(n,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value),1))}}),G=((u,o)=>{const t=u.__vccOpts||u;for(const[c,n]of o)t[c]=n;return t})(e.defineComponent({name:"BadgeFormat",__name:"BadgeFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>{const s=String(o.value||"").toLowerCase(),i="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";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`:o.value?.color&&!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(o.value.color)?`${i} bg-${o.value.color}-100 text-${o.value.color}-800`:`${i} bg-gray-100 text-gray-800`});function c(s,i=1){const h=parseInt(s.slice(1,3),16),x=parseInt(s.slice(3,5),16),C=parseInt(s.slice(5,7),16);return`rgba(${h}, ${x}, ${C}, ${i})`}const n=e.computed(()=>{const s={minWidth:"60px",textAlign:"center",display:"inline-block"};return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(o.value?.color)?{...s,backgroundColor:c(o.value.color,.1),color:c(o.value.color,.8)}:s});return(s,i)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["badge",t.value]),style:e.normalizeStyle(n.value)},e.toDisplayString(s.value?.text||s.value),7))}}),[["__scopeId","data-v-28700c64"]]),ce={class:"flex flex-wrap gap-1"},K=e.defineComponent({name:"ArrayFormat",__name:"ArrayFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>o.value?Array.isArray(o.value)?o.value:[o.value]:[]),c=n=>n?typeof n=="object"&&n.name?n.name:typeof n=="string"||typeof n=="number"?String(n):JSON.stringify(n):"";return(n,s)=>(e.openBlock(),e.createElementBlock("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(i,h)=>(e.openBlock(),e.createElementBlock("span",{key:h,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"},e.toDisplayString(c(i)),1))),128))]))}}),de=["href","target"],Q=e.defineComponent({__name:"LinkFormat",props:{href:{default:""},target:{default:"_self"},onClick:{type:Function,default:void 0},value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>typeof o.value=="string"||typeof o.value=="number"?o.value:o.value?.text||o.value?.label||"Link"),c=e.computed(()=>o.href?o.href:typeof o.value=="object"&&o.value?.href?o.value.href:""),n=e.computed(()=>o.target?o.target:typeof o.value=="object"&&o.value?.target?o.value.target:"_self"),s=e.computed(()=>"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer"),i=h=>{o.onClick&&o.row&&(h.preventDefault(),o.onClick(o.row,o.value))};return(h,x)=>c.value?(e.openBlock(),e.createElementBlock("a",{key:0,href:c.value,target:n.value,class:e.normalizeClass(s.value),onClick:i},e.toDisplayString(t.value),11,de)):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(s.value),onClick:i},e.toDisplayString(t.value),3))}}),X=e.defineComponent({name:"TextFormat",__name:"SelectFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,{value:t}=o,c=e.computed(()=>Array.isArray(t)?t.map(n=>n.text||n).filter((n,s)=>s<2).join(", ")+(t.length>2?` +${t.length-2}`:""):t?.text||t);return(n,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value),1))}}),A={number:O,date:q,text:J,badge:G,array:K,select:X,link:Q},me={class:"flex items-center space-x-4"},pe={class:"font-medium"},ue={class:"font-medium"},ge={class:"font-medium"},fe={class:"flex items-center space-x-2"},ye=["disabled"],be={class:"flex items-center space-x-1"},he=["onClick"],ke=["disabled"],I=e.defineComponent({name:"Pagination",__name:"Pagination",props:{page:{},limit:{},total:{},theme:{default:"light"},size:{default:"medium"}},emits:["update:page"],setup(u,{emit:o}){const t=u,c=e.computed(()=>({small:{text:"text-xs",button:"px-2 h-7 text-xs min-w-[28px] flex items-center justify-center",icon:"w-3.5 h-3.5"},medium:{text:"text-sm",button:"px-3 h-9 text-sm min-w-[36px] flex items-center justify-center",icon:"w-4 h-4"},large:{text:"text-base",button:"px-4 h-11 text-base min-w-[44px] flex items-center justify-center",icon:"w-5 h-5"}})[t.size]),n=e.computed(()=>{const{theme:p}=t;return p==="dark"?{container:"bg-gray-900 border-gray-700",text:"text-gray-300",button:"text-gray-300 bg-gray-800 border-gray-600 hover:bg-gray-700",buttonDisabled:"text-gray-500 bg-gray-800",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-400"}:p==="light"?{container:"bg-white border-gray-200",text:"text-gray-700",button:"text-gray-700 bg-white border-gray-300 hover:bg-gray-50",buttonDisabled:"text-gray-400 bg-gray-100",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-500"}:{container:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700",text:"text-gray-700 dark:text-gray-300",button:"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",buttonDisabled:"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-500 dark:text-gray-400"}}),s=o,i=e.computed(()=>Math.ceil(t.total/t.limit)),h=e.computed(()=>t.total===0?0:(t.page-1)*t.limit+1),x=e.computed(()=>Math.min(t.page*t.limit,t.total)),C=e.computed(()=>{const p=[];if(i.value<=7)for(let b=1;b<=i.value;b+=1)p.push(b);else{p.push(1),t.page>4&&p.push("...");const b=Math.max(2,t.page-1),_=Math.min(i.value-1,t.page+1);for(let w=b;w<=_;w+=1)w!==1&&w!==i.value&&p.push(w);t.page<i.value-3&&p.push("..."),i.value>1&&p.push(i.value)}return p}),B=p=>{p>=1&&p<=i.value&&p!==t.page&&s("update:page",p)};return(p,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex items-center justify-between py-3 border-t",n.value.container])},[e.createElementVNode("div",me,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center text-sm",n.value.text,c.value.text])},[e.createElementVNode("span",null,[g[2]||(g[2]=e.createTextVNode(" Показано ",-1)),e.createElementVNode("span",pe,e.toDisplayString(h.value),1),g[3]||(g[3]=e.createTextVNode(" до ",-1)),e.createElementVNode("span",ue,e.toDisplayString(x.value),1),g[4]||(g[4]=e.createTextVNode(" з ",-1)),e.createElementVNode("span",ge,e.toDisplayString(p.total),1),g[5]||(g[5]=e.createTextVNode(" результатів ",-1))])],2)]),e.createElementVNode("div",fe,[e.createElementVNode("button",{onClick:g[0]||(g[0]=b=>B(p.page-1)),disabled:p.page<=1,class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,p.page<=1?n.value.buttonDisabled:n.value.button])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(c.value.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},g[6]||(g[6]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"},null,-1)]),2))],10,ye),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[b==="..."?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["font-medium",c.value.button,n.value.ellipsis])}," ... ",2)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:_=>B(b),class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,b===p.page?n.value.buttonActive:n.value.button])},e.toDisplayString(b),11,he))],64))),128))]),e.createElementVNode("button",{onClick:g[1]||(g[1]=b=>B(p.page+1)),disabled:p.page>=i.value,class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,p.page>=i.value?n.value.buttonDisabled:n.value.button])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(c.value.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},g[7]||(g[7]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]),2))],10,ke)])],2))}}),xe={key:0,class:"text-center py-8"},Ce={class:"inline-flex items-center space-x-2"},_e={key:2,class:"overflow-x-auto"},Be=["checked","indeterminate"],we=["onClick"],Ee={class:"flex items-center justify-between"},$e={key:0,class:"ml-1 text-xs"},Ne={key:1,class:"w-[100px]"},Se=["onClick"],Ve=["checked","onChange"],De=["onClick"],Te={key:1,class:"text-center"},N=e.defineComponent({name:"DataTable",__name:"DataTable",props:{rows:{default:()=>[]},columns:{default:()=>[]},api:{},router:{},tableStyle:{default:""},size:{default:"medium"},theme:{default:"light"},loading:{type:Boolean,default:!1},classWrapper:{default:""},classTable:{default:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},classTbody:{default:""},classTr:{default:""},classTd:{default:""},classTh:{default:""},classThead:{default:""},classLink:{default:""},selectable:{type:Boolean,default:!1},selectedRows:{default:()=>[]},limit:{default:10},page:{default:1},total:{default:0},showPagination:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},getCellData:{type:Function,default:void 0}},emits:["update:page","update:selectedRows","row-click","sort"],setup(u,{emit:o}){const t=u,c=o,n=e.ref(t.selectedRows||[]),s=e.ref([]),i=e.ref([]),h=e.ref([]),x=e.ref(!1),C=e.ref(null),B=e.ref(t.router),p=e.useSlots(),g=e.computed(()=>p.action);function b(a){if(B.value){B.value.push(a);return}location.href=a}const _=e.computed(()=>{if(t.api)return i.value;if(t.sortable&&s.value.length>0){const a=[...t.rows];return a.sort((d,l)=>{for(const m of s.value){if(!m.direction)return 0;const r=d[m.field],y=l[m.field];if(r==null)return 1;if(y==null)return-1;let E=0;typeof r=="string"&&typeof y=="string"?E=r.localeCompare(y):r<y?E=-1:r>y?E=1:E=0;const F=m.direction==="desc"?-E:E;if(F!==0)return F}return 0}),a}return t.rows});e.watch(()=>t.selectedRows,a=>{n.value=a||[]});const w=a=>n.value.some(d=>d===a),te=a=>{const d=n.value.findIndex(l=>l===a);d>-1?n.value.splice(d,1):n.value.push(a),c("update:selectedRows",[...n.value])},L=e.computed(()=>_.value.length>0&&n.value.length===_.value.length),S=e.computed(()=>n.value.length>0&&n.value.length<_.value.length),j=()=>{L.value?n.value=[]:n.value=[..._.value],c("update:selectedRows",[...n.value])},Oe=a=>{if(!t.sortable)return;const d=s.value.findIndex(m=>m.field===a);if(d>=0){const m=s.value[d];m.direction==="asc"?m.direction="desc":m.direction==="desc"&&s.value.splice(d,1)}else s.value.unshift({field:a,direction:"asc"});const l=s.value.filter(m=>m.direction).map(m=>({name:m.field,asc:m.direction==="asc"}));c("sort",l),t.api&&T()},qe=a=>s.value.find(l=>l.field===a)?.direction==="asc",Je=a=>{const d=s.value.find(l=>l.field===a);if(!d)return"↑↓";switch(d.direction){case"asc":return"↑";case"desc":return"↓";default:return"↕️"}},R=a=>t.sortable&&a.sortable!==!1,Ge=a=>{t.clickable&&c("row-click",a)},$=(a,d)=>{const l=d[a.name];if(t.getCellData||a.getCellData){const m=a.getCellData||t.getCellData;if(m){const r={name:a.name,row:d,value:l};return m(r)}}return["_data","_text"].map(m=>{const r=`${a.name}${m}`;return d[r]?d[r]:null}).find(m=>m)||l},ae=a=>a.width?a.width==="w-full"?"w-full":typeof a.width=="string"?`w-[${a.width}px]`:typeof a.width=="number"?`w-[${a.width}px]`:"":"",P=e.ref(t.page),oe=e.ref(t.limit),M=e.ref(t.total),V=e.ref(1),H=e.ref(10),D=e.ref(0),le=e.computed(()=>t.api?V.value:P.value),ne=e.computed(()=>t.api?H.value:oe.value),re=e.computed(()=>t.api?D.value:M.value),k=e.computed(()=>{const{theme:a}=t;return a==="dark"?{container:"dark",loading:"text-gray-400",error:"text-red-400",thead:"bg-gray-800",th:"text-gray-300",thHover:"hover:bg-gray-700",tbody:"bg-gray-900 divide-gray-700",tr:"hover:bg-gray-800",td:"text-gray-300",empty:"text-gray-400",checkbox:"border-gray-600 bg-gray-700 text-blue-400"}:a==="light"?{container:"",loading:"text-gray-500",error:"text-red-500",thead:"bg-gray-50",th:"text-gray-500",thHover:"hover:bg-gray-100",tbody:"bg-white divide-gray-200",tr:"hover:bg-gray-50",td:"text-gray-900",empty:"text-gray-500",checkbox:"border-gray-300 bg-white text-blue-600"}:{container:"",loading:"text-gray-500 dark:text-gray-400",error:"text-red-500 dark:text-red-400",thead:"bg-gray-50 dark:bg-gray-800",th:"text-gray-500 dark:text-gray-300",thHover:"hover:bg-gray-100 dark:hover:bg-gray-700",tbody:"bg-white dark:bg-gray-900 divide-gray-200 dark:divide-gray-700",tr:"hover:bg-gray-50 dark:hover:bg-gray-800",td:"text-gray-900 dark:text-gray-300",empty:"text-gray-500 dark:text-gray-400",checkbox:"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400"}});e.watch(()=>t.page,a=>{P.value=a}),e.watch(()=>t.limit,a=>{oe.value=a}),e.watch(()=>t.total,a=>{M.value=a});async function T(){if(t.api){x.value=!0,C.value=null;try{const a=new URL(t.api,window.location.origin);if(a.searchParams.set("page",le.value.toString()),a.searchParams.set("limit",ne.value.toString()),s.value.length>0){const m=s.value.filter(r=>r.direction).map(r=>`${r.field}:${r.direction}`).join(",");m&&a.searchParams.set("sort",m)}const d=await fetch(a.toString());if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const l=await d.json();l.rows&&Array.isArray(l.rows)&&(i.value=l.rows),l.columns&&Array.isArray(l.columns)&&(h.value=l.columns),l.total!==void 0&&(t.api?D.value=l.total:M.value=l.total)}catch(a){C.value=a instanceof Error?a.message:"Failed to fetch data",console.error("Error fetching data:",a)}finally{x.value=!1}}}const Ke=a=>{t.api?V.value=a:(P.value=a,c("update:page",a)),t.api&&T()},Qe=e.computed(()=>t.showPagination&&re.value>0),v=e.computed(()=>({small:{header:"px-3 py-2 text-xs",cell:"px-3 py-2 text-xs"},medium:{header:"px-6 py-3 text-xs",cell:"px-6 py-4 text-sm"},large:{header:"px-8 py-4 text-sm",cell:"px-8 py-6 text-base"}})[t.size]);e.onMounted(()=>{t.api&&(t.page&&(V.value=t.page),t.limit&&(H.value=t.limit),t.total&&(D.value=t.total),T())}),e.watch(()=>t.api,a=>{a&&(V.value=t.page||1,H.value=t.limit||10,D.value=t.total||0,T())});const Xe=e.computed(()=>t.api?h.value:t.columns),W=e.ref([]),z=e.ref({});e.provide("registerColumn",(a,d)=>{W.value.push(a),d&&a.slotName&&(z.value[a.name]=d)});const se=e.computed(()=>{const a=Xe.value||[],d=[],l=p.default?.();if(l){const m=l.filter(r=>r.type?.name==="Column"||r.type==="Column"||r.type&&typeof r.type=="object"&&r.type.name==="Column").map(r=>{const y=r.props||r.componentProps||{},E=y.field||y.name||"",F=y.header||y.label||"",ie=r.children&&r.children.body,U={name:E,ua:F,format:y.format||"text",slotName:ie?"body":void 0,...y};return ie&&U.name&&(z.value[U.name]=r.children.body),U});d.push(...m)}if(W.value.length>0&&d.push(...W.value),d.length>0){const m=[],r=new Set(d.map(y=>y.name));return a.forEach(y=>{r.has(y.name)||m.push(y)}),m.push(...d),console.log("Combined columns:",{default:a.length,custom:d.length,combined:m.length}),m}return a.length>0?(console.log("Using default columns:",a.length),a):[]}),Ye=(a="text")=>A[a.toLowerCase()]||A.text;return(a,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full",k.value.container])},[x.value||t.loading?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",Ce,[d[0]||(d[0]=e.createElementVNode("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"},null,-1)),e.createElementVNode("span",{class:e.normalizeClass(k.value.loading)},"Loading...",2)])])):C.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["text-center py-8",k.value.error])},e.toDisplayString(C.value),3)):!t.loading&&_.value.length>0?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",{class:e.normalizeClass(a.classWrapper?a.classWrapper:"relative w-full overflow-auto")},[e.createElementVNode("table",{class:e.normalizeClass(a.classTable),style:e.normalizeStyle(a.tableStyle)},[e.createElementVNode("thead",{class:e.normalizeClass(a.classThead||k.value.thead)},[e.createElementVNode("tr",null,[a.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["text-left font-medium uppercase tracking-wider",k.value.th,v.value.header,t.classTh,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:L.value,indeterminate:S.value,onChange:j,class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Be)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value.filter(l=>!l.hidden),l=>(e.openBlock(),e.createElementBlock("th",{key:l.name,class:e.normalizeClass([l.align?`text-${l.align}`:"",R(l)?["cursor-pointer",k.value.thHover]:"",ae(l)].concat(t.classTh||["text-left font-medium uppercase tracking-wider",k.value.th,v.value.header])),onClick:m=>R(l)?Oe(l.name):void 0},[e.createElementVNode("div",Ee,[e.createElementVNode("span",null,e.toDisplayString(l.ua||l.header||l.name),1),R(l)?(e.openBlock(),e.createElementBlock("span",$e,[e.renderSlot(a.$slots,"sort",{asc:qe(l.name)},()=>[e.createTextVNode(e.toDisplayString(Je(l.name)),1)])])):e.createCommentVNode("",!0)])],10,we))),128)),g.value?(e.openBlock(),e.createElementBlock("th",Ne,"Дії")):e.createCommentVNode("",!0)])],2),e.createElementVNode("tbody",{class:e.normalizeClass(a.classTbody||k.value.tbody)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,(l,m)=>(e.openBlock(),e.createElementBlock("tr",{key:m,class:e.normalizeClass(t.classTr||[k.value.tr,t.clickable?"cursor-pointer":""]),onClick:r=>t.clickable?Ge(l):void 0},[a.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["whitespace-nowrap",k.value.td,v.value.cell,t.classTd,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:w(l),onChange:r=>te(l),class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Ve)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value.filter(r=>!r.hidden),r=>(e.openBlock(),e.createElementBlock("td",{key:r.name,class:e.normalizeClass(t.classTd||["whitespace-nowrap",k.value.td,v.value.cell,r.align?`text-${r.align}`:"",ae(r)])},[r.action&&g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,row:l,value:$(r,l)},null,8,["row","value"])):e.unref(p).number&&r.format==="number"?e.renderSlot(a.$slots,"number",{key:1,row:l,value:$(r,l)}):e.unref(p).badge&&r.format==="badge"?e.renderSlot(a.$slots,"badge",{key:2,row:l,value:$(r,l)}):e.unref(p).array&&r.format==="array"?e.renderSlot(a.$slots,"array",{key:3,row:l,value:$(r,l)}):r.slotName&&z.value[r.name]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z.value[r.name]),{key:4,data:l,value:$(r,l),row:l,column:r},null,8,["data","value","row","column"])):r.link?(e.openBlock(),e.createElementBlock("a",{key:5,class:e.normalizeClass(a.classLink||"hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),onClick:y=>b(r.link.replace("{id}",l.id))},e.toDisplayString($(r,l)),11,De)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Ye(r.format)),{key:6,value:$(r,l),row:l,column:r,href:r.link},null,8,["value","row","column","href"]))],2))),128)),g.value?(e.openBlock(),e.createElementBlock("td",Te,[e.renderSlot(a.$slots,"action",{row:l})])):e.createCommentVNode("",!0)],10,Se))),128))],2)],6)],2)])):e.createCommentVNode("",!0),Qe.value&&!x.value&&!t.loading&&!C.value?(e.openBlock(),e.createBlock(I,{key:3,page:le.value,limit:ne.value,total:re.value,theme:t.theme,size:t.size,"onUpdate:page":Ke},null,8,["page","limit","total","theme","size"])):e.createCommentVNode("",!0),!x.value&&!t.loading&&!C.value&&_.value.length===0?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(["text-center py-8",k.value.empty])}," Дані відсутні ",2)):e.createCommentVNode("",!0)],2))}}),ve={style:{display:"none"}},Y=e.defineComponent({name:"Column",__name:"Column",props:{field:{},name:{},header:{},label:{},format:{},hidden:{type:Boolean},sortable:{type:Boolean},width:{},align:{},slot:{},slotName:{},link:{},action:{type:Boolean},getCellData:{type:Function},suffix:{}},setup(u){const o=u,t=e.useSlots(),c=e.inject("registerColumn");return e.onMounted(()=>{if(c){const{field:n,name:s,header:i,label:h,format:x,slotName:C,link:B,action:p,getCellData:g,suffix:b,..._}=o,S={name:n||s||"",ua:i||h||"",format:x||"text",slotName:C||(t.body?"body":void 0),link:B,action:p,getCellData:g,suffix:b,..._};console.log("Registering column:",S);const j=t.body;c(S,j)}}),(n,s)=>(e.openBlock(),e.createElementBlock("div",ve,[e.renderSlot(n.$slots,"body",{data:{}})]))}}),ze={class:"mt-4"},Fe={class:"text-sm text-gray-600 dark:text-gray-300"},Z=e.defineComponent({__name:"SelectionInfo",props:{selectedRows:{},totalCount:{}},setup(u){const o=u,t=e.computed(()=>o.selectedRows.length);return(c,n)=>(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",Fe," Обрано: "+e.toDisplayString(t.value)+" з "+e.toDisplayString(c.totalCount)+" записів ",1)]))}}),Ae={class:"mt-4"},Ie={class:"border-b border-gray-200 dark:border-gray-700"},Le={class:"-mb-px flex space-x-8"},je=["onClick"],Re={class:"mt-4"},Pe={class:"bg-gray-900 rounded-lg overflow-hidden"},Me={class:"flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700"},He={class:"text-sm text-gray-300"},We=["onClick"],Ue={class:"p-4 text-sm text-gray-100 overflow-x-auto"},ee=e.defineComponent({__name:"CodeTabs",props:{tabs:{},defaultTab:{default:void 0}},setup(u){const o=u,t=e.ref(o.defaultTab||o.tabs[0]?.id||""),c=async n=>{try{await navigator.clipboard.writeText(n),console.log("Код скопійовано!")}catch(s){console.error("Помилка копіювання:",s)}};return(n,s)=>(e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",Ie,[e.createElementVNode("nav",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tabs,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:h=>t.value=i.id,class:e.normalizeClass(["py-2 px-1 border-b-2 font-medium text-sm transition-colors",t.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"])},e.toDisplayString(i.label),11,je))),128))])]),e.createElementVNode("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tabs,i=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:i.id},[e.createElementVNode("div",Pe,[e.createElementVNode("div",Me,[e.createElementVNode("span",He,e.toDisplayString(i.label),1),e.createElementVNode("button",{onClick:h=>c(i.content),class:"text-gray-400 hover:text-white transition-colors",title:"Копіювати код"},s[0]||(s[0]=[e.createElementVNode("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",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"})],-1)]),8,We)]),e.createElementVNode("pre",Ue,[e.createElementVNode("code",null,e.toDisplayString(i.content),1)])])])),[[e.vShow,t.value===i.id]])),128))])]))}});N.install=function(o){o.component("DataTable",N),o.component("Column",Y),o.component("Pagination",I),o.component("SelectionInfo",Z),o.component("CodeTabs",ee)},f.ArrayFormat=K,f.BadgeFormat=G,f.CodeTabs=ee,f.Column=Y,f.DataTable=N,f.DateFormat=q,f.LinkFormat=Q,f.NumberFormat=O,f.Pagination=I,f.SelectFormat=X,f.SelectionInfo=Z,f.TextFormat=J,f.default=N,f.formatComponents=A,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.filter={},f.Vue))})(this,(function(f,e){"use strict";const O=e.defineComponent({name:"NumberFormat",__name:"NumberFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>o.value===null||o.value===void 0?"":typeof o.value=="number"?o.value.toFixed(2):Intl.NumberFormat("uk-UA",{maximumFractionDigits:2}).format(Number(o.value)));return(c,n)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value||"-"),1))}}),q=e.defineComponent({name:"DateFormat",__name:"DateFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>{if(!o.value)return"";try{return new Date(o.value).toLocaleDateString()}catch{return o.value}});return(c,n)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(t.value||"-"),1))}}),J=e.defineComponent({name:"TextFormat",__name:"TextFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,{value:t}=o,c=e.computed(()=>Array.isArray(t)?t.map(n=>n.text||n).join(","):t?.text||t);return(n,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value||"-"),1))}}),G=((u,o)=>{const t=u.__vccOpts||u;for(const[c,n]of o)t[c]=n;return t})(e.defineComponent({name:"BadgeFormat",__name:"BadgeFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>{const s=String(o.value||"").toLowerCase(),i="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";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`:o.value?.color&&!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(o.value.color)?`${i} bg-${o.value.color}-100 text-${o.value.color}-800`:`${i} bg-gray-100 text-gray-800`});function c(s,i=1){const h=parseInt(s.slice(1,3),16),x=parseInt(s.slice(3,5),16),C=parseInt(s.slice(5,7),16);return`rgba(${h}, ${x}, ${C}, ${i})`}const n=e.computed(()=>{const s={minWidth:"60px",textAlign:"center",display:"inline-block"};return/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(o.value?.color)?{...s,backgroundColor:c(o.value.color,.1),color:c(o.value.color,.8)}:s});return(s,i)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["badge",t.value]),style:e.normalizeStyle(n.value)},e.toDisplayString(s.value?.text||s.value||"-"),7))}}),[["__scopeId","data-v-f4b15092"]]),ce={class:"flex flex-wrap gap-1"},K=e.defineComponent({name:"ArrayFormat",__name:"ArrayFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>o.value?Array.isArray(o.value)?o.value:[o.value]:[]),c=n=>n?typeof n=="object"&&n.name?n.name:typeof n=="string"||typeof n=="number"?String(n):JSON.stringify(n):"";return(n,s)=>(e.openBlock(),e.createElementBlock("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(i,h)=>(e.openBlock(),e.createElementBlock("span",{key:h,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"},e.toDisplayString(c(i)),1))),128))]))}}),de=["href","target"],Q=e.defineComponent({__name:"LinkFormat",props:{href:{default:""},target:{default:"_self"},onClick:{type:Function,default:void 0},value:{},row:{},column:{}},setup(u){const o=u,t=e.computed(()=>typeof o.value=="string"||typeof o.value=="number"?o.value:o.value?.text||o.value?.label||"Link"),c=e.computed(()=>o.href?o.href:typeof o.value=="object"&&o.value?.href?o.value.href:""),n=e.computed(()=>o.target?o.target:typeof o.value=="object"&&o.value?.target?o.value.target:"_self"),s=e.computed(()=>"text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer"),i=h=>{o.onClick&&o.row&&(h.preventDefault(),o.onClick(o.row,o.value))};return(h,x)=>c.value?(e.openBlock(),e.createElementBlock("a",{key:0,href:c.value,target:n.value,class:e.normalizeClass(s.value),onClick:i},e.toDisplayString(t.value),11,de)):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(s.value),onClick:i},e.toDisplayString(t.value),3))}}),X=e.defineComponent({name:"TextFormat",__name:"SelectFormat",props:{value:{},row:{},column:{}},setup(u){const o=u,{value:t}=o,c=e.computed(()=>Array.isArray(t)?t.map(n=>n.text||n).filter((n,s)=>s<2).join(", ")+(t.length>2?` +${t.length-2}`:""):t?.text||t);return(n,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value||"-"),1))}}),A={number:O,date:q,text:J,badge:G,array:K,select:X,link:Q},me={class:"flex items-center space-x-4"},pe={class:"font-medium"},ue={class:"font-medium"},ge={class:"font-medium"},fe={class:"flex items-center space-x-2"},ye=["disabled"],be={class:"flex items-center space-x-1"},he=["onClick"],ke=["disabled"],I=e.defineComponent({name:"Pagination",__name:"Pagination",props:{page:{},limit:{},total:{},theme:{default:"light"},size:{default:"medium"}},emits:["update:page"],setup(u,{emit:o}){const t=u,c=e.computed(()=>({small:{text:"text-xs",button:"px-2 h-7 text-xs min-w-[28px] flex items-center justify-center",icon:"w-3.5 h-3.5"},medium:{text:"text-sm",button:"px-3 h-9 text-sm min-w-[36px] flex items-center justify-center",icon:"w-4 h-4"},large:{text:"text-base",button:"px-4 h-11 text-base min-w-[44px] flex items-center justify-center",icon:"w-5 h-5"}})[t.size]),n=e.computed(()=>{const{theme:p}=t;return p==="dark"?{container:"bg-gray-900 border-gray-700",text:"text-gray-300",button:"text-gray-300 bg-gray-800 border-gray-600 hover:bg-gray-700",buttonDisabled:"text-gray-500 bg-gray-800",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-400"}:p==="light"?{container:"bg-white border-gray-200",text:"text-gray-700",button:"text-gray-700 bg-white border-gray-300 hover:bg-gray-50",buttonDisabled:"text-gray-400 bg-gray-100",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-500"}:{container:"bg-white dark:bg-gray-900 border-gray-200 dark:border-gray-700",text:"text-gray-700 dark:text-gray-300",button:"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",buttonDisabled:"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800",buttonActive:"bg-blue-600 text-white",ellipsis:"text-gray-500 dark:text-gray-400"}}),s=o,i=e.computed(()=>Math.ceil(t.total/t.limit)),h=e.computed(()=>t.total===0?0:(t.page-1)*t.limit+1),x=e.computed(()=>Math.min(t.page*t.limit,t.total)),C=e.computed(()=>{const p=[];if(i.value<=7)for(let b=1;b<=i.value;b+=1)p.push(b);else{p.push(1),t.page>4&&p.push("...");const b=Math.max(2,t.page-1),_=Math.min(i.value-1,t.page+1);for(let w=b;w<=_;w+=1)w!==1&&w!==i.value&&p.push(w);t.page<i.value-3&&p.push("..."),i.value>1&&p.push(i.value)}return p}),B=p=>{p>=1&&p<=i.value&&p!==t.page&&s("update:page",p)};return(p,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex items-center justify-between py-3 border-t",n.value.container])},[e.createElementVNode("div",me,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center text-sm",n.value.text,c.value.text])},[e.createElementVNode("span",null,[g[2]||(g[2]=e.createTextVNode(" Показано ",-1)),e.createElementVNode("span",pe,e.toDisplayString(h.value),1),g[3]||(g[3]=e.createTextVNode(" до ",-1)),e.createElementVNode("span",ue,e.toDisplayString(x.value),1),g[4]||(g[4]=e.createTextVNode(" з ",-1)),e.createElementVNode("span",ge,e.toDisplayString(p.total),1),g[5]||(g[5]=e.createTextVNode(" результатів ",-1))])],2)]),e.createElementVNode("div",fe,[e.createElementVNode("button",{onClick:g[0]||(g[0]=b=>B(p.page-1)),disabled:p.page<=1,class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,p.page<=1?n.value.buttonDisabled:n.value.button])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(c.value.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...g[6]||(g[6]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"},null,-1)])],2))],10,ye),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,b=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[b==="..."?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["font-medium",c.value.button,n.value.ellipsis])}," ... ",2)):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:_=>B(b),class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,b===p.page?n.value.buttonActive:n.value.button])},e.toDisplayString(b),11,he))],64))),128))]),e.createElementVNode("button",{onClick:g[1]||(g[1]=b=>B(p.page+1)),disabled:p.page>=i.value,class:e.normalizeClass(["relative font-medium rounded-md",c.value.button,p.page>=i.value?n.value.buttonDisabled:n.value.button])},[(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(c.value.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...g[7]||(g[7]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))],10,ke)])],2))}}),xe={key:0,class:"text-center py-8"},Ce={class:"inline-flex items-center space-x-2"},_e={key:2,class:"overflow-x-auto"},Be=["checked","indeterminate"],we=["onClick"],Ee={class:"flex items-center justify-between"},$e={key:0,class:"ml-1 text-xs"},Se=["onClick"],Ne=["checked","onChange"],Ve=["onClick"],De={key:1,class:"text-center"},N=e.defineComponent({name:"DataTable",__name:"DataTable",props:{rows:{default:()=>[]},columns:{default:()=>[]},api:{},router:{},tableStyle:{default:""},size:{default:"medium"},theme:{default:"light"},loading:{type:Boolean,default:!1},classWrapper:{default:""},classTable:{default:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},classTbody:{default:""},classTr:{default:""},classTd:{default:""},classTh:{default:""},classThead:{default:""},classLink:{default:""},selectable:{type:Boolean,default:!1},selectedRows:{default:()=>[]},limit:{default:10},page:{default:1},total:{default:0},showPagination:{type:Boolean,default:!0},sortable:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},getCellData:{type:Function,default:void 0}},emits:["update:page","update:selectedRows","row-click","sort"],setup(u,{emit:o}){const t=u,c=o,n=e.ref(t.selectedRows||[]),s=e.ref([]),i=e.ref([]),h=e.ref([]),x=e.ref(!1),C=e.ref(null),B=e.ref(t.router),p=e.useSlots(),g=e.computed(()=>p.action);function b(a){if(B.value){B.value.push(a);return}location.href=a}const _=e.computed(()=>{if(t.api)return i.value;if(t.sortable&&s.value.length>0){const a=[...t.rows];return a.sort((d,l)=>{for(const m of s.value){if(!m.direction)return 0;const r=d[m.field],y=l[m.field];if(r==null)return 1;if(y==null)return-1;let E=0;typeof r=="string"&&typeof y=="string"?E=r.localeCompare(y):r<y?E=-1:r>y?E=1:E=0;const F=m.direction==="desc"?-E:E;if(F!==0)return F}return 0}),a}return t.rows});e.watch(()=>t.selectedRows,a=>{n.value=a||[]});const w=a=>n.value.some(d=>d===a),te=a=>{const d=n.value.findIndex(l=>l===a);d>-1?n.value.splice(d,1):n.value.push(a),c("update:selectedRows",[...n.value])},L=e.computed(()=>_.value.length>0&&n.value.length===_.value.length),V=e.computed(()=>n.value.length>0&&n.value.length<_.value.length),j=()=>{L.value?n.value=[]:n.value=[..._.value],c("update:selectedRows",[...n.value])},Ue=a=>{if(!t.sortable)return;const d=s.value.findIndex(m=>m.field===a);if(d>=0){const m=s.value[d];m.direction==="asc"?m.direction="desc":m.direction==="desc"&&s.value.splice(d,1)}else s.value.unshift({field:a,direction:"asc"});const l=s.value.filter(m=>m.direction).map(m=>({name:m.field,asc:m.direction==="asc"}));c("sort",l),t.api&&z()},Oe=a=>s.value.find(l=>l.field===a)?.direction==="asc",qe=a=>{const d=s.value.find(l=>l.field===a);if(!d)return"↑↓";switch(d.direction){case"asc":return"↑";case"desc":return"↓";default:return"↕️"}},R=a=>t.sortable&&a.sortable!==!1,Je=a=>{t.clickable&&c("row-click",a)},$=(a,d)=>{const l=d[a.name];if(t.getCellData||a.getCellData){const m=a.getCellData||t.getCellData;if(m){const r={name:a.name,row:d,value:l};return m(r)}}return["_data","_text"].map(m=>{const r=`${a.name}${m}`;return d[r]?d[r]:null}).find(m=>m)||l},ae=a=>a.width?a.width==="w-full"?"w-full":typeof a.width=="string"?`w-[${a.width}px]`:typeof a.width=="number"?`w-[${a.width}px]`:"":"",P=e.ref(t.page),oe=e.ref(t.limit),M=e.ref(t.total),D=e.ref(1),H=e.ref(10),T=e.ref(0),le=e.computed(()=>t.api?D.value:P.value),ne=e.computed(()=>t.api?H.value:oe.value),re=e.computed(()=>t.api?T.value:M.value),k=e.computed(()=>{const{theme:a}=t;return a==="dark"?{container:"dark",loading:"text-gray-400",error:"text-red-400",thead:"bg-gray-800",th:"text-gray-300",thHover:"hover:bg-gray-700",tbody:"bg-gray-900 divide-gray-700",tr:"hover:bg-gray-800",td:"text-gray-300",empty:"text-gray-400",checkbox:"border-gray-600 bg-gray-700 text-blue-400"}:a==="light"?{container:"",loading:"text-gray-500",error:"text-red-500",thead:"bg-gray-50",th:"text-gray-500",thHover:"hover:bg-gray-100",tbody:"bg-white divide-gray-200",tr:"hover:bg-gray-50",td:"text-gray-900",empty:"text-gray-500",checkbox:"border-gray-300 bg-white text-blue-600"}:{container:"",loading:"text-gray-500 dark:text-gray-400",error:"text-red-500 dark:text-red-400",thead:"bg-gray-50 dark:bg-gray-800",th:"text-gray-500 dark:text-gray-300",thHover:"hover:bg-gray-100 dark:hover:bg-gray-700",tbody:"bg-white dark:bg-gray-900 divide-gray-200 dark:divide-gray-700",tr:"hover:bg-gray-50 dark:hover:bg-gray-800",td:"text-gray-900 dark:text-gray-300",empty:"text-gray-500 dark:text-gray-400",checkbox:"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-blue-600 dark:text-blue-400"}});e.watch(()=>t.page,a=>{P.value=a}),e.watch(()=>t.limit,a=>{oe.value=a}),e.watch(()=>t.total,a=>{M.value=a});async function z(){if(t.api){x.value=!0,C.value=null;try{const a=new URL(t.api,window.location.origin);if(a.searchParams.set("page",le.value.toString()),a.searchParams.set("limit",ne.value.toString()),s.value.length>0){const m=s.value.filter(r=>r.direction).map(r=>`${r.field}:${r.direction}`).join(",");m&&a.searchParams.set("sort",m)}const d=await fetch(a.toString());if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const l=await d.json();l.rows&&Array.isArray(l.rows)&&(i.value=l.rows),l.columns&&Array.isArray(l.columns)&&(h.value=l.columns),l.total!==void 0&&(t.api?T.value=l.total:M.value=l.total)}catch(a){C.value=a instanceof Error?a.message:"Failed to fetch data",console.error("Error fetching data:",a)}finally{x.value=!1}}}const Ge=a=>{t.api?D.value=a:(P.value=a,c("update:page",a)),t.api&&z()},Ke=e.computed(()=>t.showPagination&&re.value>0),S=e.computed(()=>({small:{header:"px-3 py-2 text-xs",cell:"px-3 py-2 text-xs"},medium:{header:"px-6 py-3 text-xs",cell:"px-6 py-4 text-sm"},large:{header:"px-8 py-4 text-sm",cell:"px-8 py-6 text-base"}})[t.size]);e.onMounted(()=>{t.api&&(t.page&&(D.value=t.page),t.limit&&(H.value=t.limit),t.total&&(T.value=t.total),z())}),e.watch(()=>t.api,a=>{a&&(D.value=t.page||1,H.value=t.limit||10,T.value=t.total||0,z())});const Qe=e.computed(()=>t.api?h.value:t.columns),W=e.ref([]),v=e.ref({});e.provide("registerColumn",(a,d)=>{W.value.push(a),d&&a.slotName&&(v.value[a.name]=d)});const se=e.computed(()=>{const a=Qe.value||[],d=[],l=p.default?.();if(l){const m=l.filter(r=>r.type?.name==="Column"||r.type==="Column"||r.type&&typeof r.type=="object"&&r.type.name==="Column").map(r=>{const y=r.props||r.componentProps||{},E=y.field||y.name||"",F=y.header||y.label||"",ie=r.children&&r.children.body,U={name:E,ua:F,format:y.format||"text",slotName:ie?"body":void 0,...y};return ie&&U.name&&(v.value[U.name]=r.children.body),U});d.push(...m)}if(W.value.length>0&&d.push(...W.value),d.length>0){const m=[],r=new Set(d.map(y=>y.name));return a.forEach(y=>{r.has(y.name)||m.push(y)}),m.push(...d),console.log("Combined columns:",{default:a.length,custom:d.length,combined:m.length}),m}return a.length>0?(console.log("Using default columns:",a.length),a):[]}),Xe=(a="text")=>A[a.toLowerCase()]||A.text;return(a,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full",k.value.container])},[x.value||t.loading?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",Ce,[d[0]||(d[0]=e.createElementVNode("div",{class:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"},null,-1)),e.createElementVNode("span",{class:e.normalizeClass(k.value.loading)},"Loading...",2)])])):C.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["text-center py-8",k.value.error])},e.toDisplayString(C.value),3)):!t.loading&&_.value.length>0?(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",{class:e.normalizeClass(a.classWrapper?a.classWrapper:"relative w-full overflow-auto")},[e.createElementVNode("table",{class:e.normalizeClass(a.classTable),style:e.normalizeStyle(a.tableStyle)},[e.createElementVNode("thead",{class:e.normalizeClass(a.classThead||k.value.thead)},[e.createElementVNode("tr",null,[a.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["text-left font-medium uppercase tracking-wider",k.value.th,S.value.header,t.classTh,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:L.value,indeterminate:V.value,onChange:j,class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Be)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value.filter(l=>!l.hidden),l=>(e.openBlock(),e.createElementBlock("th",{key:l.name,class:e.normalizeClass([l.align?`text-${l.align}`:"",R(l)?["cursor-pointer",k.value.thHover]:"",ae(l)].concat(t.classTh||["text-left font-medium uppercase tracking-wider",k.value.th,S.value.header])),onClick:m=>R(l)?Ue(l.name):void 0},[e.createElementVNode("div",Ee,[e.createElementVNode("span",null,e.toDisplayString(l.ua||l.header||l.name),1),R(l)?(e.openBlock(),e.createElementBlock("span",$e,[e.renderSlot(a.$slots,"sort",{asc:Oe(l.name)},()=>[e.createTextVNode(e.toDisplayString(qe(l.name)),1)])])):e.createCommentVNode("",!0)])],10,we))),128)),g.value?(e.openBlock(),e.createElementBlock("th",{key:1,class:e.normalizeClass(["w-[100px]",t.classTh||["text-left font-medium uppercase tracking-wider",k.value.th,S.value.header]])},"Дії",2)):e.createCommentVNode("",!0)])],2),e.createElementVNode("tbody",{class:e.normalizeClass(a.classTbody||k.value.tbody)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,(l,m)=>(e.openBlock(),e.createElementBlock("tr",{key:m,class:e.normalizeClass(t.classTr||[k.value.tr,t.clickable?"cursor-pointer":""]),onClick:r=>t.clickable?Je(l):void 0},[a.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["whitespace-nowrap",k.value.td,S.value.cell,t.classTd,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:w(l),onChange:r=>te(l),class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Ne)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(se.value.filter(r=>!r.hidden),r=>(e.openBlock(),e.createElementBlock("td",{key:r.name,class:e.normalizeClass(t.classTd||["whitespace-nowrap",k.value.td,S.value.cell,r.align?`text-${r.align}`:"",ae(r)])},[r.action&&g.value?e.renderSlot(a.$slots,"action",{key:0,row:l}):e.unref(p).number&&r.format==="number"?e.renderSlot(a.$slots,"number",{key:1,row:l,value:$(r,l)}):e.unref(p).badge&&r.format==="badge"?e.renderSlot(a.$slots,"badge",{key:2,row:l,value:$(r,l)}):e.unref(p).array&&r.format==="array"?e.renderSlot(a.$slots,"array",{key:3,row:l,value:$(r,l)}):r.slotName&&v.value[r.name]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.value[r.name]),{key:4,data:l,value:$(r,l),row:l,column:r},null,8,["data","value","row","column"])):r.link?(e.openBlock(),e.createElementBlock("a",{key:5,class:e.normalizeClass(a.classLink||"hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),onClick:y=>b(r.link.replace("{id}",l.id))},e.toDisplayString($(r,l)),11,Ve)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Xe(r.format)),{key:6,value:$(r,l),row:l,column:r,href:r.link},null,8,["value","row","column","href"]))],2))),128)),g.value?(e.openBlock(),e.createElementBlock("td",De,[e.renderSlot(a.$slots,"action",{row:l})])):e.createCommentVNode("",!0)],10,Se))),128))],2)],6)],2)])):e.createCommentVNode("",!0),Ke.value&&!x.value&&!t.loading&&!C.value?(e.openBlock(),e.createBlock(I,{key:3,page:le.value,limit:ne.value,total:re.value,theme:t.theme,size:t.size,"onUpdate:page":Ge},null,8,["page","limit","total","theme","size"])):e.createCommentVNode("",!0),!x.value&&!t.loading&&!C.value&&_.value.length===0?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(["text-center py-8",k.value.empty])}," Дані відсутні ",2)):e.createCommentVNode("",!0)],2))}}),Te={style:{display:"none"}},Y=e.defineComponent({name:"Column",__name:"Column",props:{field:{},name:{},header:{},label:{},format:{},hidden:{type:Boolean},sortable:{type:Boolean},width:{},align:{},slot:{},slotName:{},link:{},action:{type:Boolean},getCellData:{type:Function},suffix:{}},setup(u){const o=u,t=e.useSlots(),c=e.inject("registerColumn");return e.onMounted(()=>{if(c){const{field:n,name:s,header:i,label:h,format:x,slotName:C,link:B,action:p,getCellData:g,suffix:b,..._}=o,V={name:n||s||"",ua:i||h||"",format:x||"text",slotName:C||(t.body?"body":void 0),link:B,action:p,getCellData:g,suffix:b,..._};console.log("Registering column:",V);const j=t.body;c(V,j)}}),(n,s)=>(e.openBlock(),e.createElementBlock("div",Te,[e.renderSlot(n.$slots,"body",{data:{}})]))}}),ze={class:"mt-4"},ve={class:"text-sm text-gray-600 dark:text-gray-300"},Z=e.defineComponent({__name:"SelectionInfo",props:{selectedRows:{},totalCount:{}},setup(u){const o=u,t=e.computed(()=>o.selectedRows.length);return(c,n)=>(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",ve," Обрано: "+e.toDisplayString(t.value)+" з "+e.toDisplayString(c.totalCount)+" записів ",1)]))}}),Fe={class:"mt-4"},Ae={class:"border-b border-gray-200 dark:border-gray-700"},Ie={class:"-mb-px flex space-x-8"},Le=["onClick"],je={class:"mt-4"},Re={class:"bg-gray-900 rounded-lg overflow-hidden"},Pe={class:"flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700"},Me={class:"text-sm text-gray-300"},He=["onClick"],We={class:"p-4 text-sm text-gray-100 overflow-x-auto"},ee=e.defineComponent({__name:"CodeTabs",props:{tabs:{},defaultTab:{default:void 0}},setup(u){const o=u,t=e.ref(o.defaultTab||o.tabs[0]?.id||""),c=async n=>{try{await navigator.clipboard.writeText(n),console.log("Код скопійовано!")}catch(s){console.error("Помилка копіювання:",s)}};return(n,s)=>(e.openBlock(),e.createElementBlock("div",Fe,[e.createElementVNode("div",Ae,[e.createElementVNode("nav",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tabs,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:h=>t.value=i.id,class:e.normalizeClass(["py-2 px-1 border-b-2 font-medium text-sm transition-colors",t.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"])},e.toDisplayString(i.label),11,Le))),128))])]),e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tabs,i=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:i.id},[e.createElementVNode("div",Re,[e.createElementVNode("div",Pe,[e.createElementVNode("span",Me,e.toDisplayString(i.label),1),e.createElementVNode("button",{onClick:h=>c(i.content),class:"text-gray-400 hover:text-white transition-colors",title:"Копіювати код"},[...s[0]||(s[0]=[e.createElementVNode("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",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"})],-1)])],8,He)]),e.createElementVNode("pre",We,[e.createElementVNode("code",null,e.toDisplayString(i.content),1)])])])),[[e.vShow,t.value===i.id]])),128))])]))}});N.install=function(o){o.component("DataTable",N),o.component("Column",Y),o.component("Pagination",I),o.component("SelectionInfo",Z),o.component("CodeTabs",ee)},f.ArrayFormat=K,f.BadgeFormat=G,f.CodeTabs=ee,f.Column=Y,f.DataTable=N,f.DateFormat=q,f.LinkFormat=Q,f.NumberFormat=O,f.Pagination=I,f.SelectFormat=X,f.SelectionInfo=Z,f.TextFormat=J,f.default=N,f.formatComponents=A,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@opengis/table",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A Vue 3 data table component with advanced features",
|
|
5
|
-
"main": "dist/index.mjs",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
9
|
-
"keywords": [
|
|
10
|
-
"vue",
|
|
11
|
-
"vue3",
|
|
12
|
-
"table",
|
|
13
|
-
"data-table",
|
|
14
|
-
"component",
|
|
15
|
-
"typescript"
|
|
16
|
-
],
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"vue": "^3.0.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@tsconfig/node22": "^22.0.2",
|
|
23
|
-
"@types/node": "^22.15.32",
|
|
24
|
-
"@vitejs/plugin-vue": "^6.0.0",
|
|
25
|
-
"@vue/eslint-config-typescript": "^12.0.0",
|
|
26
|
-
"@vue/tsconfig": "^0.7.0",
|
|
27
|
-
"eslint": "8.49.0",
|
|
28
|
-
"eslint-config-airbnb": "19.0.4",
|
|
29
|
-
"eslint-plugin-import": "^2.25.3",
|
|
30
|
-
"eslint-plugin-vue": "^9.17.0",
|
|
31
|
-
"typescript": "~5.8.0",
|
|
32
|
-
"vite": "^7.0.0",
|
|
33
|
-
"vue": "^3.5.17",
|
|
34
|
-
"vue-tsc": "^2.2.10"
|
|
35
|
-
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
38
|
-
"dev": "vite",
|
|
39
|
-
"build": "vite build",
|
|
40
|
-
"docs": "vite docs",
|
|
41
|
-
"build:lib": "vite build --config vite.lib.config.ts",
|
|
42
|
-
"build:types": "copy src\\types\\index.ts dist\\types.d.ts",
|
|
43
|
-
"build:full": "npm run build:lib && npm run build:types",
|
|
44
|
-
"preview": "vite preview",
|
|
45
|
-
"build-only": "vite build",
|
|
46
|
-
"prepublishOnly": "bun run build",
|
|
47
|
-
"docs:dev": "npm run --prefix ./docs docs:dev",
|
|
48
|
-
"docs:build": "npm run --prefix ./docs docs:build",
|
|
49
|
-
"docs:preview": "npm run --prefix ./docs docs:preview"
|
|
50
|
-
},
|
|
51
|
-
"directories": {
|
|
52
|
-
"example": "examples"
|
|
53
|
-
},
|
|
54
|
-
"repository": {
|
|
55
|
-
"type": "git",
|
|
56
|
-
"url": "https://git.softpro.ua/npm/table.git"
|
|
57
|
-
},
|
|
58
|
-
"author": "softpro",
|
|
59
|
-
"dependencies": {}
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengis/table",
|
|
3
|
+
"version": "0.0.21",
|
|
4
|
+
"description": "A Vue 3 data table component with advanced features",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"keywords": [
|
|
10
|
+
"vue",
|
|
11
|
+
"vue3",
|
|
12
|
+
"table",
|
|
13
|
+
"data-table",
|
|
14
|
+
"component",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"vue": "^3.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@tsconfig/node22": "^22.0.2",
|
|
23
|
+
"@types/node": "^22.15.32",
|
|
24
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
25
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
26
|
+
"@vue/tsconfig": "^0.7.0",
|
|
27
|
+
"eslint": "8.49.0",
|
|
28
|
+
"eslint-config-airbnb": "19.0.4",
|
|
29
|
+
"eslint-plugin-import": "^2.25.3",
|
|
30
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
31
|
+
"typescript": "~5.8.0",
|
|
32
|
+
"vite": "^7.0.0",
|
|
33
|
+
"vue": "^3.5.17",
|
|
34
|
+
"vue-tsc": "^2.2.10"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
38
|
+
"dev": "vite",
|
|
39
|
+
"build": "vite build",
|
|
40
|
+
"docs": "vite docs",
|
|
41
|
+
"build:lib": "vite build --config vite.lib.config.ts",
|
|
42
|
+
"build:types": "copy src\\types\\index.ts dist\\types.d.ts",
|
|
43
|
+
"build:full": "npm run build:lib && npm run build:types",
|
|
44
|
+
"preview": "vite preview",
|
|
45
|
+
"build-only": "vite build",
|
|
46
|
+
"prepublishOnly": "bun run build",
|
|
47
|
+
"docs:dev": "npm run --prefix ./docs docs:dev",
|
|
48
|
+
"docs:build": "npm run --prefix ./docs docs:build",
|
|
49
|
+
"docs:preview": "npm run --prefix ./docs docs:preview"
|
|
50
|
+
},
|
|
51
|
+
"directories": {
|
|
52
|
+
"example": "examples"
|
|
53
|
+
},
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://git.softpro.ua/npm/table.git"
|
|
57
|
+
},
|
|
58
|
+
"author": "softpro",
|
|
59
|
+
"dependencies": {}
|
|
60
60
|
}
|