@gspa/ui 0.1.3 → 0.1.4

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 (196) hide show
  1. package/README.md +18 -0
  2. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  3. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  4. package/dist/components/Accordion.cjs +1 -0
  5. package/dist/components/Accordion.js +192 -0
  6. package/dist/components/AccordionItem.cjs +1 -0
  7. package/dist/components/AccordionItem.js +109 -0
  8. package/dist/components/AddReminderModal.cjs +1 -0
  9. package/dist/components/AddReminderModal.js +107 -0
  10. package/dist/components/Alert.cjs +1 -0
  11. package/dist/components/Alert.js +222 -0
  12. package/dist/components/Avatar.cjs +1 -0
  13. package/dist/components/Avatar.js +86 -0
  14. package/dist/components/Badge.cjs +1 -0
  15. package/dist/components/Badge.js +109 -0
  16. package/dist/components/Breadcrumb.cjs +1 -0
  17. package/dist/components/Breadcrumb.js +72 -0
  18. package/dist/components/Button.cjs +1 -0
  19. package/dist/components/Button.js +190 -0
  20. package/dist/components/ButtonGroup.cjs +1 -0
  21. package/dist/components/ButtonGroup.js +46 -0
  22. package/dist/components/Calendar.cjs +1 -0
  23. package/dist/components/Calendar.js +341 -0
  24. package/dist/components/Card.cjs +1 -0
  25. package/dist/components/Card.js +316 -0
  26. package/dist/components/CardBody.cjs +1 -0
  27. package/dist/components/CardBody.js +34 -0
  28. package/dist/components/CardContent.cjs +1 -0
  29. package/dist/components/CardContent.js +17 -0
  30. package/dist/components/CardFooter.cjs +1 -0
  31. package/dist/components/CardFooter.js +34 -0
  32. package/dist/components/CardHeader.cjs +1 -0
  33. package/dist/components/CardHeader.js +91 -0
  34. package/dist/components/CardTitle.cjs +1 -0
  35. package/dist/components/CardTitle.js +17 -0
  36. package/dist/components/Checkbox.cjs +1 -0
  37. package/dist/components/Checkbox.js +185 -0
  38. package/dist/components/CircularProgress.cjs +1 -0
  39. package/dist/components/CircularProgress.js +141 -0
  40. package/dist/components/DataTable.cjs +1 -0
  41. package/dist/components/DataTable.js +863 -0
  42. package/dist/components/DataTableCell.cjs +1 -0
  43. package/dist/components/DataTableCell.js +95 -0
  44. package/dist/components/DataTableFilters.cjs +1 -0
  45. package/dist/components/DataTableFilters.js +519 -0
  46. package/dist/components/DataTableHeader.cjs +1 -0
  47. package/dist/components/DataTableHeader.js +116 -0
  48. package/dist/components/DataTablePagination.cjs +1 -0
  49. package/dist/components/DataTablePagination.js +290 -0
  50. package/dist/components/DataTableRow.cjs +1 -0
  51. package/dist/components/DataTableRow.js +199 -0
  52. package/dist/components/DataTableToolBar.cjs +1 -0
  53. package/dist/components/DataTableToolBar.js +477 -0
  54. package/dist/components/DatePicker.cjs +1 -0
  55. package/dist/components/DatePicker.js +401 -0
  56. package/dist/components/Divider.cjs +1 -0
  57. package/dist/components/Divider.js +103 -0
  58. package/dist/components/Dropdown.cjs +1 -0
  59. package/dist/components/Dropdown.js +104 -0
  60. package/dist/components/DropdownItem.cjs +1 -0
  61. package/dist/components/DropdownItem.js +60 -0
  62. package/dist/components/EventsCalendar.cjs +1 -0
  63. package/dist/components/EventsCalendar.js +863 -0
  64. package/dist/components/FileUpload.cjs +1 -0
  65. package/dist/components/FileUpload.js +195 -0
  66. package/dist/components/FilterDrawer.cjs +1 -0
  67. package/dist/components/FilterDrawer.js +412 -0
  68. package/dist/components/Footer.cjs +1 -0
  69. package/dist/components/Footer.js +157 -0
  70. package/dist/components/FormField.cjs +1 -0
  71. package/dist/components/FormField.js +190 -0
  72. package/dist/components/Graph.cjs +1 -0
  73. package/dist/components/Graph.js +164 -0
  74. package/dist/components/GraphFilters.cjs +1 -0
  75. package/dist/components/GraphFilters.js +305 -0
  76. package/dist/components/Header.cjs +1 -0
  77. package/dist/components/Header.js +674 -0
  78. package/dist/components/Icon.cjs +1 -0
  79. package/dist/components/Icon.js +51 -0
  80. package/dist/components/Image.cjs +1 -0
  81. package/dist/components/Image.js +112 -0
  82. package/dist/components/Input.cjs +1 -0
  83. package/dist/components/Input.js +166 -0
  84. package/dist/components/InputGroup.cjs +1 -0
  85. package/dist/components/InputGroup.js +45 -0
  86. package/dist/components/Label.cjs +1 -0
  87. package/dist/components/Label.js +46 -0
  88. package/dist/components/Link.cjs +1 -0
  89. package/dist/components/Link.js +119 -0
  90. package/dist/components/ListItem.cjs +1 -0
  91. package/dist/components/ListItem.js +89 -0
  92. package/dist/components/Loader.cjs +1 -0
  93. package/dist/components/Loader.js +154 -0
  94. package/dist/components/Logo.cjs +1 -0
  95. package/dist/components/Logo.js +67 -0
  96. package/dist/components/MenuItem.cjs +1 -0
  97. package/dist/components/MenuItem.js +66 -0
  98. package/dist/components/Modal.cjs +1 -0
  99. package/dist/components/Modal.js +110 -0
  100. package/dist/components/ModalBody.cjs +1 -0
  101. package/dist/components/ModalBody.js +33 -0
  102. package/dist/components/ModalFooter.cjs +1 -0
  103. package/dist/components/ModalFooter.js +33 -0
  104. package/dist/components/ModalHeader.cjs +1 -0
  105. package/dist/components/ModalHeader.js +24 -0
  106. package/dist/components/MultiSelect.cjs +1 -0
  107. package/dist/components/MultiSelect.js +211 -0
  108. package/dist/components/Notification.cjs +1 -0
  109. package/dist/components/Notification.js +121 -0
  110. package/dist/components/Option.cjs +1 -0
  111. package/dist/components/Option.js +44 -0
  112. package/dist/components/Progress.cjs +1 -0
  113. package/dist/components/Progress.js +77 -0
  114. package/dist/components/ProgressBar.cjs +1 -0
  115. package/dist/components/ProgressBar.js +101 -0
  116. package/dist/components/Radio.cjs +1 -0
  117. package/dist/components/Radio.js +81 -0
  118. package/dist/components/RailNav.cjs +1 -0
  119. package/dist/components/RailNav.js +124 -0
  120. package/dist/components/ReminderConfig.cjs +1 -0
  121. package/dist/components/ReminderConfig.js +375 -0
  122. package/dist/components/ReusableForm.cjs +1 -0
  123. package/dist/components/ReusableForm.js +657 -0
  124. package/dist/components/ReusableFormModal.cjs +1 -0
  125. package/dist/components/ReusableFormModal.js +112 -0
  126. package/dist/components/RightDrawer.cjs +1 -0
  127. package/dist/components/RightDrawer.js +143 -0
  128. package/dist/components/Search.cjs +1 -0
  129. package/dist/components/Search.js +252 -0
  130. package/dist/components/Select.cjs +1 -0
  131. package/dist/components/Select.js +243 -0
  132. package/dist/components/Sidebar.cjs +1 -0
  133. package/dist/components/Sidebar.js +372 -0
  134. package/dist/components/Slider.cjs +1 -0
  135. package/dist/components/Slider.js +42 -0
  136. package/dist/components/Spinner.cjs +1 -0
  137. package/dist/components/Spinner.js +87 -0
  138. package/dist/components/Stepper.cjs +1 -0
  139. package/dist/components/Stepper.js +12 -0
  140. package/dist/components/StepperItem.cjs +1 -0
  141. package/dist/components/StepperItem.js +33 -0
  142. package/dist/components/Switch.cjs +1 -0
  143. package/dist/components/Switch.js +112 -0
  144. package/dist/components/Tab.cjs +1 -0
  145. package/dist/components/Tab.js +134 -0
  146. package/dist/components/TabPanel.cjs +1 -0
  147. package/dist/components/TabPanel.js +49 -0
  148. package/dist/components/Text.cjs +1 -0
  149. package/dist/components/Text.js +84 -0
  150. package/dist/components/Textarea.cjs +1 -0
  151. package/dist/components/Textarea.js +102 -0
  152. package/dist/components/ThemeConfigurator.cjs +1 -0
  153. package/dist/components/ThemeConfigurator.js +50 -0
  154. package/dist/components/Timeline.cjs +1 -0
  155. package/dist/components/Timeline.js +24 -0
  156. package/dist/components/TimelineItem.cjs +1 -0
  157. package/dist/components/TimelineItem.js +63 -0
  158. package/dist/components/Toast.cjs +1 -0
  159. package/dist/components/Toast.js +231 -0
  160. package/dist/components/Tooltip.cjs +1 -0
  161. package/dist/components/Tooltip.js +124 -0
  162. package/dist/components/Typography.cjs +1 -0
  163. package/dist/components/Typography.js +267 -0
  164. package/dist/components/charts/BarChart.cjs +1 -0
  165. package/dist/components/charts/BarChart.js +323 -0
  166. package/dist/components/charts/LineChart.cjs +1 -0
  167. package/dist/components/charts/LineChart.js +322 -0
  168. package/dist/components/charts/PieChart.cjs +1 -0
  169. package/dist/components/charts/PieChart.js +311 -0
  170. package/dist/components/charts/StackedBarChart.cjs +1 -0
  171. package/dist/components/charts/StackedBarChart.js +348 -0
  172. package/dist/components/widgets/DashboardWidget.cjs +1 -0
  173. package/dist/components/widgets/DashboardWidget.js +309 -0
  174. package/dist/directives/tooltip.cjs +47 -0
  175. package/dist/directives/tooltip.js +115 -0
  176. package/dist/index.cjs +1 -0
  177. package/dist/index.esm.js +311 -19548
  178. package/dist/layouts/AuthLayout.cjs +1 -0
  179. package/dist/layouts/AuthLayout.js +190 -0
  180. package/dist/layouts/DashboardLayout.cjs +1 -0
  181. package/dist/layouts/DashboardLayout.js +244 -0
  182. package/dist/layouts/DefaultLayout.cjs +1 -0
  183. package/dist/layouts/DefaultLayout.js +94 -0
  184. package/dist/layouts/ErrorLayout.cjs +1 -0
  185. package/dist/layouts/ErrorLayout.js +452 -0
  186. package/dist/lib/auth.cjs +1 -0
  187. package/dist/lib/auth.js +4 -0
  188. package/dist/lib/theme.cjs +1 -0
  189. package/dist/lib/theme.js +135 -0
  190. package/dist/lib/toast.cjs +1 -0
  191. package/dist/lib/toast.js +81 -0
  192. package/dist/tsconfig.tsbuildinfo +1 -1
  193. package/dist/utils/cn.cjs +1 -0
  194. package/dist/utils/cn.js +7 -0
  195. package/package.json +37 -7
  196. package/dist/index.js +0 -605
