adverich-kun-ui 0.1.158 → 0.1.159

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,5 +1,11 @@
1
- import { createElementBlock as t, openBlock as s, normalizeClass as c, createElementVNode as y, createCommentVNode as d, renderSlot as g, Fragment as S, renderList as B, normalizeStyle as f, toDisplayString as h } from "vue";
2
- const A = { key: 0 }, E = { key: 1 }, T = ["checked"], w = ["onClick"], $ = { key: 0 }, z = { key: 0 }, L = { key: 1 }, v = "bg-slate-200 dark:bg-slate-800 sticky top-0 z-5", N = "", O = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", j = {
1
+ import { createElementBlock as o, openBlock as l, normalizeClass as a, createElementVNode as u, createCommentVNode as m, renderSlot as g, Fragment as w, renderList as B, normalizeStyle as A, toDisplayString as k, createBlock as E, resolveDynamicComponent as T } from "vue";
2
+ import v from "../../../../icons/IconArrowUp.vue.js";
3
+ import $ from "../../../../icons/IconArrowDown.vue.js";
4
+ import D from "../../../../icons/IconArrowDownUp.vue.js";
5
+ const z = { key: 0 }, L = { key: 1 }, O = ["checked"], I = ["onClick"], N = {
6
+ key: 0,
7
+ class: "inline-flex items-center gap-1 ml-1"
8
+ }, U = "bg-slate-200 dark:bg-slate-800 sticky top-0 z-5", V = "", j = "px-3 py-2 text-xs font-medium text-slate-700 dark:text-slate-300 uppercase tracking-wider", G = {
3
9
  __name: "KunTableHeaders",
4
10
  props: {
5
11
  headers: Array,
@@ -16,71 +22,74 @@ const A = { key: 0 }, E = { key: 1 }, T = ["checked"], w = ["onClick"], $ = { ke
16
22
  actionLabel: String
17
23
  },
18
24
  emits: ["toggle-select-all", "sort", "expandAll", "collapseAll"],
19
- setup(l, { emit: u }) {
20
- const o = l, r = u;
21
- function m() {
22
- r("toggle-select-all");
25
+ setup(n, { emit: y }) {
26
+ const r = n, i = y;
27
+ function h() {
28
+ i("toggle-select-all");
23
29
  }
24
- function x(n) {
25
- var k;
26
- if (!n.sortable) return;
27
- const e = ((k = o.sortBy) == null ? void 0 : k.key) === n.key && o.sortBy.order === "asc" ? "desc" : "asc";
28
- r("sort", { key: n.key, order: e });
30
+ function p(s) {
31
+ var c;
32
+ if (!s.sortable) return;
33
+ const t = (c = r.sortBy) == null ? void 0 : c.find((S) => S.key === s.value), e = (t == null ? void 0 : t.order) === "asc" ? "desc" : "asc";
34
+ i("sort", { key: s.value, order: e });
29
35
  }
30
- function C(n) {
31
- var a;
32
- return ((a = o.sortBy) == null ? void 0 : a.key) === n.key;
36
+ function x(s) {
37
+ var t, e;
38
+ return (e = (t = r.sortBy) == null ? void 0 : t.find((c) => c.key === s.value)) == null ? void 0 : e.order;
33
39
  }
34
- const b = [v, o.theadClass], p = [N, o.trClass], i = [O, o.thClass];
35
- return (n, a) => (s(), t("thead", {
36
- class: c(b)
40
+ const C = (s) => {
41
+ const t = x(s);
42
+ return t ? t === "asc" ? v : $ : D;
43
+ }, f = [U, r.theadClass], b = [V, r.trClass], d = [j, r.thClass];
44
+ return (s, t) => (l(), o("thead", {
45
+ class: a(f)
37
46
  }, [
38
- y("tr", {
39
- class: c(p)
47
+ u("tr", {
48
+ class: a(b)
40
49
  }, [
41
- l.showExpand ? (s(), t("th", {
50
+ n.showExpand ? (l(), o("th", {
42
51
  key: 0,
43
- class: c([i])
52
+ class: a([d])
44
53
  }, [
45
- n.$slots.expandIcon ? g(n.$slots, "expand-icon", { key: 0 }) : (s(), t("button", {
54
+ s.$slots.expandIcon ? g(s.$slots, "expand-icon", { key: 0 }) : (l(), o("button", {
46
55
  key: 1,
47
- onClick: a[0] || (a[0] = (e) => l.isExpanded ? r("expandAll") : r("collapseAll"))
56
+ onClick: t[0] || (t[0] = (e) => n.isExpanded ? i("expandAll") : i("collapseAll"))
48
57
  }, [
49
- l.isExpanded ? (s(), t("span", A, "−")) : (s(), t("span", E, "+"))
58
+ n.isExpanded ? (l(), o("span", z, "−")) : (l(), o("span", L, "+"))
50
59
  ]))
51
- ], 2)) : d("", !0),
52
- l.showSelect ? (s(), t("th", {
60
+ ], 2)) : m("", !0),
61
+ n.showSelect ? (l(), o("th", {
53
62
  key: 1,
54
- class: c(i)
63
+ class: a(d)
55
64
  }, [
56
- y("input", {
65
+ u("input", {
57
66
  type: "checkbox",
58
- checked: l.allSelected,
59
- onChange: m,
67
+ checked: n.allSelected,
68
+ onChange: h,
60
69
  class: "form-checkbox"
61
- }, null, 40, T)
62
- ])) : d("", !0),
63
- (s(!0), t(S, null, B(l.headers, (e) => (s(), t("th", {
70
+ }, null, 40, O)
71
+ ])) : m("", !0),
72
+ (l(!0), o(w, null, B(n.headers, (e) => (l(), o("th", {
64
73
  key: e.key,
65
- class: c([i, e.headerAlign === "right" ? "text-right" : e.headerAlign === "center" ? "text-center" : "text-left"]),
66
- onClick: (k) => x(e),
67
- style: f({ cursor: e.sortable ? "pointer" : "default" })
74
+ class: a([d, e.headerAlign === "right" ? "text-right" : e.headerAlign === "center" ? "text-center" : "text-left"]),
75
+ onClick: (c) => p(e),
76
+ style: A({ cursor: e.sortable ? "pointer" : "default" })
68
77
  }, [
69
- g(n.$slots, `header.${e.key}`, { header: e }, () => [
70
- y("span", null, h(e.label), 1),
71
- e.sortable ? (s(), t("span", $, [
72
- C(e) ? (s(), t("span", z, h(l.sortBy.order === "asc" ? "⬆️" : "⬇️"), 1)) : (s(), t("span", L, "⇅"))
73
- ])) : d("", !0)
78
+ g(s.$slots, `header.${e.key}`, { header: e }, () => [
79
+ u("span", null, k(e.label ?? e.text), 1),
80
+ e.sortable ? (l(), o("span", N, [
81
+ (l(), E(T(C(e)), { class: "w-4 h-4 text-gray-500" }))
82
+ ])) : m("", !0)
74
83
  ])
75
- ], 14, w))), 128)),
76
- l.hasActions ? (s(), t("th", {
84
+ ], 14, I))), 128)),
85
+ n.hasActions ? (l(), o("th", {
77
86
  key: 2,
78
- class: c([[i], "text-center"])
79
- }, h(l.actionLabel), 3)) : d("", !0)
87
+ class: a([[d], "text-center"])
88
+ }, k(n.actionLabel), 3)) : m("", !0)
80
89
  ])
81
90
  ]));
82
91
  }
83
92
  };
84
93
  export {
85
- j as default
94
+ G as default
86
95
  };
@@ -12,6 +12,7 @@ const t = () => ({
12
12
  itemsPerPage: { type: Number, default: 10 },
13
13
  page: { type: Number, default: 1 },
14
14
  sortBy: { type: Array, default: () => [] },
15
+ mutliSort: Boolean,
15
16
  pageOptions: { type: Array, default: () => [5, 10, 25, 50, 100] },
16
17
  searchable: { type: Boolean, default: !1 },
17
18
  searchableKeys: { type: Array, default: null },
@@ -1,29 +1,47 @@
1
- import { reactive as x, watch as t, computed as s } from "vue";
2
- function I(y, a, u) {
3
- const { page: p, itemsPerPage: d, sortBy: g } = y, r = x({
1
+ import { reactive as x, watch as c, computed as f } from "vue";
2
+ function A(y, u, l) {
3
+ const { page: p, itemsPerPage: g, sortBy: P, mutliSort: m } = y, e = x({
4
4
  page: p.value,
5
- itemsPerPage: d.value,
6
- sortBy: [...g.value || []]
5
+ itemsPerPage: g.value,
6
+ sortBy: [...P.value || []]
7
7
  });
8
- t(() => p.value, (e) => r.page = e), t(() => d.value, (e) => r.itemsPerPage = e), t(() => g.value, (e) => r.sortBy = [...e]), t(() => r.page, (e) => a == null ? void 0 : a("update:page", e)), t(() => r.itemsPerPage, (e) => a == null ? void 0 : a("update:itemsPerPage", e)), t(() => r.sortBy, (e) => a == null ? void 0 : a("update:sortBy", e));
9
- const v = s(() => (r.page - 1) * r.itemsPerPage), B = s(() => v.value + r.itemsPerPage), P = s(() => Array.isArray(u.value) ? r.sortBy.length ? [...u.value].sort((e, o) => {
10
- for (const { key: n, order: i } of r.sortBy) {
11
- const c = e[n], l = o[n];
12
- if (c !== l)
13
- return i === "asc" ? c > l ? 1 : -1 : c < l ? 1 : -1;
8
+ c(() => p.value, (t) => e.page = t), c(() => g.value, (t) => e.itemsPerPage = t), c(() => e.page, (t) => u == null ? void 0 : u("update:page", t)), c(() => e.itemsPerPage, (t) => u == null ? void 0 : u("update:itemsPerPage", t));
9
+ const d = f(() => (e.page - 1) * e.itemsPerPage), B = f(() => d.value + e.itemsPerPage), v = f(() => Array.isArray(l.value) ? e.sortBy.length ? [...l.value].sort((t, s) => {
10
+ for (const { key: i, order: o } of e.sortBy) {
11
+ const n = t[i], r = s[i];
12
+ if (!(n == null && r == null)) {
13
+ if (n == null) return o === "asc" ? -1 : 1;
14
+ if (r == null) return o === "asc" ? 1 : -1;
15
+ if (n instanceof Date && r instanceof Date) {
16
+ const a = n.getTime() - r.getTime();
17
+ if (a !== 0) return o === "asc" ? a : -a;
18
+ continue;
19
+ }
20
+ if (typeof n == "number" && typeof r == "number") {
21
+ const a = n - r;
22
+ if (a !== 0) return o === "asc" ? a : -a;
23
+ continue;
24
+ }
25
+ if (typeof n == "string" && typeof r == "string") {
26
+ const a = n.localeCompare(r, void 0, { sensitivity: "base" });
27
+ if (a !== 0) return o === "asc" ? a : -a;
28
+ continue;
29
+ }
30
+ if (n !== r) return o === "asc" ? n > r ? 1 : -1 : n < r ? 1 : -1;
31
+ }
14
32
  }
15
33
  return 0;
16
- }) : u.value : []), f = s(() => P.value.slice(v.value, B.value));
34
+ }) : l.value : []), b = f(() => v.value.slice(d.value, B.value));
17
35
  return {
18
- options: r,
19
- paginatedItems: f,
20
- updateSort: (e) => {
21
- const o = r.sortBy.find((n) => n.key === e);
22
- o ? o.order = o.order === "asc" ? "desc" : "asc" : r.sortBy = [{ key: e, order: "asc" }];
36
+ options: e,
37
+ paginatedItems: b,
38
+ updateSort: ({ key: t, order: s }) => {
39
+ const i = e.sortBy.find((o) => o.key === t);
40
+ i ? i.order = s : m.value ? e.sortBy.push({ key: t, order: s }) : e.sortBy = [{ key: t, order: s }];
23
41
  },
24
- sortedItems: P
42
+ sortedItems: v
25
43
  };
26
44
  }
27
45
  export {
28
- I as default
46
+ A as default
29
47
  };
@@ -0,0 +1,20 @@
1
+ import { createElementBlock as e, openBlock as o, createElementVNode as l } from "vue";
2
+ import r from "../_virtual/_plugin-vue_export-helper.js";
3
+ const n = {}, m = {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "24",
6
+ height: "24",
7
+ viewBox: "0 0 24 24"
8
+ };
9
+ function c(s, t) {
10
+ return o(), e("svg", m, t[0] || (t[0] = [
11
+ l("path", {
12
+ fill: "currentColor",
13
+ d: "m12 20l-.707.707l.707.707l.707-.707zm1-15a1 1 0 1 0-2 0zm-7.707 9.707l6 6l1.414-1.414l-6-6zm7.414 6l6-6l-1.414-1.414l-6 6zM13 20V5h-2v15z"
14
+ }, null, -1)
15
+ ]));
16
+ }
17
+ const w = /* @__PURE__ */ r(n, [["render", c]]);
18
+ export {
19
+ w as default
20
+ };
@@ -0,0 +1,20 @@
1
+ import { createElementBlock as t, openBlock as e, createElementVNode as o } from "vue";
2
+ import r from "../_virtual/_plugin-vue_export-helper.js";
3
+ const n = {}, m = {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "24",
6
+ height: "24",
7
+ viewBox: "0 0 24 24"
8
+ };
9
+ function c(s, l) {
10
+ return e(), t("svg", m, l[0] || (l[0] = [
11
+ o("path", {
12
+ fill: "currentColor",
13
+ d: "m8 2l-.707-.707L8 .586l.707.707zm1 15a1 1 0 1 1-2 0zM2.293 6.293l5-5l1.414 1.414l-5 5zm6.414-5l5 5l-1.414 1.414l-5-5zM9 2v15H7V2zm7 20l-.707.707l.707.707l.707-.707zm1-15a1 1 0 1 0-2 0zm-6.707 10.707l5 5l1.414-1.414l-5-5zm6.414 5l5-5l-1.414-1.414l-5 5zM17 22V7h-2v15z"
14
+ }, null, -1)
15
+ ]));
16
+ }
17
+ const a = /* @__PURE__ */ r(n, [["render", c]]);
18
+ export {
19
+ a as default
20
+ };
@@ -0,0 +1,20 @@
1
+ import { createElementBlock as e, openBlock as l, createElementVNode as o } from "vue";
2
+ import r from "../_virtual/_plugin-vue_export-helper.js";
3
+ const n = {}, c = {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: "24",
6
+ height: "24",
7
+ viewBox: "0 0 24 24"
8
+ };
9
+ function m(s, t) {
10
+ return l(), e("svg", c, t[0] || (t[0] = [
11
+ o("path", {
12
+ fill: "currentColor",
13
+ d: "m12 4l-.707-.707l.707-.707l.707.707zm1 15a1 1 0 1 1-2 0zM5.293 9.293l6-6l1.414 1.414l-6 6zm7.414-6l6 6l-1.414 1.414l-6-6zM13 4v15h-2V4z"
14
+ }, null, -1)
15
+ ]));
16
+ }
17
+ const p = /* @__PURE__ */ r(n, [["render", m]]);
18
+ export {
19
+ p as default
20
+ };
@@ -1,33 +1,39 @@
1
- import o from "./IconAsterisk.vue.js";
2
- import e from "./IconCheck.vue.js";
3
- import t from "./IconClose.vue.js";
4
- import n from "./IconDelete.vue.js";
5
- import r from "./IconEdit.vue.js";
6
- import i from "./IconMenuDownOutline.vue.js";
7
- import m from "./IconMenuUpOutline.vue.js";
8
- import c from "./IconSearch.vue.js";
9
- import f from "./IconStar.vue.js";
10
- import l from "./IconEyeOutline.vue.js";
11
- import p from "./IconEyeOffOutline.vue.js";
12
- import u from "./IconAccountOutline.vue.js";
1
+ import o from "./IconAccountOutline.vue.js";
2
+ import r from "./IconArrowDown.vue.js";
3
+ import n from "./IconArrowDownUp.vue.js";
4
+ import t from "./IconArrowUp.vue.js";
5
+ import e from "./IconAsterisk.vue.js";
6
+ import i from "./IconCheck.vue.js";
7
+ import m from "./IconClose.vue.js";
8
+ import c from "./IconDelete.vue.js";
9
+ import p from "./IconEdit.vue.js";
10
+ import f from "./IconEyeOutline.vue.js";
11
+ import l from "./IconEyeOffOutline.vue.js";
12
+ import u from "./IconMenuDownOutline.vue.js";
13
+ import a from "./IconMenuUpOutline.vue.js";
13
14
  import I from "./IconPencil.vue.js";
14
- import O from "./IconTrashOutline.vue.js";
15
- const x = {
16
- asterisk: o,
17
- check: e,
18
- close: t,
19
- delete: n,
20
- edit: r,
21
- menuDownOutline: i,
22
- menuUpOutline: m,
23
- search: c,
24
- star: f,
25
- eyeOutline: l,
26
- eyeOffOutline: p,
27
- accountOutline: u,
15
+ import O from "./IconSearch.vue.js";
16
+ import s from "./IconStar.vue.js";
17
+ import w from "./IconTrashOutline.vue.js";
18
+ const q = {
19
+ accountOutline: o,
20
+ arrowDown: r,
21
+ arrowDownUp: n,
22
+ arrowUp: t,
23
+ asterisk: e,
24
+ check: i,
25
+ close: m,
26
+ delete: c,
27
+ edit: p,
28
+ eyeOutline: f,
29
+ eyeOffOutline: l,
30
+ menuDownOutline: u,
31
+ menuUpOutline: a,
28
32
  pencil: I,
29
- trashOutline: O
33
+ search: O,
34
+ star: s,
35
+ trashOutline: w
30
36
  };
31
37
  export {
32
- x as icons
38
+ q as icons
33
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.158",
3
+ "version": "0.1.159",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",