vlite3 0.6.7 → 0.6.8

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,207 +1,7 @@
1
- import { defineComponent as S, computed as G, openBlock as o, createElementBlock as r, createVNode as U, createElementVNode as i, normalizeClass as c, Fragment as f, renderList as k, toDisplayString as g, createBlock as m, createCommentVNode as b, withModifiers as j, withCtx as K, unref as w } from "vue";
2
- import P from "../CheckBox.vue.js";
3
- import B from "../Switch.vue.js";
4
- import h from "../Icon.vue.js";
5
- import D from "../Tooltip.vue.js";
6
- import { isActionEnabled as p, getMatrixPermKey as A, getMatrixRowPermKeys as E } from "./utils.js";
7
- const F = {
8
- key: 0,
9
- class: "text-center py-12 text-muted-foreground"
10
- }, H = {
11
- key: 1,
12
- class: "permission-matrix-wrapper border rounded-lg overflow-auto"
13
- }, L = { class: "w-full border-collapse" }, R = { class: "sticky top-0 z-10" }, q = { class: "bg-muted" }, I = ["onClick"], J = ["colspan"], O = { class: "flex items-center justify-between" }, Q = { class: "flex items-center gap-2" }, T = { class: "flex items-center gap-2 pl-6" }, W = {
14
- key: 0,
15
- class: "flex items-center justify-center"
16
- }, X = {
17
- key: 1,
18
- class: "flex items-center justify-center"
19
- }, se = /* @__PURE__ */ S({
20
- __name: "PermissionEditorMatrix",
21
- props: {
22
- matrixGroups: {},
23
- modelValue: {},
24
- collapsedGroups: {},
25
- toggleMode: {},
26
- readonly: { type: Boolean },
27
- size: {},
28
- collapsible: { type: Boolean }
29
- },
30
- emits: ["update:modelValue", "toggleCollapse"],
31
- setup(s, { emit: N }) {
32
- const d = s, V = N, u = G(() => d.size === "sm" ? "text-xs" : "text-sm"), v = G(() => {
33
- const n = /* @__PURE__ */ new Set(), l = [];
34
- for (const e of d.matrixGroups)
35
- for (const t of e.actions)
36
- n.has(t.key) || (n.add(t.key), l.push(t));
37
- return l;
38
- });
39
- function z(n, l) {
40
- return n.actions.some((e) => e.key === l);
41
- }
42
- function M(n, l, e) {
43
- return p(l, e) ? d.modelValue.includes(A(n, l, e)) : !1;
44
- }
45
- function $(n, l, e) {
46
- if (d.readonly || !p(l, e)) return;
47
- const t = A(n, l, e), a = d.modelValue.includes(t) ? d.modelValue.filter((y) => y !== t) : [...d.modelValue, t];
48
- V("update:modelValue", a);
49
- }
50
- function x(n) {
51
- const l = n.rows.flatMap((t) => E(n.key, t, n.actions));
52
- if (l.length === 0) return "none";
53
- const e = l.filter((t) => d.modelValue.includes(t));
54
- return e.length === 0 ? "none" : e.length === l.length ? "all" : "indeterminate";
55
- }
56
- function C(n) {
57
- if (d.readonly) return;
58
- const l = n.rows.flatMap((a) => E(n.key, a, n.actions)), e = x(n);
59
- let t;
60
- if (e === "all")
61
- t = d.modelValue.filter((a) => !l.includes(a));
62
- else {
63
- const a = l.filter((y) => !d.modelValue.includes(y));
64
- t = [...d.modelValue, ...a];
65
- }
66
- V("update:modelValue", t);
67
- }
68
- return (n, l) => s.matrixGroups.length === 0 ? (o(), r("div", F, [
69
- U(h, {
70
- icon: "lucide:search-x",
71
- class: "w-8 h-8 mx-auto mb-3 opacity-50"
72
- }),
73
- i("p", {
74
- class: c(u.value)
75
- }, "No permissions match your filters.", 2)
76
- ])) : (o(), r("div", H, [
77
- i("table", L, [
78
- i("thead", R, [
79
- i("tr", q, [
80
- i("th", {
81
- class: c([
82
- s.size === "sm" ? "px-3 py-2" : "px-4 py-2.5",
83
- u.value,
84
- "text-left font-semibold text-foreground min-w-[200px] bg-muted border-b"
85
- ])
86
- }, " Permission ", 2),
87
- (o(!0), r(f, null, k(v.value, (e) => (o(), r("th", {
88
- key: e.key,
89
- class: c([
90
- s.size === "sm" ? "px-2 py-2" : "px-3 py-2.5",
91
- u.value,
92
- "text-center font-semibold text-foreground border-l border-b bg-muted min-w-[100px]"
93
- ])
94
- }, g(e.label), 3))), 128))
95
- ])
96
- ]),
97
- i("tbody", null, [
98
- (o(!0), r(f, null, k(s.matrixGroups, (e) => (o(), r(f, {
99
- key: e.key
100
- }, [
101
- i("tr", {
102
- class: "bg-secondary/50 cursor-pointer select-none",
103
- onClick: (t) => n.$emit("toggleCollapse", e.key)
104
- }, [
105
- i("td", {
106
- colspan: v.value.length + 1,
107
- class: c([s.size === "sm" ? "px-3 py-1.5" : "px-4 py-2", "border-t"])
108
- }, [
109
- i("div", O, [
110
- i("div", Q, [
111
- s.collapsible ? (o(), m(h, {
112
- key: 0,
113
- icon: "lucide:chevron-right",
114
- class: c(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !s.collapsedGroups.has(e.key) }])
115
- }, null, 8, ["class"])) : b("", !0),
116
- e.icon ? (o(), m(h, {
117
- key: 1,
118
- icon: e.icon,
119
- class: "w-4 h-4 text-muted-foreground"
120
- }, null, 8, ["icon"])) : b("", !0),
121
- i("span", {
122
- class: c([u.value, "font-semibold text-foreground"])
123
- }, g(e.label), 3)
124
- ]),
125
- i("div", {
126
- class: "flex items-center",
127
- onClick: l[0] || (l[0] = j(() => {
128
- }, ["stop"]))
129
- }, [
130
- s.toggleMode === "checkbox" ? (o(), m(P, {
131
- key: 0,
132
- "model-value": x(e) === "all",
133
- indeterminate: x(e) === "indeterminate",
134
- disabled: s.readonly,
135
- size: s.size === "sm" ? "xs" : "sm",
136
- "onUpdate:modelValue": (t) => C(e)
137
- }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (o(), m(B, {
138
- key: 1,
139
- "model-value": x(e) === "all",
140
- disabled: s.readonly,
141
- "onUpdate:modelValue": (t) => C(e)
142
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
143
- ])
144
- ])
145
- ], 10, J)
146
- ], 8, I),
147
- s.collapsedGroups.has(e.key) ? b("", !0) : (o(!0), r(f, { key: 0 }, k(e.rows, (t) => (o(), r("tr", {
148
- key: e.key + "-" + t.key,
149
- class: "hover:bg-accent/40 transition-colors duration-100"
150
- }, [
151
- i("td", {
152
- class: c([s.size === "sm" ? "px-3 py-1.5" : "px-4 py-2", "border-t"])
153
- }, [
154
- i("div", T, [
155
- i("span", {
156
- class: c([u.value, "text-foreground"])
157
- }, g(t.label), 3),
158
- t.description ? (o(), m(D, {
159
- key: 0,
160
- content: t.description,
161
- placement: "top"
162
- }, {
163
- default: K(() => [
164
- U(h, {
165
- icon: "lucide:info",
166
- class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
167
- })
168
- ]),
169
- _: 1
170
- }, 8, ["content"])) : b("", !0)
171
- ])
172
- ], 2),
173
- (o(!0), r(f, null, k(v.value, (a) => (o(), r("td", {
174
- key: a.key,
175
- class: c([
176
- s.size === "sm" ? "px-2 py-1.5" : "px-3 py-2",
177
- "text-center border-t border-l",
178
- !z(e, a.key) || !w(p)(t, a.key) ? "bg-muted/30" : ""
179
- ])
180
- }, [
181
- !z(e, a.key) || !w(p)(t, a.key) ? (o(), r("div", W, [...l[1] || (l[1] = [
182
- i("span", { class: "text-xs text-muted-foreground/40 select-none" }, "—", -1)
183
- ])])) : (o(), r("div", X, [
184
- s.toggleMode === "checkbox" ? (o(), m(P, {
185
- key: 0,
186
- "model-value": M(e.key, t, a.key),
187
- disabled: s.readonly,
188
- size: s.size === "sm" ? "xs" : "sm",
189
- "onUpdate:modelValue": (y) => $(e.key, t, a.key)
190
- }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (o(), m(B, {
191
- key: 1,
192
- "model-value": M(e.key, t, a.key),
193
- disabled: s.readonly,
194
- "onUpdate:modelValue": (y) => $(e.key, t, a.key)
195
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
196
- ]))
197
- ], 2))), 128))
198
- ]))), 128))
199
- ], 64))), 128))
200
- ])
201
- ])
202
- ]));
203
- }
204
- });
1
+ import o from "./PermissionEditorMatrix.vue2.js";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-3bbb236a"]]);
205
5
  export {
206
- se as default
6
+ m as default
207
7
  };
@@ -1,4 +1,206 @@
1
- import f from "./PermissionEditorMatrix.vue.js";
1
+ import { defineComponent as j, computed as g, openBlock as o, createElementBlock as r, createVNode as _, createElementVNode as a, normalizeClass as d, normalizeStyle as K, Fragment as y, renderList as h, toDisplayString as V, createBlock as m, createCommentVNode as x, withModifiers as D, withCtx as F, unref as G } from "vue";
2
+ import $ from "../CheckBox.vue.js";
3
+ import P from "../Switch.vue.js";
4
+ import v from "../Icon.vue.js";
5
+ import H from "../Tooltip.vue.js";
6
+ import { isActionEnabled as b, getMatrixPermKey as S, getMatrixRowPermKeys as w } from "./utils.js";
7
+ const L = {
8
+ key: 0,
9
+ class: "text-center py-12 text-muted-foreground"
10
+ }, R = { class: "custom-table" }, q = { class: "sticky top-0 z-10" }, I = ["onClick"], J = ["colspan"], O = { class: "flex items-center justify-between" }, Q = { class: "flex items-center gap-2" }, T = ["onClick"], U = { class: "custom-td" }, W = { class: "flex items-center gap-2 pl-6" }, X = ["onClick"], Y = {
11
+ key: 0,
12
+ class: "flex items-center justify-center"
13
+ }, Z = {
14
+ key: 1,
15
+ class: "flex items-center justify-center pointer-events-none"
16
+ }, ae = /* @__PURE__ */ j({
17
+ __name: "PermissionEditorMatrix",
18
+ props: {
19
+ matrixGroups: {},
20
+ modelValue: {},
21
+ collapsedGroups: {},
22
+ toggleMode: {},
23
+ readonly: { type: Boolean },
24
+ size: {},
25
+ collapsible: { type: Boolean }
26
+ },
27
+ emits: ["update:modelValue", "toggleCollapse"],
28
+ setup(i, { emit: B }) {
29
+ const c = i, z = B, u = g(() => c.size === "sm" ? "text-xs" : "text-sm"), A = g(() => ({
30
+ "--cell-py": c.size === "sm" ? "0.5rem" : "0.625rem",
31
+ "--cell-px": c.size === "sm" ? "0.75rem" : "1rem"
32
+ })), p = g(() => {
33
+ const s = /* @__PURE__ */ new Set(), l = [];
34
+ for (const e of c.matrixGroups)
35
+ for (const t of e.actions)
36
+ s.has(t.key) || (s.add(t.key), l.push(t));
37
+ return l;
38
+ });
39
+ function M(s, l) {
40
+ return s.actions.some((e) => e.key === l);
41
+ }
42
+ function C(s, l, e) {
43
+ return b(l, e) ? c.modelValue.includes(S(s, l, e)) : !1;
44
+ }
45
+ function E(s, l, e) {
46
+ if (c.readonly || !b(l, e)) return;
47
+ const t = S(s, l, e), n = c.modelValue.includes(t) ? c.modelValue.filter((k) => k !== t) : [...c.modelValue, t];
48
+ z("update:modelValue", n);
49
+ }
50
+ function f(s) {
51
+ const l = s.rows.flatMap((t) => w(s.key, t, s.actions));
52
+ if (l.length === 0) return "none";
53
+ const e = l.filter((t) => c.modelValue.includes(t));
54
+ return e.length === 0 ? "none" : e.length === l.length ? "all" : "indeterminate";
55
+ }
56
+ function N(s) {
57
+ if (c.readonly) return;
58
+ const l = s.rows.flatMap((n) => w(s.key, n, s.actions)), e = f(s);
59
+ let t;
60
+ if (e === "all")
61
+ t = c.modelValue.filter((n) => !l.includes(n));
62
+ else {
63
+ const n = l.filter((k) => !c.modelValue.includes(k));
64
+ t = [...c.modelValue, ...n];
65
+ }
66
+ z("update:modelValue", t);
67
+ }
68
+ return (s, l) => i.matrixGroups.length === 0 ? (o(), r("div", L, [
69
+ _(v, {
70
+ icon: "lucide:search-x",
71
+ class: "w-8 h-8 mx-auto mb-3 opacity-50"
72
+ }),
73
+ a("p", {
74
+ class: d(u.value)
75
+ }, "No permissions match your filters.", 2)
76
+ ])) : (o(), r("div", {
77
+ key: 1,
78
+ class: "permission-matrix-wrapper",
79
+ style: K(A.value)
80
+ }, [
81
+ a("table", R, [
82
+ a("thead", q, [
83
+ a("tr", null, [
84
+ a("th", {
85
+ class: d([u.value, "custom-th"])
86
+ }, "Permission", 2),
87
+ (o(!0), r(y, null, h(p.value, (e) => (o(), r("th", {
88
+ key: e.key,
89
+ class: d([u.value, "custom-th text-center"])
90
+ }, V(e.label), 3))), 128))
91
+ ])
92
+ ]),
93
+ a("tbody", null, [
94
+ (o(!0), r(y, null, h(i.matrixGroups, (e) => (o(), r(y, {
95
+ key: e.key
96
+ }, [
97
+ a("tr", {
98
+ class: "custom-group-row cursor-pointer select-none",
99
+ onClick: (t) => s.$emit("toggleCollapse", e.key)
100
+ }, [
101
+ a("td", {
102
+ colspan: p.value.length + 1,
103
+ class: "custom-td"
104
+ }, [
105
+ a("div", O, [
106
+ a("div", Q, [
107
+ i.collapsible ? (o(), m(v, {
108
+ key: 0,
109
+ icon: "lucide:chevron-right",
110
+ class: d(["w-3.5 h-3.5 transition-transform duration-200", { "rotate-90": !i.collapsedGroups.has(e.key) }]),
111
+ style: { color: "var(--color-muted-foreground)" }
112
+ }, null, 8, ["class"])) : x("", !0),
113
+ e.icon ? (o(), m(v, {
114
+ key: 1,
115
+ icon: e.icon,
116
+ class: "w-4 h-4",
117
+ style: { color: "var(--color-muted-foreground)" }
118
+ }, null, 8, ["icon"])) : x("", !0),
119
+ a("span", {
120
+ class: d([u.value, "font-semibold"]),
121
+ style: { color: "var(--color-foreground)" }
122
+ }, V(e.label), 3)
123
+ ]),
124
+ a("div", {
125
+ class: "flex items-center",
126
+ onClick: D((t) => N(e), ["stop"])
127
+ }, [
128
+ i.toggleMode === "checkbox" ? (o(), m($, {
129
+ key: 0,
130
+ "model-value": f(e) === "all",
131
+ indeterminate: f(e) === "indeterminate",
132
+ disabled: i.readonly,
133
+ size: i.size === "sm" ? "xs" : "sm",
134
+ class: "pointer-events-none"
135
+ }, null, 8, ["model-value", "indeterminate", "disabled", "size"])) : (o(), m(P, {
136
+ key: 1,
137
+ "model-value": f(e) === "all",
138
+ disabled: i.readonly,
139
+ class: "pointer-events-none"
140
+ }, null, 8, ["model-value", "disabled"]))
141
+ ], 8, T)
142
+ ])
143
+ ], 8, J)
144
+ ], 8, I),
145
+ i.collapsedGroups.has(e.key) ? x("", !0) : (o(!0), r(y, { key: 0 }, h(e.rows, (t) => (o(), r("tr", {
146
+ key: e.key + "-" + t.key,
147
+ class: "custom-entity-row"
148
+ }, [
149
+ a("td", U, [
150
+ a("div", W, [
151
+ a("span", {
152
+ class: d([u.value]),
153
+ style: { color: "var(--color-foreground)" }
154
+ }, V(t.label), 3),
155
+ t.description ? (o(), m(H, {
156
+ key: 0,
157
+ content: t.description,
158
+ placement: "top"
159
+ }, {
160
+ default: F(() => [
161
+ _(v, {
162
+ icon: "lucide:info",
163
+ class: "w-3 h-3 cursor-auto shrink-0",
164
+ style: { color: "var(--color-muted-foreground)" }
165
+ })
166
+ ]),
167
+ _: 1
168
+ }, 8, ["content"])) : x("", !0)
169
+ ])
170
+ ]),
171
+ (o(!0), r(y, null, h(p.value, (n) => (o(), r("td", {
172
+ key: n.key,
173
+ class: d([
174
+ "custom-td text-center",
175
+ !M(e, n.key) || !G(b)(t, n.key) ? "custom-disabled-cell" : i.readonly ? "" : "custom-active-cell"
176
+ ]),
177
+ onClick: (k) => E(e.key, t, n.key)
178
+ }, [
179
+ !M(e, n.key) || !G(b)(t, n.key) ? (o(), r("div", Y, [...l[0] || (l[0] = [
180
+ a("span", {
181
+ class: "text-xs select-none",
182
+ style: { color: "var(--color-muted-foreground)", opacity: "0.4" }
183
+ }, " — ", -1)
184
+ ])])) : (o(), r("div", Z, [
185
+ i.toggleMode === "checkbox" ? (o(), m($, {
186
+ key: 0,
187
+ "model-value": C(e.key, t, n.key),
188
+ disabled: i.readonly,
189
+ size: i.size === "sm" ? "xs" : "sm"
190
+ }, null, 8, ["model-value", "disabled", "size"])) : (o(), m(P, {
191
+ key: 1,
192
+ "model-value": C(e.key, t, n.key),
193
+ disabled: i.readonly
194
+ }, null, 8, ["model-value", "disabled"]))
195
+ ]))
196
+ ], 10, X))), 128))
197
+ ]))), 128))
198
+ ], 64))), 128))
199
+ ])
200
+ ])
201
+ ], 4));
202
+ }
203
+ });
2
204
  export {
3
- f as default
205
+ ae as default
4
206
  };
@@ -1,7 +1,7 @@
1
1
  import o from "./PermissionMatrix.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const s = /* @__PURE__ */ r(o, [["__scopeId", "data-v-c5641678"]]);
4
+ const s = /* @__PURE__ */ r(o, [["__scopeId", "data-v-4b13b586"]]);
5
5
  export {
6
6
  s as default
7
7
  };