vlite3 0.4.8 → 0.5.2

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 (268) hide show
  1. package/README.md +201 -100
  2. package/_virtual/Barcode.js +4 -0
  3. package/_virtual/CODE128.js +4 -0
  4. package/_virtual/CODE128A.js +4 -0
  5. package/_virtual/CODE128B.js +4 -0
  6. package/_virtual/CODE128C.js +4 -0
  7. package/_virtual/CODE128_AUTO.js +4 -0
  8. package/_virtual/CODE93.js +4 -0
  9. package/_virtual/CODE93FullASCII.js +4 -0
  10. package/_virtual/EAN.js +4 -0
  11. package/_virtual/EAN13.js +4 -0
  12. package/_virtual/EAN2.js +4 -0
  13. package/_virtual/EAN5.js +4 -0
  14. package/_virtual/EAN8.js +4 -0
  15. package/_virtual/ErrorHandler.js +4 -0
  16. package/_virtual/FileSaver.min.js +5 -0
  17. package/_virtual/FileSaver.min2.js +4 -0
  18. package/_virtual/ITF.js +4 -0
  19. package/_virtual/ITF14.js +4 -0
  20. package/_virtual/JsBarcode.js +7 -0
  21. package/_virtual/MSI.js +4 -0
  22. package/_virtual/MSI10.js +4 -0
  23. package/_virtual/MSI1010.js +4 -0
  24. package/_virtual/MSI11.js +4 -0
  25. package/_virtual/MSI1110.js +4 -0
  26. package/_virtual/UPC.js +4 -0
  27. package/_virtual/UPCE.js +4 -0
  28. package/_virtual/_commonjsHelpers.js +8 -0
  29. package/_virtual/alignment-pattern.js +4 -0
  30. package/_virtual/auto.js +4 -0
  31. package/_virtual/browser.js +7 -0
  32. package/_virtual/browser2.js +4 -0
  33. package/_virtual/canvas.js +4 -0
  34. package/_virtual/canvas2.js +4 -0
  35. package/_virtual/checksums.js +4 -0
  36. package/_virtual/constants.js +4 -0
  37. package/_virtual/constants2.js +4 -0
  38. package/_virtual/constants3.js +4 -0
  39. package/_virtual/constants4.js +4 -0
  40. package/_virtual/defaults.js +4 -0
  41. package/_virtual/dijkstra.js +4 -0
  42. package/_virtual/encoder.js +4 -0
  43. package/_virtual/error-correction-code.js +4 -0
  44. package/_virtual/error-correction-level.js +4 -0
  45. package/_virtual/exceptions.js +4 -0
  46. package/_virtual/finder-pattern.js +4 -0
  47. package/_virtual/fixOptions.js +4 -0
  48. package/_virtual/format-info.js +4 -0
  49. package/_virtual/galois-field.js +4 -0
  50. package/_virtual/getOptionsFromElement.js +4 -0
  51. package/_virtual/getRenderProperties.js +4 -0
  52. package/_virtual/index.js +4 -0
  53. package/_virtual/index10.js +4 -0
  54. package/_virtual/index11.js +4 -0
  55. package/_virtual/index2.js +4 -0
  56. package/_virtual/index3.js +4 -0
  57. package/_virtual/index4.js +4 -0
  58. package/_virtual/index5.js +4 -0
  59. package/_virtual/index6.js +4 -0
  60. package/_virtual/index7.js +4 -0
  61. package/_virtual/index8.js +4 -0
  62. package/_virtual/index9.js +4 -0
  63. package/_virtual/linearizeEncodings.js +4 -0
  64. package/_virtual/mask-pattern.js +4 -0
  65. package/_virtual/merge.js +4 -0
  66. package/_virtual/mode.js +4 -0
  67. package/_virtual/object.js +4 -0
  68. package/_virtual/optionsFromStrings.js +4 -0
  69. package/_virtual/papaparse.min.js +7 -0
  70. package/_virtual/papaparse.min2.js +4 -0
  71. package/_virtual/polynomial.js +4 -0
  72. package/_virtual/qrcode.js +4 -0
  73. package/_virtual/regex.js +4 -0
  74. package/_virtual/segments.js +4 -0
  75. package/_virtual/shared.js +4 -0
  76. package/_virtual/svg-tag.js +4 -0
  77. package/_virtual/svg.js +4 -0
  78. package/_virtual/utils.js +4 -0
  79. package/_virtual/utils2.js +4 -0
  80. package/_virtual/version-check.js +4 -0
  81. package/_virtual/version.js +4 -0
  82. package/components/Accordion/Accordion.vue.d.ts +7 -7
  83. package/components/Accordion/AccordionItem.vue.d.ts +4 -4
  84. package/components/Accordion/AccordionTrigger.vue.d.ts +2 -2
  85. package/components/Alert.vue.d.ts +1 -1
  86. package/components/Avatar.vue.d.ts +2 -2
  87. package/components/Avatar.vue.js +2 -2
  88. package/components/AvatarUploader/AvatarUploader.vue.d.ts +5 -5
  89. package/components/Badge.vue.d.ts +1 -1
  90. package/components/Barcode/Barcode.vue.d.ts +22 -0
  91. package/components/Barcode/Barcode.vue.js +58 -0
  92. package/components/Barcode/Barcode.vue2.js +4 -0
  93. package/components/Barcode/index.d.ts +2 -0
  94. package/components/Barcode/types.d.ts +5 -0
  95. package/components/Barcode/types.js +15 -0
  96. package/components/Breadcrumb/Breadcrumb.vue.d.ts +23 -0
  97. package/components/Breadcrumb/Breadcrumb.vue.js +7 -0
  98. package/components/Breadcrumb/Breadcrumb.vue2.js +84 -0
  99. package/components/Breadcrumb/BreadcrumbItem.vue.d.ts +27 -0
  100. package/components/Breadcrumb/BreadcrumbItem.vue.js +7 -0
  101. package/components/Breadcrumb/BreadcrumbItem.vue2.js +50 -0
  102. package/components/Breadcrumb/index.d.ts +3 -0
  103. package/components/Breadcrumb/types.d.ts +19 -0
  104. package/components/Button.vue.d.ts +4 -4
  105. package/components/Button.vue.js +32 -29
  106. package/components/ButtonGroup.vue.d.ts +1 -1
  107. package/components/Carousel/Carousel.vue.d.ts +58 -58
  108. package/components/CheckBox.vue.d.ts +2 -2
  109. package/components/Chip/Chip.vue.d.ts +3 -3
  110. package/components/ChoiceBox/ChoiceBox.vue.d.ts +4 -4
  111. package/components/ColorPicker/ColorPicker.vue.d.ts +3 -3
  112. package/components/ColorPicker/index.d.ts +1 -0
  113. package/components/CommandPaletteContent.vue.d.ts +15 -0
  114. package/components/CommandPaletteContent.vue.js +7 -0
  115. package/components/CommandPaletteContent.vue2.js +287 -0
  116. package/components/ConfirmationModal.vue.js +12 -10
  117. package/components/DataList/DataList.vue.d.ts +2 -2
  118. package/components/DataTable/DataTable.vue.d.ts +6 -6
  119. package/components/DataTable/DataTableRow.vue.d.ts +3 -3
  120. package/components/DatePicker.vue.d.ts +2 -2
  121. package/components/DatePicker.vue.js +7 -7
  122. package/components/DateRangePicker.vue.d.ts +29 -0
  123. package/components/DateRangePicker.vue.js +231 -0
  124. package/components/DateRangePicker.vue2.js +4 -0
  125. package/components/Dropdown/Dropdown.vue.d.ts +11 -6
  126. package/components/Dropdown/Dropdown.vue.js +147 -109
  127. package/components/Dropdown/DropdownBooleanItem.vue.js +9 -8
  128. package/components/Dropdown/DropdownGroupedLayout.vue.d.ts +1 -1
  129. package/components/Dropdown/DropdownGroupedLayout.vue.js +35 -34
  130. package/components/Dropdown/DropdownItem.vue.js +11 -10
  131. package/components/Dropdown/DropdownMenu.vue.d.ts +5 -3
  132. package/components/Dropdown/DropdownMenu.vue.js +114 -111
  133. package/components/Dropdown/DropdownTrigger.vue.d.ts +2 -0
  134. package/components/Dropdown/DropdownTrigger.vue.js +9 -7
  135. package/components/ExportData/ExportData.vue.d.ts +16 -0
  136. package/components/ExportData/ExportData.vue.js +135 -0
  137. package/components/ExportData/ExportData.vue2.js +4 -0
  138. package/components/ExportData/index.d.ts +2 -0
  139. package/components/ExportData/types.d.ts +17 -0
  140. package/components/FilePicker/FilePicker.vue.d.ts +5 -5
  141. package/components/Form/CustomFields.vue.d.ts +6 -6
  142. package/components/Form/CustomFields.vue.js +1 -1
  143. package/components/Form/Form.vue.d.ts +4 -5
  144. package/components/Form/Form.vue.js +2 -2
  145. package/components/Form/Form.vue2.js +221 -178
  146. package/components/Form/FormField.vue.d.ts +4 -3
  147. package/components/Form/FormField.vue.js +70 -62
  148. package/components/Form/FormFields.vue.d.ts +3 -1
  149. package/components/Form/FormFields.vue.js +2 -2
  150. package/components/Form/FormFields.vue2.js +105 -59
  151. package/components/GoogleLogin.vue.d.ts +2 -2
  152. package/components/Icon.vue.d.ts +2 -0
  153. package/components/Icon.vue.js +12 -11
  154. package/components/ImportData/ImportData.vue.d.ts +31 -0
  155. package/components/ImportData/ImportData.vue.js +242 -0
  156. package/components/ImportData/ImportData.vue2.js +4 -0
  157. package/components/ImportData/ImportStep1.vue.d.ts +23 -0
  158. package/components/ImportData/ImportStep1.vue.js +162 -0
  159. package/components/ImportData/ImportStep1.vue2.js +4 -0
  160. package/components/ImportData/ImportStep2.vue.d.ts +20 -0
  161. package/components/ImportData/ImportStep2.vue.js +98 -0
  162. package/components/ImportData/ImportStep2.vue2.js +4 -0
  163. package/components/ImportData/ImportStep3.vue.d.ts +6 -0
  164. package/components/ImportData/ImportStep3.vue.js +98 -0
  165. package/components/ImportData/ImportStep3.vue2.js +4 -0
  166. package/components/ImportData/ImportStep4.vue.d.ts +6 -0
  167. package/components/ImportData/ImportStep4.vue.js +139 -0
  168. package/components/ImportData/ImportStep4.vue2.js +4 -0
  169. package/components/ImportData/index.d.ts +2 -0
  170. package/components/ImportData/types.d.ts +51 -0
  171. package/components/Input.vue.d.ts +9 -9
  172. package/components/Input.vue.js +137 -120
  173. package/components/List/List.vue.d.ts +18 -0
  174. package/components/List/List.vue.js +189 -0
  175. package/components/List/List.vue2.js +4 -0
  176. package/components/List/ListFieldRow.vue.d.ts +35 -0
  177. package/components/List/ListFieldRow.vue.js +119 -0
  178. package/components/List/ListFieldRow.vue2.js +4 -0
  179. package/components/List/index.d.ts +4 -0
  180. package/components/List/types.d.ts +1 -0
  181. package/components/List/utils.d.ts +9 -0
  182. package/components/List/utils.js +64 -0
  183. package/components/Masonry/Masonry.vue.d.ts +2 -2
  184. package/components/Modal.vue.js +5 -122
  185. package/components/Modal.vue2.js +133 -2
  186. package/components/MultiSelect/MultiSelect.vue.d.ts +12 -9
  187. package/components/MultiSelect/MultiSelect.vue.js +101 -64
  188. package/components/Navbar/Navbar.vue.d.ts +48 -9
  189. package/components/Navbar/Navbar.vue.js +418 -146
  190. package/components/Navbar/NavbarItem.vue.d.ts +2 -2
  191. package/components/Navbar/NavbarTabs.vue.d.ts +21 -0
  192. package/components/Navbar/NavbarTabs.vue.js +179 -0
  193. package/components/Navbar/NavbarTabs.vue3.js +5 -0
  194. package/components/Navbar/index.d.ts +3 -0
  195. package/components/NavbarCommandPalette.vue.d.ts +48 -0
  196. package/components/NumberInput.vue.d.ts +8 -8
  197. package/components/OTPInput/OTPInput.vue.d.ts +7 -7
  198. package/components/Pagination/Pagination.vue.d.ts +1 -1
  199. package/components/PermissionMatrix/PermissionEditor.vue.d.ts +36 -0
  200. package/components/PermissionMatrix/PermissionEditor.vue.js +323 -0
  201. package/components/PermissionMatrix/PermissionEditor.vue2.js +4 -0
  202. package/components/PermissionMatrix/PermissionMatrix.vue.d.ts +15 -0
  203. package/components/PermissionMatrix/PermissionMatrix.vue.js +7 -0
  204. package/components/PermissionMatrix/PermissionMatrix.vue2.js +245 -0
  205. package/components/PermissionMatrix/index.d.ts +3 -0
  206. package/components/PermissionMatrix/types.d.ts +59 -0
  207. package/components/PricingPlan/PricingPlan.vue.d.ts +3 -3
  208. package/components/ProgressBar/ProgressBar.vue.d.ts +3 -3
  209. package/components/QRCode/QRCode.vue.d.ts +15 -0
  210. package/components/QRCode/QRCode.vue.js +38 -0
  211. package/components/QRCode/QRCode.vue2.js +4 -0
  212. package/components/QRCode/index.d.ts +1 -0
  213. package/components/Screen/Screen.vue.d.ts +232 -5
  214. package/components/Screen/Screen.vue.js +423 -271
  215. package/components/Screen/ScreenFilter.vue.d.ts +2 -2
  216. package/components/Screen/ScreenFilter.vue.js +9 -9
  217. package/components/Screen/types.d.ts +12 -0
  218. package/components/SidePanel.vue.d.ts +2 -2
  219. package/components/SidebarMenu/SidebarMenu.vue.d.ts +15 -2
  220. package/components/SidebarMenu/SidebarMenu.vue.js +117 -47
  221. package/components/SidebarMenu/SidebarMenuItem.vue.d.ts +2 -0
  222. package/components/SidebarMenu/SidebarMenuItem.vue.js +192 -175
  223. package/components/SidebarMenu/types.d.ts +32 -5
  224. package/components/Slider.vue.d.ts +2 -2
  225. package/components/Spinner/Spinner.vue.d.ts +2 -2
  226. package/components/Stats/Stats.vue.d.ts +14 -0
  227. package/components/Stats/Stats.vue.js +307 -0
  228. package/components/Stats/Stats.vue2.js +4 -0
  229. package/components/Stats/index.d.ts +2 -0
  230. package/components/Stats/types.d.ts +32 -0
  231. package/components/Switch.vue.d.ts +2 -1
  232. package/components/Switch.vue.js +4 -2
  233. package/components/Tabes/Tabes.vue.d.ts +3 -3
  234. package/components/Tabes/Tabes.vue.js +60 -57
  235. package/components/Tabes/types.d.ts +5 -0
  236. package/components/Textarea.vue.d.ts +3 -3
  237. package/components/{Timeline.vue.d.ts → Timeline/Timeline.vue.d.ts} +23 -2
  238. package/components/Timeline/Timeline.vue.js +92 -0
  239. package/components/Timeline/TimelineIndicator.vue.d.ts +9 -0
  240. package/components/Timeline/TimelineIndicator.vue.js +68 -0
  241. package/components/Timeline/TimelineIndicator.vue2.js +4 -0
  242. package/components/Timeline/TimelineItem.vue.d.ts +56 -0
  243. package/components/Timeline/TimelineItem.vue.js +173 -0
  244. package/components/Timeline/TimelineItem.vue2.js +4 -0
  245. package/components/Timeline/index.d.ts +3 -0
  246. package/components/Tooltip.vue.d.ts +2 -2
  247. package/components/Workbook/Sheet.vue.d.ts +2 -2
  248. package/components/Workbook/Workbook.vue.d.ts +3 -3
  249. package/components/index.d.ts +62 -0
  250. package/composables/useBreadcrumb.d.ts +17 -0
  251. package/composables/useBreadcrumb.js +27 -0
  252. package/core/config.d.ts +34 -0
  253. package/core/config.js +10 -7
  254. package/core/index.js +15 -8
  255. package/index.d.ts +55 -44
  256. package/index.js +243 -200
  257. package/package.json +12 -2
  258. package/router.d.ts +2 -0
  259. package/style.css +7 -5
  260. package/types/button.d.ts +1 -1
  261. package/types/config.type.d.ts +35 -0
  262. package/types/form.type.d.ts +3 -1
  263. package/types/index.d.ts +2 -1
  264. package/types/list.type.d.ts +57 -0
  265. package/types/navbar.type.d.ts +38 -1
  266. package/types/timeline.type.d.ts +14 -4
  267. package/components/Timeline.vue.js +0 -160
  268. /package/components/{Timeline.vue2.js → Timeline/Timeline.vue2.js} +0 -0
