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