adverich-kun-ui 0.1.337 → 0.1.338

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,8 +1,8 @@
1
- import { computed as d, createElementBlock as u, openBlock as i, normalizeClass as h, createElementVNode as m, createVNode as V, renderSlot as c, createTextVNode as b, toDisplayString as g, Fragment as S, renderList as x, unref as K, withCtx as C } from "vue";
2
- import { getNestedValue as f } from "../../../../utils/tableFormatters.js";
1
+ import { computed as i, createElementBlock as d, openBlock as c, normalizeClass as V, createElementVNode as m, createVNode as S, renderSlot as f, createTextVNode as b, toDisplayString as v, Fragment as K, renderList as x, unref as k, withCtx as C } from "vue";
2
+ import { getNestedValue as s } from "../../../../utils/tableFormatters.js";
3
3
  import N from "../../../KunVirtualScroller/src/components/KunVirtualScroller.vue.js";
4
4
  import P from "../../../KunCheckbox/src/components/KunCheckbox.vue.js";
5
- const T = { class: "sticky top-0 z-10 flex border-b text-sm font-semibold" }, w = { class: "p-2 border-r flex-1" }, z = { class: "flex border-b text-sm" }, B = { class: "p-2 border-r flex-1" }, D = {
5
+ const B = { class: "sticky top-0 z-10 flex border-b text-sm font-semibold" }, T = { class: "p-2 border-r flex-1" }, j = { class: "flex border-b text-sm" }, z = { class: "p-2 border-r flex-1" }, U = {
6
6
  __name: "KunRelationMatrix",
7
7
  props: {
8
8
  rows: Array,
@@ -27,61 +27,69 @@ const T = { class: "sticky top-0 z-10 flex border-b text-sm font-semibold" }, w
27
27
  rounded: { type: String, default: "rounded" }
28
28
  },
29
29
  emits: ["update:modelValue"],
30
- setup(a, { emit: k }) {
31
- const r = a, L = k, y = d(() => r.rowKey), s = d(() => r.columnKey), A = d(() => r.rowLabel), $ = d(() => r.columnLabel);
32
- function p(l, n, t) {
33
- const e = structuredClone(r.modelValue);
34
- Array.isArray(e[l]) || (e[l] = []), t ? e[l].includes(n) || e[l].push(n) : e[l] = e[l].filter((o) => o !== n), L("update:modelValue", e);
30
+ setup(o, { emit: A }) {
31
+ const r = o, L = A, y = i(() => r.rowKey), u = i(() => r.columnKey), w = i(() => r.rowLabel), $ = i(() => r.columnLabel), g = i(() => {
32
+ if (Object.keys(r.modelValue).length) return r.modelValue;
33
+ const l = {};
34
+ for (const a of r.rows) {
35
+ const t = s(a, r.rowKey), e = s(a, r.relationPath);
36
+ Array.isArray(e) && (l[t] = e.map((n) => s(n, r.relationKey)).filter(Boolean));
37
+ }
38
+ return l;
39
+ });
40
+ function p(l, a, t) {
41
+ const e = structuredClone(g.value);
42
+ Array.isArray(e[l]) || (e[l] = []), t ? e[l].includes(a) || e[l].push(a) : e[l] = e[l].filter((n) => n !== a), L("update:modelValue", e);
35
43
  }
36
- function v(l, n) {
44
+ function h(l, a) {
37
45
  var e;
38
46
  if (!r.relationPath)
39
- return (((e = r.modelValue) == null ? void 0 : e[l[y.value]]) ?? []).includes(n);
40
- const t = f(l, r.relationPath);
41
- return Array.isArray(t) ? t.some((o) => f(o, r.relationKey) === n) : !1;
47
+ return (((e = g.value) == null ? void 0 : e[l[y.value]]) ?? []).includes(a);
48
+ const t = s(l, r.relationPath);
49
+ return Array.isArray(t) ? t.some((n) => s(n, r.relationKey) === a) : !1;
42
50
  }
43
- return (l, n) => (i(), u("div", {
44
- class: h(["overflow-auto", [a.border, a.rounded]])
51
+ return (l, a) => (c(), d("div", {
52
+ class: V(["overflow-auto", [o.border, o.rounded]])
45
53
  }, [
46
- m("div", T, [
47
- m("div", w, [
48
- c(l.$slots, "row-header", {}, () => [
49
- b(g(a.relationTitle), 1)
54
+ m("div", B, [
55
+ m("div", T, [
56
+ f(l.$slots, "row-header", {}, () => [
57
+ b(v(o.relationTitle), 1)
50
58
  ])
51
59
  ]),
52
- (i(!0), u(S, null, x(a.columns, (t) => (i(), u("div", {
53
- key: t[s.value],
60
+ (c(!0), d(K, null, x(o.columns, (t) => (c(), d("div", {
61
+ key: t[u.value],
54
62
  class: "p-2 border-r text-center"
55
63
  }, [
56
- c(l.$slots, "column-header", { column: t }, () => [
57
- b(g(K(f)(t, $.value)), 1)
64
+ f(l.$slots, "column-header", { column: t }, () => [
65
+ b(v(k(s)(t, $.value)), 1)
58
66
  ])
59
67
  ]))), 128))
60
68
  ]),
61
- V(N, {
62
- items: a.rows,
69
+ S(N, {
70
+ items: o.rows,
63
71
  estimatedItemHeight: 48
64
72
  }, {
65
73
  default: C(({ item: t }) => [
66
- m("div", z, [
67
- m("div", B, [
68
- c(l.$slots, "row-label", { row: t }, () => [
69
- b(g(K(f)(t, A.value)), 1)
74
+ m("div", j, [
75
+ m("div", z, [
76
+ f(l.$slots, "row-label", { row: t }, () => [
77
+ b(v(k(s)(t, w.value)), 1)
70
78
  ])
71
79
  ]),
72
- (i(!0), u(S, null, x(a.columns, (e) => (i(), u("div", {
73
- key: e[s.value],
74
- class: h(["p-2 border-r text-center", a.cellClass])
80
+ (c(!0), d(K, null, x(o.columns, (e) => (c(), d("div", {
81
+ key: e[u.value],
82
+ class: V(["p-2 border-r text-center", o.cellClass])
75
83
  }, [
76
- c(l.$slots, "cell", {
84
+ f(l.$slots, "cell", {
77
85
  row: t,
78
86
  column: e,
79
- checked: v(t, e[s.value]),
80
- toggle: (o) => p(t[y.value], e[s.value], o)
87
+ checked: h(t, e[u.value]),
88
+ toggle: (n) => p(t[y.value], e[u.value], n)
81
89
  }, () => [
82
- V(P, {
83
- modelValue: v(t, e[s.value]),
84
- "onUpdate:modelValue": (o) => p(t[y.value], e[s.value], o)
90
+ S(P, {
91
+ modelValue: h(t, e[u.value]),
92
+ "onUpdate:modelValue": (n) => p(t[y.value], e[u.value], n)
85
93
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
86
94
  ])
87
95
  ], 2))), 128))
@@ -93,5 +101,5 @@ const T = { class: "sticky top-0 z-10 flex border-b text-sm font-semibold" }, w
93
101
  }
94
102
  };
95
103
  export {
96
- D as default
104
+ U as default
97
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.337",
3
+ "version": "0.1.338",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",