@opengis/table 0.0.16 → 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 CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, computed as f, createElementBlock as u, openBlock as s, toDisplayString as y, 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";
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
2
  const Se = /* @__PURE__ */ S({
3
3
  name: "NumberFormat",
4
4
  __name: "NumberFormat",
@@ -11,7 +11,7 @@ const Se = /* @__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, r) => (s(), u("span", null, y(e.value), 1));
14
+ return (c, r) => (o(), u("span", null, h(e.value), 1));
15
15
  }
16
16
  }), De = /* @__PURE__ */ S({
17
17
  name: "DateFormat",
@@ -30,7 +30,7 @@ const Se = /* @__PURE__ */ S({
30
30
  return a.value;
31
31
  }
32
32
  });
33
- return (c, r) => (s(), u("span", null, y(e.value), 1));
33
+ return (c, r) => (o(), u("span", null, h(e.value), 1));
34
34
  }
35
35
  }), Ae = /* @__PURE__ */ S({
36
36
  name: "TextFormat",
@@ -42,7 +42,7 @@ const Se = /* @__PURE__ */ S({
42
42
  },
43
43
  setup(b) {
44
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, o) => (s(), u("span", null, y(c.value), 1));
45
+ return (r, s) => (o(), u("span", null, h(c.value), 1));
46
46
  }
47
47
  }), Ie = /* @__PURE__ */ S({
48
48
  name: "BadgeFormat",
@@ -54,29 +54,29 @@ const Se = /* @__PURE__ */ S({
54
54
  },
55
55
  setup(b) {
56
56
  const a = b, e = f(() => {
57
- const o = String(a.value || "").toLowerCase(), i = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";
58
- return o.includes("success") || o.includes("active") || o.includes("completed") ? `${i} bg-green-100 text-green-800` : o.includes("error") || o.includes("failed") || o.includes("inactive") ? `${i} bg-red-100 text-red-800` : o.includes("warning") || o.includes("pending") ? `${i} bg-yellow-100 text-yellow-800` : o.includes("info") || o.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`;
57
+ const s = String(a.value || "").toLowerCase(), i = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium";
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`;
59
59
  });
60
- function c(o, i = 1) {
61
- const _ = parseInt(o.slice(1, 3), 16), $ = parseInt(o.slice(3, 5), 16), T = parseInt(o.slice(5, 7), 16);
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
62
  return `rgba(${_}, ${$}, ${T}, ${i})`;
63
63
  }
64
64
  const r = f(() => {
65
- const o = {
65
+ const s = {
66
66
  minWidth: "60px",
67
67
  textAlign: "center",
68
68
  display: "inline-block"
69
69
  };
70
70
  return /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a.value?.color) ? {
71
- ...o,
71
+ ...s,
72
72
  backgroundColor: c(a.value.color, 0.1),
73
73
  color: c(a.value.color, 0.8)
74
- } : o;
74
+ } : s;
75
75
  });
76
- return (o, i) => (s(), u("span", {
76
+ return (s, i) => (o(), u("span", {
77
77
  class: m(["badge", e.value]),
78
78
  style: de(r.value)
79
- }, y(o.value?.text || o.value), 7));
79
+ }, h(s.value?.text || s.value), 7));
80
80
  }
81
81
  }), je = (b, a) => {
82
82
  const e = b.__vccOpts || b;
@@ -93,11 +93,11 @@ const Se = /* @__PURE__ */ S({
93
93
  },
94
94
  setup(b) {
95
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, o) => (s(), u("div", Re, [
97
- (s(!0), u(B, null, R(e.value, (i, _) => (s(), u("span", {
96
+ return (r, s) => (o(), u("div", Re, [
97
+ (o(!0), u(B, null, R(e.value, (i, _) => (o(), u("span", {
98
98
  key: _,
99
99
  class: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 hover:bg-blue-200 transition-colors"
100
- }, y(c(i)), 1))), 128))
100
+ }, h(c(i)), 1))), 128))
101
101
  ]));
102
102
  }
103
103
  }), Pe = ["href", "target"], Le = /* @__PURE__ */ S({
@@ -111,21 +111,21 @@ const Se = /* @__PURE__ */ S({
111
111
  column: {}
112
112
  },
113
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"), o = f(() => "text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 underline cursor-pointer"), i = (_) => {
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 = (_) => {
115
115
  a.onClick && a.row && (_.preventDefault(), a.onClick(a.row, a.value));
116
116
  };
117
- return (_, $) => c.value ? (s(), u("a", {
117
+ return (_, $) => c.value ? (o(), u("a", {
118
118
  key: 0,
119
119
  href: c.value,
120
120
  target: r.value,
121
- class: m(o.value),
121
+ class: m(s.value),
122
122
  onClick: i
123
- }, y(e.value), 11, Pe)) : (s(), u("button", {
123
+ }, h(e.value), 11, Pe)) : (o(), u("button", {
124
124
  key: 1,
125
125
  type: "button",
126
- class: m(o.value),
126
+ class: m(s.value),
127
127
  onClick: i
128
- }, y(e.value), 3));
128
+ }, h(e.value), 3));
129
129
  }
130
130
  }), Ne = /* @__PURE__ */ S({
131
131
  name: "TextFormat",
@@ -136,8 +136,8 @@ const Se = /* @__PURE__ */ S({
136
136
  column: {}
137
137
  },
138
138
  setup(b) {
139
- const a = b, { value: e } = a, c = f(() => Array.isArray(e) ? e.map((r) => r.text || r).filter((r, o) => o < 2).join(", ") + (e.length > 2 ? ` +${e.length - 2}` : "") : e?.text || e);
140
- return (r, o) => (s(), u("span", null, y(c.value), 1));
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));
141
141
  }
142
142
  }), ue = {
143
143
  number: Se,
@@ -199,7 +199,7 @@ const Se = /* @__PURE__ */ S({
199
199
  buttonActive: "bg-blue-600 text-white",
200
200
  ellipsis: "text-gray-500 dark:text-gray-400"
201
201
  };
202
- }), o = 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(() => {
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
203
  const p = [];
204
204
  if (i.value <= 7)
205
205
  for (let k = 1; k <= i.value; k += 1)
@@ -213,9 +213,9 @@ const Se = /* @__PURE__ */ S({
213
213
  }
214
214
  return p;
215
215
  }), D = (p) => {
216
- p >= 1 && p <= i.value && p !== e.page && o("update:page", p);
216
+ p >= 1 && p <= i.value && p !== e.page && s("update:page", p);
217
217
  };
218
- return (p, h) => (s(), u("div", {
218
+ return (p, y) => (o(), u("div", {
219
219
  class: m(["flex items-center justify-between py-3 border-t", r.value.container])
220
220
  }, [
221
221
  d("div", Ve, [
@@ -223,19 +223,19 @@ const Se = /* @__PURE__ */ S({
223
223
  class: m(["flex items-center text-sm", r.value.text, c.value.text])
224
224
  }, [
225
225
  d("span", null, [
226
- h[2] || (h[2] = L(" Показано ", -1)),
227
- d("span", Me, y(_.value), 1),
228
- h[3] || (h[3] = L(" до ", -1)),
229
- d("span", Ee, y($.value), 1),
230
- h[4] || (h[4] = L(" з ", -1)),
231
- d("span", He, y(p.total), 1),
232
- h[5] || (h[5] = L(" результатів ", -1))
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))
233
233
  ])
234
234
  ], 2)
235
235
  ]),
236
236
  d("div", We, [
237
237
  d("button", {
238
- onClick: h[0] || (h[0] = (k) => D(p.page - 1)),
238
+ onClick: y[0] || (y[0] = (k) => D(p.page - 1)),
239
239
  disabled: p.page <= 1,
240
240
  class: m([
241
241
  "relative font-medium rounded-md",
@@ -243,12 +243,12 @@ const Se = /* @__PURE__ */ S({
243
243
  p.page <= 1 ? r.value.buttonDisabled : r.value.button
244
244
  ])
245
245
  }, [
246
- (s(), u("svg", {
246
+ (o(), u("svg", {
247
247
  class: m(c.value.icon),
248
248
  fill: "none",
249
249
  stroke: "currentColor",
250
250
  viewBox: "0 0 24 24"
251
- }, h[6] || (h[6] = [
251
+ }, y[6] || (y[6] = [
252
252
  d("path", {
253
253
  "stroke-linecap": "round",
254
254
  "stroke-linejoin": "round",
@@ -258,11 +258,11 @@ const Se = /* @__PURE__ */ S({
258
258
  ]), 2))
259
259
  ], 10, Ue),
260
260
  d("div", Oe, [
261
- (s(!0), u(B, null, R(T.value, (k) => (s(), u(B, { key: k }, [
262
- k === "..." ? (s(), u("span", {
261
+ (o(!0), u(B, null, R(T.value, (k) => (o(), u(B, { key: k }, [
262
+ k === "..." ? (o(), u("span", {
263
263
  key: 0,
264
264
  class: m(["font-medium", c.value.button, r.value.ellipsis])
265
- }, " ... ", 2)) : (s(), u("button", {
265
+ }, " ... ", 2)) : (o(), u("button", {
266
266
  key: 1,
267
267
  onClick: (F) => D(k),
268
268
  class: m([
@@ -270,11 +270,11 @@ const Se = /* @__PURE__ */ S({
270
270
  c.value.button,
271
271
  k === p.page ? r.value.buttonActive : r.value.button
272
272
  ])
273
- }, y(k), 11, Je))
273
+ }, h(k), 11, Je))
274
274
  ], 64))), 128))
275
275
  ]),
276
276
  d("button", {
277
- onClick: h[1] || (h[1] = (k) => D(p.page + 1)),
277
+ onClick: y[1] || (y[1] = (k) => D(p.page + 1)),
278
278
  disabled: p.page >= i.value,
279
279
  class: m([
280
280
  "relative font-medium rounded-md",
@@ -282,12 +282,12 @@ const Se = /* @__PURE__ */ S({
282
282
  p.page >= i.value ? r.value.buttonDisabled : r.value.button
283
283
  ])
284
284
  }, [
285
- (s(), u("svg", {
285
+ (o(), u("svg", {
286
286
  class: m(c.value.icon),
287
287
  fill: "none",
288
288
  stroke: "currentColor",
289
289
  viewBox: "0 0 24 24"
290
- }, h[7] || (h[7] = [
290
+ }, y[7] || (y[7] = [
291
291
  d("path", {
292
292
  "stroke-linecap": "round",
293
293
  "stroke-linejoin": "round",
@@ -308,7 +308,10 @@ const Se = /* @__PURE__ */ S({
308
308
  }, Xe = ["checked", "indeterminate"], Ye = ["onClick"], Ze = { class: "flex items-center justify-between" }, et = {
309
309
  key: 0,
310
310
  class: "ml-1 text-xs"
311
- }, tt = { key: 1 }, at = ["onClick"], rt = ["checked", "onChange"], lt = ["onClick"], ce = /* @__PURE__ */ S({
311
+ }, tt = {
312
+ key: 1,
313
+ class: "w-[100px]"
314
+ }, at = ["onClick"], rt = ["checked", "onChange"], lt = ["onClick"], nt = { class: "text-center" }, ce = /* @__PURE__ */ S({
312
315
  name: "DataTable",
313
316
  __name: "DataTable",
314
317
  props: {
@@ -317,11 +320,12 @@ const Se = /* @__PURE__ */ S({
317
320
  api: {},
318
321
  router: {},
319
322
  tableStyle: { default: "min-width: 50rem" },
320
- tableClass: { default: "min-w-full divide-y divide-gray-200 dark:divide-gray-700" },
321
- tableClassWrapper: {},
322
323
  size: { default: "medium" },
323
324
  theme: { default: "light" },
324
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: "" },
325
329
  classTr: { default: "" },
326
330
  classTd: { default: "" },
327
331
  classTh: { default: "" },
@@ -338,7 +342,7 @@ const Se = /* @__PURE__ */ S({
338
342
  },
339
343
  emits: ["update:page", "update:selectedRows", "row-click", "sort"],
340
344
  setup(b, { emit: a }) {
341
- const e = b, c = a, r = w(e.selectedRows || []), o = w([]), i = w([]), _ = w([]), $ = w(!1), T = w(null), D = w(e.router), p = ve(), h = f(() => p.action);
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);
342
346
  function k(t) {
343
347
  if (D.value) {
344
348
  D.value.push(t);
@@ -349,10 +353,10 @@ const Se = /* @__PURE__ */ S({
349
353
  const F = f(() => {
350
354
  if (e.api)
351
355
  return i.value;
352
- if (e.sortable && o.value.length > 0) {
356
+ if (e.sortable && s.value.length > 0) {
353
357
  const t = [...e.rows];
354
358
  return t.sort((v, l) => {
355
- for (const g of o.value) {
359
+ for (const g of s.value) {
356
360
  if (!g.direction)
357
361
  return 0;
358
362
  const n = v[g.field], x = l[g.field];
@@ -378,22 +382,22 @@ const Se = /* @__PURE__ */ S({
378
382
  q.value ? r.value = [] : r.value = [...F.value], c("update:selectedRows", [...r.value]);
379
383
  }, me = (t) => {
380
384
  if (!e.sortable) return;
381
- const v = o.value.findIndex((g) => g.field === t);
385
+ const v = s.value.findIndex((g) => g.field === t);
382
386
  if (v >= 0) {
383
- const g = o.value[v];
384
- g.direction === "asc" ? g.direction = "desc" : g.direction === "desc" && o.value.splice(v, 1);
387
+ const g = s.value[v];
388
+ g.direction === "asc" ? g.direction = "desc" : g.direction === "desc" && s.value.splice(v, 1);
385
389
  } else
386
- o.value.unshift({
390
+ s.value.unshift({
387
391
  field: t,
388
392
  direction: "asc"
389
393
  });
390
- const l = o.value.filter((g) => g.direction).map((g) => ({
394
+ const l = s.value.filter((g) => g.direction).map((g) => ({
391
395
  name: g.field,
392
396
  asc: g.direction === "asc"
393
397
  }));
394
398
  c("sort", l), e.api && H();
395
- }, be = (t) => o.value.find((l) => l.field === t)?.direction === "asc", he = (t) => {
396
- const v = o.value.find((l) => l.field === t);
399
+ }, be = (t) => s.value.find((l) => l.field === t)?.direction === "asc", ye = (t) => {
400
+ const v = s.value.find((l) => l.field === t);
397
401
  if (!v)
398
402
  return "↑↓";
399
403
  switch (v.direction) {
@@ -406,7 +410,7 @@ const Se = /* @__PURE__ */ S({
406
410
  default:
407
411
  return "↕️";
408
412
  }
409
- }, K = (t) => e.sortable && t.sortable !== !1, ye = (t) => {
413
+ }, K = (t) => e.sortable && t.sortable !== !1, he = (t) => {
410
414
  e.clickable && c("row-click", t);
411
415
  }, V = (t, v) => {
412
416
  const l = v[t.name];
@@ -425,7 +429,7 @@ const Se = /* @__PURE__ */ S({
425
429
  const n = `${t.name}${g}`;
426
430
  return v[n] ? v[n] : null;
427
431
  }).find((g) => g) || l;
428
- }, ae = (t) => t.width ? t.width === "w-full" ? "w-full" : typeof t.width == "string" ? t.width : typeof t.width == "number" ? `w-${t.width}` : "" : "", 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), oe = f(() => e.api ? E.value : X.value), C = f(() => {
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(() => {
429
433
  const { theme: t } = e;
430
434
  return t === "dark" ? {
431
435
  container: "dark",
@@ -477,8 +481,8 @@ const Se = /* @__PURE__ */ S({
477
481
  $.value = !0, T.value = null;
478
482
  try {
479
483
  const t = new URL(e.api, window.location.origin);
480
- if (t.searchParams.set("page", le.value.toString()), t.searchParams.set("limit", ne.value.toString()), o.value.length > 0) {
481
- const g = o.value.filter((n) => n.direction).map((n) => `${n.field}:${n.direction}`).join(",");
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(",");
482
486
  g && t.searchParams.set("sort", g);
483
487
  }
484
488
  const v = await fetch(t.toString());
@@ -495,7 +499,7 @@ const Se = /* @__PURE__ */ S({
495
499
  }
496
500
  const xe = (t) => {
497
501
  e.api ? M.value = t : (Q.value = t, c("update:page", t)), e.api && H();
498
- }, ke = f(() => e.showPagination && oe.value > 0), W = f(() => ({
502
+ }, ke = f(() => e.showPagination && se.value > 0), W = f(() => ({
499
503
  small: {
500
504
  header: "px-3 py-2 text-xs",
501
505
  cell: "px-3 py-2 text-xs"
@@ -518,7 +522,7 @@ const Se = /* @__PURE__ */ S({
518
522
  Ce("registerColumn", (t, v) => {
519
523
  Z.value.push(t), v && t.slotName && (U.value[t.name] = v);
520
524
  });
521
- const se = f(() => {
525
+ const oe = f(() => {
522
526
  const t = _e.value || [], v = [], l = p.default?.();
523
527
  if (l) {
524
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) => {
@@ -547,32 +551,32 @@ const Se = /* @__PURE__ */ S({
547
551
  }
548
552
  return t.length > 0 ? (console.log("Using default columns:", t.length), t) : [];
549
553
  }), we = (t = "text") => ue[t] || ue.text;
550
- return (t, v) => (s(), u("div", {
554
+ return (t, v) => (o(), u("div", {
551
555
  class: m(["w-full", C.value.container])
552
556
  }, [
553
- $.value || e.loading ? (s(), u("div", Ge, [
557
+ $.value || e.loading ? (o(), u("div", Ge, [
554
558
  d("div", Ke, [
555
559
  v[0] || (v[0] = d("div", { class: "animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600" }, null, -1)),
556
560
  d("span", {
557
561
  class: m(C.value.loading)
558
562
  }, "Loading...", 2)
559
563
  ])
560
- ])) : T.value ? (s(), u("div", {
564
+ ])) : T.value ? (o(), u("div", {
561
565
  key: 1,
562
566
  class: m(["text-center py-8", C.value.error])
563
- }, y(T.value), 3)) : !e.loading && F.value.length > 0 ? (s(), u("div", Qe, [
567
+ }, h(T.value), 3)) : !e.loading && F.value.length > 0 ? (o(), u("div", Qe, [
564
568
  d("div", {
565
- class: m(t.tableClassWrapper ? t.tableClassWrapper : "relative w-full overflow-auto")
569
+ class: m(t.classWrapper ? t.classWrapper : "relative w-full overflow-auto")
566
570
  }, [
567
571
  d("table", {
568
- class: m(t.tableClass),
572
+ class: m(t.classTable),
569
573
  style: de(t.tableStyle)
570
574
  }, [
571
575
  d("thead", {
572
576
  class: m(C.value.thead)
573
577
  }, [
574
578
  d("tr", null, [
575
- t.selectable ? (s(), u("th", {
579
+ t.selectable ? (o(), u("th", {
576
580
  key: 0,
577
581
  class: m(["text-left font-medium uppercase tracking-wider", C.value.th, W.value.header, e.classTh, "w-12"])
578
582
  }, [
@@ -584,46 +588,47 @@ const Se = /* @__PURE__ */ S({
584
588
  class: m(["h-4 w-4 focus:ring-blue-500 rounded", C.value.checkbox])
585
589
  }, null, 42, Xe)
586
590
  ], 2)) : j("", !0),
587
- (s(!0), u(B, null, R(se.value.filter((l) => !l.hidden), (l) => (s(), u("th", {
591
+ (o(!0), u(B, null, R(oe.value.filter((l) => !l.hidden), (l) => (o(), u("th", {
588
592
  key: l.name,
589
593
  class: m([
590
- "text-left font-medium uppercase tracking-wider",
591
- C.value.th,
592
- W.value.header,
593
- e.classTh,
594
594
  l.align ? `text-${l.align}` : "",
595
595
  K(l) ? ["cursor-pointer", C.value.thHover] : "",
596
596
  ae(l)
597
- ]),
597
+ ].concat(
598
+ e.classTh || [
599
+ "text-left font-medium uppercase tracking-wider",
600
+ C.value.th,
601
+ W.value.header
602
+ ]
603
+ )),
598
604
  onClick: (g) => K(l) ? me(l.name) : void 0
599
605
  }, [
600
606
  d("div", Ze, [
601
- d("span", null, y(l.ua || l.header || l.name), 1),
602
- K(l) ? (s(), u("span", et, [
607
+ d("span", null, h(l.ua || l.header || l.name), 1),
608
+ K(l) ? (o(), u("span", et, [
603
609
  pe(t.$slots, "sort", {
604
610
  asc: be(l.name)
605
611
  }, () => [
606
- L(y(he(l.name)), 1)
612
+ L(h(ye(l.name)), 1)
607
613
  ])
608
614
  ])) : j("", !0)
609
615
  ])
610
616
  ], 10, Ye))), 128)),
611
- h.value ? (s(), u("th", tt, "Дії")) : j("", !0)
617
+ y.value ? (o(), u("th", tt, "Дії")) : j("", !0)
612
618
  ])
613
619
  ], 2),
614
620
  d("tbody", {
615
- class: m(C.value.tbody)
621
+ class: m(t.classTbody || C.value.tbody)
616
622
  }, [
617
- (s(!0), u(B, null, R(F.value, (l, g) => (s(), u("tr", {
623
+ (o(!0), u(B, null, R(F.value, (l, g) => (o(), u("tr", {
618
624
  key: g,
619
- class: m([
625
+ class: m(e.classTr || [
620
626
  C.value.tr,
621
- e.classTr,
622
627
  e.clickable ? "cursor-pointer" : ""
623
628
  ]),
624
- onClick: (n) => e.clickable ? ye(l) : void 0
629
+ onClick: (n) => e.clickable ? he(l) : void 0
625
630
  }, [
626
- t.selectable ? (s(), u("td", {
631
+ t.selectable ? (o(), u("td", {
627
632
  key: 0,
628
633
  class: m(["whitespace-nowrap", C.value.td, W.value.cell, e.classTd, "w-12"])
629
634
  }, [
@@ -634,32 +639,31 @@ const Se = /* @__PURE__ */ S({
634
639
  class: m(["h-4 w-4 focus:ring-blue-500 rounded", C.value.checkbox])
635
640
  }, null, 42, rt)
636
641
  ], 2)) : j("", !0),
637
- (s(!0), u(B, null, R(se.value.filter((n) => !n.hidden), (n) => (s(), u("td", {
642
+ (o(!0), u(B, null, R(oe.value.filter((n) => !n.hidden), (n) => (o(), u("td", {
638
643
  key: n.name,
639
- class: m([
644
+ class: m(e.classTd || [
640
645
  "whitespace-nowrap",
641
646
  C.value.td,
642
647
  W.value.cell,
643
- e.classTd,
644
648
  n.align ? `text-${n.align}` : "",
645
649
  ae(n)
646
650
  ])
647
651
  }, [
648
- n.action && h.value ? (s(), P(J(h.value), {
652
+ n.action && y.value ? (o(), P(J(y.value), {
649
653
  key: 0,
650
654
  row: l,
651
655
  value: V(n, l)
652
- }, null, 8, ["row", "value"])) : n.slotName && U.value[n.name] ? (s(), P(J(U.value[n.name]), {
656
+ }, null, 8, ["row", "value"])) : n.slotName && U.value[n.name] ? (o(), P(J(U.value[n.name]), {
653
657
  key: 1,
654
658
  data: l,
655
659
  value: V(n, l),
656
660
  row: l,
657
661
  column: n
658
- }, null, 8, ["data", "value", "row", "column"])) : n.link ? (s(), u("a", {
662
+ }, null, 8, ["data", "value", "row", "column"])) : n.link ? (o(), u("a", {
659
663
  key: 2,
660
664
  class: m(t.classLink || "hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),
661
665
  onClick: (x) => k(n.link.replace("{id}", l.id))
662
- }, y(V(n, l)), 11, lt)) : (s(), P(J(we(n.format)), {
666
+ }, h(V(n, l)), 11, lt)) : (o(), P(J(we(n.format)), {
663
667
  key: 3,
664
668
  value: V(n, l),
665
669
  row: l,
@@ -667,8 +671,8 @@ const Se = /* @__PURE__ */ S({
667
671
  href: n.link
668
672
  }, null, 8, ["value", "row", "column", "href"]))
669
673
  ], 2))), 128)),
670
- d("td", null, [
671
- h.value ? (s(), P(J(h.value), {
674
+ d("td", nt, [
675
+ y.value ? (o(), P(J(y.value), {
672
676
  key: 0,
673
677
  row: l
674
678
  }, null, 8, ["row"])) : j("", !0)
@@ -678,22 +682,22 @@ const Se = /* @__PURE__ */ S({
678
682
  ], 6)
679
683
  ], 2)
680
684
  ])) : j("", !0),
681
- ke.value && !$.value && !e.loading && !T.value ? (s(), P(fe, {
685
+ ke.value && !$.value && !e.loading && !T.value ? (o(), P(fe, {
682
686
  key: 3,
683
687
  page: le.value,
684
688
  limit: ne.value,
685
- total: oe.value,
689
+ total: se.value,
686
690
  theme: e.theme,
687
691
  size: e.size,
688
692
  "onUpdate:page": xe
689
693
  }, null, 8, ["page", "limit", "total", "theme", "size"])) : j("", !0),
690
- !$.value && !e.loading && !T.value && F.value.length === 0 ? (s(), u("div", {
694
+ !$.value && !e.loading && !T.value && F.value.length === 0 ? (o(), u("div", {
691
695
  key: 4,
692
696
  class: m(["text-center py-8", C.value.empty])
693
697
  }, " Дані відсутні ", 2)) : j("", !0)
694
698
  ], 2));
695
699
  }
696
- }), nt = { style: { display: "none" } }, ot = /* @__PURE__ */ S({
700
+ }), st = { style: { display: "none" } }, ot = /* @__PURE__ */ S({
697
701
  name: "Column",
698
702
  __name: "Column",
699
703
  props: {
@@ -719,25 +723,25 @@ const Se = /* @__PURE__ */ S({
719
723
  if (c) {
720
724
  const {
721
725
  field: r,
722
- name: o,
726
+ name: s,
723
727
  header: i,
724
728
  label: _,
725
729
  format: $,
726
730
  slotName: T,
727
731
  link: D,
728
732
  action: p,
729
- getCellData: h,
733
+ getCellData: y,
730
734
  suffix: k,
731
735
  ...F
732
736
  } = a, N = {
733
- name: r || o || "",
737
+ name: r || s || "",
734
738
  ua: i || _ || "",
735
739
  format: $ || "text",
736
740
  slotName: T || (e.body ? "body" : void 0),
737
741
  // Use 'body' slot if it exists
738
742
  link: D,
739
743
  action: p,
740
- getCellData: h,
744
+ getCellData: y,
741
745
  suffix: k,
742
746
  ...F
743
747
  };
@@ -745,11 +749,11 @@ const Se = /* @__PURE__ */ S({
745
749
  const G = e.body;
746
750
  c(N, G);
747
751
  }
748
- }), (r, o) => (s(), u("div", nt, [
752
+ }), (r, s) => (o(), u("div", st, [
749
753
  pe(r.$slots, "body", { data: {} })
750
754
  ]));
751
755
  }
752
- }), st = { class: "mt-4" }, it = { class: "text-sm text-gray-600 dark:text-gray-300" }, ut = /* @__PURE__ */ S({
756
+ }), it = { class: "mt-4" }, ut = { class: "text-sm text-gray-600 dark:text-gray-300" }, ct = /* @__PURE__ */ S({
753
757
  __name: "SelectionInfo",
754
758
  props: {
755
759
  selectedRows: {},
@@ -757,11 +761,11 @@ const Se = /* @__PURE__ */ S({
757
761
  },
758
762
  setup(b) {
759
763
  const a = b, e = f(() => a.selectedRows.length);
760
- return (c, r) => (s(), u("div", st, [
761
- d("div", it, " Обрано: " + y(e.value) + " з " + y(c.totalCount) + " записів ", 1)
764
+ return (c, r) => (o(), u("div", it, [
765
+ d("div", ut, " Обрано: " + h(e.value) + " з " + h(c.totalCount) + " записів ", 1)
762
766
  ]));
763
767
  }
764
- }), ct = { class: "mt-4" }, dt = { class: "border-b border-gray-200 dark:border-gray-700" }, vt = { class: "-mb-px flex space-x-8" }, gt = ["onClick"], pt = { class: "mt-4" }, ft = { class: "bg-gray-900 rounded-lg overflow-hidden" }, mt = { class: "flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700" }, bt = { class: "text-sm text-gray-300" }, ht = ["onClick"], yt = { class: "p-4 text-sm text-gray-100 overflow-x-auto" }, xt = /* @__PURE__ */ S({
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({
765
769
  __name: "CodeTabs",
766
770
  props: {
767
771
  tabs: {},
@@ -771,35 +775,35 @@ const Se = /* @__PURE__ */ S({
771
775
  const a = b, e = w(a.defaultTab || a.tabs[0]?.id || ""), c = async (r) => {
772
776
  try {
773
777
  await navigator.clipboard.writeText(r), console.log("Код скопійовано!");
774
- } catch (o) {
775
- console.error("Помилка копіювання:", o);
778
+ } catch (s) {
779
+ console.error("Помилка копіювання:", s);
776
780
  }
777
781
  };
778
- return (r, o) => (s(), u("div", ct, [
779
- d("div", dt, [
780
- d("nav", vt, [
781
- (s(!0), u(B, null, R(r.tabs, (i) => (s(), u("button", {
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", {
782
786
  key: i.id,
783
787
  onClick: (_) => e.value = i.id,
784
788
  class: m([
785
789
  "py-2 px-1 border-b-2 font-medium text-sm transition-colors",
786
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"
787
791
  ])
788
- }, y(i.label), 11, gt))), 128))
792
+ }, h(i.label), 11, pt))), 128))
789
793
  ])
790
794
  ]),
791
- d("div", pt, [
792
- (s(!0), u(B, null, R(r.tabs, (i) => Te((s(), u("div", {
795
+ d("div", ft, [
796
+ (o(!0), u(B, null, R(r.tabs, (i) => Te((o(), u("div", {
793
797
  key: i.id
794
798
  }, [
795
- d("div", ft, [
796
- d("div", mt, [
797
- d("span", bt, y(i.label), 1),
799
+ d("div", mt, [
800
+ d("div", bt, [
801
+ d("span", yt, h(i.label), 1),
798
802
  d("button", {
799
803
  onClick: (_) => c(i.content),
800
804
  class: "text-gray-400 hover:text-white transition-colors",
801
805
  title: "Копіювати код"
802
- }, o[0] || (o[0] = [
806
+ }, s[0] || (s[0] = [
803
807
  d("svg", {
804
808
  class: "w-4 h-4",
805
809
  fill: "none",
@@ -815,8 +819,8 @@ const Se = /* @__PURE__ */ S({
815
819
  ], -1)
816
820
  ]), 8, ht)
817
821
  ]),
818
- d("pre", yt, [
819
- d("code", null, y(i.content), 1)
822
+ d("pre", xt, [
823
+ d("code", null, h(i.content), 1)
820
824
  ])
821
825
  ])
822
826
  ])), [
@@ -827,12 +831,12 @@ const Se = /* @__PURE__ */ S({
827
831
  }
828
832
  });
829
833
  ce.install = function(a) {
830
- a.component("DataTable", ce), a.component("Column", ot), a.component("Pagination", fe), a.component("SelectionInfo", ut), a.component("CodeTabs", xt);
834
+ a.component("DataTable", ce), a.component("Column", ot), a.component("Pagination", fe), a.component("SelectionInfo", ct), a.component("CodeTabs", kt);
831
835
  };
832
836
  export {
833
837
  ze as ArrayFormat,
834
838
  Be as BadgeFormat,
835
- xt as CodeTabs,
839
+ kt as CodeTabs,
836
840
  ot as Column,
837
841
  ce as DataTable,
838
842
  De as DateFormat,
@@ -840,7 +844,7 @@ export {
840
844
  Se as NumberFormat,
841
845
  fe as Pagination,
842
846
  Ne as SelectFormat,
843
- ut as SelectionInfo,
847
+ ct as SelectionInfo,
844
848
  Ae as TextFormat,
845
849
  ce as default,
846
850
  ue 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,l)=>(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,l)=>(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(l=>l.text||l).join(","):t?.text||t);return(l,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value),1))}}),G=((u,o)=>{const t=u.__vccOpts||u;for(const[c,l]of o)t[c]=l;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 l=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(l.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=l=>l?typeof l=="object"&&l.name?l.name:typeof l=="string"||typeof l=="number"?String(l):JSON.stringify(l):"";return(l,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:""),l=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:l.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(l=>l.text||l).filter((l,s)=>s<2).join(", ")+(t.length>2?` +${t.length-2}`:""):t?.text||t);return(l,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]),l=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",l.value.container])},[e.createElementVNode("div",me,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center text-sm",l.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?l.value.buttonDisabled:l.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,l.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?l.value.buttonActive:l.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?l.value.buttonDisabled:l.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},Ve=["onClick"],Se=["checked","onChange"],De=["onClick"],$=e.defineComponent({name:"DataTable",__name:"DataTable",props:{rows:{default:()=>[]},columns:{default:()=>[]},api:{},router:{},tableStyle:{default:"min-width: 50rem"},tableClass:{default:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},tableClassWrapper:{},size:{default:"medium"},theme:{default:"light"},loading:{type:Boolean,default:!1},classTr:{default:""},classTd:{default:""},classTh:{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,l=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,n)=>{for(const m of s.value){if(!m.direction)return 0;const r=d[m.field],y=n[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 T=m.direction==="desc"?-E:E;if(T!==0)return T}return 0}),a}return t.rows});e.watch(()=>t.selectedRows,a=>{l.value=a||[]});const w=a=>l.value.some(d=>d===a),te=a=>{const d=l.value.findIndex(n=>n===a);d>-1?l.value.splice(d,1):l.value.push(a),c("update:selectedRows",[...l.value])},j=e.computed(()=>_.value.length>0&&l.value.length===_.value.length),N=e.computed(()=>l.value.length>0&&l.value.length<_.value.length),L=()=>{j.value?l.value=[]:l.value=[..._.value],c("update:selectedRows",[...l.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 n=s.value.filter(m=>m.direction).map(m=>({name:m.field,asc:m.direction==="asc"}));c("sort",n),t.api&&v()},Oe=a=>s.value.find(n=>n.field===a)?.direction==="asc",qe=a=>{const d=s.value.find(n=>n.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)},V=(a,d)=>{const n=d[a.name];if(t.getCellData||a.getCellData){const m=a.getCellData||t.getCellData;if(m){const r={name:a.name,row:d,value:n};return m(r)}}return["_data","_text"].map(m=>{const r=`${a.name}${m}`;return d[r]?d[r]:null}).find(m=>m)||n},ae=a=>a.width?a.width==="w-full"?"w-full":typeof a.width=="string"?a.width:typeof a.width=="number"?`w-${a.width}`:"":"",P=e.ref(t.page),oe=e.ref(t.limit),M=e.ref(t.total),S=e.ref(1),H=e.ref(10),D=e.ref(0),le=e.computed(()=>t.api?S.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 v(){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 n=await d.json();n.rows&&Array.isArray(n.rows)&&(i.value=n.rows),n.columns&&Array.isArray(n.columns)&&(h.value=n.columns),n.total!==void 0&&(t.api?D.value=n.total:M.value=n.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?S.value=a:(P.value=a,c("update:page",a)),t.api&&v()},Ke=e.computed(()=>t.showPagination&&re.value>0),z=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&&(S.value=t.page),t.limit&&(H.value=t.limit),t.total&&(D.value=t.total),v())}),e.watch(()=>t.api,a=>{a&&(S.value=t.page||1,H.value=t.limit||10,D.value=t.total||0,v())});const Qe=e.computed(()=>t.api?h.value:t.columns),W=e.ref([]),F=e.ref({});e.provide("registerColumn",(a,d)=>{W.value.push(a),d&&a.slotName&&(F.value[a.name]=d)});const se=e.computed(()=>{const a=Qe.value||[],d=[],n=p.default?.();if(n){const m=n.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||"",T=y.header||y.label||"",ie=r.children&&r.children.body,U={name:E,ua:T,format:y.format||"text",slotName:ie?"body":void 0,...y};return ie&&U.name&&(F.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]||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.tableClassWrapper?a.tableClassWrapper:"relative w-full overflow-auto")},[e.createElementVNode("table",{class:e.normalizeClass(a.tableClass),style:e.normalizeStyle(a.tableStyle)},[e.createElementVNode("thead",{class:e.normalizeClass(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,z.value.header,t.classTh,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:j.value,indeterminate:N.value,onChange:L,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(n=>!n.hidden),n=>(e.openBlock(),e.createElementBlock("th",{key:n.name,class:e.normalizeClass(["text-left font-medium uppercase tracking-wider",k.value.th,z.value.header,t.classTh,n.align?`text-${n.align}`:"",R(n)?["cursor-pointer",k.value.thHover]:"",ae(n)]),onClick:m=>R(n)?Ue(n.name):void 0},[e.createElementVNode("div",Ee,[e.createElementVNode("span",null,e.toDisplayString(n.ua||n.header||n.name),1),R(n)?(e.openBlock(),e.createElementBlock("span",$e,[e.renderSlot(a.$slots,"sort",{asc:Oe(n.name)},()=>[e.createTextVNode(e.toDisplayString(qe(n.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(k.value.tbody)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,(n,m)=>(e.openBlock(),e.createElementBlock("tr",{key:m,class:e.normalizeClass([k.value.tr,t.classTr,t.clickable?"cursor-pointer":""]),onClick:r=>t.clickable?Je(n):void 0},[a.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["whitespace-nowrap",k.value.td,z.value.cell,t.classTd,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:w(n),onChange:r=>te(n),class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Se)],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(["whitespace-nowrap",k.value.td,z.value.cell,t.classTd,r.align?`text-${r.align}`:"",ae(r)])},[r.action&&g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,row:n,value:V(r,n)},null,8,["row","value"])):r.slotName&&F.value[r.name]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(F.value[r.name]),{key:1,data:n,value:V(r,n),row:n,column:r},null,8,["data","value","row","column"])):r.link?(e.openBlock(),e.createElementBlock("a",{key:2,class:e.normalizeClass(a.classLink||"hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),onClick:y=>b(r.link.replace("{id}",n.id))},e.toDisplayString(V(r,n)),11,De)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Xe(r.format)),{key:3,value:V(r,n),row:n,column:r,href:r.link},null,8,["value","row","column","href"]))],2))),128)),e.createElementVNode("td",null,[g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,row:n},null,8,["row"])):e.createCommentVNode("",!0)])],10,Ve))),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))}}),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:l,name:s,header:i,label:h,format:x,slotName:C,link:B,action:p,getCellData:g,suffix:b,..._}=o,N={name:l||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:",N);const L=t.body;c(N,L)}}),(l,s)=>(e.openBlock(),e.createElementBlock("div",ve,[e.renderSlot(l.$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,l)=>(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",Fe," Обрано: "+e.toDisplayString(t.value)+" з "+e.toDisplayString(c.totalCount)+" записів ",1)]))}}),Te={class:"mt-4"},Ae={class:"border-b border-gray-200 dark:border-gray-700"},Ie={class:"-mb-px flex space-x-8"},je=["onClick"],Le={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 l=>{try{await navigator.clipboard.writeText(l),console.log("Код скопійовано!")}catch(s){console.error("Помилка копіювання:",s)}};return(l,s)=>(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",Ae,[e.createElementVNode("nav",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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))])]))}});$.install=function(o){o.component("DataTable",$),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=$,f.DateFormat=q,f.LinkFormat=Q,f.NumberFormat=O,f.Pagination=I,f.SelectFormat=X,f.SelectionInfo=Z,f.TextFormat=J,f.default=$,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,l)=>(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,l)=>(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(l=>l.text||l).join(","):t?.text||t);return(l,s)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(c.value),1))}}),G=((u,o)=>{const t=u.__vccOpts||u;for(const[c,l]of o)t[c]=l;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 l=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(l.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=l=>l?typeof l=="object"&&l.name?l.name:typeof l=="string"||typeof l=="number"?String(l):JSON.stringify(l):"";return(l,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:""),l=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:l.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(l=>l.text||l).filter((l,s)=>s<2).join(", ")+(t.length>2?` +${t.length-2}`:""):t?.text||t);return(l,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]),l=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",l.value.container])},[e.createElementVNode("div",me,[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center text-sm",l.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?l.value.buttonDisabled:l.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,l.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?l.value.buttonActive:l.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?l.value.buttonDisabled:l.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]"},Ve=["onClick"],Se=["checked","onChange"],De=["onClick"],ve={class:"text-center"},$=e.defineComponent({name:"DataTable",__name:"DataTable",props:{rows:{default:()=>[]},columns:{default:()=>[]},api:{},router:{},tableStyle:{default:"min-width: 50rem"},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:""},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,l=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,n)=>{for(const m of s.value){if(!m.direction)return 0;const r=d[m.field],y=n[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=>{l.value=a||[]});const w=a=>l.value.some(d=>d===a),te=a=>{const d=l.value.findIndex(n=>n===a);d>-1?l.value.splice(d,1):l.value.push(a),c("update:selectedRows",[...l.value])},j=e.computed(()=>_.value.length>0&&l.value.length===_.value.length),N=e.computed(()=>l.value.length>0&&l.value.length<_.value.length),L=()=>{j.value?l.value=[]:l.value=[..._.value],c("update:selectedRows",[...l.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 n=s.value.filter(m=>m.direction).map(m=>({name:m.field,asc:m.direction==="asc"}));c("sort",n),t.api&&v()},qe=a=>s.value.find(n=>n.field===a)?.direction==="asc",Je=a=>{const d=s.value.find(n=>n.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)},V=(a,d)=>{const n=d[a.name];if(t.getCellData||a.getCellData){const m=a.getCellData||t.getCellData;if(m){const r={name:a.name,row:d,value:n};return m(r)}}return["_data","_text"].map(m=>{const r=`${a.name}${m}`;return d[r]?d[r]:null}).find(m=>m)||n},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),S=e.ref(1),H=e.ref(10),D=e.ref(0),le=e.computed(()=>t.api?S.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 v(){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 n=await d.json();n.rows&&Array.isArray(n.rows)&&(i.value=n.rows),n.columns&&Array.isArray(n.columns)&&(h.value=n.columns),n.total!==void 0&&(t.api?D.value=n.total:M.value=n.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?S.value=a:(P.value=a,c("update:page",a)),t.api&&v()},Qe=e.computed(()=>t.showPagination&&re.value>0),T=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&&(S.value=t.page),t.limit&&(H.value=t.limit),t.total&&(D.value=t.total),v())}),e.watch(()=>t.api,a=>{a&&(S.value=t.page||1,H.value=t.limit||10,D.value=t.total||0,v())});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=[],n=p.default?.();if(n){const m=n.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]||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(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,T.value.header,t.classTh,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:j.value,indeterminate:N.value,onChange:L,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(n=>!n.hidden),n=>(e.openBlock(),e.createElementBlock("th",{key:n.name,class:e.normalizeClass([n.align?`text-${n.align}`:"",R(n)?["cursor-pointer",k.value.thHover]:"",ae(n)].concat(t.classTh||["text-left font-medium uppercase tracking-wider",k.value.th,T.value.header])),onClick:m=>R(n)?Oe(n.name):void 0},[e.createElementVNode("div",Ee,[e.createElementVNode("span",null,e.toDisplayString(n.ua||n.header||n.name),1),R(n)?(e.openBlock(),e.createElementBlock("span",$e,[e.renderSlot(a.$slots,"sort",{asc:qe(n.name)},()=>[e.createTextVNode(e.toDisplayString(Je(n.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,(n,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(n):void 0},[a.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["whitespace-nowrap",k.value.td,T.value.cell,t.classTd,"w-12"])},[e.createElementVNode("input",{type:"checkbox",checked:w(n),onChange:r=>te(n),class:e.normalizeClass(["h-4 w-4 focus:ring-blue-500 rounded",k.value.checkbox])},null,42,Se)],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,T.value.cell,r.align?`text-${r.align}`:"",ae(r)])},[r.action&&g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,row:n,value:V(r,n)},null,8,["row","value"])):r.slotName&&z.value[r.name]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z.value[r.name]),{key:1,data:n,value:V(r,n),row:n,column:r},null,8,["data","value","row","column"])):r.link?(e.openBlock(),e.createElementBlock("a",{key:2,class:e.normalizeClass(a.classLink||"hover:text-blue-900 cursor-pointer text-blue-700 hover:underline"),onClick:y=>b(r.link.replace("{id}",n.id))},e.toDisplayString(V(r,n)),11,De)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(Ye(r.format)),{key:3,value:V(r,n),row:n,column:r,href:r.link},null,8,["value","row","column","href"]))],2))),128)),e.createElementVNode("td",ve,[g.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.value),{key:0,row:n},null,8,["row"])):e.createCommentVNode("",!0)])],10,Ve))),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))}}),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:l,name:s,header:i,label:h,format:x,slotName:C,link:B,action:p,getCellData:g,suffix:b,..._}=o,N={name:l||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:",N);const L=t.body;c(N,L)}}),(l,s)=>(e.openBlock(),e.createElementBlock("div",Te,[e.renderSlot(l.$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,l)=>(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"},je={class:"-mb-px flex space-x-8"},Le=["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 l=>{try{await navigator.clipboard.writeText(l),console.log("Код скопійовано!")}catch(s){console.error("Помилка копіювання:",s)}};return(l,s)=>(e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",Ie,[e.createElementVNode("nav",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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))])]))}});$.install=function(o){o.component("DataTable",$),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=$,f.DateFormat=q,f.LinkFormat=Q,f.NumberFormat=O,f.Pagination=I,f.SelectFormat=X,f.SelectionInfo=Z,f.TextFormat=J,f.default=$,f.formatComponents=A,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/table",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "description": "A Vue 3 data table component with advanced features",
5
5
  "main": "dist/index.mjs",
6
6
  "files": [