adverich-kun-ui 0.1.340 → 0.1.342

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