adverich-kun-ui 0.1.156 → 0.1.158

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.
@@ -1,15 +1,29 @@
1
- import { ref as S, inject as g, onMounted as A, onBeforeUnmount as x, computed as c, createElementBlock as r, openBlock as l, mergeProps as B, withKeys as C, withModifiers as $, createCommentVNode as i, createElementVNode as j, renderSlot as s, createBlock as h, resolveDynamicComponent as y, normalizeClass as k } from "vue";
2
- const E = ["aria-selected", "aria-disabled", "onKeydown"], K = {
1
+ import { ref as A, inject as p, onMounted as C, onBeforeUnmount as $, computed as o, createBlock as f, openBlock as a, resolveDynamicComponent as v, mergeProps as j, withKeys as E, withModifiers as L, withCtx as N, createElementBlock as i, createCommentVNode as r, createElementVNode as R, renderSlot as c, normalizeClass as S, toDisplayString as x } from "vue";
2
+ import "vue-router";
3
+ const K = {
3
4
  key: 0,
4
5
  class: "shrink-0 flex items-center gap-2 me-3"
5
- }, O = ["src"], P = { class: "flex flex-col min-w-0 flex-1" }, R = {
6
+ }, O = ["src"], P = { class: "flex flex-col min-w-0 flex-1" }, D = {
7
+ key: 0,
8
+ class: "font-medium truncate"
9
+ }, F = {
10
+ key: 0,
11
+ class: "text-sm text-gray-500 dark:text-gray-400 truncate"
12
+ }, G = {
6
13
  key: 1,
7
14
  class: "shrink-0 flex items-center gap-2 ms-3"
8
- }, L = ["src"], F = {
15
+ }, M = ["src"], H = {
9
16
  __name: "KunListItem",
10
17
  props: {
11
18
  value: [String, Number, Boolean, Object, Array, null],
12
19
  to: [String, Object],
20
+ href: String,
21
+ tag: {
22
+ type: String,
23
+ default: "li"
24
+ },
25
+ replace: Boolean,
26
+ exact: Boolean,
13
27
  disabled: Boolean,
14
28
  active: Boolean,
15
29
  activeClass: {
@@ -36,41 +50,44 @@ const E = ["aria-selected", "aria-disabled", "onKeydown"], K = {
36
50
  prependIcon: [String, Object, Function],
37
51
  appendIcon: [String, Object, Function],
38
52
  prependAvatar: String,
39
- appendAvatar: String
53
+ appendAvatar: String,
54
+ title: [String, Number, Boolean],
55
+ subtitle: [String, Number, Boolean]
40
56
  },
41
57
  setup(e) {
42
- const n = e, o = S(null), d = g("registerListItemRef", null), a = g("kunListContext", null);
43
- A(() => {
44
- d && o.value && d(o.value);
45
- }), x(() => {
58
+ const n = e, s = A(null), d = p("registerListItemRef", null), l = p("kunListContext", null);
59
+ C(() => {
60
+ d && s.value && d(s.value);
61
+ }), $(() => {
46
62
  d && d(null);
47
63
  });
48
- const v = c(() => {
64
+ const g = (t) => typeof t == "object" || typeof t == "function", I = o(() => !!(n.prependIcon || n.prependAvatar)), w = o(() => !!(n.appendIcon || n.appendAvatar)), m = o(() => {
49
65
  var t;
50
- return ((t = a == null ? void 0 : a.isSelected) == null ? void 0 : t.call(a, n.value)) ?? !1;
51
- }), f = c(() => n.active), I = c(() => !!(n.prependIcon || n.prependAvatar)), w = c(() => !!(n.appendIcon || n.appendAvatar));
52
- function m(t) {
53
- return typeof t == "object" || typeof t == "function";
54
- }
55
- function p() {
56
- var t, u, b;
57
- n.disabled || ((t = o.value) == null || t.dispatchEvent(
66
+ return ((t = l == null ? void 0 : l.isSelected) == null ? void 0 : t.call(l, n.value)) ?? !1;
67
+ }), b = o(() => n.active), h = o(() => !!n.to), B = o(() => !!n.href);
68
+ function y() {
69
+ var t, u, k;
70
+ n.disabled || ((t = s.value) == null || t.dispatchEvent(
58
71
  new CustomEvent("select", {
59
72
  detail: n.value,
60
73
  bubbles: !0
61
74
  })
62
- ), a && n.value !== null && ((u = a.toggleItem) == null || u.call(a, n.value), (b = o.value) == null || b.dispatchEvent(
75
+ ), l && n.value !== null && ((u = l.toggleItem) == null || u.call(l, n.value), (k = s.value) == null || k.dispatchEvent(
63
76
  new CustomEvent("selected", {
64
77
  detail: n.value,
65
78
  bubbles: !0
66
79
  })
67
80
  )));
68
81
  }
69
- return (t, u) => (l(), r("li", B({
82
+ return (t, u) => (a(), f(v(h.value ? "RouterLink" : e.tag), j({
83
+ to: h.value ? e.to : void 0,
84
+ href: B.value ? e.href : void 0,
85
+ replace: e.replace,
86
+ exact: e.exact,
70
87
  ref_key: "liRef",
71
- ref: o,
88
+ ref: s,
72
89
  role: "option",
73
- "aria-selected": v.value || f.value,
90
+ "aria-selected": m.value || b.value,
74
91
  "aria-disabled": e.disabled,
75
92
  tabindex: "-1",
76
93
  class: ["w-full flex", [
@@ -81,54 +98,61 @@ const E = ["aria-selected", "aria-disabled", "onKeydown"], K = {
81
98
  {
82
99
  "cursor-not-allowed opacity-50": e.disabled,
83
100
  [`cursor-pointer ${e.hoverBg}`]: !e.disabled,
84
- [e.activeClass]: v.value || f.value,
101
+ [e.activeClass]: m.value || b.value,
85
102
  "px-4 py-2": !e.noGutters
86
103
  }
87
104
  ]],
88
- onKeydown: C($(p, ["prevent"]), ["enter"]),
89
- onClick: p
90
- }, t.$attrs), [
91
- I.value ? (l(), r("div", K, [
92
- s(t.$slots, "prepend", {}, () => [
93
- e.prependAvatar ? (l(), r("img", {
94
- key: 0,
95
- src: e.prependAvatar,
96
- class: "w-8 h-8 rounded-full"
97
- }, null, 8, O)) : i("", !0),
98
- m(e.prependIcon) ? (l(), h(y(e.prependIcon), {
99
- key: 1,
100
- class: "w-5 h-5"
101
- })) : e.prependIcon ? (l(), r("i", {
102
- key: 2,
103
- class: k([e.prependIcon, "text-xl leading-none"])
104
- }, null, 2)) : i("", !0)
105
- ])
106
- ])) : i("", !0),
107
- j("div", P, [
108
- s(t.$slots, "default", {}, () => [
109
- s(t.$slots, "title"),
110
- s(t.$slots, "subtitle")
111
- ])
105
+ onClick: y,
106
+ onKeydown: E(L(y, ["prevent"]), ["enter"])
107
+ }, t.$attrs), {
108
+ default: N(() => [
109
+ I.value ? (a(), i("div", K, [
110
+ c(t.$slots, "prepend", {}, () => [
111
+ e.prependAvatar ? (a(), i("img", {
112
+ key: 0,
113
+ src: e.prependAvatar,
114
+ class: "w-8 h-8 rounded-full"
115
+ }, null, 8, O)) : r("", !0),
116
+ g(e.prependIcon) ? (a(), f(v(e.prependIcon), {
117
+ key: 1,
118
+ class: "w-5 h-5"
119
+ })) : e.prependIcon ? (a(), i("i", {
120
+ key: 2,
121
+ class: S([e.prependIcon, "text-xl leading-none"])
122
+ }, null, 2)) : r("", !0)
123
+ ])
124
+ ])) : r("", !0),
125
+ R("div", P, [
126
+ c(t.$slots, "default", {}, () => [
127
+ c(t.$slots, "title", {}, () => [
128
+ e.title ? (a(), i("div", D, x(e.title), 1)) : r("", !0)
129
+ ]),
130
+ c(t.$slots, "subtitle", {}, () => [
131
+ e.subtitle ? (a(), i("div", F, x(e.subtitle), 1)) : r("", !0)
132
+ ])
133
+ ])
134
+ ]),
135
+ w.value ? (a(), i("div", G, [
136
+ c(t.$slots, "append", {}, () => [
137
+ e.appendAvatar ? (a(), i("img", {
138
+ key: 0,
139
+ src: e.appendAvatar,
140
+ class: "w-8 h-8 rounded-full"
141
+ }, null, 8, M)) : r("", !0),
142
+ g(e.appendIcon) ? (a(), f(v(e.appendIcon), {
143
+ key: 1,
144
+ class: "w-5 h-5"
145
+ })) : e.appendIcon ? (a(), i("i", {
146
+ key: 2,
147
+ class: S([e.appendIcon, "text-xl leading-none"])
148
+ }, null, 2)) : r("", !0)
149
+ ])
150
+ ])) : r("", !0)
112
151
  ]),
113
- w.value ? (l(), r("div", R, [
114
- s(t.$slots, "append", {}, () => [
115
- e.appendAvatar ? (l(), r("img", {
116
- key: 0,
117
- src: e.appendAvatar,
118
- class: "w-8 h-8 rounded-full"
119
- }, null, 8, L)) : i("", !0),
120
- m(e.appendIcon) ? (l(), h(y(e.appendIcon), {
121
- key: 1,
122
- class: "w-5 h-5"
123
- })) : e.appendIcon ? (l(), r("i", {
124
- key: 2,
125
- class: k([e.appendIcon, "text-xl leading-none"])
126
- }, null, 2)) : i("", !0)
127
- ])
128
- ])) : i("", !0)
129
- ], 16, E));
152
+ _: 3
153
+ }, 16, ["to", "href", "replace", "exact", "aria-selected", "aria-disabled", "class", "onKeydown"]));
130
154
  }
131
155
  };
132
156
  export {
133
- F as default
157
+ H as default
134
158
  };
@@ -1,6 +1,6 @@
1
- import { toRefs as le, ref as oe, watch as ae, computed as B, createElementBlock as a, openBlock as l, mergeProps as b, createCommentVNode as c, createElementVNode as V, renderSlot as i, createBlock as v, unref as s, normalizeClass as j, withDirectives as re, vModelText as ie, normalizeProps as n, guardReactiveProps as u, Fragment as x, createVNode as C, createSlots as ne, renderList as de, withCtx as pe, isRef as ce } from "vue";
1
+ import { toRefs as le, ref as oe, watch as ae, computed as V, createElementBlock as a, openBlock as l, mergeProps as b, createCommentVNode as m, createElementVNode as v, renderSlot as i, createBlock as C, unref as s, normalizeClass as j, withDirectives as re, vModelText as ie, normalizeProps as n, guardReactiveProps as u, Fragment as x, createVNode as w, createSlots as ne, renderList as de, withCtx as pe, isRef as me } from "vue";
2
2
  import { isMobile as z } from "../../../../utils/_platform.js";
3
- import me from "./KunTableHeaders.vue.js";
3
+ import ce from "./KunTableHeaders.vue.js";
4
4
  import ue from "./KunTableFooter.vue.js";
5
5
  import fe from "./KunTableRows.vue.js";
6
6
  import ge from "../../../KunBtn/src/components/KunBtn.vue.js";
@@ -19,10 +19,10 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
19
19
  props: ke(),
20
20
  emits: ["update:page", "update:itemsPerPage", "update:sortBy", "update:selectedItems"],
21
21
  setup(N, { emit: R }) {
22
- const w = R, d = N, f = le(d), {
22
+ const k = R, d = N, f = le(d), {
23
23
  headers: h,
24
- showExpand: k,
25
- showSelect: P,
24
+ showExpand: P,
25
+ showSelect: S,
26
26
  rowClass: U,
27
27
  hideDefaultFooter: D,
28
28
  hideDefaultHeader: I,
@@ -30,30 +30,30 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
30
30
  wrapperClass: M,
31
31
  pageOptions: O,
32
32
  items: W,
33
- searchable: S,
33
+ searchable: $,
34
34
  debounceTime: H
35
- } = f, y = oe(""), { filteredItems: K, setSearch: Q, modalFilter: m, applyColumnFilters: q, clearFilters: G, appliedFilters: J } = we(f, H);
35
+ } = f, y = oe(""), { filteredItems: K, setSearch: Q, modalFilter: c, applyColumnFilters: q, clearFilters: G, appliedFilters: J } = we(f, H);
36
36
  ae(y, (e) => {
37
37
  Q(e);
38
38
  });
39
- const { options: r, paginatedItems: g, updateSort: X } = ve(f, w, K), { isSelected: $, toggleSelect: F, toggleSelectAll: Y, allSelected: Z } = Ce(f, w), { isExpanded: T, toggleExpand: A } = be(), p = B(() => ({
39
+ const { options: r, paginatedItems: g, updateSort: X } = ve(f, k, K), { isSelected: F, toggleSelect: T, toggleSelectAll: Y, allSelected: Z } = Ce(f, k), { isExpanded: A, toggleExpand: E } = be(), p = V(() => ({
40
40
  items: g.value,
41
41
  headers: h.value,
42
42
  page: r.page,
43
43
  itemsPerPage: r.itemsPerPage,
44
- toggleSelect: F,
45
- isSelected: $,
46
- toggleExpand: A,
47
- isExpanded: T,
44
+ toggleSelect: T,
45
+ isSelected: F,
46
+ toggleExpand: E,
47
+ isExpanded: A,
48
48
  sortBy: r.sortBy,
49
49
  hasActions: d.hasActions
50
- })), _ = [Ee, M.value], ee = [Be, L.value], se = B(() => {
50
+ })), _ = [Ee, M.value], ee = [Be, L.value], se = V(() => {
51
51
  var t;
52
52
  let e = ((t = d.headers) == null ? void 0 : t.length) || 0;
53
53
  return d.showSelect && (e += 1), d.showExpand && (e += 1), d.hasActions && (e += 1), e;
54
54
  });
55
55
  return (e, t) => (l(), a("div", b({ class: _ }, e.$attrs, { style: { "user-select": "text" } }), [
56
- s(S) || e.filterable ? (l(), a("div", {
56
+ s($) || e.filterable ? (l(), a("div", {
57
57
  key: 0,
58
58
  class: j(["py-2 px-4 bg-slate-200 dark:bg-slate-800", {
59
59
  "justify-start flex": e.searchPosition === "start",
@@ -61,13 +61,13 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
61
61
  "justify-end flex": e.searchPosition === "end"
62
62
  }])
63
63
  }, [
64
- e.filterable ? (l(), v(ge, {
64
+ e.filterable ? (l(), C(ge, {
65
65
  key: 0,
66
- onClick: t[0] || (t[0] = (o) => m.value = !0),
66
+ onClick: t[0] || (t[0] = (o) => c.value = !0),
67
67
  text: "Filtrar",
68
68
  bgColor: "bg-slate-300 dark:bg-slate-700"
69
- })) : c("", !0),
70
- s(S) ? re((l(), a("input", {
69
+ })) : m("", !0),
70
+ s($) ? re((l(), a("input", {
71
71
  key: 1,
72
72
  "onUpdate:modelValue": t[1] || (t[1] = (o) => y.value = o),
73
73
  type: "text",
@@ -75,20 +75,20 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
75
75
  class: "border mx-2 px-3 py-1 rounded w-full max-w-sm text-sm"
76
76
  }, null, 8, Pe)), [
77
77
  [ie, y.value]
78
- ]) : c("", !0)
79
- ], 2)) : c("", !0),
80
- V("table", {
78
+ ]) : m("", !0)
79
+ ], 2)) : m("", !0),
80
+ v("table", {
81
81
  class: j(ee)
82
82
  }, [
83
83
  e.$slots.colgroup ? (l(), a("colgroup", Se, [
84
84
  i(e.$slots, "colgroup", n(u(p.value)))
85
- ])) : c("", !0),
86
- s(I) ? i(e.$slots, "thead", n(b({ key: 2 }, p.value))) : (l(), v(me, {
85
+ ])) : m("", !0),
86
+ s(I) ? i(e.$slots, "thead", n(b({ key: 2 }, p.value))) : (l(), C(ce, {
87
87
  key: 1,
88
88
  headers: s(h),
89
89
  "sort-by": s(r).sortBy,
90
- "show-select": s(P),
91
- "show-expand": s(k),
90
+ "show-select": s(S),
91
+ "show-expand": s(P),
92
92
  "all-selected": s(Z),
93
93
  "thead-class": e.theadClass,
94
94
  "tr-class": e.trClass,
@@ -100,35 +100,35 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
100
100
  }, null, 8, ["headers", "sort-by", "show-select", "show-expand", "all-selected", "thead-class", "tr-class", "th-class", "has-actions", "action-label", "onSort", "onToggleSelectAll"])),
101
101
  s(g).length && !s(z) ? (l(), a(x, { key: 3 }, [
102
102
  i(e.$slots, "body.prepend", n(u(p.value))),
103
- C(fe, {
103
+ w(fe, {
104
104
  items: s(g),
105
- "is-selected": s($),
106
- "is-expanded": s(T),
105
+ "is-selected": s(F),
106
+ "is-expanded": s(A),
107
107
  "tbody-class": e.tbodyClass,
108
108
  "row-class": s(U),
109
109
  "tr-class": e.trClass,
110
110
  "td-class": e.tdClass,
111
111
  "selected-class": e.selectedClass,
112
112
  "striped-class": e.stripedClass,
113
- "show-select": s(P),
114
- "show-expand": s(k),
113
+ "show-select": s(S),
114
+ "show-expand": s(P),
115
115
  headers: s(h),
116
116
  "has-actions": e.hasActions,
117
117
  "action-loading-map": e.actionLoadingMap,
118
- onToggleExpand: s(A),
119
- onToggleSelect: s(F)
118
+ onToggleExpand: s(E),
119
+ onToggleSelect: s(T)
120
120
  }, ne({ _: 2 }, [
121
- de(e.$slots, (o, E) => ({
122
- name: E,
121
+ de(e.$slots, (o, B) => ({
122
+ name: B,
123
123
  fn: pe((te) => [
124
- i(e.$slots, E, n(u(te)))
124
+ i(e.$slots, B, n(u(te)))
125
125
  ])
126
126
  }))
127
127
  ]), 1032, ["items", "is-selected", "is-expanded", "tbody-class", "row-class", "tr-class", "td-class", "selected-class", "striped-class", "show-select", "show-expand", "headers", "has-actions", "action-loading-map", "onToggleExpand", "onToggleSelect"]),
128
128
  i(e.$slots, "body.append", n(u(p.value)))
129
129
  ], 64)) : s(g).length && s(z) ? (l(), a(x, { key: 4 }, [], 64)) : (l(), a("tr", $e, [
130
- V("td", { colspan: se.value }, [
131
- C(ye, {
130
+ v("td", { colspan: se.value }, [
131
+ w(ye, {
132
132
  class: "h-full flex justify-center items-center",
133
133
  title: "No hay elementos disponibles",
134
134
  titleSize: "text-4xl"
@@ -137,10 +137,11 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
137
137
  ])),
138
138
  e.$slots.tfoot ? (l(), a("tfoot", Te, [
139
139
  i(e.$slots, "tfoot", n(u(p.value)))
140
- ])) : c("", !0)
140
+ ])) : m("", !0)
141
141
  ]),
142
+ t[5] || (t[5] = v("div", { class: "h-full" }, null, -1)),
142
143
  s(D) ? i(e.$slots, "footer", n(b({ key: 2 }, p.value))) : (l(), a("div", Ae, [
143
- C(ue, {
144
+ w(ue, {
144
145
  "items-length": s(W).length,
145
146
  "items-per-page": s(r).itemsPerPage,
146
147
  "current-page": s(r).page,
@@ -149,15 +150,15 @@ const Pe = ["placeholder"], Se = { key: 0 }, $e = { key: 5 }, Fe = ["colspan"],
149
150
  "onUpdate:page": t[3] || (t[3] = (o) => s(r).page = o)
150
151
  }, null, 8, ["items-length", "items-per-page", "current-page", "page-options"])
151
152
  ])),
152
- e.filterable && s(m) ? (l(), v(he, {
153
+ e.filterable && s(c) ? (l(), C(he, {
153
154
  key: 3,
154
155
  filters: e.filters,
155
- modelValue: s(m),
156
- "onUpdate:modelValue": t[4] || (t[4] = (o) => ce(m) ? m.value = o : null),
156
+ modelValue: s(c),
157
+ "onUpdate:modelValue": t[4] || (t[4] = (o) => me(c) ? c.value = o : null),
157
158
  onApplyFilters: s(q),
158
159
  onClearFilters: s(G),
159
160
  activeFilters: s(J).byColumn
160
- }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : c("", !0)
161
+ }, null, 8, ["filters", "modelValue", "onApplyFilters", "onClearFilters", "activeFilters"])) : m("", !0)
161
162
  ], 16));
162
163
  }
163
164
  };
@@ -1,5 +1,5 @@
1
1
  const o = {
2
- class: String,
2
+ class: [String, Array, Object],
3
3
  modelValue: Boolean,
4
4
  activator: [String, Object],
5
5
  activatorProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.156",
3
+ "version": "0.1.158",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",