vlite3 0.7.13 → 0.7.15
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.
- package/components/Button.vue.js +1 -1
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +18 -17
- package/components/{CommandPaletteContent.vue.d.ts → CommandPalette/CommandPaletteContent.vue.d.ts} +3 -3
- package/components/CommandPalette/CommandPaletteContent.vue.js +7 -0
- package/components/CommandPalette/CommandPaletteContent.vue2.js +180 -0
- package/components/CommandPalette/CommandPaletteItem.vue.d.ts +15 -0
- package/components/CommandPalette/CommandPaletteItem.vue2.js +7 -0
- package/components/CommandPalette/CommandPaletteItem.vue3.js +60 -0
- package/components/CommandPalette/index.d.ts +5 -0
- package/components/CommandPalette/types.d.ts +40 -0
- package/components/CommandPalette/useCommandPaletteItems.d.ts +15 -0
- package/components/CommandPalette/useCommandPaletteItems.js +99 -0
- package/components/CommandPalette/useCommandPaletteNav.d.ts +13 -0
- package/components/CommandPalette/useCommandPaletteNav.js +49 -0
- package/components/DataList/DataList.vue.js +53 -50
- package/components/DataTable/DataTable.vue.js +185 -173
- package/components/DatePicker.vue.js +3 -2
- package/components/DateRangePicker.vue.js +26 -25
- package/components/Dropdown/Dropdown.vue.js +20 -20
- package/components/Dropdown/DropdownMenu.vue.js +5 -256
- package/components/Dropdown/DropdownMenu.vue2.js +256 -2
- package/components/Form/CustomFields.vue.js +1 -1
- package/components/Form/CustomFields.vue2.js +102 -97
- package/components/Form/Form.vue.d.ts +0 -1
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +20 -20
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +90 -78
- package/components/IconPicker.vue.js +3 -2
- package/components/ImportData/ImportStep2.vue.js +10 -9
- package/components/List/List.vue.js +205 -180
- package/components/Modal.vue.js +2 -2
- package/components/Modal.vue2.js +82 -96
- package/components/MultiSelect/MultiSelect.vue.js +7 -7
- package/components/Navbar/Navbar.vue.js +12 -12
- package/components/NavbarCommandPalette.vue.d.ts +7 -30
- package/components/NavbarCommandPalette.vue.js +40 -40
- package/components/PermissionMatrix/PermissionEditorList.vue.js +1 -1
- package/components/PermissionMatrix/PermissionEditorList.vue2.js +84 -75
- package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +2 -2
- package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +122 -107
- package/components/PermissionMatrix/PermissionMatrix.vue.js +2 -2
- package/components/PermissionMatrix/PermissionMatrix.vue2.js +161 -138
- package/components/PermissionMatrix/PermissionTopBar.vue.js +19 -18
- package/components/Screen/Screen.vue.js +169 -166
- package/components/Screen/ScreenFilter.vue.js +4 -3
- package/components/SidePanel.vue.js +5 -146
- package/components/SidePanel.vue2.js +146 -2
- package/components/SidebarMenu/SidebarMenuItem.vue.js +26 -25
- package/components/Workbook/Sheet.vue.js +3 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/components/CommandPaletteContent.vue.js +0 -7
- package/components/CommandPaletteContent.vue2.js +0 -311
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as R, ref as N, computed as S, openBlock as o, createElementBlock as r, normalizeClass as c, createVNode as B, createCommentVNode as C, createElementVNode as i, Fragment as h, renderList as V, toDisplayString as v, withMemo as T, createBlock as b, isMemoSame as U, withCtx as I } from "vue";
|
|
2
|
+
import j from "../CheckBox.vue.js";
|
|
3
|
+
import E from "../Switch.vue.js";
|
|
4
|
+
import M from "../Icon.vue.js";
|
|
5
|
+
import J from "../Input.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
8
|
-
const
|
|
7
|
+
import O from "../Tooltip.vue.js";
|
|
8
|
+
const W = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "mb-4"
|
|
11
|
-
},
|
|
11
|
+
}, X = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "text-center py-12 text-muted-foreground"
|
|
14
|
-
},
|
|
14
|
+
}, Y = {
|
|
15
15
|
key: 2,
|
|
16
16
|
class: "permission-matrix-wrapper border rounded-lg overflow-auto"
|
|
17
|
-
},
|
|
17
|
+
}, Z = { class: "w-full border-collapse" }, _ = { class: "bg-muted" }, K = { class: "flex flex-col items-center gap-0.5" }, ee = ["onClick"], te = { class: "flex items-center gap-2" }, le = ["onClick"], se = { class: "flex items-center justify-center pointer-events-none" }, ne = { class: "flex items-center gap-2 pl-6" }, oe = ["onClick"], ae = { class: "flex items-center justify-center pointer-events-none" }, ye = /* @__PURE__ */ R({
|
|
18
18
|
__name: "PermissionMatrix",
|
|
19
19
|
props: {
|
|
20
20
|
roles: {},
|
|
@@ -29,215 +29,238 @@ const J = {
|
|
|
29
29
|
class: { default: "" }
|
|
30
30
|
},
|
|
31
31
|
emits: ["update:modelValue"],
|
|
32
|
-
setup(
|
|
33
|
-
const
|
|
34
|
-
function
|
|
35
|
-
if (!
|
|
36
|
-
const
|
|
37
|
-
|
|
32
|
+
setup(n, { emit: H }) {
|
|
33
|
+
const a = n, G = H, $ = N(""), g = N(/* @__PURE__ */ new Set());
|
|
34
|
+
function q(s) {
|
|
35
|
+
if (!a.collapsible) return;
|
|
36
|
+
const l = new Set(g.value);
|
|
37
|
+
l.has(s) ? l.delete(s) : l.add(s), g.value = l;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
const
|
|
44
|
-
(
|
|
39
|
+
const L = S(() => {
|
|
40
|
+
if (!$.value.trim()) return a.groups;
|
|
41
|
+
const s = $.value.toLowerCase();
|
|
42
|
+
return a.groups.map((l) => {
|
|
43
|
+
const t = l.permissions.filter(
|
|
44
|
+
(e) => e.label.toLowerCase().includes(s) || e.key.toLowerCase().includes(s) || l.label.toLowerCase().includes(s)
|
|
45
45
|
);
|
|
46
|
-
return
|
|
46
|
+
return t.length === 0 ? null : { ...l, permissions: t };
|
|
47
47
|
}).filter(Boolean);
|
|
48
|
-
}),
|
|
49
|
-
const
|
|
50
|
-
for (const
|
|
51
|
-
|
|
52
|
-
return
|
|
48
|
+
}), p = S(() => {
|
|
49
|
+
const s = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const l of a.roles)
|
|
51
|
+
s.set(l.key, new Set(a.modelValue[l.key] || []));
|
|
52
|
+
return s;
|
|
53
53
|
});
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function P(s, l) {
|
|
55
|
+
return p.value.get(s)?.has(l) ?? !1;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
57
|
+
function A(s, l) {
|
|
58
|
+
if (a.readonly || a.roles.find((y) => y.key === s)?.locked) return;
|
|
59
|
+
const e = a.modelValue[s] || [], k = p.value.get(s)?.has(l) ? e.filter((y) => y !== l) : [...e, l];
|
|
60
|
+
G("update:modelValue", { ...a.modelValue, [s]: k });
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
let
|
|
66
|
-
for (const k of
|
|
67
|
-
|
|
68
|
-
return
|
|
62
|
+
function w(s, l) {
|
|
63
|
+
const t = p.value.get(s);
|
|
64
|
+
if (!t) return "none";
|
|
65
|
+
let e = 0;
|
|
66
|
+
for (const k of l.permissions)
|
|
67
|
+
t.has(k.key) && e++;
|
|
68
|
+
return e === 0 ? "none" : e === l.permissions.length ? "all" : "indeterminate";
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
70
|
+
function D(s, l) {
|
|
71
|
+
if (a.readonly || a.roles.find((f) => f.key === s)?.locked) return;
|
|
72
|
+
const e = w(s, l), k = p.value.get(s) ?? /* @__PURE__ */ new Set(), y = a.modelValue[s] || [];
|
|
73
73
|
let m;
|
|
74
|
-
if (
|
|
75
|
-
const f = new Set(
|
|
76
|
-
m = y.filter((
|
|
74
|
+
if (e === "all") {
|
|
75
|
+
const f = new Set(l.permissions.map((u) => u.key));
|
|
76
|
+
m = y.filter((u) => !f.has(u));
|
|
77
77
|
} else {
|
|
78
|
-
const f =
|
|
78
|
+
const f = l.permissions.filter((u) => !k.has(u.key)).map((u) => u.key);
|
|
79
79
|
m = [...y, ...f];
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
G("update:modelValue", { ...a.modelValue, [s]: m });
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
85
|
-
return
|
|
83
|
+
const x = S(() => a.size === "sm" ? "px-2 py-1" : "px-3 py-2"), z = S(() => a.size === "sm" ? "text-xs" : "text-sm");
|
|
84
|
+
function F(s) {
|
|
85
|
+
return a.modelValue[s]?.length || 0;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
87
|
+
function Q() {
|
|
88
|
+
return a.groups.reduce((s, l) => s + l.permissions.length, 0);
|
|
89
89
|
}
|
|
90
|
-
return (
|
|
91
|
-
class:
|
|
90
|
+
return (s, l) => (o(), r("div", {
|
|
91
|
+
class: c(["permission-matrix", a.class])
|
|
92
92
|
}, [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
modelValue:
|
|
96
|
-
"onUpdate:modelValue":
|
|
93
|
+
n.searchable ? (o(), r("div", W, [
|
|
94
|
+
B(J, {
|
|
95
|
+
modelValue: $.value,
|
|
96
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => $.value = t),
|
|
97
97
|
placeholder: "Search permissions...",
|
|
98
98
|
icon: "lucide:search",
|
|
99
|
-
size:
|
|
99
|
+
size: n.size,
|
|
100
100
|
"show-clear-button": ""
|
|
101
101
|
}, null, 8, ["modelValue", "size"])
|
|
102
|
-
])) :
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
])) : C("", !0),
|
|
103
|
+
L.value.length === 0 ? (o(), r("div", X, [
|
|
104
|
+
B(M, {
|
|
105
105
|
icon: "lucide:search-x",
|
|
106
106
|
class: "w-8 h-8 mx-auto mb-3 opacity-50"
|
|
107
107
|
}),
|
|
108
108
|
i("p", {
|
|
109
|
-
class:
|
|
109
|
+
class: c(z.value)
|
|
110
110
|
}, "No permissions match your search.", 2)
|
|
111
|
-
])) : (
|
|
112
|
-
i("table",
|
|
111
|
+
])) : (o(), r("div", Y, [
|
|
112
|
+
i("table", Z, [
|
|
113
113
|
i("thead", {
|
|
114
|
-
class:
|
|
114
|
+
class: c(n.stickyHeader ? "sticky top-0 z-10" : "")
|
|
115
115
|
}, [
|
|
116
|
-
i("tr",
|
|
116
|
+
i("tr", _, [
|
|
117
117
|
i("th", {
|
|
118
|
-
class:
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
class: c([
|
|
119
|
+
x.value,
|
|
120
|
+
z.value,
|
|
121
121
|
"text-left font-semibold text-foreground min-w-[220px] sm:min-w-[260px] bg-muted border-b"
|
|
122
122
|
])
|
|
123
123
|
}, " Permission ", 2),
|
|
124
|
-
(
|
|
125
|
-
key:
|
|
126
|
-
class:
|
|
124
|
+
(o(!0), r(h, null, V(n.roles, (t) => (o(), r("th", {
|
|
125
|
+
key: t.key,
|
|
126
|
+
class: c([x.value, "text-center border-b border-l bg-muted min-w-[100px]"])
|
|
127
127
|
}, [
|
|
128
|
-
i("div",
|
|
128
|
+
i("div", K, [
|
|
129
129
|
i("span", {
|
|
130
|
-
class:
|
|
131
|
-
}, v(
|
|
130
|
+
class: c([z.value, "font-semibold text-foreground whitespace-nowrap"])
|
|
131
|
+
}, v(t.label), 3),
|
|
132
132
|
i("span", {
|
|
133
|
-
class:
|
|
134
|
-
|
|
133
|
+
class: c([
|
|
134
|
+
a.size === "sm" ? "text-[10px]" : "text-xs",
|
|
135
|
+
"text-muted-foreground"
|
|
136
|
+
])
|
|
137
|
+
}, v(F(t.key)) + "/" + v(Q()), 3)
|
|
135
138
|
])
|
|
136
139
|
], 2))), 128))
|
|
137
140
|
])
|
|
138
141
|
], 2),
|
|
139
142
|
i("tbody", null, [
|
|
140
|
-
(
|
|
141
|
-
key:
|
|
143
|
+
(o(!0), r(h, null, V(L.value, (t) => (o(), r(h, {
|
|
144
|
+
key: t.key
|
|
142
145
|
}, [
|
|
143
|
-
|
|
146
|
+
T([
|
|
147
|
+
g.value.has(t.key),
|
|
148
|
+
n.collapsible,
|
|
149
|
+
n.size,
|
|
150
|
+
n.toggleMode,
|
|
151
|
+
n.readonly,
|
|
152
|
+
t.label,
|
|
153
|
+
t.icon,
|
|
154
|
+
t.permissions.length,
|
|
155
|
+
...n.roles.map((e) => `${e.key}-${w(e.key, t)}-${e.locked}`)
|
|
156
|
+
], () => (o(), r("tr", { class: "bg-secondary/60" }, [
|
|
144
157
|
i("td", {
|
|
145
|
-
class:
|
|
146
|
-
onClick: (
|
|
158
|
+
class: c([x.value, "border-b cursor-pointer select-none"]),
|
|
159
|
+
onClick: (e) => q(t.key)
|
|
147
160
|
}, [
|
|
148
161
|
i("div", te, [
|
|
149
|
-
|
|
162
|
+
n.collapsible ? (o(), b(M, {
|
|
150
163
|
key: 0,
|
|
151
164
|
icon: "lucide:chevron-right",
|
|
152
|
-
class:
|
|
153
|
-
}, null, 8, ["class"])) :
|
|
154
|
-
|
|
165
|
+
class: c(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !g.value.has(t.key) }])
|
|
166
|
+
}, null, 8, ["class"])) : C("", !0),
|
|
167
|
+
t.icon ? (o(), b(M, {
|
|
155
168
|
key: 1,
|
|
156
|
-
icon:
|
|
169
|
+
icon: t.icon,
|
|
157
170
|
class: "w-3.5 h-3.5 text-muted-foreground"
|
|
158
|
-
}, null, 8, ["icon"])) :
|
|
171
|
+
}, null, 8, ["icon"])) : C("", !0),
|
|
159
172
|
i("span", {
|
|
160
|
-
class:
|
|
161
|
-
}, v(
|
|
173
|
+
class: c([z.value, "font-semibold text-foreground"])
|
|
174
|
+
}, v(t.label), 3),
|
|
162
175
|
i("span", {
|
|
163
|
-
class:
|
|
164
|
-
|
|
176
|
+
class: c([
|
|
177
|
+
a.size === "sm" ? "text-[10px]" : "text-xs",
|
|
178
|
+
"text-muted-foreground ml-1"
|
|
179
|
+
])
|
|
180
|
+
}, " (" + v(t.permissions.length) + ") ", 3)
|
|
165
181
|
])
|
|
166
182
|
], 10, ee),
|
|
167
|
-
(
|
|
168
|
-
key:
|
|
169
|
-
class:
|
|
170
|
-
onClick: (k) =>
|
|
183
|
+
(o(!0), r(h, null, V(n.roles, (e) => (o(), r("td", {
|
|
184
|
+
key: e.key,
|
|
185
|
+
class: c([x.value, "text-center border-b border-l cursor-pointer"]),
|
|
186
|
+
onClick: (k) => D(e.key, t)
|
|
171
187
|
}, [
|
|
172
|
-
i("div",
|
|
173
|
-
|
|
188
|
+
i("div", se, [
|
|
189
|
+
n.toggleMode === "checkbox" ? (o(), b(j, {
|
|
174
190
|
key: 0,
|
|
175
|
-
"model-value":
|
|
176
|
-
indeterminate:
|
|
177
|
-
disabled:
|
|
178
|
-
size:
|
|
179
|
-
}, null, 8, ["model-value", "indeterminate", "disabled", "size"])) : (
|
|
191
|
+
"model-value": w(e.key, t) === "all",
|
|
192
|
+
indeterminate: w(e.key, t) === "indeterminate",
|
|
193
|
+
disabled: n.readonly || e.locked,
|
|
194
|
+
size: n.size === "sm" ? "xs" : "sm"
|
|
195
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "size"])) : (o(), b(E, {
|
|
180
196
|
key: 1,
|
|
181
|
-
"model-value":
|
|
182
|
-
disabled:
|
|
197
|
+
"model-value": w(e.key, t) === "all",
|
|
198
|
+
disabled: n.readonly || e.locked
|
|
183
199
|
}, null, 8, ["model-value", "disabled"]))
|
|
184
200
|
])
|
|
185
|
-
], 10,
|
|
186
|
-
]),
|
|
187
|
-
|
|
188
|
-
const f = [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
201
|
+
], 10, le))), 128))
|
|
202
|
+
])), l, 1),
|
|
203
|
+
g.value.has(t.key) ? C("", !0) : (o(!0), r(h, { key: 0 }, V(t.permissions, (e, k, y, m) => {
|
|
204
|
+
const f = [
|
|
205
|
+
n.readonly,
|
|
206
|
+
n.size,
|
|
207
|
+
n.toggleMode,
|
|
208
|
+
e.label,
|
|
209
|
+
e.description,
|
|
210
|
+
...n.roles.map((d) => `${d.key}-${P(d.key, e.key)}-${d.locked}`)
|
|
211
|
+
];
|
|
212
|
+
if (m && m.key === e.key && U(m, f)) return m;
|
|
213
|
+
const u = (o(), r("tr", {
|
|
214
|
+
key: e.key,
|
|
192
215
|
class: "hover:bg-accent/40 transition-colors duration-100"
|
|
193
216
|
}, [
|
|
194
217
|
i("td", {
|
|
195
|
-
class:
|
|
218
|
+
class: c([x.value, "border-b"])
|
|
196
219
|
}, [
|
|
197
220
|
i("div", ne, [
|
|
198
221
|
i("span", {
|
|
199
|
-
class:
|
|
200
|
-
}, v(
|
|
201
|
-
|
|
222
|
+
class: c([z.value, "text-foreground"])
|
|
223
|
+
}, v(e.label), 3),
|
|
224
|
+
e.description ? (o(), b(O, {
|
|
202
225
|
key: 0,
|
|
203
|
-
content:
|
|
226
|
+
content: e.description,
|
|
204
227
|
placement: "top"
|
|
205
228
|
}, {
|
|
206
|
-
default:
|
|
207
|
-
|
|
229
|
+
default: I(() => [
|
|
230
|
+
B(M, {
|
|
208
231
|
icon: "lucide:info",
|
|
209
232
|
class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
|
|
210
233
|
})
|
|
211
234
|
]),
|
|
212
235
|
_: 1
|
|
213
|
-
}, 8, ["content"])) :
|
|
236
|
+
}, 8, ["content"])) : C("", !0)
|
|
214
237
|
])
|
|
215
238
|
], 2),
|
|
216
|
-
(
|
|
217
|
-
key:
|
|
218
|
-
class:
|
|
219
|
-
|
|
239
|
+
(o(!0), r(h, null, V(n.roles, (d) => (o(), r("td", {
|
|
240
|
+
key: d.key,
|
|
241
|
+
class: c([
|
|
242
|
+
x.value,
|
|
220
243
|
"text-center border-b border-l",
|
|
221
|
-
!
|
|
244
|
+
!n.readonly && !d.locked ? "cursor-pointer" : ""
|
|
222
245
|
]),
|
|
223
|
-
onClick: (ie) =>
|
|
246
|
+
onClick: (ie) => A(d.key, e.key)
|
|
224
247
|
}, [
|
|
225
248
|
i("div", ae, [
|
|
226
|
-
|
|
249
|
+
n.toggleMode === "checkbox" ? (o(), b(j, {
|
|
227
250
|
key: 0,
|
|
228
|
-
"model-value":
|
|
229
|
-
disabled:
|
|
230
|
-
size:
|
|
231
|
-
}, null, 8, ["model-value", "disabled", "size"])) : (
|
|
251
|
+
"model-value": P(d.key, e.key),
|
|
252
|
+
disabled: n.readonly || d.locked,
|
|
253
|
+
size: n.size === "sm" ? "xs" : "sm"
|
|
254
|
+
}, null, 8, ["model-value", "disabled", "size"])) : (o(), b(E, {
|
|
232
255
|
key: 1,
|
|
233
|
-
"model-value":
|
|
234
|
-
disabled:
|
|
256
|
+
"model-value": P(d.key, e.key),
|
|
257
|
+
disabled: n.readonly || d.locked
|
|
235
258
|
}, null, 8, ["model-value", "disabled"]))
|
|
236
259
|
])
|
|
237
260
|
], 10, oe))), 128))
|
|
238
261
|
]));
|
|
239
|
-
return
|
|
240
|
-
},
|
|
262
|
+
return u.memo = f, u;
|
|
263
|
+
}, l, 2), 128))
|
|
241
264
|
], 64))), 128))
|
|
242
265
|
])
|
|
243
266
|
])
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent as w, computed as k, openBlock as l, createElementBlock as n, createElementVNode as
|
|
1
|
+
import { defineComponent as w, computed as k, openBlock as l, createElementBlock as n, createElementVNode as s, createVNode as c, createCommentVNode as i, unref as C, withCtx as f, withModifiers as G, createBlock as $, toDisplayString as a, normalizeClass as u } from "vue";
|
|
2
2
|
import z from "../Input.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import h from "../Icon.vue.js";
|
|
5
5
|
import K from "../CheckBox.vue.js";
|
|
6
6
|
import B from "../Dropdown/Dropdown.vue.js";
|
|
7
7
|
import "../../core/config.js";
|
|
8
|
+
/* empty css */
|
|
8
9
|
const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3 mb-4" }, V = { class: "flex items-center gap-2 flex-1 w-full sm:max-w-lg" }, A = {
|
|
9
10
|
key: 0,
|
|
10
11
|
class: "flex-1"
|
|
@@ -14,7 +15,7 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
14
15
|
}, N = ["onClick"], P = { class: "text-sm" }, U = {
|
|
15
16
|
key: 0,
|
|
16
17
|
class: "border-t px-3 py-1.5"
|
|
17
|
-
}, E = { class: "flex items-center gap-3 ml-auto" },
|
|
18
|
+
}, E = { class: "flex items-center gap-3 ml-auto" }, I = /* @__PURE__ */ w({
|
|
18
19
|
__name: "PermissionTopBar",
|
|
19
20
|
props: {
|
|
20
21
|
searchQuery: {},
|
|
@@ -29,18 +30,18 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
29
30
|
emits: ["update:searchQuery", "update:selectedGroupKeys", "selectAll", "clearAll"],
|
|
30
31
|
setup(e, { emit: g }) {
|
|
31
32
|
const x = e, d = g, m = k(() => x.size === "sm" ? "text-xs" : "text-sm");
|
|
32
|
-
function y(
|
|
33
|
-
const t = x.selectedGroupKeys, o = t.includes(
|
|
33
|
+
function y(r) {
|
|
34
|
+
const t = x.selectedGroupKeys, o = t.includes(r) ? t.filter((p) => p !== r) : [...t, r];
|
|
34
35
|
d("update:selectedGroupKeys", o);
|
|
35
36
|
}
|
|
36
37
|
function v() {
|
|
37
38
|
d("update:selectedGroupKeys", []);
|
|
38
39
|
}
|
|
39
|
-
function b(
|
|
40
|
-
d("update:searchQuery", String(
|
|
40
|
+
function b(r) {
|
|
41
|
+
d("update:searchQuery", String(r));
|
|
41
42
|
}
|
|
42
|
-
return (
|
|
43
|
-
|
|
43
|
+
return (r, t) => (l(), n("div", S, [
|
|
44
|
+
s("div", V, [
|
|
44
45
|
e.searchable ? (l(), n("div", A, [
|
|
45
46
|
c(z, {
|
|
46
47
|
"model-value": e.searchQuery,
|
|
@@ -58,7 +59,7 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
58
59
|
position: "bottom-end"
|
|
59
60
|
}, {
|
|
60
61
|
trigger: f(() => [
|
|
61
|
-
|
|
62
|
+
s("button", {
|
|
62
63
|
type: "button",
|
|
63
64
|
class: u([
|
|
64
65
|
"inline-flex items-center gap-1.5 border rounded-md cursor-pointer transition-colors",
|
|
@@ -70,12 +71,12 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
70
71
|
icon: "lucide:filter",
|
|
71
72
|
class: "w-3.5 h-3.5"
|
|
72
73
|
}),
|
|
73
|
-
t[2] || (t[2] =
|
|
74
|
+
t[2] || (t[2] = s("span", { class: "hidden sm:inline" }, "Modules", -1)),
|
|
74
75
|
e.selectedGroupKeys.length > 0 ? (l(), n("span", Q, a(e.selectedGroupKeys.length), 1)) : i("", !0)
|
|
75
76
|
], 2)
|
|
76
77
|
]),
|
|
77
78
|
item: f(({ option: o }) => [
|
|
78
|
-
|
|
79
|
+
s("div", {
|
|
79
80
|
class: "flex items-center gap-2 w-full cursor-pointer hover:bg-accent rounded-md",
|
|
80
81
|
onClick: G((p) => y(o.value), ["stop"])
|
|
81
82
|
}, [
|
|
@@ -89,12 +90,12 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
89
90
|
icon: o.icon,
|
|
90
91
|
class: "w-3.5 h-3.5 text-muted-foreground"
|
|
91
92
|
}, null, 8, ["icon"])) : i("", !0),
|
|
92
|
-
|
|
93
|
+
s("span", P, a(o.label), 1)
|
|
93
94
|
], 8, N)
|
|
94
95
|
]),
|
|
95
96
|
footer: f(() => [
|
|
96
97
|
e.selectedGroupKeys.length > 0 ? (l(), n("div", U, [
|
|
97
|
-
|
|
98
|
+
s("button", {
|
|
98
99
|
type: "button",
|
|
99
100
|
class: "text-xs text-muted-foreground hover:text-foreground cursor-pointer",
|
|
100
101
|
onClick: v
|
|
@@ -104,15 +105,15 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
104
105
|
_: 1
|
|
105
106
|
}, 8, ["options"])
|
|
106
107
|
]),
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
s("div", E, [
|
|
109
|
+
s("span", {
|
|
109
110
|
class: u([m.value, "text-muted-foreground whitespace-nowrap"])
|
|
110
111
|
}, a(e.selectedCount) + " / " + a(e.totalPerms) + " selected ", 3),
|
|
111
112
|
e.readonly ? i("", !0) : (l(), n("button", {
|
|
112
113
|
key: 0,
|
|
113
114
|
type: "button",
|
|
114
115
|
class: u([m.value, "text-primary hover:underline whitespace-nowrap cursor-pointer"]),
|
|
115
|
-
onClick: t[0] || (t[0] = (o) =>
|
|
116
|
+
onClick: t[0] || (t[0] = (o) => r.$emit("selectAll"))
|
|
116
117
|
}, " Select All ", 2)),
|
|
117
118
|
!e.readonly && e.selectedCount > 0 ? (l(), n("button", {
|
|
118
119
|
key: 1,
|
|
@@ -121,12 +122,12 @@ const S = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3
|
|
|
121
122
|
m.value,
|
|
122
123
|
"text-muted-foreground hover:text-foreground hover:underline whitespace-nowrap cursor-pointer"
|
|
123
124
|
]),
|
|
124
|
-
onClick: t[1] || (t[1] = (o) =>
|
|
125
|
+
onClick: t[1] || (t[1] = (o) => r.$emit("clearAll"))
|
|
125
126
|
}, " Clear ", 2)) : i("", !0)
|
|
126
127
|
])
|
|
127
128
|
]));
|
|
128
129
|
}
|
|
129
130
|
});
|
|
130
131
|
export {
|
|
131
|
-
|
|
132
|
+
I as default
|
|
132
133
|
};
|