vlite3 0.6.6 → 0.6.7

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,40 +1,9 @@
1
- import { defineComponent as de, ref as B, computed as p, onMounted as ue, watch as ce, openBlock as a, createElementBlock as d, normalizeClass as u, createElementVNode as i, createVNode as V, createCommentVNode as f, unref as me, withCtx as G, withModifiers as D, createBlock as m, toDisplayString as v, Fragment as k, renderList as M } from "vue";
2
- import U from "../CheckBox.vue.js";
3
- import E from "../Switch.vue.js";
4
- import h from "../Icon.vue.js";
5
- import fe from "../Input.vue.js";
6
- /* empty css */
7
- import Y from "../Tooltip.vue.js";
8
- import ye from "../Dropdown/Dropdown.vue.js";
9
- import "../../core/config.js";
10
- const xe = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3 mb-4" }, ve = { class: "flex items-center gap-2 flex-1 w-full sm:max-w-lg" }, pe = {
11
- key: 0,
12
- class: "flex-1"
13
- }, ke = {
14
- key: 0,
15
- class: "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground text-[10px] font-bold min-w-[18px] h-[18px] px-1"
16
- }, he = ["onClick"], be = { class: "text-sm" }, ge = {
17
- key: 0,
18
- class: "border-t px-3 py-1.5"
19
- }, we = { class: "flex items-center gap-3 ml-auto" }, Ve = {
20
- key: 0,
21
- class: "text-center py-12 text-muted-foreground"
22
- }, Ce = {
23
- key: 1,
24
- class: "permission-matrix-wrapper border rounded-lg overflow-auto"
25
- }, ze = { class: "w-full border-collapse" }, Me = { class: "sticky top-0 z-10" }, $e = { class: "bg-muted" }, Ge = ["onClick"], Ue = ["colspan"], Se = { class: "flex items-center justify-between" }, Le = { class: "flex items-center gap-2" }, Pe = { class: "flex items-center gap-2 pl-6" }, Ae = {
26
- key: 0,
27
- class: "flex items-center justify-center"
28
- }, Be = {
29
- key: 1,
30
- class: "flex items-center justify-center"
31
- }, Ee = {
32
- key: 0,
33
- class: "text-center py-12 text-muted-foreground"
34
- }, je = {
35
- key: 1,
36
- class: "space-y-0 border rounded-lg overflow-hidden"
37
- }, Ne = ["onClick"], Ke = { class: "flex items-center gap-2" }, De = { key: 0 }, Fe = { class: "flex items-center gap-2 pl-6" }, qe = { class: "flex items-center" }, Ye = /* @__PURE__ */ de({
1
+ import { defineComponent as B, computed as c, ref as p, onMounted as K, watch as E, openBlock as g, createElementBlock as A, normalizeClass as $, createVNode as Q, createBlock as b } from "vue";
2
+ import U from "./PermissionTopBar.vue.js";
3
+ import P from "./PermissionEditorList.vue.js";
4
+ import q from "./PermissionEditorMatrix.vue.js";
5
+ import { getAllMatrixKeys as h } from "./utils.js";
6
+ const D = /* @__PURE__ */ B({
38
7
  __name: "PermissionEditor",
39
8
  props: {
40
9
  groups: { default: () => [] },
@@ -50,515 +19,142 @@ const xe = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
50
19
  matrixGroups: { default: () => [] }
51
20
  },
52
21
  emits: ["update:modelValue"],
53
- setup(r, { emit: Z }) {
54
- const n = r, g = Z, w = B(""), y = B([]), _ = p(
55
- () => n.groups.map((l) => ({
22
+ setup(s, { emit: C }) {
23
+ const a = s, f = C, i = c(() => a.layout === "matrix"), r = p(""), d = p([]), y = c(() => i.value ? a.matrixGroups : a.groups), x = c(
24
+ () => y.value.map((l) => ({
56
25
  label: l.label,
57
26
  value: l.key,
58
27
  icon: l.icon
59
28
  }))
60
- );
61
- function F(l) {
62
- const t = y.value;
63
- t.includes(l) ? y.value = t.filter((e) => e !== l) : y.value = [...t, l];
64
- }
65
- function ee() {
66
- y.value = [];
67
- }
68
- const b = B(/* @__PURE__ */ new Set()), j = B(/* @__PURE__ */ new Set());
69
- function te() {
70
- if (n.defaultExpanded && n.defaultExpanded.length > 0) {
71
- const l = n.groups.map((t) => t.key);
72
- return new Set(l.filter((t) => !n.defaultExpanded.includes(t)));
29
+ ), n = p(/* @__PURE__ */ new Set()), v = p(/* @__PURE__ */ new Set());
30
+ function k() {
31
+ if (a.defaultExpanded && a.defaultExpanded.length > 0) {
32
+ const l = y.value.map((e) => e.key);
33
+ return new Set(l.filter((e) => !a.defaultExpanded.includes(e)));
73
34
  }
74
35
  return /* @__PURE__ */ new Set();
75
36
  }
76
- ue(() => {
77
- const l = te();
78
- j.value = l, b.value = new Set(l);
79
- }), ce(w, (l) => {
37
+ K(() => {
38
+ const l = k();
39
+ v.value = l, n.value = new Set(l);
40
+ }), E(r, (l) => {
80
41
  if (l.trim()) {
81
- const t = l.toLowerCase(), e = /* @__PURE__ */ new Set();
82
- for (const s of n.groups)
83
- (s.label.toLowerCase().includes(t) || s.permissions.some(
84
- (z) => z.label.toLowerCase().includes(t) || z.key.toLowerCase().includes(t)
85
- )) && e.add(s.key);
86
- const o = n.groups.map((s) => s.key);
87
- b.value = new Set(o.filter((s) => !e.has(s)));
42
+ const e = l.toLowerCase(), o = /* @__PURE__ */ new Set();
43
+ if (i.value)
44
+ for (const t of a.matrixGroups)
45
+ (t.label.toLowerCase().includes(e) || t.rows.some(
46
+ (m) => m.label.toLowerCase().includes(e) || m.key.toLowerCase().includes(e)
47
+ )) && o.add(t.key);
48
+ else
49
+ for (const t of a.groups)
50
+ (t.label.toLowerCase().includes(e) || t.permissions.some(
51
+ (m) => m.label.toLowerCase().includes(e) || m.key.toLowerCase().includes(e)
52
+ )) && o.add(t.key);
53
+ const u = y.value.map((t) => t.key);
54
+ n.value = new Set(u.filter((t) => !o.has(t)));
88
55
  } else
89
- b.value = new Set(j.value);
56
+ n.value = new Set(v.value);
90
57
  });
91
- function q(l) {
92
- if (!n.collapsible) return;
93
- const t = new Set(b.value);
94
- t.has(l) ? t.delete(l) : t.add(l), b.value = t, w.value.trim() || (j.value = new Set(t));
95
- }
96
- const O = p(() => {
97
- let l = n.groups;
98
- if (y.value.length > 0 && (l = l.filter((t) => y.value.includes(t.key))), w.value.trim()) {
99
- const t = w.value.toLowerCase();
100
- l = l.map((e) => {
101
- const o = e.permissions.filter(
102
- (s) => s.label.toLowerCase().includes(t) || s.key.toLowerCase().includes(t) || e.label.toLowerCase().includes(t)
58
+ function w(l) {
59
+ if (!a.collapsible) return;
60
+ const e = new Set(n.value);
61
+ e.has(l) ? e.delete(l) : e.add(l), n.value = e, r.value.trim() || (v.value = new Set(e));
62
+ }
63
+ const G = c(() => {
64
+ let l = a.groups;
65
+ if (d.value.length > 0 && (l = l.filter((e) => d.value.includes(e.key))), r.value.trim()) {
66
+ const e = r.value.toLowerCase();
67
+ l = l.map((o) => {
68
+ const u = o.permissions.filter(
69
+ (t) => t.label.toLowerCase().includes(e) || t.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
103
70
  );
104
- return o.length === 0 ? null : { ...e, permissions: o };
71
+ return u.length === 0 ? null : { ...o, permissions: u };
105
72
  }).filter(Boolean);
106
73
  }
107
74
  return l;
108
- });
109
- function $(l) {
110
- return n.modelValue.includes(l);
111
- }
112
- function R(l) {
113
- if (n.readonly) return;
114
- const t = $(l) ? n.modelValue.filter((e) => e !== l) : [...n.modelValue, l];
115
- g("update:modelValue", t);
116
- }
117
- function S(l) {
118
- const t = l.permissions, e = t.filter((o) => $(o.key));
119
- return e.length === 0 ? "none" : e.length === t.length ? "all" : "indeterminate";
120
- }
121
- function H(l) {
122
- if (n.readonly) return;
123
- const t = S(l), e = l.permissions.map((s) => s.key);
124
- let o;
125
- if (t === "all")
126
- o = n.modelValue.filter((s) => !e.includes(s));
127
- else {
128
- const s = e.filter((c) => !n.modelValue.includes(c));
129
- o = [...n.modelValue, ...s];
130
- }
131
- g("update:modelValue", o);
132
- }
133
- function le() {
134
- if (n.readonly) return;
135
- const l = n.groups.flatMap((t) => t.permissions.map((e) => e.key));
136
- g("update:modelValue", l);
137
- }
138
- function se() {
139
- n.readonly || g("update:modelValue", []);
140
- }
141
- const ne = p(() => n.layout === "matrix" ? oe.value : n.groups.reduce((l, t) => l + t.permissions.length, 0)), x = p(() => n.size === "sm" ? "text-xs" : "text-sm"), Q = p(() => n.size === "sm" ? "px-3 py-1.5" : "px-4 py-2.5"), L = p(() => n.layout === "matrix");
142
- function N(l, t, e) {
143
- return t.singleKey ? `${l}-${t.key}` : `${l}-${t.key}-${e}`;
144
- }
145
- function C(l, t) {
146
- return l.actions.includes(t);
147
- }
148
- function I(l, t, e) {
149
- return C(t, e) ? n.modelValue.includes(N(l, t, e)) : !1;
150
- }
151
- function J(l, t, e) {
152
- if (n.readonly || !C(t, e)) return;
153
- const o = N(l, t, e), s = n.modelValue.includes(o) ? n.modelValue.filter((c) => c !== o) : [...n.modelValue, o];
154
- g("update:modelValue", s);
155
- }
156
- function P(l, t, e) {
157
- return e.filter((o) => C(t, o.key)).map((o) => N(l, t, o.key));
158
- }
159
- function A(l) {
160
- const t = l.rows.flatMap((o) => P(l.key, o, l.actions));
161
- if (t.length === 0) return "none";
162
- const e = t.filter((o) => n.modelValue.includes(o));
163
- return e.length === 0 ? "none" : e.length === t.length ? "all" : "indeterminate";
164
- }
165
- function T(l) {
166
- if (n.readonly) return;
167
- const t = l.rows.flatMap((s) => P(l.key, s, l.actions)), e = A(l);
168
- let o;
169
- if (e === "all")
170
- o = n.modelValue.filter((s) => !t.includes(s));
171
- else {
172
- const s = t.filter((c) => !n.modelValue.includes(c));
173
- o = [...n.modelValue, ...s];
174
- }
175
- g("update:modelValue", o);
176
- }
177
- const oe = p(
178
- () => n.matrixGroups.reduce(
179
- (l, t) => l + t.rows.reduce((e, o) => e + o.actions.filter((s) => C(o, s)).length, 0),
180
- 0
181
- )
182
- );
183
- function ae() {
184
- if (n.readonly) return;
185
- const l = n.matrixGroups.flatMap(
186
- (e) => e.rows.flatMap((o) => P(e.key, o, e.actions))
187
- ), t = n.modelValue.filter((e) => !l.includes(e));
188
- g("update:modelValue", [...t, ...l]);
189
- }
190
- function ie() {
191
- if (n.readonly) return;
192
- const l = new Set(
193
- n.matrixGroups.flatMap(
194
- (t) => t.rows.flatMap((e) => P(t.key, e, t.actions))
195
- )
196
- );
197
- g(
198
- "update:modelValue",
199
- n.modelValue.filter((t) => !l.has(t))
200
- );
201
- }
202
- const W = p(() => {
203
- let l = n.matrixGroups;
204
- if (y.value.length > 0 && (l = l.filter((t) => y.value.includes(t.key))), w.value.trim()) {
205
- const t = w.value.toLowerCase();
206
- l = l.map((e) => {
207
- const o = e.rows.filter(
208
- (s) => s.label.toLowerCase().includes(t) || s.key.toLowerCase().includes(t) || e.label.toLowerCase().includes(t)
75
+ }), V = c(() => {
76
+ let l = a.matrixGroups;
77
+ if (d.value.length > 0 && (l = l.filter((e) => d.value.includes(e.key))), r.value.trim()) {
78
+ const e = r.value.toLowerCase();
79
+ l = l.map((o) => {
80
+ const u = o.rows.filter(
81
+ (t) => t.label.toLowerCase().includes(e) || t.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
209
82
  );
210
- return o.length === 0 ? null : { ...e, rows: o };
83
+ return u.length === 0 ? null : { ...o, rows: u };
211
84
  }).filter(Boolean);
212
85
  }
213
86
  return l;
214
- }), re = p(
215
- () => n.matrixGroups.map((l) => ({
216
- label: l.label,
217
- value: l.key,
218
- icon: l.icon
219
- }))
220
- ), K = p(() => {
221
- const l = /* @__PURE__ */ new Set(), t = [];
222
- for (const e of n.matrixGroups)
223
- for (const o of e.actions)
224
- l.has(o.key) || (l.add(o.key), t.push(o));
225
- return t;
226
- });
227
- function X(l, t) {
228
- return l.actions.some((e) => e.key === t);
87
+ }), L = c(() => i.value ? a.matrixGroups.reduce(
88
+ (l, e) => l + e.rows.reduce(
89
+ (o, u) => o + u.actions.filter((t) => u.actions.includes(t?.key)).length,
90
+ 0
91
+ ),
92
+ 0
93
+ ) : a.groups.reduce((l, e) => l + e.permissions.length, 0));
94
+ function M() {
95
+ if (!a.readonly)
96
+ if (i.value) {
97
+ const l = h(a.matrixGroups), e = a.modelValue.filter((o) => !l.includes(o));
98
+ f("update:modelValue", [...e, ...l]);
99
+ } else {
100
+ const l = a.groups.flatMap((e) => e.permissions.map((o) => o.key));
101
+ f("update:modelValue", l);
102
+ }
103
+ }
104
+ function S() {
105
+ if (!a.readonly)
106
+ if (i.value) {
107
+ const l = new Set(h(a.matrixGroups));
108
+ f(
109
+ "update:modelValue",
110
+ a.modelValue.filter((e) => !l.has(e))
111
+ );
112
+ } else
113
+ f("update:modelValue", []);
229
114
  }
230
- return (l, t) => (a(), d("div", {
231
- class: u(["permission-editor", n.class])
115
+ return (l, e) => (g(), A("div", {
116
+ class: $(["permission-editor", a.class])
232
117
  }, [
233
- i("div", xe, [
234
- i("div", ve, [
235
- r.searchable ? (a(), d("div", pe, [
236
- V(fe, {
237
- modelValue: w.value,
238
- "onUpdate:modelValue": t[0] || (t[0] = (e) => w.value = e),
239
- placeholder: "Search permissions...",
240
- icon: "lucide:search",
241
- size: r.size,
242
- "show-clear-button": ""
243
- }, null, 8, ["modelValue", "size"])
244
- ])) : f("", !0),
245
- V(me(ye), {
246
- options: L.value ? re.value : _.value,
247
- "close-on-select": !1,
248
- selectable: !1,
249
- position: "bottom-end"
250
- }, {
251
- trigger: G(() => [
252
- i("button", {
253
- type: "button",
254
- class: u([
255
- "inline-flex items-center gap-1.5 border rounded-md cursor-pointer transition-colors",
256
- r.size === "sm" ? "px-2 py-1.5 text-xs" : "px-3 py-2 text-sm",
257
- y.value.length > 0 ? "border-primary bg-primary/5 text-primary" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
258
- ])
259
- }, [
260
- V(h, {
261
- icon: "lucide:filter",
262
- class: "w-3.5 h-3.5"
263
- }),
264
- t[5] || (t[5] = i("span", { class: "hidden sm:inline" }, "Modules", -1)),
265
- y.value.length > 0 ? (a(), d("span", ke, v(y.value.length), 1)) : f("", !0)
266
- ], 2)
267
- ]),
268
- item: G(({ option: e }) => [
269
- i("div", {
270
- class: "flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-accent rounded-md",
271
- onClick: D((o) => F(e.value), ["stop"])
272
- }, [
273
- V(U, {
274
- "model-value": y.value.includes(e.value),
275
- size: "xs",
276
- "onUpdate:modelValue": (o) => F(e.value)
277
- }, null, 8, ["model-value", "onUpdate:modelValue"]),
278
- e.icon ? (a(), m(h, {
279
- key: 0,
280
- icon: e.icon,
281
- class: "w-3.5 h-3.5 text-muted-foreground"
282
- }, null, 8, ["icon"])) : f("", !0),
283
- i("span", be, v(e.label), 1)
284
- ], 8, he)
285
- ]),
286
- footer: G(() => [
287
- y.value.length > 0 ? (a(), d("div", ge, [
288
- i("button", {
289
- type: "button",
290
- class: "text-xs text-muted-foreground hover:text-foreground cursor-pointer",
291
- onClick: ee
292
- }, " Clear filters ")
293
- ])) : f("", !0)
294
- ]),
295
- _: 1
296
- }, 8, ["options"])
297
- ]),
298
- i("div", we, [
299
- i("span", {
300
- class: u([x.value, "text-muted-foreground whitespace-nowrap"])
301
- }, v(r.modelValue.length) + " / " + v(ne.value) + " selected ", 3),
302
- r.readonly ? f("", !0) : (a(), d("button", {
303
- key: 0,
304
- type: "button",
305
- class: u([x.value, "text-primary hover:underline whitespace-nowrap cursor-pointer"]),
306
- onClick: t[1] || (t[1] = (e) => L.value ? ae() : le())
307
- }, " Select All ", 2)),
308
- !r.readonly && r.modelValue.length > 0 ? (a(), d("button", {
309
- key: 1,
310
- type: "button",
311
- class: u([
312
- x.value,
313
- "text-muted-foreground hover:text-foreground hover:underline whitespace-nowrap cursor-pointer"
314
- ]),
315
- onClick: t[2] || (t[2] = (e) => L.value ? ie() : se())
316
- }, " Clear ", 2)) : f("", !0)
317
- ])
318
- ]),
319
- L.value ? (a(), d(k, { key: 0 }, [
320
- W.value.length === 0 ? (a(), d("div", Ve, [
321
- V(h, {
322
- icon: "lucide:search-x",
323
- class: "w-8 h-8 mx-auto mb-3 opacity-50"
324
- }),
325
- i("p", {
326
- class: u(x.value)
327
- }, "No permissions match your filters.", 2)
328
- ])) : (a(), d("div", Ce, [
329
- i("table", ze, [
330
- i("thead", Me, [
331
- i("tr", $e, [
332
- i("th", {
333
- class: u([
334
- r.size === "sm" ? "px-3 py-2" : "px-4 py-2.5",
335
- x.value,
336
- "text-left font-semibold text-foreground min-w-[200px] bg-muted border-b"
337
- ])
338
- }, " Permission ", 2),
339
- (a(!0), d(k, null, M(K.value, (e) => (a(), d("th", {
340
- key: e.key,
341
- class: u([
342
- r.size === "sm" ? "px-2 py-2" : "px-3 py-2.5",
343
- x.value,
344
- "text-center font-semibold text-foreground border-l border-b bg-muted min-w-[100px]"
345
- ])
346
- }, v(e.label), 3))), 128))
347
- ])
348
- ]),
349
- i("tbody", null, [
350
- (a(!0), d(k, null, M(W.value, (e, o) => (a(), d(k, {
351
- key: e.key
352
- }, [
353
- i("tr", {
354
- class: "bg-secondary/50 cursor-pointer select-none",
355
- onClick: (s) => q(e.key)
356
- }, [
357
- i("td", {
358
- colspan: K.value.length + 1,
359
- class: u([r.size === "sm" ? "px-3 py-1.5" : "px-4 py-2", "border-t"])
360
- }, [
361
- i("div", Se, [
362
- i("div", Le, [
363
- r.collapsible ? (a(), m(h, {
364
- key: 0,
365
- icon: "lucide:chevron-right",
366
- class: u(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !b.value.has(e.key) }])
367
- }, null, 8, ["class"])) : f("", !0),
368
- e.icon ? (a(), m(h, {
369
- key: 1,
370
- icon: e.icon,
371
- class: "w-4 h-4 text-muted-foreground"
372
- }, null, 8, ["icon"])) : f("", !0),
373
- i("span", {
374
- class: u([x.value, "font-semibold text-foreground"])
375
- }, v(e.label), 3)
376
- ]),
377
- i("div", {
378
- class: "flex items-center",
379
- onClick: t[3] || (t[3] = D(() => {
380
- }, ["stop"]))
381
- }, [
382
- r.toggleMode === "checkbox" ? (a(), m(U, {
383
- key: 0,
384
- "model-value": A(e) === "all",
385
- indeterminate: A(e) === "indeterminate",
386
- disabled: r.readonly,
387
- size: r.size === "sm" ? "xs" : "sm",
388
- "onUpdate:modelValue": (s) => T(e)
389
- }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (a(), m(E, {
390
- key: 1,
391
- "model-value": A(e) === "all",
392
- disabled: r.readonly,
393
- "onUpdate:modelValue": (s) => T(e)
394
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
395
- ])
396
- ])
397
- ], 10, Ue)
398
- ], 8, Ge),
399
- b.value.has(e.key) ? f("", !0) : (a(!0), d(k, { key: 0 }, M(e.rows, (s) => (a(), d("tr", {
400
- key: e.key + "-" + s.key,
401
- class: "hover:bg-accent/40 transition-colors duration-100"
402
- }, [
403
- i("td", {
404
- class: u([r.size === "sm" ? "px-3 py-1.5" : "px-4 py-2", "border-t"])
405
- }, [
406
- i("div", Pe, [
407
- i("span", {
408
- class: u([x.value, "text-foreground"])
409
- }, v(s.label), 3),
410
- s.description ? (a(), m(Y, {
411
- key: 0,
412
- content: s.description,
413
- placement: "top"
414
- }, {
415
- default: G(() => [
416
- V(h, {
417
- icon: "lucide:info",
418
- class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
419
- })
420
- ]),
421
- _: 1
422
- }, 8, ["content"])) : f("", !0)
423
- ])
424
- ], 2),
425
- (a(!0), d(k, null, M(K.value, (c) => (a(), d("td", {
426
- key: c.key,
427
- class: u([
428
- r.size === "sm" ? "px-2 py-1.5" : "px-3 py-2",
429
- "text-center border-t border-l",
430
- !X(e, c.key) || !C(s, c.key) ? "bg-muted/30" : ""
431
- ])
432
- }, [
433
- !X(e, c.key) || !C(s, c.key) ? (a(), d("div", Ae, [...t[6] || (t[6] = [
434
- i("span", { class: "text-xs text-muted-foreground/40 select-none" }, "—", -1)
435
- ])])) : (a(), d("div", Be, [
436
- r.toggleMode === "checkbox" ? (a(), m(U, {
437
- key: 0,
438
- "model-value": I(e.key, s, c.key),
439
- disabled: r.readonly,
440
- size: r.size === "sm" ? "xs" : "sm",
441
- "onUpdate:modelValue": (z) => J(e.key, s, c.key)
442
- }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (a(), m(E, {
443
- key: 1,
444
- "model-value": I(e.key, s, c.key),
445
- disabled: r.readonly,
446
- "onUpdate:modelValue": (z) => J(e.key, s, c.key)
447
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
448
- ]))
449
- ], 2))), 128))
450
- ]))), 128))
451
- ], 64))), 128))
452
- ])
453
- ])
454
- ]))
455
- ], 64)) : (a(), d(k, { key: 1 }, [
456
- O.value.length === 0 ? (a(), d("div", Ee, [
457
- V(h, {
458
- icon: "lucide:search-x",
459
- class: "w-8 h-8 mx-auto mb-3 opacity-50"
460
- }),
461
- i("p", {
462
- class: u(x.value)
463
- }, "No permissions match your filters.", 2)
464
- ])) : (a(), d("div", je, [
465
- (a(!0), d(k, null, M(O.value, (e, o) => (a(), d(k, {
466
- key: e.key
467
- }, [
468
- i("div", {
469
- class: u([
470
- Q.value,
471
- "flex items-center justify-between bg-muted cursor-pointer select-none",
472
- o > 0 ? "border-t" : ""
473
- ]),
474
- onClick: (s) => q(e.key)
475
- }, [
476
- i("div", Ke, [
477
- r.collapsible ? (a(), m(h, {
478
- key: 0,
479
- icon: "lucide:chevron-right",
480
- class: u(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !b.value.has(e.key) }])
481
- }, null, 8, ["class"])) : f("", !0),
482
- e.icon ? (a(), m(h, {
483
- key: 1,
484
- icon: e.icon,
485
- class: "w-4 h-4 text-muted-foreground"
486
- }, null, 8, ["icon"])) : f("", !0),
487
- i("span", {
488
- class: u([x.value, "font-semibold text-foreground"])
489
- }, v(e.label), 3),
490
- i("span", {
491
- class: u([r.size === "sm" ? "text-[10px]" : "text-xs", "text-muted-foreground"])
492
- }, " (" + v(e.permissions.filter((s) => $(s.key)).length) + "/" + v(e.permissions.length) + ") ", 3)
493
- ]),
494
- i("div", {
495
- class: "flex items-center",
496
- onClick: t[4] || (t[4] = D(() => {
497
- }, ["stop"]))
498
- }, [
499
- r.toggleMode === "checkbox" ? (a(), m(U, {
500
- key: 0,
501
- "model-value": S(e) === "all",
502
- indeterminate: S(e) === "indeterminate",
503
- disabled: r.readonly,
504
- size: r.size === "sm" ? "xs" : "sm",
505
- "onUpdate:modelValue": (s) => H(e)
506
- }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (a(), m(E, {
507
- key: 1,
508
- "model-value": S(e) === "all",
509
- disabled: r.readonly,
510
- "onUpdate:modelValue": (s) => H(e)
511
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
512
- ])
513
- ], 10, Ne),
514
- b.value.has(e.key) ? f("", !0) : (a(), d("div", De, [
515
- (a(!0), d(k, null, M(e.permissions, (s, c) => (a(), d("div", {
516
- key: s.key,
517
- class: u([
518
- Q.value,
519
- "flex items-center justify-between border-t hover:bg-accent/40 transition-colors duration-100"
520
- ])
521
- }, [
522
- i("div", Fe, [
523
- i("span", {
524
- class: u([x.value, "text-foreground"])
525
- }, v(s.label), 3),
526
- s.description ? (a(), m(Y, {
527
- key: 0,
528
- content: s.description,
529
- placement: "top"
530
- }, {
531
- default: G(() => [
532
- V(h, {
533
- icon: "lucide:info",
534
- class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
535
- })
536
- ]),
537
- _: 1
538
- }, 8, ["content"])) : f("", !0)
539
- ]),
540
- i("div", qe, [
541
- r.toggleMode === "checkbox" ? (a(), m(U, {
542
- key: 0,
543
- "model-value": $(s.key),
544
- disabled: r.readonly,
545
- size: r.size === "sm" ? "xs" : "sm",
546
- "onUpdate:modelValue": (z) => R(s.key)
547
- }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (a(), m(E, {
548
- key: 1,
549
- "model-value": $(s.key),
550
- disabled: r.readonly,
551
- "onUpdate:modelValue": (z) => R(s.key)
552
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
553
- ])
554
- ], 2))), 128))
555
- ]))
556
- ], 64))), 128))
557
- ]))
558
- ], 64))
118
+ Q(U, {
119
+ searchQuery: r.value,
120
+ "onUpdate:searchQuery": e[0] || (e[0] = (o) => r.value = o),
121
+ selectedGroupKeys: d.value,
122
+ "onUpdate:selectedGroupKeys": e[1] || (e[1] = (o) => d.value = o),
123
+ searchable: s.searchable,
124
+ size: s.size,
125
+ readonly: s.readonly,
126
+ "total-perms": L.value,
127
+ "selected-count": s.modelValue.length,
128
+ "group-options": x.value,
129
+ onSelectAll: M,
130
+ onClearAll: S
131
+ }, null, 8, ["searchQuery", "selectedGroupKeys", "searchable", "size", "readonly", "total-perms", "selected-count", "group-options"]),
132
+ i.value ? (g(), b(q, {
133
+ key: 0,
134
+ "matrix-groups": V.value,
135
+ "model-value": s.modelValue,
136
+ "collapsed-groups": n.value,
137
+ "toggle-mode": s.toggleMode,
138
+ readonly: s.readonly,
139
+ size: s.size,
140
+ collapsible: s.collapsible,
141
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => l.$emit("update:modelValue", o)),
142
+ onToggleCollapse: w
143
+ }, null, 8, ["matrix-groups", "model-value", "collapsed-groups", "toggle-mode", "readonly", "size", "collapsible"])) : (g(), b(P, {
144
+ key: 1,
145
+ groups: G.value,
146
+ "model-value": s.modelValue,
147
+ "collapsed-groups": n.value,
148
+ "toggle-mode": s.toggleMode,
149
+ readonly: s.readonly,
150
+ size: s.size,
151
+ collapsible: s.collapsible,
152
+ "onUpdate:modelValue": e[3] || (e[3] = (o) => l.$emit("update:modelValue", o)),
153
+ onToggleCollapse: w
154
+ }, null, 8, ["groups", "model-value", "collapsed-groups", "toggle-mode", "readonly", "size", "collapsible"]))
559
155
  ], 2));
560
156
  }
561
157
  });
562
158
  export {
563
- Ye as default
159
+ D as default
564
160
  };