@@ -0,0 +1,323 @@
1
+ import { defineComponent as K, ref as z, computed as k, onMounted as R, watch as T, openBlock as n, createElementBlock as d, normalizeClass as u, createElementVNode as i, createVNode as h, createCommentVNode as m, unref as W, withCtx as S, withModifiers as A, createBlock as f, toDisplayString as p, Fragment as U, renderList as N } from "vue";
2
+ import _ from "../CheckBox.vue.js";
3
+ import j from "../Switch.vue.js";
4
+ import b from "../Icon.vue.js";
5
+ import X from "../Input.vue.js";
6
+ import Y from "../Tooltip.vue.js";
7
+ import Z from "../Dropdown/Dropdown.vue.js";
8
+ import "../../core/config.js";
9
+ const ee = { class: "flex flex-col sm:flex-row items-start sm:items-center gap-3 mb-4" }, te = { class: "flex items-center gap-2 flex-1 w-full sm:max-w-lg" }, le = {
10
+ key: 0,
11
+ class: "flex-1"
12
+ }, oe = {
13
+ key: 0,
14
+ 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"
15
+ }, se = ["onClick"], ne = { class: "text-sm" }, ae = {
16
+ key: 0,
17
+ class: "border-t px-3 py-1.5"
18
+ }, ie = { class: "flex items-center gap-3 ml-auto" }, re = {
19
+ key: 0,
20
+ class: "text-center py-12 text-muted-foreground"
21
+ }, de = {
22
+ key: 1,
23
+ class: "space-y-0 border rounded-lg overflow-hidden"
24
+ }, ue = ["onClick"], ce = { class: "flex items-center gap-2" }, me = { key: 0 }, fe = { class: "flex items-center gap-2 pl-6" }, pe = { class: "flex items-center" }, Ve = /* @__PURE__ */ K({
25
+ __name: "PermissionEditor",
26
+ props: {
27
+ groups: {},
28
+ modelValue: {},
29
+ toggleMode: { default: "checkbox" },
30
+ searchable: { type: Boolean, default: !0 },
31
+ collapsible: { type: Boolean, default: !0 },
32
+ readonly: { type: Boolean, default: !1 },
33
+ size: { default: "md" },
34
+ class: { default: "" },
35
+ defaultExpanded: { default: () => [] }
36
+ },
37
+ emits: ["update:modelValue"],
38
+ setup(a, { emit: F }) {
39
+ const s = a, w = F, x = z(""), c = z([]), D = k(
40
+ () => s.groups.map((t) => ({
41
+ label: t.label,
42
+ value: t.key,
43
+ icon: t.icon
44
+ }))
45
+ );
46
+ function L(t) {
47
+ const l = c.value;
48
+ l.includes(t) ? c.value = l.filter((e) => e !== t) : c.value = [...l, t];
49
+ }
50
+ function q() {
51
+ c.value = [];
52
+ }
53
+ const v = z(/* @__PURE__ */ new Set()), $ = z(/* @__PURE__ */ new Set());
54
+ function O() {
55
+ if (s.defaultExpanded && s.defaultExpanded.length > 0) {
56
+ const t = s.groups.map((l) => l.key);
57
+ return new Set(t.filter((l) => !s.defaultExpanded.includes(l)));
58
+ }
59
+ return /* @__PURE__ */ new Set();
60
+ }
61
+ R(() => {
62
+ const t = O();
63
+ $.value = t, v.value = new Set(t);
64
+ }), T(x, (t) => {
65
+ if (t.trim()) {
66
+ const l = t.toLowerCase(), e = /* @__PURE__ */ new Set();
67
+ for (const o of s.groups)
68
+ (o.label.toLowerCase().includes(l) || o.permissions.some(
69
+ (C) => C.label.toLowerCase().includes(l) || C.key.toLowerCase().includes(l)
70
+ )) && e.add(o.key);
71
+ const r = s.groups.map((o) => o.key);
72
+ v.value = new Set(r.filter((o) => !e.has(o)));
73
+ } else
74
+ v.value = new Set($.value);
75
+ });
76
+ function Q(t) {
77
+ if (!s.collapsible) return;
78
+ const l = new Set(v.value);
79
+ l.has(t) ? l.delete(t) : l.add(t), v.value = l, x.value.trim() || ($.value = new Set(l));
80
+ }
81
+ const M = k(() => {
82
+ let t = s.groups;
83
+ if (c.value.length > 0 && (t = t.filter((l) => c.value.includes(l.key))), x.value.trim()) {
84
+ const l = x.value.toLowerCase();
85
+ t = t.map((e) => {
86
+ const r = e.permissions.filter(
87
+ (o) => o.label.toLowerCase().includes(l) || o.key.toLowerCase().includes(l) || e.label.toLowerCase().includes(l)
88
+ );
89
+ return r.length === 0 ? null : { ...e, permissions: r };
90
+ }).filter(Boolean);
91
+ }
92
+ return t;
93
+ });
94
+ function g(t) {
95
+ return s.modelValue.includes(t);
96
+ }
97
+ function B(t) {
98
+ if (s.readonly) return;
99
+ const l = g(t) ? s.modelValue.filter((e) => e !== t) : [...s.modelValue, t];
100
+ w("update:modelValue", l);
101
+ }
102
+ function V(t) {
103
+ const l = t.permissions, e = l.filter((r) => g(r.key));
104
+ return e.length === 0 ? "none" : e.length === l.length ? "all" : "indeterminate";
105
+ }
106
+ function E(t) {
107
+ if (s.readonly) return;
108
+ const l = V(t), e = t.permissions.map((o) => o.key);
109
+ let r;
110
+ if (l === "all")
111
+ r = s.modelValue.filter((o) => !e.includes(o));
112
+ else {
113
+ const o = e.filter((G) => !s.modelValue.includes(G));
114
+ r = [...s.modelValue, ...o];
115
+ }
116
+ w("update:modelValue", r);
117
+ }
118
+ function H() {
119
+ if (s.readonly) return;
120
+ const t = s.groups.flatMap((l) => l.permissions.map((e) => e.key));
121
+ w("update:modelValue", t);
122
+ }
123
+ function I() {
124
+ s.readonly || w("update:modelValue", []);
125
+ }
126
+ const J = k(() => s.groups.reduce((t, l) => t + l.permissions.length, 0)), y = k(() => s.size === "sm" ? "text-xs" : "text-sm"), P = k(() => s.size === "sm" ? "px-3 py-1.5" : "px-4 py-2.5");
127
+ return (t, l) => (n(), d("div", {
128
+ class: u(["permission-editor", s.class])
129
+ }, [
130
+ i("div", ee, [
131
+ i("div", te, [
132
+ a.searchable ? (n(), d("div", le, [
133
+ h(X, {
134
+ modelValue: x.value,
135
+ "onUpdate:modelValue": l[0] || (l[0] = (e) => x.value = e),
136
+ placeholder: "Search permissions...",
137
+ icon: "lucide:search",
138
+ size: a.size,
139
+ "show-clear-button": ""
140
+ }, null, 8, ["modelValue", "size"])
141
+ ])) : m("", !0),
142
+ h(W(Z), {
143
+ options: D.value,
144
+ "close-on-select": !1,
145
+ selectable: !1,
146
+ position: "bottom-end"
147
+ }, {
148
+ trigger: S(() => [
149
+ i("button", {
150
+ type: "button",
151
+ class: u([
152
+ "inline-flex items-center gap-1.5 border rounded-md cursor-pointer transition-colors",
153
+ a.size === "sm" ? "px-2 py-1.5 text-xs" : "px-3 py-2 text-sm",
154
+ c.value.length > 0 ? "border-primary bg-primary/5 text-primary" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
155
+ ])
156
+ }, [
157
+ h(b, {
158
+ icon: "lucide:filter",
159
+ class: "w-3.5 h-3.5"
160
+ }),
161
+ l[2] || (l[2] = i("span", { class: "hidden sm:inline" }, "Modules", -1)),
162
+ c.value.length > 0 ? (n(), d("span", oe, p(c.value.length), 1)) : m("", !0)
163
+ ], 2)
164
+ ]),
165
+ item: S(({ option: e }) => [
166
+ i("div", {
167
+ class: "flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-accent rounded-md",
168
+ onClick: A((r) => L(e.value), ["stop"])
169
+ }, [
170
+ h(_, {
171
+ "model-value": c.value.includes(e.value),
172
+ size: "xs",
173
+ "onUpdate:modelValue": (r) => L(e.value)
174
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
175
+ e.icon ? (n(), f(b, {
176
+ key: 0,
177
+ icon: e.icon,
178
+ class: "w-3.5 h-3.5 text-muted-foreground"
179
+ }, null, 8, ["icon"])) : m("", !0),
180
+ i("span", ne, p(e.label), 1)
181
+ ], 8, se)
182
+ ]),
183
+ footer: S(() => [
184
+ c.value.length > 0 ? (n(), d("div", ae, [
185
+ i("button", {
186
+ type: "button",
187
+ class: "text-xs text-muted-foreground hover:text-foreground cursor-pointer",
188
+ onClick: q
189
+ }, " Clear filters ")
190
+ ])) : m("", !0)
191
+ ]),
192
+ _: 1
193
+ }, 8, ["options"])
194
+ ]),
195
+ i("div", ie, [
196
+ i("span", {
197
+ class: u([y.value, "text-muted-foreground whitespace-nowrap"])
198
+ }, p(a.modelValue.length) + " / " + p(J.value) + " selected ", 3),
199
+ a.readonly ? m("", !0) : (n(), d("button", {
200
+ key: 0,
201
+ type: "button",
202
+ class: u([y.value, "text-primary hover:underline whitespace-nowrap cursor-pointer"]),
203
+ onClick: H
204
+ }, " Select All ", 2)),
205
+ !a.readonly && a.modelValue.length > 0 ? (n(), d("button", {
206
+ key: 1,
207
+ type: "button",
208
+ class: u([
209
+ y.value,
210
+ "text-muted-foreground hover:text-foreground hover:underline whitespace-nowrap cursor-pointer"
211
+ ]),
212
+ onClick: I
213
+ }, " Clear ", 2)) : m("", !0)
214
+ ])
215
+ ]),
216
+ M.value.length === 0 ? (n(), d("div", re, [
217
+ h(b, {
218
+ icon: "lucide:search-x",
219
+ class: "w-8 h-8 mx-auto mb-3 opacity-50"
220
+ }),
221
+ i("p", {
222
+ class: u(y.value)
223
+ }, "No permissions match your filters.", 2)
224
+ ])) : (n(), d("div", de, [
225
+ (n(!0), d(U, null, N(M.value, (e, r) => (n(), d(U, {
226
+ key: e.key
227
+ }, [
228
+ i("div", {
229
+ class: u([
230
+ P.value,
231
+ "flex items-center justify-between bg-muted cursor-pointer select-none",
232
+ r > 0 ? "border-t" : ""
233
+ ]),
234
+ onClick: (o) => Q(e.key)
235
+ }, [
236
+ i("div", ce, [
237
+ a.collapsible ? (n(), f(b, {
238
+ key: 0,
239
+ icon: "lucide:chevron-right",
240
+ class: u(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !v.value.has(e.key) }])
241
+ }, null, 8, ["class"])) : m("", !0),
242
+ e.icon ? (n(), f(b, {
243
+ key: 1,
244
+ icon: e.icon,
245
+ class: "w-4 h-4 text-muted-foreground"
246
+ }, null, 8, ["icon"])) : m("", !0),
247
+ i("span", {
248
+ class: u([y.value, "font-semibold text-foreground"])
249
+ }, p(e.label), 3),
250
+ i("span", {
251
+ class: u([a.size === "sm" ? "text-[10px]" : "text-xs", "text-muted-foreground"])
252
+ }, " (" + p(e.permissions.filter((o) => g(o.key)).length) + "/" + p(e.permissions.length) + ") ", 3)
253
+ ]),
254
+ i("div", {
255
+ class: "flex items-center",
256
+ onClick: l[1] || (l[1] = A(() => {
257
+ }, ["stop"]))
258
+ }, [
259
+ a.toggleMode === "checkbox" ? (n(), f(_, {
260
+ key: 0,
261
+ "model-value": V(e) === "all",
262
+ indeterminate: V(e) === "indeterminate",
263
+ disabled: a.readonly,
264
+ size: a.size === "sm" ? "xs" : "sm",
265
+ "onUpdate:modelValue": (o) => E(e)
266
+ }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (n(), f(j, {
267
+ key: 1,
268
+ "model-value": V(e) === "all",
269
+ disabled: a.readonly,
270
+ "onUpdate:modelValue": (o) => E(e)
271
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
272
+ ])
273
+ ], 10, ue),
274
+ v.value.has(e.key) ? m("", !0) : (n(), d("div", me, [
275
+ (n(!0), d(U, null, N(e.permissions, (o, G) => (n(), d("div", {
276
+ key: o.key,
277
+ class: u([
278
+ P.value,
279
+ "flex items-center justify-between border-t hover:bg-accent/40 transition-colors duration-100"
280
+ ])
281
+ }, [
282
+ i("div", fe, [
283
+ i("span", {
284
+ class: u([y.value, "text-foreground"])
285
+ }, p(o.label), 3),
286
+ o.description ? (n(), f(Y, {
287
+ key: 0,
288
+ content: o.description,
289
+ placement: "top"
290
+ }, {
291
+ default: S(() => [
292
+ h(b, {
293
+ icon: "lucide:info",
294
+ class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
295
+ })
296
+ ]),
297
+ _: 1
298
+ }, 8, ["content"])) : m("", !0)
299
+ ]),
300
+ i("div", pe, [
301
+ a.toggleMode === "checkbox" ? (n(), f(_, {
302
+ key: 0,
303
+ "model-value": g(o.key),
304
+ disabled: a.readonly,
305
+ size: a.size === "sm" ? "xs" : "sm",
306
+ "onUpdate:modelValue": (C) => B(o.key)
307
+ }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (n(), f(j, {
308
+ key: 1,
309
+ "model-value": g(o.key),
310
+ disabled: a.readonly,
311
+ "onUpdate:modelValue": (C) => B(o.key)
312
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
313
+ ])
314
+ ], 2))), 128))
315
+ ]))
316
+ ], 64))), 128))
317
+ ]))
318
+ ], 2));
319
+ }
320
+ });
321
+ export {
322
+ Ve as default
323
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./PermissionEditor.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,15 @@
1
+ import { PermissionMatrixProps, PermissionMap, PermissionMatrixSize } from './types';
2
+ declare const _default: import('vue').DefineComponent<PermissionMatrixProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
3
+ "update:modelValue": (value: PermissionMap) => any;
4
+ }, string, import('vue').PublicProps, Readonly<PermissionMatrixProps> & Readonly<{
5
+ "onUpdate:modelValue"?: (value: PermissionMap) => any;
6
+ }>, {
7
+ readonly: boolean;
8
+ size: PermissionMatrixSize;
9
+ class: string;
10
+ searchable: boolean;
11
+ toggleMode: import('./types').PermissionToggleMode;
12
+ collapsible: boolean;
13
+ stickyHeader: boolean;
14
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
15
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import o from "./PermissionMatrix.vue2.js";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1f9be4e0"]]);
5
+ export {
6
+ m as default
7
+ };
@@ -0,0 +1,245 @@
1
+ import { defineComponent as A, ref as G, computed as $, openBlock as n, createElementBlock as c, normalizeClass as r, createVNode as U, createCommentVNode as h, createElementVNode as a, Fragment as y, renderList as v, toDisplayString as x, createBlock as f, withCtx as D } from "vue";
2
+ import L from "../CheckBox.vue.js";
3
+ import M from "../Switch.vue.js";
4
+ import w from "../Icon.vue.js";
5
+ import F from "../Input.vue.js";
6
+ import Q from "../Tooltip.vue.js";
7
+ const R = {
8
+ key: 0,
9
+ class: "mb-4"
10
+ }, T = {
11
+ key: 1,
12
+ class: "text-center py-12 text-muted-foreground"
13
+ }, I = {
14
+ key: 2,
15
+ class: "permission-matrix-wrapper border rounded-lg overflow-auto"
16
+ }, J = { class: "w-full border-collapse" }, O = { class: "bg-muted" }, W = { class: "flex flex-col items-center gap-0.5" }, X = { class: "bg-secondary/60" }, Y = ["onClick"], Z = { class: "flex items-center gap-2" }, K = ["onClick"], ee = { class: "flex items-center justify-center" }, te = { class: "flex items-center gap-2 pl-6" }, le = { class: "flex items-center justify-center" }, re = /* @__PURE__ */ A({
17
+ __name: "PermissionMatrix",
18
+ props: {
19
+ roles: {},
20
+ groups: {},
21
+ modelValue: {},
22
+ toggleMode: { default: "checkbox" },
23
+ searchable: { type: Boolean, default: !0 },
24
+ collapsible: { type: Boolean, default: !0 },
25
+ readonly: { type: Boolean, default: !1 },
26
+ size: { default: "md" },
27
+ stickyHeader: { type: Boolean, default: !0 },
28
+ class: { default: "" }
29
+ },
30
+ emits: ["update:modelValue"],
31
+ setup(d, { emit: N }) {
32
+ const o = d, B = N, p = G(""), g = G(/* @__PURE__ */ new Set());
33
+ function j(l) {
34
+ if (!o.collapsible) return;
35
+ const s = new Set(g.value);
36
+ s.has(l) ? s.delete(l) : s.add(l), g.value = s;
37
+ }
38
+ const P = $(() => {
39
+ if (!p.value.trim()) return o.groups;
40
+ const l = p.value.toLowerCase();
41
+ return o.groups.map((s) => {
42
+ const t = s.permissions.filter(
43
+ (e) => e.label.toLowerCase().includes(l) || e.key.toLowerCase().includes(l) || s.label.toLowerCase().includes(l)
44
+ );
45
+ return t.length === 0 ? null : { ...s, permissions: t };
46
+ }).filter(Boolean);
47
+ });
48
+ function z(l, s) {
49
+ return o.modelValue[l]?.includes(s) ?? !1;
50
+ }
51
+ function S(l, s) {
52
+ if (o.readonly || o.roles.find((u) => u.key === l)?.locked) return;
53
+ const e = o.modelValue[l] || [], i = e.includes(s) ? e.filter((u) => u !== s) : [...e, s];
54
+ B("update:modelValue", {
55
+ ...o.modelValue,
56
+ [l]: i
57
+ });
58
+ }
59
+ function V(l, s) {
60
+ const t = s.permissions, e = t.filter((i) => z(l, i.key));
61
+ return e.length === 0 ? "none" : e.length === t.length ? "all" : "indeterminate";
62
+ }
63
+ function C(l, s) {
64
+ if (o.readonly || o.roles.find((m) => m.key === l)?.locked) return;
65
+ const e = V(l, s), i = s.permissions.map((m) => m.key), u = o.modelValue[l] || [];
66
+ let _;
67
+ if (e === "all")
68
+ _ = u.filter((m) => !i.includes(m));
69
+ else {
70
+ const m = i.filter((q) => !u.includes(q));
71
+ _ = [...u, ...m];
72
+ }
73
+ B("update:modelValue", {
74
+ ...o.modelValue,
75
+ [l]: _
76
+ });
77
+ }
78
+ const k = $(() => o.size === "sm" ? "px-2 py-1" : "px-3 py-2"), b = $(() => o.size === "sm" ? "text-xs" : "text-sm");
79
+ function E(l) {
80
+ return o.modelValue[l]?.length || 0;
81
+ }
82
+ function H() {
83
+ return o.groups.reduce((l, s) => l + s.permissions.length, 0);
84
+ }
85
+ return (l, s) => (n(), c("div", {
86
+ class: r(["permission-matrix", o.class])
87
+ }, [
88
+ d.searchable ? (n(), c("div", R, [
89
+ U(F, {
90
+ modelValue: p.value,
91
+ "onUpdate:modelValue": s[0] || (s[0] = (t) => p.value = t),
92
+ placeholder: "Search permissions...",
93
+ icon: "lucide:search",
94
+ size: d.size,
95
+ "show-clear-button": ""
96
+ }, null, 8, ["modelValue", "size"])
97
+ ])) : h("", !0),
98
+ P.value.length === 0 ? (n(), c("div", T, [
99
+ U(w, {
100
+ icon: "lucide:search-x",
101
+ class: "w-8 h-8 mx-auto mb-3 opacity-50"
102
+ }),
103
+ a("p", {
104
+ class: r(b.value)
105
+ }, "No permissions match your search.", 2)
106
+ ])) : (n(), c("div", I, [
107
+ a("table", J, [
108
+ a("thead", {
109
+ class: r(d.stickyHeader ? "sticky top-0 z-10" : "")
110
+ }, [
111
+ a("tr", O, [
112
+ a("th", {
113
+ class: r([
114
+ k.value,
115
+ b.value,
116
+ "text-left font-semibold text-foreground min-w-[220px] sm:min-w-[260px] bg-muted border-b"
117
+ ])
118
+ }, " Permission ", 2),
119
+ (n(!0), c(y, null, v(d.roles, (t) => (n(), c("th", {
120
+ key: t.key,
121
+ class: r([k.value, "text-center border-b border-l bg-muted min-w-[100px]"])
122
+ }, [
123
+ a("div", W, [
124
+ a("span", {
125
+ class: r([b.value, "font-semibold text-foreground whitespace-nowrap"])
126
+ }, x(t.label), 3),
127
+ a("span", {
128
+ class: r([
129
+ o.size === "sm" ? "text-[10px]" : "text-xs",
130
+ "text-muted-foreground"
131
+ ])
132
+ }, x(E(t.key)) + "/" + x(H()), 3)
133
+ ])
134
+ ], 2))), 128))
135
+ ])
136
+ ], 2),
137
+ a("tbody", null, [
138
+ (n(!0), c(y, null, v(P.value, (t) => (n(), c(y, {
139
+ key: t.key
140
+ }, [
141
+ a("tr", X, [
142
+ a("td", {
143
+ class: r([k.value, "border-b cursor-pointer select-none"]),
144
+ onClick: (e) => j(t.key)
145
+ }, [
146
+ a("div", Z, [
147
+ d.collapsible ? (n(), f(w, {
148
+ key: 0,
149
+ icon: "lucide:chevron-right",
150
+ class: r(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !g.value.has(t.key) }])
151
+ }, null, 8, ["class"])) : h("", !0),
152
+ t.icon ? (n(), f(w, {
153
+ key: 1,
154
+ icon: t.icon,
155
+ class: "w-3.5 h-3.5 text-muted-foreground"
156
+ }, null, 8, ["icon"])) : h("", !0),
157
+ a("span", {
158
+ class: r([b.value, "font-semibold text-foreground"])
159
+ }, x(t.label), 3),
160
+ a("span", {
161
+ class: r([
162
+ o.size === "sm" ? "text-[10px]" : "text-xs",
163
+ "text-muted-foreground ml-1"
164
+ ])
165
+ }, " (" + x(t.permissions.length) + ") ", 3)
166
+ ])
167
+ ], 10, Y),
168
+ (n(!0), c(y, null, v(d.roles, (e) => (n(), c("td", {
169
+ key: e.key,
170
+ class: r([k.value, "text-center border-b border-l"]),
171
+ onClick: (i) => C(e.key, t)
172
+ }, [
173
+ a("div", ee, [
174
+ d.toggleMode === "checkbox" ? (n(), f(L, {
175
+ key: 0,
176
+ "model-value": V(e.key, t) === "all",
177
+ indeterminate: V(e.key, t) === "indeterminate",
178
+ disabled: d.readonly || e.locked,
179
+ size: d.size === "sm" ? "xs" : "sm",
180
+ "onUpdate:modelValue": (i) => C(e.key, t)
181
+ }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (n(), f(M, {
182
+ key: 1,
183
+ "model-value": V(e.key, t) === "all",
184
+ disabled: d.readonly || e.locked,
185
+ "onUpdate:modelValue": (i) => C(e.key, t)
186
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
187
+ ])
188
+ ], 10, K))), 128))
189
+ ]),
190
+ g.value.has(t.key) ? h("", !0) : (n(!0), c(y, { key: 0 }, v(t.permissions, (e) => (n(), c("tr", {
191
+ key: e.key,
192
+ class: "hover:bg-accent/40 transition-colors duration-100"
193
+ }, [
194
+ a("td", {
195
+ class: r([k.value, "border-b"])
196
+ }, [
197
+ a("div", te, [
198
+ a("span", {
199
+ class: r([b.value, "text-foreground"])
200
+ }, x(e.label), 3),
201
+ e.description ? (n(), f(Q, {
202
+ key: 0,
203
+ content: e.description,
204
+ placement: "top"
205
+ }, {
206
+ default: D(() => [
207
+ U(w, {
208
+ icon: "lucide:info",
209
+ class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
210
+ })
211
+ ]),
212
+ _: 1
213
+ }, 8, ["content"])) : h("", !0)
214
+ ])
215
+ ], 2),
216
+ (n(!0), c(y, null, v(d.roles, (i) => (n(), c("td", {
217
+ key: i.key,
218
+ class: r([k.value, "text-center border-b border-l"])
219
+ }, [
220
+ a("div", le, [
221
+ d.toggleMode === "checkbox" ? (n(), f(L, {
222
+ key: 0,
223
+ "model-value": z(i.key, e.key),
224
+ disabled: d.readonly || i.locked,
225
+ size: d.size === "sm" ? "xs" : "sm",
226
+ "onUpdate:modelValue": (u) => S(i.key, e.key)
227
+ }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (n(), f(M, {
228
+ key: 1,
229
+ "model-value": z(i.key, e.key),
230
+ disabled: d.readonly || i.locked,
231
+ "onUpdate:modelValue": (u) => S(i.key, e.key)
232
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
233
+ ])
234
+ ], 2))), 128))
235
+ ]))), 128))
236
+ ], 64))), 128))
237
+ ])
238
+ ])
239
+ ]))
240
+ ], 2));
241
+ }
242
+ });
243
+ export {
244
+ re as default
245
+ };
@@ -0,0 +1,3 @@
1
+ export { default as PermissionMatrix } from './PermissionMatrix.vue';
2
+ export { default as PermissionEditor } from './PermissionEditor.vue';
3
+ export * from './types';
@@ -0,0 +1,59 @@
1
+ /** A single permission definition */
2
+ export interface PermissionDef {
3
+ /** Unique key, e.g. 'hrm_manage_payroll' */
4
+ key: string;
5
+ /** Display label, e.g. 'Manage Payroll' */
6
+ label: string;
7
+ /** Optional tooltip description */
8
+ description?: string;
9
+ }
10
+ /** Group of permissions under a module/category */
11
+ export interface PermissionGroup {
12
+ /** Unique group key, e.g. 'hrm' */
13
+ key: string;
14
+ /** Display label, e.g. 'HRM' */
15
+ label: string;
16
+ /** Optional icon (Iconify format) */
17
+ icon?: string;
18
+ /** Permissions in this group */
19
+ permissions: PermissionDef[];
20
+ }
21
+ /** A role definition */
22
+ export interface RoleDef {
23
+ /** Unique key, e.g. 'admin' */
24
+ key: string;
25
+ /** Display label, e.g. 'Administrator' */
26
+ label: string;
27
+ /** Optional color tint for the role column header */
28
+ color?: string;
29
+ /** Optional description */
30
+ description?: string;
31
+ /** If true, all toggles for this role are disabled (e.g. super-admin) */
32
+ locked?: boolean;
33
+ }
34
+ /** Map of role keys → array of granted permission keys */
35
+ export type PermissionMap = Record<string, string[]>;
36
+ export type PermissionToggleMode = 'checkbox' | 'switch';
37
+ export type PermissionMatrixSize = 'sm' | 'md';
38
+ export interface PermissionMatrixProps {
39
+ /** Role definitions (columns) */
40
+ roles: RoleDef[];
41
+ /** Permission groups with nested permissions (rows) */
42
+ groups: PermissionGroup[];
43
+ /** v-model: map of roleKey → permissionKey[] */
44
+ modelValue: PermissionMap;
45
+ /** Toggle display mode (default: 'checkbox') */
46
+ toggleMode?: PermissionToggleMode;
47
+ /** Show search input (default: true) */
48
+ searchable?: boolean;
49
+ /** Allow collapsing groups (default: true) */
50
+ collapsible?: boolean;
51
+ /** Read-only mode — all toggles disabled */
52
+ readonly?: boolean;
53
+ /** Size variant (default: 'md') */
54
+ size?: PermissionMatrixSize;
55
+ /** Sticky role header row (default: true) */
56
+ stickyHeader?: boolean;
57
+ /** Extra CSS classes */
58
+ class?: string;
59
+ }
@@ -7,16 +7,16 @@ interface Props {
7
7
  gap?: number;
8
8
  }
9
9
  declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
10
- "update:modelValue": (value: string | number) => any;
11
10
  change: (value: string | number) => any;
11
+ "update:modelValue": (value: string | number) => any;
12
12
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
13
- "onUpdate:modelValue"?: (value: string | number) => any;
14
13
  onChange?: (value: string | number) => any;
14
+ "onUpdate:modelValue"?: (value: string | number) => any;
15
15
  }>, {
16
16
  variant: PricingPlanVariant;
17
17
  modelValue: string | number | null;
18
+ columns: number | string;
18
19
  items: PricingPlanItemSchema[];
19
20
  gap: number;
20
- columns: number | string;
21
21
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
22
22
  export default _default;