@webilio-xyz/webilio-vue 1.1.17 → 1.1.18

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.
Files changed (2) hide show
  1. package/dist/Table.js +293 -261
  2. package/package.json +1 -1
package/dist/Table.js CHANGED
@@ -1,78 +1,78 @@
1
- import { computed as w, openBlock as l, createElementBlock as i, renderSlot as k, createElementVNode as v, normalizeClass as f, createVNode as A, unref as $, Fragment as p, toDisplayString as y, renderList as x, createCommentVNode as N, createTextVNode as M, createBlock as B, resolveDynamicComponent as Y, ref as V, watch as R } from "vue";
2
- import { usePage as J, router as Q } from "@inertiajs/vue3";
3
- import { C as W, a as T } from "./ColumnDefinition-DMr-A-Xx.js";
4
- import { AkChevronLeft as _, AkChevronRight as ee } from "@kalimahapps/vue-icons";
5
- import { e as te, b as z, g as S } from "./_baseIteratee-B9n7IWT3.js";
6
- import { i as E, a as ne, k as ae } from "./_baseEach-BeZ5ghU7.js";
7
- import { a as se } from "./isObject-BD_iszZg.js";
8
- import { t as oe, d as le } from "./debounce-Cx8aOQWk.js";
9
- import { f as re } from "./forEach-DN2We3cJ.js";
10
- var q = 1 / 0, ie = 17976931348623157e292;
11
- function L(e) {
1
+ import { computed as x, ref as T, openBlock as s, createElementBlock as o, renderSlot as h, createElementVNode as g, normalizeClass as v, createVNode as F, unref as $, Fragment as y, toDisplayString as C, renderList as P, createCommentVNode as M, withDirectives as Y, withKeys as J, vModelText as Q, nextTick as W, createTextVNode as K, createBlock as q, resolveDynamicComponent as _, watch as B } from "vue";
2
+ import { usePage as ee, router as te } from "@inertiajs/vue3";
3
+ import { C as ne, a as L } from "./ColumnDefinition-DMr-A-Xx.js";
4
+ import { AkChevronLeft as ae, AkChevronRight as se, AkArrowForward as oe } from "@kalimahapps/vue-icons";
5
+ import { e as le, b as E, g as V } from "./_baseIteratee-B9n7IWT3.js";
6
+ import { i as G, a as re, k as ie } from "./_baseEach-BeZ5ghU7.js";
7
+ import { a as ue } from "./isObject-BD_iszZg.js";
8
+ import { t as ce, d as de } from "./debounce-Cx8aOQWk.js";
9
+ import { f as ve } from "./forEach-DN2We3cJ.js";
10
+ var z = 1 / 0, ge = 17976931348623157e292;
11
+ function H(e) {
12
12
  if (!e)
13
13
  return e === 0 ? e : 0;
14
- if (e = oe(e), e === q || e === -q) {
14
+ if (e = ce(e), e === z || e === -z) {
15
15
  var n = e < 0 ? -1 : 1;
16
- return n * ie;
16
+ return n * ge;
17
17
  }
18
18
  return e === e ? e : 0;
19
19
  }
20
- function ue(e) {
21
- var n = L(e), a = n % 1;
20
+ function me(e) {
21
+ var n = H(e), a = n % 1;
22
22
  return n === n ? a ? n - a : n : 0;
23
23
  }
24
- function ce(e, n, a, t) {
25
- for (var c = e.length, r = a + -1; ++r < c; )
26
- if (n(e[r], r, e))
27
- return r;
24
+ function fe(e, n, a, t) {
25
+ for (var i = e.length, l = a + -1; ++l < i; )
26
+ if (n(e[l], l, e))
27
+ return l;
28
28
  return -1;
29
29
  }
30
- function de(e, n, a) {
31
- if (!se(a))
30
+ function pe(e, n, a) {
31
+ if (!ue(a))
32
32
  return !1;
33
33
  var t = typeof n;
34
- return (t == "number" ? E(a) && ne(n, a.length) : t == "string" && n in a) ? te(a[n], e) : !1;
34
+ return (t == "number" ? G(a) && re(n, a.length) : t == "string" && n in a) ? le(a[n], e) : !1;
35
35
  }
36
- function ve(e) {
36
+ function ye(e) {
37
37
  return function(n, a, t) {
38
- var c = Object(n);
39
- if (!E(n)) {
40
- var r = z(a);
41
- n = ae(n), a = function(d) {
42
- return r(c[d], d, c);
38
+ var i = Object(n);
39
+ if (!G(n)) {
40
+ var l = E(a);
41
+ n = ie(n), a = function(d) {
42
+ return l(i[d], d, i);
43
43
  };
44
44
  }
45
- var g = e(n, a, t);
46
- return g > -1 ? c[r ? n[g] : g] : void 0;
45
+ var m = e(n, a, t);
46
+ return m > -1 ? i[l ? n[m] : m] : void 0;
47
47
  };
48
48
  }
49
- var ge = Math.max;
50
- function H(e, n, a) {
49
+ var be = Math.max;
50
+ function D(e, n, a) {
51
51
  var t = e == null ? 0 : e.length;
52
52
  if (!t)
53
53
  return -1;
54
- var c = a == null ? 0 : ue(a);
55
- return c < 0 && (c = ge(t + c, 0)), ce(e, z(n), c);
54
+ var i = a == null ? 0 : me(a);
55
+ return i < 0 && (i = be(t + i, 0)), fe(e, E(n), i);
56
56
  }
57
- var fe = ve(H), me = Math.ceil, pe = Math.max;
58
- function ye(e, n, a, t) {
59
- for (var c = -1, r = pe(me((n - e) / (a || 1)), 0), g = Array(r); r--; )
60
- g[++c] = e, e += a;
61
- return g;
57
+ var Ce = ye(D), ke = Math.ceil, we = Math.max;
58
+ function he(e, n, a, t) {
59
+ for (var i = -1, l = we(ke((n - e) / (a || 1)), 0), m = Array(l); l--; )
60
+ m[++i] = e, e += a;
61
+ return m;
62
62
  }
63
- function be(e) {
63
+ function $e(e) {
64
64
  return function(n, a, t) {
65
- return t && typeof t != "number" && de(n, a, t) && (a = t = void 0), n = L(n), a === void 0 ? (a = n, n = 0) : a = L(a), t = t === void 0 ? n < a ? 1 : -1 : L(t), ye(n, a, t);
65
+ return t && typeof t != "number" && pe(n, a, t) && (a = t = void 0), n = H(n), a === void 0 ? (a = n, n = 0) : a = H(a), t = t === void 0 ? n < a ? 1 : -1 : H(t), he(n, a, t);
66
66
  };
67
67
  }
68
- var P = be();
69
- const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], he = ["onClick"], $e = ["onClick"], xe = ["onClick"], Se = {
68
+ var R = $e();
69
+ const xe = { class: "flex space-x-1.5" }, Se = ["disabled"], Pe = ["onClick"], Te = ["onClick"], Ve = ["onClick"], Ae = ["onClick"], Ne = {
70
70
  key: 0,
71
71
  class: "wv-pagination-dot py-2"
72
- }, Pe = ["onClick"], Te = ["onClick"], Ve = {
72
+ }, Re = ["onClick"], Me = ["onClick"], Fe = {
73
73
  key: 0,
74
74
  class: "wv-pagination-dot py-2"
75
- }, Re = ["disabled"], K = {
75
+ }, Le = ["disabled"], Be = ["max"], O = {
76
76
  __name: "TablePaginationComponent",
77
77
  props: {
78
78
  modelValue: {
@@ -94,125 +94,157 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
94
94
  buttonPageClass: {
95
95
  type: String,
96
96
  default: ""
97
+ },
98
+ goto: {
99
+ type: Boolean,
100
+ default: !0
97
101
  }
98
102
  },
99
103
  emits: ["update:modelValue"],
100
104
  setup(e, { emit: n }) {
101
- const a = e, t = w(() => a.modelValue), c = w(() => `${a.buttonClass} ${a.buttonLrClass}`), r = w(() => `${a.buttonClass} ${a.buttonPageClass}`), g = n, d = (u) => {
102
- g("update:modelValue", u);
105
+ const a = e, t = x(() => a.modelValue), i = x(() => `${a.buttonClass} ${a.buttonLrClass}`), l = x(() => `${a.buttonClass} ${a.buttonPageClass}`), m = n, d = (b) => {
106
+ m("update:modelValue", b);
107
+ }, f = T(!1), c = T(t.value), k = T(null), A = async () => {
108
+ var b, p;
109
+ c.value = t.value, f.value = !0, await W(), (b = k.value) == null || b.focus(), (p = k.value) == null || p.select();
110
+ }, N = () => {
111
+ const b = Math.min(Math.max(Math.round(Number(c.value)) || 1, 1), a.lastPage);
112
+ d(b), f.value = !1;
103
113
  };
104
- return (u, o) => (l(), i("div", Ce, [
105
- k(u.$slots, "before", {}, () => [
106
- v("button", {
107
- class: f([c.value, "wv-pagination-button wv-pagination-before"]),
114
+ return (b, p) => (s(), o("div", xe, [
115
+ h(b.$slots, "before", {}, () => [
116
+ g("button", {
117
+ class: v([i.value, "wv-pagination-button wv-pagination-before"]),
108
118
  disabled: t.value === 1,
109
- onClick: o[0] || (o[0] = (s) => d(t.value - 1))
119
+ onClick: p[0] || (p[0] = (r) => d(t.value - 1))
110
120
  }, [
111
- A($(_), { class: "w-5 h-5" })
112
- ], 10, ke)
121
+ F($(ae), { class: "w-5 h-5" })
122
+ ], 10, Se)
113
123
  ]),
114
- t.value === 1 ? (l(), i(p, { key: 0 }, [
115
- k(u.$slots, "current", {}, () => [
116
- v("button", {
117
- class: f([r.value, "wv-pagination-button wv-pagination-current"]),
124
+ t.value === 1 ? (s(), o(y, { key: 0 }, [
125
+ h(b.$slots, "current", {}, () => [
126
+ g("button", {
127
+ class: v([l.value, "wv-pagination-button wv-pagination-current"]),
118
128
  disabled: ""
119
- }, y(t.value), 3)
129
+ }, C(t.value), 3)
120
130
  ]),
121
- k(u.$slots, "next", {}, () => [
122
- e.lastPage < 5 ? (l(!0), i(p, { key: 0 }, x($(P)(t.value + 1, e.lastPage + 1), (s) => (l(), i("button", {
123
- class: f([r.value, "wv-pagination-button wv-pagination-next"]),
124
- key: s,
125
- onClick: (C) => d(s)
126
- }, y(s), 11, we))), 128)) : (l(), i(p, { key: 1 }, [
127
- (l(!0), i(p, null, x($(P)(t.value + 1, t.value + 3), (s) => (l(), i("button", {
128
- class: f([r.value, "wv-pagination-button wv-pagination-next"]),
129
- key: s,
130
- onClick: (C) => d(s)
131
- }, y(s), 11, he))), 128)),
132
- o[6] || (o[6] = v("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
133
- v("button", {
134
- class: f([r.value, "wv-pagination-button wv-pagination-next"]),
135
- onClick: o[1] || (o[1] = (s) => d(e.lastPage))
136
- }, y(e.lastPage), 3)
131
+ h(b.$slots, "next", {}, () => [
132
+ e.lastPage < 5 ? (s(!0), o(y, { key: 0 }, P($(R)(t.value + 1, e.lastPage + 1), (r) => (s(), o("button", {
133
+ class: v([l.value, "wv-pagination-button wv-pagination-next"]),
134
+ key: r,
135
+ onClick: (u) => d(r)
136
+ }, C(r), 11, Pe))), 128)) : (s(), o(y, { key: 1 }, [
137
+ (s(!0), o(y, null, P($(R)(t.value + 1, t.value + 3), (r) => (s(), o("button", {
138
+ class: v([l.value, "wv-pagination-button wv-pagination-next"]),
139
+ key: r,
140
+ onClick: (u) => d(r)
141
+ }, C(r), 11, Te))), 128)),
142
+ p[7] || (p[7] = g("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
143
+ g("button", {
144
+ class: v([l.value, "wv-pagination-button wv-pagination-next"]),
145
+ onClick: p[1] || (p[1] = (r) => d(e.lastPage))
146
+ }, C(e.lastPage), 3)
137
147
  ], 64))
138
148
  ])
139
- ], 64)) : t.value === e.lastPage ? (l(), i(p, { key: 1 }, [
140
- k(u.$slots, "previous", {}, () => [
141
- e.lastPage < 5 ? (l(!0), i(p, { key: 0 }, x($(P)(1, e.lastPage), (s) => (l(), i("button", {
142
- class: f([r.value, "wv-pagination-button wv-pagination-previous"]),
143
- key: s,
144
- onClick: (C) => d(s)
145
- }, y(s), 11, $e))), 128)) : (l(), i(p, { key: 1 }, [
146
- v("button", {
147
- class: f([r.value, "wv-pagination-button wv-pagination-previous"]),
148
- onClick: o[2] || (o[2] = (s) => d(1))
149
+ ], 64)) : t.value === e.lastPage ? (s(), o(y, { key: 1 }, [
150
+ h(b.$slots, "previous", {}, () => [
151
+ e.lastPage < 5 ? (s(!0), o(y, { key: 0 }, P($(R)(1, e.lastPage), (r) => (s(), o("button", {
152
+ class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
153
+ key: r,
154
+ onClick: (u) => d(r)
155
+ }, C(r), 11, Ve))), 128)) : (s(), o(y, { key: 1 }, [
156
+ g("button", {
157
+ class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
158
+ onClick: p[2] || (p[2] = (r) => d(1))
149
159
  }, " 1 ", 2),
150
- o[7] || (o[7] = v("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
151
- (l(!0), i(p, null, x($(P)(t.value - 2, t.value), (s) => (l(), i("button", {
152
- class: f([r.value, "wv-pagination-button wv-pagination-previous"]),
153
- key: s,
154
- onClick: (C) => d(s)
155
- }, y(s), 11, xe))), 128))
160
+ p[8] || (p[8] = g("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
161
+ (s(!0), o(y, null, P($(R)(t.value - 2, t.value), (r) => (s(), o("button", {
162
+ class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
163
+ key: r,
164
+ onClick: (u) => d(r)
165
+ }, C(r), 11, Ae))), 128))
156
166
  ], 64))
157
167
  ]),
158
- k(u.$slots, "current", {}, () => [
159
- v("button", {
160
- class: f([r.value, "wv-pagination-button wv-pagination-current"]),
168
+ h(b.$slots, "current", {}, () => [
169
+ g("button", {
170
+ class: v([l.value, "wv-pagination-button wv-pagination-current"]),
161
171
  disabled: ""
162
- }, y(t.value), 3)
172
+ }, C(t.value), 3)
163
173
  ])
164
- ], 64)) : (l(), i(p, { key: 2 }, [
165
- k(u.$slots, "previous", {}, () => [
166
- t.value > 2 ? (l(), i(p, { key: 0 }, [
167
- v("button", {
168
- class: f([r.value, "wv-pagination-button wv-pagination-previous"]),
169
- onClick: o[3] || (o[3] = (s) => d(1))
174
+ ], 64)) : (s(), o(y, { key: 2 }, [
175
+ h(b.$slots, "previous", {}, () => [
176
+ t.value > 2 ? (s(), o(y, { key: 0 }, [
177
+ g("button", {
178
+ class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
179
+ onClick: p[3] || (p[3] = (r) => d(1))
170
180
  }, " 1 ", 2),
171
- t.value > 3 ? (l(), i("span", Se, "...")) : N("", !0)
172
- ], 64)) : N("", !0),
173
- (l(!0), i(p, null, x($(P)(t.value - 1, t.value), (s) => (l(), i("button", {
174
- class: f([r.value, "wv-pagination-button wv-pagination-previous"]),
175
- key: s,
176
- onClick: (C) => d(s)
177
- }, y(s), 11, Pe))), 128))
181
+ t.value > 3 ? (s(), o("span", Ne, "...")) : M("", !0)
182
+ ], 64)) : M("", !0),
183
+ (s(!0), o(y, null, P($(R)(t.value - 1, t.value), (r) => (s(), o("button", {
184
+ class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
185
+ key: r,
186
+ onClick: (u) => d(r)
187
+ }, C(r), 11, Re))), 128))
178
188
  ]),
179
- k(u.$slots, "current", {}, () => [
180
- v("button", {
181
- class: f([r.value, "wv-pagination-button wv-pagination-current"]),
189
+ h(b.$slots, "current", {}, () => [
190
+ g("button", {
191
+ class: v([l.value, "wv-pagination-button wv-pagination-current"]),
182
192
  disabled: ""
183
- }, y(t.value), 3)
193
+ }, C(t.value), 3)
184
194
  ]),
185
- k(u.$slots, "next", {}, () => [
186
- (l(!0), i(p, null, x($(P)(t.value + 1, t.value + 2), (s) => (l(), i("button", {
187
- class: f([r.value, "wv-pagination-button wv-pagination-next"]),
188
- key: s,
189
- onClick: (C) => d(s)
190
- }, y(s), 11, Te))), 128)),
191
- t.value < e.lastPage - 1 ? (l(), i(p, { key: 0 }, [
192
- t.value < e.lastPage - 2 ? (l(), i("span", Ve, "...")) : N("", !0),
193
- v("button", {
194
- class: f([r.value, "wv-pagination-button wv-pagination-next"]),
195
- onClick: o[4] || (o[4] = (s) => d(e.lastPage))
196
- }, y(e.lastPage), 3)
197
- ], 64)) : N("", !0)
195
+ h(b.$slots, "next", {}, () => [
196
+ (s(!0), o(y, null, P($(R)(t.value + 1, t.value + 2), (r) => (s(), o("button", {
197
+ class: v([l.value, "wv-pagination-button wv-pagination-next"]),
198
+ key: r,
199
+ onClick: (u) => d(r)
200
+ }, C(r), 11, Me))), 128)),
201
+ t.value < e.lastPage - 1 ? (s(), o(y, { key: 0 }, [
202
+ t.value < e.lastPage - 2 ? (s(), o("span", Fe, "...")) : M("", !0),
203
+ g("button", {
204
+ class: v([l.value, "wv-pagination-button wv-pagination-next"]),
205
+ onClick: p[4] || (p[4] = (r) => d(e.lastPage))
206
+ }, C(e.lastPage), 3)
207
+ ], 64)) : M("", !0)
198
208
  ])
199
209
  ], 64)),
200
- k(u.$slots, "after", {}, () => [
201
- v("button", {
202
- class: f([c.value, "wv-pagination-button wv-pagination-after"]),
210
+ h(b.$slots, "after", {}, () => [
211
+ g("button", {
212
+ class: v([i.value, "wv-pagination-button wv-pagination-after"]),
203
213
  disabled: t.value === e.lastPage,
204
- onClick: o[5] || (o[5] = (s) => d(t.value + 1))
214
+ onClick: p[5] || (p[5] = (r) => d(t.value + 1))
205
215
  }, [
206
- A($(ee), { class: "w-5 h-5" })
207
- ], 10, Re)
208
- ])
216
+ F($(se), { class: "w-5 h-5" })
217
+ ], 10, Le)
218
+ ]),
219
+ e.goto ? (s(), o(y, { key: 3 }, [
220
+ f.value ? Y((s(), o("input", {
221
+ key: 0,
222
+ ref_key: "gotoInput",
223
+ ref: k,
224
+ "onUpdate:modelValue": p[6] || (p[6] = (r) => c.value = r),
225
+ type: "number",
226
+ min: 1,
227
+ max: e.lastPage,
228
+ class: "wv-pagination-goto-input",
229
+ onKeyup: J(N, ["enter"]),
230
+ onBlur: N
231
+ }, null, 40, Be)), [
232
+ [Q, c.value]
233
+ ]) : (s(), o("button", {
234
+ key: 1,
235
+ class: v([i.value, "wv-pagination-button wv-pagination-goto"]),
236
+ onClick: A
237
+ }, [
238
+ F($(oe), { class: "w-5 h-5" })
239
+ ], 2))
240
+ ], 64)) : M("", !0)
209
241
  ]));
210
242
  }
211
- }, O = {
243
+ }, I = {
212
244
  __name: "TableCellComponent",
213
245
  props: {
214
246
  column: {
215
- type: W,
247
+ type: ne,
216
248
  default: () => {
217
249
  }
218
250
  },
@@ -223,24 +255,24 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
223
255
  }
224
256
  },
225
257
  setup(e) {
226
- const n = e, a = w(() => !!n.column.formatter && typeof n.column.formatter == "function"), t = w(() => typeof n.column.render == "function"), c = w(() => a.value ? n.column.formatter(n.data, n.column) : t.value ? n.column.render(n.data, n.column) : S(n.data, n.column.key, null)), r = w(() => [
258
+ const n = e, a = x(() => !!n.column.formatter && typeof n.column.formatter == "function"), t = x(() => typeof n.column.render == "function"), i = x(() => a.value ? n.column.formatter(n.data, n.column) : t.value ? n.column.render(n.data, n.column) : V(n.data, n.column.key, null)), l = x(() => [
227
259
  `w-${n.column.size ?? "auto"}`,
228
260
  n.column.className
229
261
  ]);
230
- return (g, d) => (l(), i("td", {
231
- class: f(["px-6 py-4 whitespace-nowrap text-sm font-medium", r.value])
262
+ return (m, d) => (s(), o("td", {
263
+ class: v(["px-6 py-4 whitespace-nowrap text-sm font-medium", l.value])
232
264
  }, [
233
- t.value ? (l(), B(Y(c.value), { key: 1 })) : (l(), i(p, { key: 0 }, [
234
- M(y(c.value), 1)
265
+ t.value ? (s(), q(_(i.value), { key: 1 })) : (s(), o(y, { key: 0 }, [
266
+ K(C(i.value), 1)
235
267
  ], 64))
236
268
  ], 2));
237
269
  }
238
- }, Ne = { class: "border-0 border-b" }, j = {
270
+ }, He = { class: "border-0 border-b" }, j = {
239
271
  __name: "TableRowComponent",
240
272
  props: {
241
273
  columns: {
242
- type: T,
243
- default: () => new T()
274
+ type: L,
275
+ default: () => new L()
244
276
  },
245
277
  data: {
246
278
  type: Object,
@@ -249,15 +281,15 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
249
281
  }
250
282
  },
251
283
  setup(e) {
252
- return (n, a) => (l(), i("tr", Ne, [
253
- (l(!0), i(p, null, x(e.columns.columns, (t) => (l(), B(O, {
284
+ return (n, a) => (s(), o("tr", He, [
285
+ (s(!0), o(y, null, P(e.columns.columns, (t) => (s(), q(I, {
254
286
  key: t.key,
255
287
  column: t,
256
288
  data: e.data
257
289
  }, null, 8, ["column", "data"]))), 128))
258
290
  ]));
259
291
  }
260
- }, Ae = ["onClick"], Le = {
292
+ }, De = ["onClick"], Ke = {
261
293
  key: 0,
262
294
  class: "ms-1",
263
295
  xmlns: "http://www.w3.org/2000/svg",
@@ -265,11 +297,11 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
265
297
  height: "15",
266
298
  fill: "#000000",
267
299
  viewBox: "0 0 256 256"
268
- }, Fe = ["d"], G = {
300
+ }, qe = ["d"], U = {
269
301
  __name: "TableHeaderComponent",
270
302
  props: {
271
303
  columns: {
272
- type: T,
304
+ type: L,
273
305
  default: () => []
274
306
  },
275
307
  trClass: {
@@ -287,9 +319,9 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
287
319
  },
288
320
  emits: ["setSort", "addSort"],
289
321
  setup(e, { emit: n }) {
290
- const a = e, t = w(() => a.columns.columns.filter((u) => u.visible).sort((u, o) => u.order >= o.order ? 1 : -1)), c = n, r = (u) => u.sortable ? fe(a.sorting, (o) => o.key === u.key) : !1, g = (u) => {
291
- var o;
292
- switch ((o = r(u)) == null ? void 0 : o.direction) {
322
+ const a = e, t = x(() => a.columns.columns.filter((f) => f.visible).sort((f, c) => f.order >= c.order ? 1 : -1)), i = n, l = (f) => f.sortable ? Ce(a.sorting, (c) => c.key === f.key) : !1, m = (f) => {
323
+ var c;
324
+ switch ((c = l(f)) == null ? void 0 : c.direction) {
293
325
  case "asc":
294
326
  return "asc";
295
327
  case "desc":
@@ -297,43 +329,43 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
297
329
  default:
298
330
  return !1;
299
331
  }
300
- }, d = (u, o) => {
301
- if (!u.sortable)
332
+ }, d = (f, c) => {
333
+ if (!f.sortable)
302
334
  return "";
303
- o.shiftKey ? c("addSort", u) : c("setSort", u);
335
+ c.shiftKey ? i("addSort", f) : i("setSort", f);
304
336
  };
305
- return (u, o) => (l(), i("thead", {
306
- class: f(e.headerClass)
337
+ return (f, c) => (s(), o("thead", {
338
+ class: v(e.headerClass)
307
339
  }, [
308
- v("tr", {
309
- class: f(e.trClass)
340
+ g("tr", {
341
+ class: v(e.trClass)
310
342
  }, [
311
- (l(!0), i(p, null, x(t.value, (s) => (l(), i("th", {
312
- key: s.key,
343
+ (s(!0), o(y, null, P(t.value, (k) => (s(), o("th", {
344
+ key: k.key,
313
345
  scope: "col",
314
- class: f(["px-6 py-3 text-start", [s.thClassName, { "cursor-pointer": s.sortable }]])
346
+ class: v(["px-6 py-3 text-start", [k.thClassName, { "cursor-pointer": k.sortable }]])
315
347
  }, [
316
- v("div", {
348
+ g("div", {
317
349
  class: "flex items-center",
318
- onClick: (C) => d(s, C)
350
+ onClick: (A) => d(k, A)
319
351
  }, [
320
- M(y(s.name) + " ", 1),
321
- g(s) ? (l(), i("svg", Le, [
322
- v("path", {
323
- d: g(s) === "asc" ? "M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z" : "M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"
324
- }, null, 8, Fe)
325
- ])) : N("", !0)
326
- ], 8, Ae)
352
+ K(C(k.name) + " ", 1),
353
+ m(k) ? (s(), o("svg", Ke, [
354
+ g("path", {
355
+ d: m(k) === "asc" ? "M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z" : "M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"
356
+ }, null, 8, qe)
357
+ ])) : M("", !0)
358
+ ], 8, De)
327
359
  ], 2))), 128))
328
360
  ], 2)
329
361
  ], 2));
330
362
  }
331
- }, He = { class: "overflow-x-auto table w-full relative" }, Me = { key: 1 }, Be = ["colspan"], De = { class: "flex items-center justify-center" }, qe = { key: 2 }, ze = ["colspan"], I = {
363
+ }, ze = { class: "overflow-x-auto table w-full relative" }, Ee = { key: 1 }, Ge = ["colspan"], Oe = { class: "flex items-center justify-center" }, Ie = { key: 2 }, je = ["colspan"], Z = {
332
364
  __name: "TableComponent",
333
365
  props: {
334
366
  columns: {
335
- type: T,
336
- default: () => new T()
367
+ type: L,
368
+ default: () => new L()
337
369
  },
338
370
  data: {
339
371
  type: Array,
@@ -359,37 +391,37 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
359
391
  emits: ["setSort", "addSort"],
360
392
  setup(e, { emit: n }) {
361
393
  const a = n;
362
- return (t, c) => {
363
- var r;
364
- return l(), i("table", He, [
365
- A(G, {
394
+ return (t, i) => {
395
+ var l;
396
+ return s(), o("table", ze, [
397
+ F(U, {
366
398
  columns: e.columns,
367
399
  headerClass: e.headerClass,
368
400
  trClass: e.trHeadClass,
369
401
  sorting: e.sorting,
370
- onSetSort: c[0] || (c[0] = (g) => a("setSort", g)),
371
- onAddSort: c[1] || (c[1] = (g) => a("addSort", g))
402
+ onSetSort: i[0] || (i[0] = (m) => a("setSort", m)),
403
+ onAddSort: i[1] || (i[1] = (m) => a("addSort", m))
372
404
  }, null, 8, ["columns", "headerClass", "trClass", "sorting"]),
373
- (r = e.data) != null && r.length && !e.isLoading ? (l(!0), i(p, { key: 0 }, x(e.data, (g, d) => (l(), B(j, {
405
+ (l = e.data) != null && l.length && !e.isLoading ? (s(!0), o(y, { key: 0 }, P(e.data, (m, d) => (s(), q(j, {
374
406
  key: d,
375
407
  columns: e.columns,
376
- data: g,
377
- class: f(g == null ? void 0 : g.trClassName)
378
- }, null, 8, ["columns", "data", "class"]))), 128)) : e.isLoading ? (l(), i("tr", Me, [
379
- v("td", {
408
+ data: m,
409
+ class: v(m == null ? void 0 : m.trClassName)
410
+ }, null, 8, ["columns", "data", "class"]))), 128)) : e.isLoading ? (s(), o("tr", Ee, [
411
+ g("td", {
380
412
  colspan: e.columns.columns.length,
381
413
  class: "text-center py-4"
382
414
  }, [
383
- v("div", De, [
384
- M(y(t.$t("text.loading")) + " ", 1),
385
- c[2] || (c[2] = v("div", { class: "mx-1" }, [
386
- v("svg", {
415
+ g("div", Oe, [
416
+ K(C(t.$t("text.loading")) + " ", 1),
417
+ i[2] || (i[2] = g("div", { class: "mx-1" }, [
418
+ g("svg", {
387
419
  class: "animate-spin h-5 w-5",
388
420
  fill: "none",
389
421
  viewBox: "0 0 24 24",
390
422
  xmlns: "http://www.w3.org/2000/svg"
391
423
  }, [
392
- v("circle", {
424
+ g("circle", {
393
425
  class: "opacity-25",
394
426
  cx: "12",
395
427
  cy: "12",
@@ -397,7 +429,7 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
397
429
  stroke: "currentColor",
398
430
  "stroke-width": "4"
399
431
  }),
400
- v("path", {
432
+ g("path", {
401
433
  class: "opacity-75",
402
434
  d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
403
435
  fill: "currentColor"
@@ -405,21 +437,21 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
405
437
  ])
406
438
  ], -1))
407
439
  ])
408
- ], 8, Be)
409
- ])) : (l(), i("tr", qe, [
410
- v("td", {
440
+ ], 8, Ge)
441
+ ])) : (s(), o("tr", Ie, [
442
+ g("td", {
411
443
  colspan: e.columns.columns.length,
412
444
  class: "text-center pt-4 text-gray-500"
413
- }, y(t.$t("text.no_results")), 9, ze)
445
+ }, C(t.$t("text.no_results")), 9, je)
414
446
  ]))
415
447
  ]);
416
448
  };
417
449
  }
418
- }, Ee = { class: "flex-grow flex" }, Ke = { class: "py-2" }, Oe = {
450
+ }, Ue = { class: "flex-grow flex" }, Ze = { class: "py-2" }, Xe = {
419
451
  __name: "InertiaTableComponent",
420
452
  props: {
421
453
  columns: {
422
- type: T,
454
+ type: L,
423
455
  required: !0
424
456
  },
425
457
  additionalFilters: {
@@ -460,30 +492,30 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
460
492
  }
461
493
  },
462
494
  setup(e, { expose: n }) {
463
- const a = J(), t = e, c = V({}), r = V(S(a.props, t.inertiaKey, {})), g = w(() => S(r.value, "data", [])), d = V(!1), u = V(S(r, "current_page", t.currentPage)), o = V(t.sorting);
495
+ const a = ee(), t = e, i = T({}), l = T(V(a.props, t.inertiaKey, {})), m = x(() => V(l.value, "data", [])), d = T(!1), f = T(V(l, "current_page", t.currentPage)), c = T(t.sorting);
464
496
  n({
465
- getData: C
497
+ getData: A
466
498
  });
467
- const s = w(() => {
468
- let m = {};
469
- return re(o.value, (b, h) => {
470
- m[h] = { key: b.key, direction: b.direction };
471
- }), m;
499
+ const k = x(() => {
500
+ let u = {};
501
+ return ve(c.value, (w, S) => {
502
+ u[S] = { key: w.key, direction: w.direction };
503
+ }), u;
472
504
  });
473
- function C() {
474
- d.value = !0, Q.get(
505
+ function A() {
506
+ d.value = !0, te.get(
475
507
  window.location.pathname,
476
508
  {
477
- filters: { ...t.additionalFilters, ...c.value },
478
- sort: s.value,
479
- page: u.value
509
+ filters: { ...t.additionalFilters, ...i.value },
510
+ sort: k.value,
511
+ page: f.value
480
512
  },
481
513
  {
482
514
  preserveState: !0,
483
515
  preserveScroll: !0,
484
516
  only: [t.inertiaKey],
485
- onSuccess: (m) => {
486
- r.value = S(m.props, t.inertiaKey);
517
+ onSuccess: (u) => {
518
+ l.value = V(u.props, t.inertiaKey);
487
519
  },
488
520
  onFinish: () => {
489
521
  d.value = !1;
@@ -491,31 +523,31 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
491
523
  }
492
524
  );
493
525
  }
494
- const F = le(C, 500);
495
- R(t, F, { deep: !0 }), R(u, F), R(() => t.currentPage, (m) => {
496
- u.value = m;
497
- }), R(() => t.sorting, (m) => {
498
- o.value = m;
499
- }), R(o, () => {
500
- F();
526
+ const N = de(A, 500);
527
+ B(t, N, { deep: !0 }), B(f, N), B(() => t.currentPage, (u) => {
528
+ f.value = u;
529
+ }), B(() => t.sorting, (u) => {
530
+ c.value = u;
531
+ }), B(c, () => {
532
+ N();
501
533
  }, { deep: !0 });
502
- const Z = (m) => {
503
- let b = D(m), h = H(o.value, (X) => X.key === m.key);
504
- b ? h > -1 ? o.value[h] = {
505
- key: m.key,
506
- direction: b
507
- } : o.value.push({
508
- key: m.key,
509
- direction: b
510
- }) : delete o.value[h];
511
- }, U = (m) => {
512
- o.value = [{
513
- key: m.key,
514
- direction: D(m)
534
+ const b = (u) => {
535
+ let w = r(u), S = D(c.value, (X) => X.key === u.key);
536
+ w ? S > -1 ? c.value[S] = {
537
+ key: u.key,
538
+ direction: w
539
+ } : c.value.push({
540
+ key: u.key,
541
+ direction: w
542
+ }) : delete c.value[S];
543
+ }, p = (u) => {
544
+ c.value = [{
545
+ key: u.key,
546
+ direction: r(u)
515
547
  }];
516
- }, D = (m) => {
517
- let b = H(o.value, (h) => h.key === m.key);
518
- switch (S(o.value, `${b}.direction`, !1)) {
548
+ }, r = (u) => {
549
+ let w = D(c.value, (S) => S.key === u.key);
550
+ switch (V(c.value, `${w}.direction`, !1)) {
519
551
  case "asc":
520
552
  return "desc";
521
553
  case "desc":
@@ -524,50 +556,50 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
524
556
  return "asc";
525
557
  }
526
558
  };
527
- return (m, b) => (l(), i(p, null, [
528
- A(I, {
559
+ return (u, w) => (s(), o(y, null, [
560
+ F(Z, {
529
561
  ref: "props.table",
530
562
  "is-loading": d.value,
531
- data: g.value,
563
+ data: m.value,
532
564
  columns: e.columns,
533
- class: f(e.tableClass),
565
+ class: v(e.tableClass),
534
566
  headerClass: e.headerClass,
535
567
  trHeadClass: e.trHeadClass,
536
- sorting: o.value,
537
- onSetSort: U,
538
- onAddSort: Z
568
+ sorting: c.value,
569
+ onSetSort: p,
570
+ onAddSort: b
539
571
  }, null, 8, ["is-loading", "data", "columns", "class", "headerClass", "trHeadClass", "sorting"]),
540
- k(m.$slots, "pagination", {}, () => [
541
- v("div", {
542
- class: f(["flex items-center", e.footerClass])
572
+ h(u.$slots, "pagination", {}, () => [
573
+ g("div", {
574
+ class: v(["flex items-center", e.footerClass])
543
575
  }, [
544
- v("div", Ee, [
545
- v("span", Ke, y(m.$t("table.nbResults", { total: $(S)(r.value, "total", 0) })), 1)
576
+ g("div", Ue, [
577
+ g("span", Ze, C(u.$t("table.nbResults", { total: $(V)(l.value, "total", 0) })), 1)
546
578
  ]),
547
- A(K, {
548
- "last-page": r.value.last_page,
549
- modelValue: u.value,
550
- "onUpdate:modelValue": b[0] || (b[0] = (h) => u.value = h),
551
- class: f(e.footerClass)
579
+ F(O, {
580
+ "last-page": l.value.last_page,
581
+ modelValue: f.value,
582
+ "onUpdate:modelValue": w[0] || (w[0] = (S) => f.value = S),
583
+ class: v(e.footerClass)
552
584
  }, null, 8, ["last-page", "modelValue", "class"])
553
585
  ], 2)
554
586
  ])
555
587
  ], 64));
556
588
  }
557
- }, We = {
558
- InertiaTableComponent: Oe,
559
- TableComponent: I,
560
- TableCellComponent: O,
589
+ }, st = {
590
+ InertiaTableComponent: Xe,
591
+ TableComponent: Z,
592
+ TableCellComponent: I,
561
593
  TableRowComponent: j,
562
- TableHeaderComponent: G,
563
- TablePaginationComponent: K
594
+ TableHeaderComponent: U,
595
+ TablePaginationComponent: O
564
596
  };
565
597
  export {
566
- Oe as InertiaTableComponent,
567
- O as TableCellComponent,
568
- I as TableComponent,
569
- G as TableHeaderComponent,
570
- K as TablePaginationComponent,
598
+ Xe as InertiaTableComponent,
599
+ I as TableCellComponent,
600
+ Z as TableComponent,
601
+ U as TableHeaderComponent,
602
+ O as TablePaginationComponent,
571
603
  j as TableRowComponent,
572
- We as default
604
+ st as default
573
605
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webilio-xyz/webilio-vue",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host 0.0.0.0",