vlite3 0.6.6 → 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.
Files changed (26) hide show
  1. package/components/DataTable/DataTable.vue.js +232 -209
  2. package/components/DataTable/types.d.ts +15 -0
  3. package/components/DataTable/types.js +4 -0
  4. package/components/Dropdown/Dropdown.vue.js +13 -21
  5. package/components/Modal.vue.js +2 -2
  6. package/components/Modal.vue2.js +58 -56
  7. package/components/PermissionMatrix/PermissionEditor.vue.d.ts +0 -12
  8. package/components/PermissionMatrix/PermissionEditor.vue.js +120 -524
  9. package/components/PermissionMatrix/PermissionEditorList.vue.d.ts +18 -0
  10. package/components/PermissionMatrix/PermissionEditorList.vue.js +7 -0
  11. package/components/PermissionMatrix/PermissionEditorList.vue2.js +162 -0
  12. package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +18 -0
  13. package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +7 -0
  14. package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +206 -0
  15. package/components/PermissionMatrix/PermissionMatrix.vue.js +1 -1
  16. package/components/PermissionMatrix/PermissionMatrix.vue2.js +115 -126
  17. package/components/PermissionMatrix/PermissionTopBar.vue.d.ts +28 -0
  18. package/components/PermissionMatrix/PermissionTopBar.vue.js +132 -0
  19. package/components/PermissionMatrix/PermissionTopBar.vue2.js +4 -0
  20. package/components/PermissionMatrix/utils.d.ts +11 -0
  21. package/components/PermissionMatrix/utils.js +20 -0
  22. package/components/Screen/Screen.vue.js +113 -107
  23. package/components/SidePanel.vue.js +57 -53
  24. package/index.js +179 -177
  25. package/package.json +1 -1
  26. package/style.css +1 -1