@@ -0,0 +1,863 @@
1
+ import { useSlots as Ee, ref as w, computed as u, watch as E, resolveComponent as He, createElementBlock as s, openBlock as r, normalizeClass as g, createBlock as p, createCommentVNode as y, createElementVNode as d, createVNode as N, withCtx as b, renderSlot as S, createTextVNode as Je, toDisplayString as $, Fragment as V, renderList as P, createSlots as Ge, withModifiers as ne, mergeProps as Qe } from "vue";
2
+ import { cva as O } from "class-variance-authority";
3
+ import { cn as k } from "../utils/cn.js";
4
+ import Xe from "./Checkbox.js";
5
+ import Ye from "./DataTableHeader.js";
6
+ import Ze from "./DataTableRow.js";
7
+ import We from "./DataTableToolBar.js";
8
+ import _e from "./DataTablePagination.js";
9
+ import et from "./FilterDrawer.js";
10
+ import re from "./Icon.js";
11
+ import H from "./Loader.js";
12
+ import tt from "./Button.js";
13
+ import at from "./Tooltip.js";
14
+ import lt from "./Modal.js";
15
+ import { _ as nt } from "../_plugin-vue_export-helper-CHgC5LLL.js";
16
+ const rt = {
17
+ key: 0,
18
+ class: "inline-flex items-center justify-center min-w-5 h-5 rounded-full text-xs ui-primary-bg text-white px-1"
19
+ }, ot = { class: "relative" }, it = { class: "flex items-center justify-center" }, st = ["onClick"], dt = { class: "flex items-center gap-2" }, ut = {
20
+ key: 1,
21
+ class: "flex flex-col"
22
+ }, ct = ["onClick"], ft = { key: 1 }, gt = {
23
+ key: 1,
24
+ class: "flex items-center gap-1 justify-center"
25
+ }, yt = {
26
+ key: 1,
27
+ class: "text-xs"
28
+ }, mt = { key: 2 }, vt = ["colspan"], pt = { class: "flex flex-col items-center justify-center py-12" }, bt = { class: "ui-text mb-4 flex justify-center" }, ht = { class: "ui-text text-lg font-medium mb-2" }, wt = { class: "ui-text text-sm" }, kt = { class: "p-6" }, xt = { class: "text-xl font-bold ui-text whitespace-pre-wrap wrap-break-word" }, Ct = {
29
+ __name: "DataTable",
30
+ props: {
31
+ data: {
32
+ type: Array,
33
+ required: !0
34
+ },
35
+ columns: {
36
+ type: Array,
37
+ required: !0
38
+ },
39
+ title: {
40
+ type: String,
41
+ default: null
42
+ },
43
+ description: {
44
+ type: String,
45
+ default: null
46
+ },
47
+ selectable: {
48
+ type: Boolean,
49
+ default: !1
50
+ },
51
+ selectedItems: {
52
+ type: Array,
53
+ default: () => []
54
+ },
55
+ sortBy: {
56
+ type: String,
57
+ default: null
58
+ },
59
+ sortOrder: {
60
+ type: String,
61
+ default: "asc",
62
+ validator: (a) => ["asc", "desc"].includes(a)
63
+ },
64
+ pageSize: {
65
+ type: Number,
66
+ default: 10
67
+ },
68
+ showPagination: {
69
+ type: Boolean,
70
+ default: !0
71
+ },
72
+ striped: {
73
+ type: Boolean,
74
+ default: !0
75
+ },
76
+ hoverable: {
77
+ type: Boolean,
78
+ default: !0
79
+ },
80
+ clickableRows: {
81
+ type: Boolean,
82
+ default: !1
83
+ },
84
+ highlightUnreadRows: {
85
+ type: Boolean,
86
+ default: !0
87
+ },
88
+ unreadCreatedAtField: {
89
+ type: String,
90
+ default: ""
91
+ },
92
+ unreadMode: {
93
+ type: String,
94
+ default: "all",
95
+ validator: (a) => ["all", "new-only"].includes(a)
96
+ },
97
+ unreadPersistKey: {
98
+ type: String,
99
+ default: ""
100
+ },
101
+ emptyText: {
102
+ type: String,
103
+ default: "No data available"
104
+ },
105
+ emptySubtitle: {
106
+ type: String,
107
+ default: "Try adjusting your search or filter criteria"
108
+ },
109
+ rowKey: {
110
+ type: String,
111
+ default: "id"
112
+ },
113
+ variant: {
114
+ type: String,
115
+ default: "default",
116
+ validator: (a) => ["default", "bordered", "minimal"].includes(a)
117
+ },
118
+ density: {
119
+ type: String,
120
+ default: "compact",
121
+ validator: (a) => ["compact", "normal", "comfortable"].includes(a)
122
+ },
123
+ headerVariant: {
124
+ type: String,
125
+ default: "default"
126
+ },
127
+ headerPadding: {
128
+ type: String,
129
+ default: "normal"
130
+ },
131
+ paginationVariant: {
132
+ type: String,
133
+ default: "default"
134
+ },
135
+ paginationPadding: {
136
+ type: String,
137
+ default: "normal"
138
+ },
139
+ // Actions configuration
140
+ actions: {
141
+ type: Array,
142
+ default: () => []
143
+ // Expected format:
144
+ // [
145
+ // {
146
+ // key: 'edit',
147
+ // label: 'Edit',
148
+ // icon: 'pen',
149
+ // variant: 'primary', // primary, secondary, danger, success, warning
150
+ // permission: (item) => true, // Function to check permission
151
+ // visible: (item) => true, // Function to check visibility
152
+ // disabled: (item) => false, // Function to check if disabled
153
+ // tooltip: 'Edit item',
154
+ // onClick: (item) => {} // Optional handler
155
+ // }
156
+ // ]
157
+ },
158
+ showActionsColumn: {
159
+ type: Boolean,
160
+ default: !0
161
+ },
162
+ addButton: {
163
+ type: Object,
164
+ default: () => ({})
165
+ },
166
+ // Loading Props
167
+ loading: {
168
+ type: Boolean,
169
+ default: !1
170
+ },
171
+ dataLoading: {
172
+ type: Boolean,
173
+ default: !1
174
+ },
175
+ sortLoading: {
176
+ type: Boolean,
177
+ default: !1
178
+ },
179
+ paginationLoading: {
180
+ type: Boolean,
181
+ default: !1
182
+ },
183
+ bulkLoading: {
184
+ type: Boolean,
185
+ default: !1
186
+ },
187
+ rowLoading: {
188
+ type: Object,
189
+ default: () => ({})
190
+ },
191
+ loadingType: {
192
+ type: String,
193
+ default: "dots",
194
+ validator: (a) => ["spin", "pulse", "bounce", "ripple", "bars", "dots", "ring"].includes(a)
195
+ },
196
+ loadingSize: {
197
+ type: String,
198
+ default: "medium",
199
+ validator: (a) => ["small", "medium", "large", "xl"].includes(a)
200
+ },
201
+ loadingColor: {
202
+ type: String,
203
+ default: "#3b82f6"
204
+ },
205
+ loadingText: {
206
+ type: String,
207
+ default: "Loading..."
208
+ },
209
+ loadingTextPosition: {
210
+ type: String,
211
+ default: "bottom",
212
+ validator: (a) => ["top", "bottom"].includes(a)
213
+ },
214
+ loadingBackground: {
215
+ type: String,
216
+ default: "rgba(255, 255, 255, 0.95)"
217
+ },
218
+ showSkeleton: {
219
+ type: Boolean,
220
+ default: !0
221
+ },
222
+ skeletonRows: {
223
+ type: Number,
224
+ default: 10
225
+ },
226
+ // Toolbar
227
+ showToolbar: {
228
+ type: Boolean,
229
+ default: !1
230
+ },
231
+ showDensityToggle: {
232
+ type: Boolean,
233
+ default: !0
234
+ },
235
+ showColumnToggle: {
236
+ type: Boolean,
237
+ default: !0
238
+ },
239
+ showRefresh: {
240
+ type: Boolean,
241
+ default: !0
242
+ },
243
+ showFilterDrawer: {
244
+ type: Boolean,
245
+ default: !1
246
+ },
247
+ filterFields: {
248
+ type: Array,
249
+ default: () => []
250
+ },
251
+ filterRules: {
252
+ type: Object,
253
+ default: () => ({ logic: "all", rules: [] })
254
+ },
255
+ defaultFilterRules: {
256
+ type: Object,
257
+ default: () => ({ logic: "all", rules: [] })
258
+ },
259
+ themeScope: {
260
+ type: String,
261
+ default: "default",
262
+ validator: (a) => ["default", "module"].includes(a)
263
+ }
264
+ },
265
+ emits: [
266
+ "selection-change",
267
+ "sort-change",
268
+ "row-click",
269
+ "page-change",
270
+ "page-size-change",
271
+ "refresh",
272
+ "action",
273
+ "update:density",
274
+ "toggle-column",
275
+ "add",
276
+ "add-button-click",
277
+ "update:filterRules"
278
+ ],
279
+ setup(a, { expose: oe, emit: ie }) {
280
+ const l = a, m = ie, se = Ee(), T = w(1), B = w(l.pageSize), R = w(l.columns.map((e) => e.key)), x = w(l.sortBy), C = w(l.sortOrder), D = w(!1), L = w(""), K = w(!1), z = w(/* @__PURE__ */ new Set()), J = w(Date.now()), de = (e, t) => {
281
+ if (!(!e || !t))
282
+ return String(t).split(".").reduce((o, n) => o?.[n], e);
283
+ }, U = u(() => Array.isArray(l.filterRules?.rules) ? l.filterRules.rules.length : 0), ue = (e) => {
284
+ if (e && typeof e == "object") {
285
+ const t = e.from || "", o = e.to || "";
286
+ return t && o ? `${t} to ${o}` : t || o || "";
287
+ }
288
+ return String(e ?? "");
289
+ }, ce = () => m("update:filterRules", { logic: "all", rules: [] }), fe = u(
290
+ () => (l.filterRules?.rules || []).map((e) => ({
291
+ id: e.id,
292
+ label: e.label,
293
+ value: ue(e.value)
294
+ }))
295
+ ), ge = O("border ui-border-strong rounded-2xl relative overflow-hidden flex flex-col gap-y-2 px-2 pb-2", {
296
+ variants: {
297
+ variant: {
298
+ default: "shadow-sm ui-border-strong",
299
+ bordered: "border-2 ui-border-strong",
300
+ minimal: "border-none ui-border-strong shadow-none bg-transparent"
301
+ }
302
+ },
303
+ defaultVariants: {
304
+ variant: "default"
305
+ }
306
+ }), ye = O("min-w-full", {
307
+ variants: {
308
+ variant: {
309
+ default: "divide-y divide-(--ui-border-strong)",
310
+ bordered: "border-collapse [&_td]:border [&_th]:border [&_td]:border-(--ui-border-strong) [&_th]:border-(--ui-border-strong)",
311
+ minimal: "divide-y divide-(--ui-border-strong)"
312
+ }
313
+ },
314
+ defaultVariants: {
315
+ variant: "default"
316
+ }
317
+ }), me = O("", {
318
+ variants: {
319
+ variant: {
320
+ default: " border-b border-(--ui-border-strong)",
321
+ bordered: " border-b-2 border-(--ui-border-strong)",
322
+ minimal: "bg-transparent border-b border-(--ui-border-strong)"
323
+ }
324
+ },
325
+ defaultVariants: {
326
+ variant: "default"
327
+ }
328
+ }), ve = O("divide-y", {
329
+ variants: {
330
+ variant: {
331
+ default: " divide-(--ui-border-strong)",
332
+ bordered: " divide-(--ui-border-strong)",
333
+ minimal: "bg-transparent divide-(--ui-border-strong)"
334
+ }
335
+ },
336
+ defaultVariants: {
337
+ variant: "default"
338
+ }
339
+ }), h = u(() => {
340
+ let e = [...l.data];
341
+ if (x.value) {
342
+ const t = l.columns.find((o) => o.key === x.value);
343
+ t && e.sort((o, n) => {
344
+ const v = I(o, t), c = I(n, t);
345
+ return v < c ? C.value === "asc" ? -1 : 1 : v > c ? C.value === "asc" ? 1 : -1 : 0;
346
+ });
347
+ }
348
+ return e;
349
+ }), G = u(() => Math.ceil(h.value.length / B.value)), Q = u(() => {
350
+ if (!l.showPagination) return h.value;
351
+ const e = (T.value - 1) * B.value, t = e + B.value;
352
+ return h.value.slice(e, t);
353
+ }), F = u(
354
+ () => l.columns.filter((e) => R.value.includes(e.key))
355
+ ), pe = u(
356
+ () => l.columns.filter((e) => e.toggleable !== !1)
357
+ ), be = (e, t) => {
358
+ t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((o) => o !== e), m("toggle-column", { key: e, visible: t });
359
+ }, M = u(() => l.showActionsColumn ? se.actions ? !0 : !l.actions || l.actions.length === 0 ? !1 : l.actions.some((t) => t.permission === void 0 ? !0 : typeof t.permission == "boolean" ? t.permission === !0 : typeof t.permission == "function") : !1), he = u(() => {
360
+ let e = l.columns.length;
361
+ return l.selectable && e++, M.value && e++, e;
362
+ }), we = (e) => l.actions.filter((t) => {
363
+ if (t.permission !== void 0) {
364
+ if (typeof t.permission == "function") {
365
+ if (!t.permission(e))
366
+ return !1;
367
+ } else if (!t.permission)
368
+ return !1;
369
+ }
370
+ return t.visible && typeof t.visible == "function" ? t.visible(e) : !0;
371
+ }), X = (e, t) => e.permission && typeof e.permission == "function" ? e.permission(t) : !0, Y = (e, t) => e.disabled && typeof e.disabled == "function" ? e.disabled(t) : !1, ke = (e, t) => {
372
+ Y(e, t) || !X(e, t) || (m("action", { action: e.key, item: t, actionConfig: e }), e.onClick && typeof e.onClick == "function" && e.onClick(t));
373
+ }, xe = (e) => ({
374
+ default: "default",
375
+ primary: "gradient",
376
+ secondary: "secondary",
377
+ danger: "danger",
378
+ success: "success",
379
+ warning: "warning",
380
+ info: "info",
381
+ subtle: "subtle",
382
+ dark: "dark",
383
+ light: "light",
384
+ primaryOutline: "primaryOutline",
385
+ dangerOutline: "dangerOutline",
386
+ successOutline: "successOutline",
387
+ outline: "outline",
388
+ link: "link",
389
+ ghost: "ghost"
390
+ })[e] || "ghost", Z = u(() => h.value.length > 0 && h.value.every((e) => q(e))), Ce = u(() => {
391
+ const e = h.value.filter((t) => q(t)).length;
392
+ return e > 0 && e < h.value.length;
393
+ }), I = (e, t) => t.accessor ? t.accessor(e) : t.key.split(".").reduce((o, n) => o?.[n], e), A = (e, t) => e[l.rowKey] || t, q = (e) => l.selectedItems.some(
394
+ (t) => A(t) === A(e)
395
+ ), Se = (e) => {
396
+ const t = [...l.selectedItems], o = t.findIndex(
397
+ (n) => A(n) === A(e)
398
+ );
399
+ o > -1 ? t.splice(o, 1) : t.push(e), m("selection-change", t);
400
+ }, W = () => {
401
+ if (l.loading || l.dataLoading) return;
402
+ const e = Z.value ? [] : [...h.value];
403
+ m("selection-change", e);
404
+ }, $e = async (e) => {
405
+ !e.sortable || l.loading || l.sortLoading || (x.value === e.key ? C.value = C.value === "asc" ? "desc" : "asc" : (x.value = e.key, C.value = "asc"), m("sort-change", { column: e.key, direction: C.value }));
406
+ }, Re = (e) => {
407
+ if (!l.loading) {
408
+ if (l.highlightUnreadRows) {
409
+ const t = A(e.item, e.index);
410
+ z.value.add(String(t)), Te();
411
+ }
412
+ m("row-click", e);
413
+ }
414
+ }, Ae = (e, t) => {
415
+ if (!l.highlightUnreadRows) return !1;
416
+ const o = String(A(e, t));
417
+ if (z.value.has(o)) return !1;
418
+ if (l.unreadMode === "all") return !0;
419
+ const n = l.unreadCreatedAtField;
420
+ if (!n) return !1;
421
+ const v = n.includes(".") ? de(e, n) : e?.[n];
422
+ if (!v) return !1;
423
+ const c = String(v).trim();
424
+ let f = new Date(c).getTime();
425
+ if (Number.isNaN(f)) {
426
+ const i = c.match(/^(\d{2})[-/](\d{2})[-/](\d{4})$/);
427
+ if (i) {
428
+ const [, le, Ie, qe] = i;
429
+ f = (/* @__PURE__ */ new Date(`${qe}-${Ie}-${le}T00:00:00`)).getTime();
430
+ }
431
+ }
432
+ if (Number.isNaN(f)) return !1;
433
+ if (/^\d{4}-\d{2}-\d{2}$/.test(c)) {
434
+ const i = new Date(J.value);
435
+ return i.setHours(0, 0, 0, 0), f >= i.getTime();
436
+ }
437
+ return f >= J.value;
438
+ }, Be = (e, t) => l.highlightUnreadRows ? Ae(e, t) ? "font-bold !bg-[color:color-mix(in_oklab,var(--module-soft,var(--ui-primary-soft))_62%,var(--ui-surface)_38%)]" : "font-normal !bg-[color:color-mix(in_oklab,var(--module-soft-alt,var(--ui-surface-soft))_42%,var(--ui-surface)_58%)]" : "", Pe = () => {
439
+ if (!(!l.unreadPersistKey || typeof window > "u"))
440
+ try {
441
+ const e = window.localStorage.getItem(l.unreadPersistKey);
442
+ if (!e) return;
443
+ const t = JSON.parse(e);
444
+ Array.isArray(t) && (z.value = new Set(t.map(String)));
445
+ } catch {
446
+ }
447
+ }, Te = () => {
448
+ if (!(!l.unreadPersistKey || typeof window > "u"))
449
+ try {
450
+ window.localStorage.setItem(l.unreadPersistKey, JSON.stringify(Array.from(z.value)));
451
+ } catch {
452
+ }
453
+ }, _ = async (e) => {
454
+ l.paginationLoading || l.loading || (T.value = e, m("page-change", e));
455
+ }, Ve = async (e) => {
456
+ l.paginationLoading || l.loading || (B.value = e, T.value = 1, m("page-size-change", e));
457
+ }, De = u(
458
+ () => k(
459
+ ge({ variant: l.variant }),
460
+ l.themeScope === "module" && "kv-module-themed-table"
461
+ )
462
+ ), Le = u(
463
+ () => k(ye({ variant: l.variant }))
464
+ ), ze = u(
465
+ () => k(me({ variant: l.variant }))
466
+ ), Fe = u(
467
+ () => k(ve({ variant: l.variant }))
468
+ ), je = (e) => k(
469
+ {
470
+ compact: "px-3.5 py-1.5",
471
+ normal: "px-6 py-3",
472
+ comfortable: "px-8 py-4"
473
+ }[l.density],
474
+ "text-left text-sm font-extrabold ui-text uppercase tracking-wider",
475
+ {
476
+ "cursor-pointer hover:bg-(--ui-surface) transition-colors": e.sortable && !l.loading && !l.sortLoading,
477
+ "cursor-not-allowed opacity-50": l.loading || l.sortLoading && x.value === e.key
478
+ }
479
+ ), Ne = () => k(
480
+ {
481
+ compact: "px-3.5 py-1.5",
482
+ normal: "px-6 py-4",
483
+ comfortable: "px-8 py-6"
484
+ }[l.density],
485
+ "whitespace-nowrap text-sm ui-text"
486
+ ), j = (e, t) => {
487
+ const o = I(e, t);
488
+ return typeof t == "object" && t.formatter ? t.formatter(o, e) : o == null ? "" : o instanceof Date ? o.toLocaleDateString() : Array.isArray(o) ? o.join(", ") : o;
489
+ }, Oe = (e, t = 10) => {
490
+ if (!e) return e;
491
+ const o = e.toString().split(" ");
492
+ return o.length <= t ? e : o.slice(0, t).join(" ") + "...";
493
+ }, Ke = (e) => {
494
+ L.value || (L.value = e, D.value = !0);
495
+ }, Ue = () => {
496
+ D.value = !1, L.value = "";
497
+ }, ee = u(() => k(
498
+ {
499
+ compact: "px-3.5 py-1.5",
500
+ normal: "px-6 py-4",
501
+ comfortable: "px-8 py-6"
502
+ }[l.density],
503
+ "whitespace-nowrap text-sm ui-text w-12"
504
+ )), te = u(() => k(
505
+ {
506
+ compact: "px-3.5 py-1.5",
507
+ normal: "px-6 py-4",
508
+ comfortable: "px-8 py-6"
509
+ }[l.density],
510
+ "whitespace-nowrap text-md font-extrabold text-center"
511
+ )), Me = u(() => k(
512
+ {
513
+ compact: "px-4 py-4",
514
+ normal: "px-6 py-6",
515
+ comfortable: "px-8 py-8"
516
+ }[l.density],
517
+ "text-center"
518
+ )), ae = (e, t) => k(
519
+ {
520
+ "ui-primary": x.value === e.key && C.value === t,
521
+ "ui-text": x.value !== e.key || C.value !== t
522
+ }
523
+ );
524
+ return E(() => l.selectedItems, () => {
525
+ }, { deep: !0 }), E(() => l.pageSize, (e) => {
526
+ B.value = e;
527
+ }), E(() => l.columns, (e) => {
528
+ R.value = e.map((t) => t.key);
529
+ }, { deep: !0 }), oe({
530
+ refresh: () => {
531
+ m("refresh");
532
+ },
533
+ goToPage: (e) => {
534
+ _(e);
535
+ },
536
+ selectAll: () => {
537
+ W();
538
+ },
539
+ clearSelection: () => {
540
+ m("selection-change", []);
541
+ },
542
+ getCurrentPage: () => T.value,
543
+ getTotalPages: () => G.value,
544
+ getSelectedItems: () => l.selectedItems
545
+ }), Pe(), (e, t) => {
546
+ const o = He("font-awesome-icon");
547
+ return r(), s("div", {
548
+ class: g(De.value)
549
+ }, [
550
+ a.title || a.description || e.$slots.header ? (r(), p(Ye, {
551
+ key: 0,
552
+ title: a.title,
553
+ description: a.description,
554
+ variant: a.headerVariant,
555
+ padding: a.headerPadding
556
+ }, {
557
+ header: b(() => [
558
+ S(e.$slots, "header", {}, void 0, !0)
559
+ ]),
560
+ filters: b(() => [
561
+ S(e.$slots, "filters", {}, void 0, !0)
562
+ ]),
563
+ _: 3
564
+ }, 8, ["title", "description", "variant", "padding"])) : y("", !0),
565
+ a.showToolbar ? (r(), p(We, {
566
+ key: 1,
567
+ "selected-items": a.selectedItems,
568
+ "total-items": h.value.length,
569
+ "show-density-toggle": a.showDensityToggle,
570
+ "show-column-toggle": a.showColumnToggle,
571
+ "show-refresh": a.showRefresh,
572
+ "active-filters": a.showFilterDrawer ? fe.value : [],
573
+ "default-filter-rules": a.defaultFilterRules,
574
+ "add-button": a.addButton,
575
+ density: a.density,
576
+ "toggleable-columns": pe.value,
577
+ "visible-columns": R.value,
578
+ "onUpdate:density": t[1] || (t[1] = (n) => m("update:density", n)),
579
+ onToggleColumn: be,
580
+ onRefresh: t[2] || (t[2] = (n) => e.$emit("refresh")),
581
+ onAdd: t[3] || (t[3] = (n) => m("add")),
582
+ onAddButtonClick: t[4] || (t[4] = (n) => m("add-button-click", n))
583
+ }, {
584
+ actions: b(() => [
585
+ S(e.$slots, "toolbar-actions", {}, void 0, !0)
586
+ ]),
587
+ "actions-after-add": b(() => [
588
+ a.showFilterDrawer ? (r(), s("button", {
589
+ key: 0,
590
+ class: "px-3 py-2 text-sm border ui-border-strong rounded-md hover:bg-(--ui-surface) flex items-center gap-2",
591
+ onClick: t[0] || (t[0] = (n) => K.value = !0)
592
+ }, [
593
+ N(o, { icon: "filter" }),
594
+ t[8] || (t[8] = Je(" Filter ", -1)),
595
+ U.value > 0 ? (r(), s("span", rt, $(U.value), 1)) : y("", !0)
596
+ ])) : y("", !0),
597
+ S(e.$slots, "toolbar-actions-after-add", {}, void 0, !0)
598
+ ]),
599
+ "active-filter-actions": b(() => [
600
+ a.showFilterDrawer && U.value > 0 ? (r(), s("button", {
601
+ key: 0,
602
+ class: "ml-1 px-2 py-1 text-sm border border-(--ui-primary) rounded-md ui-primary hover:bg-(--ui-primary-soft)",
603
+ onClick: ce
604
+ }, " Clear filter ")) : y("", !0)
605
+ ]),
606
+ _: 3
607
+ }, 8, ["selected-items", "total-items", "show-density-toggle", "show-column-toggle", "show-refresh", "active-filters", "default-filter-rules", "add-button", "density", "toggleable-columns", "visible-columns"])) : y("", !0),
608
+ a.showFilterDrawer ? (r(), p(et, {
609
+ key: 2,
610
+ open: K.value,
611
+ fields: a.filterFields,
612
+ "model-value": a.filterRules,
613
+ "onUpdate:modelValue": t[5] || (t[5] = (n) => e.$emit("update:filterRules", n)),
614
+ onClose: t[6] || (t[6] = (n) => K.value = !1)
615
+ }, null, 8, ["open", "fields", "model-value"])) : y("", !0),
616
+ d("div", ot, [
617
+ a.loading ? (r(), p(H, {
618
+ key: 0,
619
+ loading: !0,
620
+ type: a.loadingType,
621
+ size: a.loadingSize,
622
+ color: a.loadingColor,
623
+ overlay: !0,
624
+ text: a.loadingText,
625
+ "text-position": a.loadingTextPosition,
626
+ "background-color": a.loadingBackground,
627
+ class: "table-loading-overlay"
628
+ }, null, 8, ["type", "size", "color", "text", "text-position", "background-color"])) : y("", !0),
629
+ d("div", {
630
+ class: g(["overflow-x-auto", { "opacity-50": a.loading }])
631
+ }, [
632
+ d("table", {
633
+ class: g(Le.value)
634
+ }, [
635
+ d("thead", {
636
+ class: g(ze.value)
637
+ }, [
638
+ d("tr", null, [
639
+ a.selectable ? (r(), s("th", {
640
+ key: 0,
641
+ class: g(ee.value)
642
+ }, [
643
+ d("div", it, [
644
+ a.bulkLoading ? (r(), p(H, {
645
+ key: 0,
646
+ loading: !0,
647
+ type: "spin",
648
+ size: "small",
649
+ color: a.loadingColor
650
+ }, null, 8, ["color"])) : (r(), p(Xe, {
651
+ key: 1,
652
+ "model-value": Z.value,
653
+ indeterminate: Ce.value,
654
+ disabled: a.loading || a.dataLoading,
655
+ "onUpdate:modelValue": W
656
+ }, null, 8, ["model-value", "indeterminate", "disabled"]))
657
+ ])
658
+ ], 2)) : y("", !0),
659
+ (r(!0), s(V, null, P(F.value, (n) => (r(), s("th", {
660
+ key: n.key,
661
+ class: g(je(n)),
662
+ onClick: (v) => $e(n)
663
+ }, [
664
+ d("div", dt, [
665
+ d("span", null, $(n.label), 1),
666
+ a.sortLoading && x.value === n.key ? (r(), p(H, {
667
+ key: 0,
668
+ loading: !0,
669
+ type: "spin",
670
+ size: "small",
671
+ color: a.loadingColor
672
+ }, null, 8, ["color"])) : n.sortable ? (r(), s("div", ut, [
673
+ (r(), s("svg", {
674
+ class: g([ae(n, "asc"), "w-3 h-3 transition-colors"]),
675
+ fill: "none",
676
+ viewBox: "0 0 24 24",
677
+ "stroke-width": "1.5",
678
+ stroke: "currentColor"
679
+ }, [...t[9] || (t[9] = [
680
+ d("path", {
681
+ "stroke-linecap": "round",
682
+ "stroke-linejoin": "round",
683
+ d: "m4.5 15.75 7.5-7.5 7.5 7.5"
684
+ }, null, -1)
685
+ ])], 2)),
686
+ (r(), s("svg", {
687
+ class: g([ae(n, "desc"), "w-3 h-3 transition-colors"]),
688
+ fill: "none",
689
+ viewBox: "0 0 24 24",
690
+ "stroke-width": "1.5",
691
+ stroke: "currentColor"
692
+ }, [...t[10] || (t[10] = [
693
+ d("path", {
694
+ "stroke-linecap": "round",
695
+ "stroke-linejoin": "round",
696
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5"
697
+ }, null, -1)
698
+ ])], 2))
699
+ ])) : y("", !0)
700
+ ])
701
+ ], 10, st))), 128)),
702
+ M.value ? (r(), s("th", {
703
+ key: 1,
704
+ class: g(te.value)
705
+ }, " Actions ", 2)) : y("", !0)
706
+ ])
707
+ ], 2),
708
+ d("tbody", {
709
+ class: g(Fe.value)
710
+ }, [
711
+ a.showSkeleton && (a.loading || a.dataLoading) ? (r(!0), s(V, { key: 0 }, P(a.skeletonRows, (n) => (r(), s("tr", {
712
+ key: `skeleton-${n}`,
713
+ class: "animate-pulse"
714
+ }, [
715
+ a.selectable ? (r(), s("td", {
716
+ key: 0,
717
+ class: g(ee.value)
718
+ }, [...t[11] || (t[11] = [
719
+ d("div", { class: "w-4 h-4 ui-bg rounded" }, null, -1)
720
+ ])], 2)) : y("", !0),
721
+ (r(!0), s(V, null, P(F.value, (v) => (r(), s("td", {
722
+ key: v.key,
723
+ class: g(Ne())
724
+ }, [...t[12] || (t[12] = [
725
+ d("div", { class: "h-4 ui-bg rounded w-3/4" }, null, -1)
726
+ ])], 2))), 128)),
727
+ M.value ? (r(), s("td", {
728
+ key: 1,
729
+ class: g(te.value)
730
+ }, [...t[13] || (t[13] = [
731
+ d("div", { class: "flex gap-2 justify-center" }, [
732
+ d("div", { class: "w-6 h-6 ui-surface rounded" }),
733
+ d("div", { class: "w-6 h-6 ui-surface rounded" })
734
+ ], -1)
735
+ ])], 2)) : y("", !0)
736
+ ]))), 128)) : Q.value.length > 0 ? (r(!0), s(V, { key: 1 }, P(Q.value, (n, v) => (r(), p(Ze, {
737
+ key: A(n, v),
738
+ item: n,
739
+ columns: F.value,
740
+ index: v,
741
+ selectable: a.selectable,
742
+ "is-selected": q(n),
743
+ striped: a.striped,
744
+ hoverable: a.hoverable,
745
+ "clickable-rows": a.clickableRows,
746
+ "row-class": Be(n, v),
747
+ density: a.density,
748
+ variant: a.variant,
749
+ onToggleSelection: Se,
750
+ onRowClick: Re
751
+ }, Ge({
752
+ actions: b(({ item: c, index: f }) => [
753
+ e.$slots.actions ? S(e.$slots, "actions", {
754
+ key: 0,
755
+ item: c,
756
+ index: f
757
+ }, void 0, !0) : a.actions.length > 0 ? (r(), s("div", gt, [
758
+ (r(!0), s(V, null, P(we(c), (i) => (r(), p(at, {
759
+ key: i.key,
760
+ content: typeof i.tooltip == "function" ? i.tooltip(c) : i.tooltip || i.label || i.key,
761
+ placement: "top"
762
+ }, {
763
+ default: b(() => [
764
+ N(tt, {
765
+ variant: xe(i.variant),
766
+ size: "xs",
767
+ disabled: Y(i, c) || !X(i, c),
768
+ class: g(["h-8 w-8", typeof i.class == "function" ? i.class(c) : i.class]),
769
+ onClick: ne((le) => ke(i, c), ["stop"])
770
+ }, {
771
+ default: b(() => [
772
+ i.icon ? (r(), p(re, {
773
+ key: 0,
774
+ icon: i.icon,
775
+ class: "w-4 h-4"
776
+ }, null, 8, ["icon"])) : i.label ? (r(), s("span", yt, $(i.label), 1)) : y("", !0)
777
+ ]),
778
+ _: 2
779
+ }, 1032, ["variant", "disabled", "class", "onClick"])
780
+ ]),
781
+ _: 2
782
+ }, 1032, ["content"]))), 128))
783
+ ])) : y("", !0)
784
+ ]),
785
+ _: 2
786
+ }, [
787
+ P(F.value, (c) => ({
788
+ name: `cell-${c.key}`,
789
+ fn: b((f) => [
790
+ S(e.$slots, `cell-${c.key}`, Qe({ ref_for: !0 }, f), () => [
791
+ j(f.item, f.column).toString().split(" ").length > 10 ? (r(), s("span", {
792
+ key: 0,
793
+ class: "cursor-pointer ui-primary hover:text-(--ui-primary)",
794
+ onClick: ne((i) => Ke(j(f.item, f.column)), ["stop"])
795
+ }, $(Oe(j(f.item, f.column))), 9, ct)) : (r(), s("span", ft, $(j(f.item, f.column)), 1))
796
+ ], !0)
797
+ ])
798
+ }))
799
+ ]), 1032, ["item", "columns", "index", "selectable", "is-selected", "striped", "hoverable", "clickable-rows", "row-class", "density", "variant"]))), 128)) : (r(), s("tr", mt, [
800
+ d("td", {
801
+ colspan: he.value,
802
+ class: g(Me.value)
803
+ }, [
804
+ S(e.$slots, "empty", {}, () => [
805
+ d("div", pt, [
806
+ d("div", bt, [
807
+ N(re, {
808
+ icon: "search",
809
+ class: "w-16 h-16"
810
+ })
811
+ ]),
812
+ d("p", ht, $(a.emptyText), 1),
813
+ d("p", wt, $(a.emptySubtitle), 1)
814
+ ])
815
+ ], !0)
816
+ ], 10, vt)
817
+ ]))
818
+ ], 2)
819
+ ], 2)
820
+ ], 2)
821
+ ]),
822
+ a.showPagination || e.$slots.footer ? (r(), p(_e, {
823
+ key: 3,
824
+ "current-page": T.value,
825
+ "total-pages": G.value,
826
+ total: h.value.length,
827
+ "page-size": B.value,
828
+ "show-pagination": a.showPagination,
829
+ selectable: a.selectable,
830
+ "selected-count": a.selectedItems.length,
831
+ variant: a.paginationVariant,
832
+ padding: a.paginationPadding,
833
+ loading: a.paginationLoading,
834
+ disabled: a.loading || a.dataLoading,
835
+ "onUpdate:currentPage": _,
836
+ "onUpdate:pageSize": Ve
837
+ }, {
838
+ footer: b(() => [
839
+ S(e.$slots, "footer", {}, void 0, !0)
840
+ ]),
841
+ _: 3
842
+ }, 8, ["current-page", "total-pages", "total", "page-size", "show-pagination", "selectable", "selected-count", "variant", "padding", "loading", "disabled"])) : y("", !0),
843
+ N(lt, {
844
+ modelValue: D.value,
845
+ "onUpdate:modelValue": t[7] || (t[7] = (n) => D.value = n),
846
+ size: "lg",
847
+ onClose: Ue
848
+ }, {
849
+ default: b(() => [
850
+ d("div", kt, [
851
+ t[14] || (t[14] = d("h3", { class: "text-md font-semibold mb-4" }, " Full Text ", -1)),
852
+ d("div", xt, $(L.value), 1)
853
+ ])
854
+ ]),
855
+ _: 1
856
+ }, 8, ["modelValue"])
857
+ ], 2);
858
+ };
859
+ }
860
+ }, Kt = /* @__PURE__ */ nt(Ct, [["__scopeId", "data-v-dc691687"]]);
861
+ export {
862
+ Kt as default
863
+ };