@@ -0,0 +1,18 @@
1
+ import { PermissionGroup, PermissionToggleMode, PermissionMatrixSize } from './types';
2
+ type __VLS_Props = {
3
+ groups: PermissionGroup[];
4
+ modelValue: string[];
5
+ collapsedGroups: Set<string>;
6
+ toggleMode: PermissionToggleMode;
7
+ readonly: boolean;
8
+ size: PermissionMatrixSize;
9
+ collapsible: boolean;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
12
+ "update:modelValue": (val: string[]) => any;
13
+ toggleCollapse: (groupKey: string) => any;
14
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:modelValue"?: (val: string[]) => any;
16
+ onToggleCollapse?: (groupKey: string) => any;
17
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import o from "./PermissionEditorList.vue2.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3adbf210"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,162 @@
1
+ import { defineComponent as N, computed as b, openBlock as s, createElementBlock as r, createVNode as p, createElementVNode as a, normalizeClass as m, normalizeStyle as E, Fragment as x, renderList as z, createBlock as c, createCommentVNode as f, toDisplayString as k, withModifiers as C, withCtx as P } from "vue";
2
+ import V from "../CheckBox.vue.js";
3
+ import w from "../Switch.vue.js";
4
+ import v from "../Icon.vue.js";
5
+ import j from "../Tooltip.vue.js";
6
+ const L = {
7
+ key: 0,
8
+ class: "text-center py-12 text-muted-foreground"
9
+ }, A = ["onClick"], D = { class: "flex items-center gap-2" }, F = ["onClick"], q = {
10
+ key: 0,
11
+ class: "custom-list-group-content"
12
+ }, H = ["onClick"], I = { class: "flex items-center gap-2 pl-6" }, J = { class: "flex items-center pointer-events-none" }, W = /* @__PURE__ */ N({
13
+ __name: "PermissionEditorList",
14
+ props: {
15
+ groups: {},
16
+ modelValue: {},
17
+ collapsedGroups: {},
18
+ toggleMode: {},
19
+ readonly: { type: Boolean },
20
+ size: {},
21
+ collapsible: { type: Boolean }
22
+ },
23
+ emits: ["update:modelValue", "toggleCollapse"],
24
+ setup(t, { emit: $ }) {
25
+ const n = t, g = $, h = b(() => n.size === "sm" ? "text-xs" : "text-sm"), B = b(() => ({
26
+ "--cell-py": n.size === "sm" ? "0.5rem" : "0.625rem",
27
+ "--cell-px": n.size === "sm" ? "0.75rem" : "1rem"
28
+ }));
29
+ function u(o) {
30
+ return n.modelValue.includes(o);
31
+ }
32
+ function G(o) {
33
+ if (n.readonly) return;
34
+ const i = u(o) ? n.modelValue.filter((e) => e !== o) : [...n.modelValue, o];
35
+ g("update:modelValue", i);
36
+ }
37
+ function y(o) {
38
+ const i = o.permissions.filter((e) => u(e.key));
39
+ return i.length === 0 ? "none" : i.length === o.permissions.length ? "all" : "indeterminate";
40
+ }
41
+ function S(o) {
42
+ if (n.readonly) return;
43
+ const i = y(o), e = o.permissions.map((d) => d.key);
44
+ let l;
45
+ if (i === "all")
46
+ l = n.modelValue.filter((d) => !e.includes(d));
47
+ else {
48
+ const d = e.filter((M) => !n.modelValue.includes(M));
49
+ l = [...n.modelValue, ...d];
50
+ }
51
+ g("update:modelValue", l);
52
+ }
53
+ return (o, i) => t.groups.length === 0 ? (s(), r("div", L, [
54
+ p(v, {
55
+ icon: "lucide:search-x",
56
+ class: "w-8 h-8 mx-auto mb-3 opacity-50"
57
+ }),
58
+ a("p", {
59
+ class: m(h.value)
60
+ }, "No permissions match your filters.", 2)
61
+ ])) : (s(), r("div", {
62
+ key: 1,
63
+ class: "permission-list-wrapper",
64
+ style: E(B.value)
65
+ }, [
66
+ (s(!0), r(x, null, z(t.groups, (e) => (s(), r(x, {
67
+ key: e.key
68
+ }, [
69
+ a("div", {
70
+ class: "custom-list-header flex items-center justify-between cursor-pointer select-none",
71
+ onClick: (l) => o.$emit("toggleCollapse", e.key)
72
+ }, [
73
+ a("div", D, [
74
+ t.collapsible ? (s(), c(v, {
75
+ key: 0,
76
+ icon: "lucide:chevron-right",
77
+ class: m(["w-3.5 h-3.5 transition-transform duration-200", { "rotate-90": !t.collapsedGroups.has(e.key) }]),
78
+ style: { color: "var(--color-muted-foreground)" }
79
+ }, null, 8, ["class"])) : f("", !0),
80
+ e.icon ? (s(), c(v, {
81
+ key: 1,
82
+ icon: e.icon,
83
+ class: "w-4 h-4",
84
+ style: { color: "var(--color-muted-foreground)" }
85
+ }, null, 8, ["icon"])) : f("", !0),
86
+ a("span", {
87
+ class: m([h.value, "font-semibold"]),
88
+ style: { color: "var(--color-foreground)" }
89
+ }, k(e.label), 3),
90
+ a("span", {
91
+ class: m([t.size === "sm" ? "text-[10px]" : "text-xs"]),
92
+ style: { color: "var(--color-muted-foreground)" }
93
+ }, " (" + k(e.permissions.filter((l) => u(l.key)).length) + "/" + k(e.permissions.length) + ") ", 3)
94
+ ]),
95
+ a("div", {
96
+ class: "flex items-center",
97
+ onClick: C((l) => S(e), ["stop"])
98
+ }, [
99
+ t.toggleMode === "checkbox" ? (s(), c(V, {
100
+ key: 0,
101
+ "model-value": y(e) === "all",
102
+ indeterminate: y(e) === "indeterminate",
103
+ disabled: t.readonly,
104
+ size: t.size === "sm" ? "xs" : "sm",
105
+ class: "pointer-events-none"
106
+ }, null, 8, ["model-value", "indeterminate", "disabled", "size"])) : (s(), c(w, {
107
+ key: 1,
108
+ "model-value": y(e) === "all",
109
+ disabled: t.readonly,
110
+ class: "pointer-events-none"
111
+ }, null, 8, ["model-value", "disabled"]))
112
+ ], 8, F)
113
+ ], 8, A),
114
+ t.collapsedGroups.has(e.key) ? f("", !0) : (s(), r("div", q, [
115
+ (s(!0), r(x, null, z(e.permissions, (l) => (s(), r("div", {
116
+ key: l.key,
117
+ class: m(["custom-list-item flex items-center justify-between transition-colors duration-100", { "cursor-pointer": !t.readonly }]),
118
+ onClick: (d) => G(l.key)
119
+ }, [
120
+ a("div", I, [
121
+ a("span", {
122
+ class: m([h.value]),
123
+ style: { color: "var(--color-foreground)" }
124
+ }, k(l.label), 3),
125
+ l.description ? (s(), c(j, {
126
+ key: 0,
127
+ content: l.description,
128
+ placement: "top"
129
+ }, {
130
+ default: P(() => [
131
+ p(v, {
132
+ icon: "lucide:info",
133
+ class: "w-3 h-3 cursor-auto shrink-0",
134
+ style: { color: "var(--color-muted-foreground)" },
135
+ onClick: i[0] || (i[0] = C(() => {
136
+ }, ["stop"]))
137
+ })
138
+ ]),
139
+ _: 1
140
+ }, 8, ["content"])) : f("", !0)
141
+ ]),
142
+ a("div", J, [
143
+ t.toggleMode === "checkbox" ? (s(), c(V, {
144
+ key: 0,
145
+ "model-value": u(l.key),
146
+ disabled: t.readonly,
147
+ size: t.size === "sm" ? "xs" : "sm"
148
+ }, null, 8, ["model-value", "disabled", "size"])) : (s(), c(w, {
149
+ key: 1,
150
+ "model-value": u(l.key),
151
+ disabled: t.readonly
152
+ }, null, 8, ["model-value", "disabled"]))
153
+ ])
154
+ ], 10, H))), 128))
155
+ ]))
156
+ ], 64))), 128))
157
+ ], 4));
158
+ }
159
+ });
160
+ export {
161
+ W as default
162
+ };
@@ -0,0 +1,18 @@
1
+ import { PermissionMatrixGroup, PermissionToggleMode, PermissionMatrixSize } from './types';
2
+ type __VLS_Props = {
3
+ matrixGroups: PermissionMatrixGroup[];
4
+ modelValue: string[];
5
+ collapsedGroups: Set<string>;
6
+ toggleMode: PermissionToggleMode;
7
+ readonly: boolean;
8
+ size: PermissionMatrixSize;
9
+ collapsible: boolean;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
12
+ "update:modelValue": (val: string[]) => any;
13
+ toggleCollapse: (groupKey: string) => any;
14
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:modelValue"?: (val: string[]) => any;
16
+ onToggleCollapse?: (groupKey: string) => any;
17
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
18
+ export default _default;
@@ -0,0 +1,7 @@
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"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,206 @@
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
+ });
204
+ export {
205
+ ae as default
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
  };