vlite3 0.1.9 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -106
- package/components/Button.vue.js +1 -1
- package/components/Chip/Chip.vue.js +15 -15
- package/components/ConfirmationModal.vue.js +17 -14
- package/components/DataTable/DataTable.vue.js +2 -2
- package/components/DataTable/DataTable.vue2.js +41 -39
- package/components/DataTable/types.d.ts +1 -0
- package/components/DatePicker.vue.d.ts +12 -3
- package/components/DatePicker.vue.js +80 -39
- package/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/components/Dropdown/Dropdown.vue.js +28 -22
- package/components/Dropdown/DropdownMenu.vue.js +54 -51
- package/components/Form/Form.vue.d.ts +2 -0
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +104 -101
- package/components/Form/FormField.vue.d.ts +4 -0
- package/components/Form/FormField.vue.js +248 -147
- package/components/Form/FormFields.vue.d.ts +2 -0
- package/components/Form/FormFields.vue.js +2 -2
- package/components/Form/FormFields.vue2.js +45 -39
- package/components/Form/types.d.ts +24 -4
- package/components/Form/utils/form.utils.d.ts +5 -1
- package/components/Form/utils/form.utils.js +69 -60
- package/components/GoogleLogin.vue.d.ts +41 -0
- package/components/Input.vue.js +120 -111
- package/components/Modal.vue.js +17 -17
- package/components/NumberInput.vue.d.ts +38 -0
- package/components/NumberInput.vue.js +7 -0
- package/components/NumberInput.vue2.js +191 -0
- package/components/Pagination/Pagination.vue.d.ts +1 -0
- package/components/Pagination/Pagination.vue.js +60 -46
- package/components/ProgressBar/ProgressBar.vue.d.ts +12 -0
- package/components/ProgressBar/index.d.ts +3 -0
- package/components/Spinner/Spinner.vue.d.ts +8 -0
- package/components/Spinner/Spinner.vue.js +89 -0
- package/components/Spinner/Spinner.vue2.js +4 -0
- package/components/Spinner/index.d.ts +2 -0
- package/components/Spinner/types.d.ts +9 -0
- package/components/Tabes/Tabes.vue.d.ts +3 -1
- package/components/Tabes/Tabes.vue.js +103 -44
- package/index.d.ts +2 -0
- package/index.js +133 -114
- package/package.json +4 -3
- package/style.css +35 -4
- package/types/form.type.d.ts +2 -2
- package/types/progressbar.d.ts +75 -0
- package/utils/functions.d.ts +99 -0
- package/utils/functions.js +91 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# vlite3
|
|
2
2
|
|
|
3
|
-
A lightweight Vue 3 UI component library built with Tailwind CSS.
|
|
3
|
+
A lightweight Vue 3 UI component library built with Tailwind CSS, created for personal projects and available for anyone to use.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -138,6 +138,59 @@ To customize the theme, simply override the CSS variables in your main CSS file:
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
## 8. Typography Scale System
|
|
142
|
+
|
|
143
|
+
The system is divided into two groups:
|
|
144
|
+
|
|
145
|
+
- Compact scale (prefixed with `--text--fs-*`) for smaller text
|
|
146
|
+
- Progressive scale (prefixed with `--text-fs-*`) for base and larger text
|
|
147
|
+
|
|
148
|
+
### Compact Text Scale
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
--text--fs-1: 0.95em;
|
|
152
|
+
--text--fs-2: 0.8em;
|
|
153
|
+
--text--fs-3: 0.75em;
|
|
154
|
+
--text--fs-4: 0.7em;
|
|
155
|
+
--text--fs-5: 0.65em;
|
|
156
|
+
--text--fs-6: 0.6em;
|
|
157
|
+
--text--fs-7: 0.55em;
|
|
158
|
+
--text--fs-8: 0.5em;
|
|
159
|
+
--text-fs-0.5: 1.05em;
|
|
160
|
+
--text-fs-1: 1.1em;
|
|
161
|
+
--text-fs-1.5: 1.14em;
|
|
162
|
+
--text-fs-2: 1.18em;
|
|
163
|
+
--text-fs-2.5: 1.22em;
|
|
164
|
+
--text-fs-3: 1.26em;
|
|
165
|
+
--text-fs-3.5: 1.3em;
|
|
166
|
+
--text-fs-4: 1.34em;
|
|
167
|
+
--text-fs-4.5: 1.38em;
|
|
168
|
+
--text-fs-5: 1.42em;
|
|
169
|
+
--text-fs-5.5: 1.46em;
|
|
170
|
+
--text-fs-6: 1.5em;
|
|
171
|
+
--text-fs-6.5: 1.54em;
|
|
172
|
+
--text-fs-7: 1.58em;
|
|
173
|
+
--text-fs-7.5: 1.62em;
|
|
174
|
+
--text-fs-8: 1.68em;
|
|
175
|
+
--text-fs-8.5: 1.72em;
|
|
176
|
+
--text-fs-9: 1.8em;
|
|
177
|
+
--text-fs-9.5: 2em;
|
|
178
|
+
--text-fs-10: 2.5em;
|
|
179
|
+
|
|
180
|
+
--text-xs: 0.75rem --text-sm: 0.875rem --text-base: 1rem --text-lg: 1.125rem --text-xl: 1.25rem
|
|
181
|
+
--text-2xl: 1.5rem --text-3xl: 1.875rem --text-4xl: 2.25rem --text-5xl: 3rem --text-6xl: 4rem;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
```html
|
|
187
|
+
<p class="text-fs-2">Body text</p>
|
|
188
|
+
|
|
189
|
+
<span class="-text-fs-4 text-muted"> Caption text </span>
|
|
190
|
+
|
|
191
|
+
<h1 class="text-xl font-semibold">Page Title</h1>
|
|
192
|
+
```
|
|
193
|
+
|
|
141
194
|
## ✅ Components
|
|
142
195
|
|
|
143
196
|
- **Button**
|
|
@@ -170,6 +223,8 @@ To customize the theme, simply override the CSS variables in your main CSS file:
|
|
|
170
223
|
- **MultiSelect**
|
|
171
224
|
- **Form**
|
|
172
225
|
- **CustomFields**
|
|
226
|
+
- **NumberInput**
|
|
227
|
+
- **Google Login**
|
|
173
228
|
|
|
174
229
|
### Data Display
|
|
175
230
|
|
|
@@ -193,110 +248,12 @@ To customize the theme, simply override the CSS variables in your main CSS file:
|
|
|
193
248
|
- **ToastNotification**
|
|
194
249
|
- **Tooltip**
|
|
195
250
|
- **Dropdown**
|
|
251
|
+
- **ProgressBar**
|
|
252
|
+
- **Spinner**
|
|
196
253
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
vlite3 features a plugin-based architecture that allows you to register global services. This is particularly useful for dependency injection, such as defining how file uploads should be handled across all `Form` components in your app.
|
|
200
|
-
|
|
201
|
-
### Setting up the Plugin
|
|
202
|
-
|
|
203
|
-
In your `main.ts` or `main.js`, import `createVLite` and register your services:
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
import { createApp } from 'vue'
|
|
207
|
-
import App from './App.vue'
|
|
208
|
-
import { createVLite } from 'vlite3'
|
|
209
|
-
|
|
210
|
-
const app = createApp(App)
|
|
211
|
-
|
|
212
|
-
// Initialize VLite with custom configuration
|
|
213
|
-
const vlite = createVLite({
|
|
214
|
-
services: {
|
|
215
|
-
/**
|
|
216
|
-
* Global File Upload Handler
|
|
217
|
-
*
|
|
218
|
-
* This function will be called automatically by:
|
|
219
|
-
* - useFileUpload() composable
|
|
220
|
-
* - Form components (when using 'file', 'fileUploader', or 'avatarUpload' types)
|
|
221
|
-
*
|
|
222
|
-
* @param file - The File object to upload
|
|
223
|
-
* @param folderId - (Optional) Folder ID passed from component props
|
|
224
|
-
* @returns Promise<string> - The public URL of the uploaded file
|
|
225
|
-
*/
|
|
226
|
-
upload: async (file, folderId) => {
|
|
227
|
-
// Example: Upload to your own backend
|
|
228
|
-
const formData = new FormData()
|
|
229
|
-
formData.append('file', file)
|
|
230
|
-
if (folderId) formData.append('folder_id', folderId)
|
|
231
|
-
|
|
232
|
-
// Replace with your actual API call (e.g., Axios, Fetch)
|
|
233
|
-
const response = await fetch(
|
|
234
|
-
'[https://api.yourdomain.com/v1/upload](https://api.yourdomain.com/v1/upload)',
|
|
235
|
-
{
|
|
236
|
-
method: 'POST',
|
|
237
|
-
body: formData,
|
|
238
|
-
headers: {
|
|
239
|
-
Authorization: 'Bearer ...',
|
|
240
|
-
},
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
if (!response.ok) throw new Error('Upload failed')
|
|
245
|
-
|
|
246
|
-
const data = await response.json()
|
|
247
|
-
return data.url // MUST return the file URL string
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
app.use(vlite)
|
|
253
|
-
app.mount('#app')
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### How it works
|
|
257
|
-
|
|
258
|
-
Once registered, you don't need to pass upload handlers to individual components.
|
|
254
|
+
# Complete reference for AI agents and developers:
|
|
259
255
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
## 4. Usage
|
|
265
|
-
|
|
266
|
-
Import components directly in your Vue files:
|
|
267
|
-
|
|
268
|
-
```vue
|
|
269
|
-
<script setup>
|
|
270
|
-
import { Button, Input, Form } from 'vlite3'
|
|
271
|
-
|
|
272
|
-
// The form will automatically use the global upload service defined in main.ts
|
|
273
|
-
const schema = [
|
|
274
|
-
{
|
|
275
|
-
name: 'avatar',
|
|
276
|
-
label: 'Profile Picture',
|
|
277
|
-
type: 'avatarUpload',
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
name: 'documents',
|
|
281
|
-
label: 'Attachments',
|
|
282
|
-
type: 'fileUploader',
|
|
283
|
-
props: { multiple: true },
|
|
284
|
-
},
|
|
285
|
-
]
|
|
286
|
-
|
|
287
|
-
const handleSubmit = (payload) => {
|
|
288
|
-
// payload.values.avatar will be a URL string (e.g., "https://api...")
|
|
289
|
-
// payload.values.documents will be an array of URL strings
|
|
290
|
-
console.log(payload.values)
|
|
291
|
-
}
|
|
292
|
-
</script>
|
|
293
|
-
|
|
294
|
-
<template>
|
|
295
|
-
<div class="p-4 space-y-4">
|
|
296
|
-
<Button>Click Me</Button>
|
|
297
|
-
<Input placeholder="Type here..." />
|
|
298
|
-
|
|
299
|
-
<Form :schema="schema" @onSubmit="handleSubmit" />
|
|
300
|
-
</div>
|
|
301
|
-
</template>
|
|
302
|
-
```
|
|
256
|
+
- [llms.txt](https://github.com/safdar-azeem/vlite3/blob/main/llms.txt).
|
|
257
|
+
- [llms-theming.txt](https://github.com/safdar-azeem/vlite3/blob/main/llms-theming.txt).
|
|
258
|
+
- [llms-full.txt](https://github.com/safdar-azeem/vlite3/blob/main/llms-full.txt).
|
|
259
|
+
- [llms-advance.txt](https://github.com/safdar-azeem/vlite3/blob/main/llms-advance.txt).
|
package/components/Button.vue.js
CHANGED
|
@@ -17,7 +17,7 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
17
17
|
},
|
|
18
18
|
setup(e) {
|
|
19
19
|
const t = e, g = x(), l = s(() => t.icon && !t.text && !g.default), h = s(() => {
|
|
20
|
-
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-
|
|
20
|
+
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] cursor-pointer gap-2", d = {
|
|
21
21
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
22
22
|
"primary-light": "bg-primary-light text-primary-fg-light hover:bg-primary/20",
|
|
23
23
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as $, computed as s, openBlock as l, createElementBlock as c, normalizeClass as o, renderSlot as u, createBlock as d, createCommentVNode as i, createTextVNode as C, toDisplayString as z, withCtx as B, createVNode as D } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import f from "../Icon.vue.js";
|
|
3
3
|
import S from "../Button.vue.js";
|
|
4
4
|
const N = ["role", "tabindex"], V = {
|
|
5
5
|
key: 0,
|
|
@@ -17,8 +17,8 @@ const N = ["role", "tabindex"], V = {
|
|
|
17
17
|
class: { default: "" }
|
|
18
18
|
},
|
|
19
19
|
emits: ["click", "delete"],
|
|
20
|
-
setup(a, { emit:
|
|
21
|
-
const t = a, n =
|
|
20
|
+
setup(a, { emit: b }) {
|
|
21
|
+
const t = a, n = b, r = s(() => t.clickable && !t.disabled), g = (e) => {
|
|
22
22
|
t.disabled || t.clickable && n("click", e);
|
|
23
23
|
}, v = (e) => {
|
|
24
24
|
t.disabled || (e.stopPropagation(), n("delete", e));
|
|
@@ -27,11 +27,11 @@ const N = ["role", "tabindex"], V = {
|
|
|
27
27
|
}, h = s(() => {
|
|
28
28
|
switch (t.size) {
|
|
29
29
|
case "small":
|
|
30
|
-
return "h-
|
|
30
|
+
return "h-5 text-[10px] px-1.5 gap-1";
|
|
31
31
|
case "large":
|
|
32
|
-
return "h-10 text-base px-4 gap-2.5";
|
|
33
|
-
default:
|
|
34
32
|
return "h-8 text-sm px-3 gap-2";
|
|
33
|
+
default:
|
|
34
|
+
return "h-6 text-xs px-2.5 gap-1.5";
|
|
35
35
|
}
|
|
36
36
|
}), x = s(() => {
|
|
37
37
|
if (t.disabled)
|
|
@@ -53,20 +53,20 @@ const N = ["role", "tabindex"], V = {
|
|
|
53
53
|
}), p = s(() => [j, h.value, x.value, t.class].join(" ")), k = s(() => {
|
|
54
54
|
switch (t.size) {
|
|
55
55
|
case "small":
|
|
56
|
-
return "h-3
|
|
56
|
+
return "h-3 w-3";
|
|
57
57
|
case "large":
|
|
58
|
-
return "h-5 w-5";
|
|
59
|
-
default:
|
|
60
58
|
return "h-4 w-4";
|
|
59
|
+
default:
|
|
60
|
+
return "h-3.5 w-3.5";
|
|
61
61
|
}
|
|
62
62
|
}), y = s(() => {
|
|
63
63
|
switch (t.size) {
|
|
64
64
|
case "small":
|
|
65
|
-
return "h-
|
|
65
|
+
return "h-2.5 w-2.5";
|
|
66
66
|
case "large":
|
|
67
|
-
return "h-4 w-4";
|
|
68
|
-
default:
|
|
69
67
|
return "h-3.5 w-3.5";
|
|
68
|
+
default:
|
|
69
|
+
return "h-3 w-3";
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
return (e, w) => (l(), c("div", {
|
|
@@ -77,7 +77,7 @@ const N = ["role", "tabindex"], V = {
|
|
|
77
77
|
onKeydown: m
|
|
78
78
|
}, [
|
|
79
79
|
u(e.$slots, "icon", {}, () => [
|
|
80
|
-
a.icon ? (l(), d(
|
|
80
|
+
a.icon ? (l(), d(f, {
|
|
81
81
|
key: 0,
|
|
82
82
|
icon: a.icon,
|
|
83
83
|
class: o([k.value, "shrink-0", a.text ? "-ml-0.5" : ""])
|
|
@@ -94,11 +94,11 @@ const N = ["role", "tabindex"], V = {
|
|
|
94
94
|
size: "xs",
|
|
95
95
|
rounded: "full",
|
|
96
96
|
disabled: a.disabled,
|
|
97
|
-
class: o(["ml-auto
|
|
97
|
+
class: o(["ml-auto p-0.5! h-auto! w-auto! hover:bg-[#8282823c]", [a.text ? a.size === "small" ? "-mr-0.5" : "-mr-1" : ""]]),
|
|
98
98
|
onClick: v
|
|
99
99
|
}, {
|
|
100
100
|
default: B(() => [
|
|
101
|
-
D(
|
|
101
|
+
D(f, {
|
|
102
102
|
icon: "lucide:x",
|
|
103
103
|
class: o(y.value)
|
|
104
104
|
}, null, 8, ["class"])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as f, openBlock as m, createBlock as u, withCtx as a, createElementVNode as x, createVNode as
|
|
1
|
+
import { defineComponent as f, openBlock as m, createBlock as u, withCtx as a, createElementVNode as x, createVNode as r, renderSlot as d } from "vue";
|
|
2
2
|
import g from "./Modal.vue.js";
|
|
3
|
-
import
|
|
4
|
-
const w = { class: "flex w-full items-center justify-end space-x-2
|
|
3
|
+
import c from "./Button.vue.js";
|
|
4
|
+
const w = { class: "flex w-full items-center justify-end space-x-2" }, k = /* @__PURE__ */ f({
|
|
5
5
|
__name: "ConfirmationModal",
|
|
6
6
|
props: {
|
|
7
7
|
show: { type: Boolean, default: !1 },
|
|
@@ -13,36 +13,39 @@ const w = { class: "flex w-full items-center justify-end space-x-2 pt-4" }, p =
|
|
|
13
13
|
variant: { default: "danger" }
|
|
14
14
|
},
|
|
15
15
|
emits: ["cancel", "confirm"],
|
|
16
|
-
setup(e, { emit:
|
|
17
|
-
const i =
|
|
16
|
+
setup(e, { emit: s }) {
|
|
17
|
+
const i = s, n = () => {
|
|
18
18
|
i("cancel");
|
|
19
19
|
};
|
|
20
20
|
return (l, t) => (m(), u(g, {
|
|
21
21
|
show: e.show,
|
|
22
22
|
title: e.title,
|
|
23
23
|
description: e.description,
|
|
24
|
+
footerClass: "border-t-0! pt-0! pb-3.5!",
|
|
24
25
|
"max-width": "max-w-[400px]",
|
|
25
26
|
onClose: n,
|
|
26
27
|
"onUpdate:show": t[1] || (t[1] = (o) => !o && n())
|
|
27
28
|
}, {
|
|
28
29
|
trigger: a(() => [
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
d(l.$slots, "trigger", {}, () => [
|
|
31
|
+
d(l.$slots, "default")
|
|
31
32
|
])
|
|
32
33
|
]),
|
|
33
|
-
|
|
34
|
+
footer: a(({ close: o }) => [
|
|
34
35
|
x("div", w, [
|
|
35
|
-
|
|
36
|
+
r(c, {
|
|
36
37
|
variant: "outline",
|
|
37
38
|
text: e.cancelText,
|
|
38
39
|
disabled: e.loading,
|
|
39
|
-
onClick:
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
onClick: () => {
|
|
41
|
+
o?.(), n?.();
|
|
42
|
+
}
|
|
43
|
+
}, null, 8, ["text", "disabled", "onClick"]),
|
|
44
|
+
r(c, {
|
|
42
45
|
variant: e.variant,
|
|
43
46
|
text: e.confirmText,
|
|
44
47
|
loading: e.loading,
|
|
45
|
-
onClick: t[0] || (t[0] = (
|
|
48
|
+
onClick: t[0] || (t[0] = (C) => i("confirm"))
|
|
46
49
|
}, null, 8, ["variant", "text", "loading"])
|
|
47
50
|
])
|
|
48
51
|
]),
|
|
@@ -51,5 +54,5 @@ const w = { class: "flex w-full items-center justify-end space-x-2 pt-4" }, p =
|
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
export {
|
|
54
|
-
|
|
57
|
+
k as default
|
|
55
58
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./DataTable.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-53f1fe21"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as
|
|
1
|
+
import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as n, createElementBlock as i, createVNode as C, createSlots as V, withCtx as T, renderSlot as S, createBlock as D, createCommentVNode as I, createElementVNode as r, normalizeClass as B, Fragment as R, renderList as $, normalizeStyle as A, mergeProps as le, toDisplayString as M, createTextVNode as ae, unref as se } from "vue";
|
|
2
2
|
import oe from "../Icon.vue.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import ne from "../CheckBox.vue.js";
|
|
4
|
+
import re from "../Button.vue.js";
|
|
5
|
+
import ie from "../ConfirmationModal.vue.js";
|
|
6
|
+
import de from "../Pagination/Pagination.vue.js";
|
|
7
7
|
import ue from "./DataTableHeader.vue.js";
|
|
8
8
|
import ce from "./DataTableRow.vue.js";
|
|
9
9
|
import me from "./DataTableToolbar.vue.js";
|
|
@@ -35,6 +35,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
35
35
|
emptyDescription: { default: "No results found. Try adjusting your filters or search terms." },
|
|
36
36
|
emptyIcon: { default: "lucide:inbox" },
|
|
37
37
|
showPagination: { type: Boolean, default: !0 },
|
|
38
|
+
paginationPosition: {},
|
|
38
39
|
pageInfo: {},
|
|
39
40
|
itemsPerPage: { default: 10 },
|
|
40
41
|
itemsPerPageOptions: { default: () => [10, 25, 50, 100] },
|
|
@@ -50,7 +51,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
50
51
|
},
|
|
51
52
|
emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
|
|
52
53
|
setup(a, { emit: U }) {
|
|
53
|
-
const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U,
|
|
54
|
+
const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, d = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
|
|
54
55
|
p(
|
|
55
56
|
() => l.loading,
|
|
56
57
|
(e, t) => {
|
|
@@ -110,7 +111,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
110
111
|
};
|
|
111
112
|
w("select", c), w("update:selectedRows", s);
|
|
112
113
|
}, H = (e) => {
|
|
113
|
-
|
|
114
|
+
d.value.field === e ? d.value.order === "asc" ? d.value.order = "desc" : d.value.order === "desc" ? (d.value.order = "", d.value.field = "") : d.value.order = "asc" : (d.value.field = e, d.value.order = "asc"), h.value = 1, v.value = "sort", x();
|
|
114
115
|
}, J = (e) => {
|
|
115
116
|
h.value = e, v.value = "page", x();
|
|
116
117
|
}, K = (e) => {
|
|
@@ -126,7 +127,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
126
127
|
page: h.value,
|
|
127
128
|
limit: k.value
|
|
128
129
|
},
|
|
129
|
-
sorting: { ...
|
|
130
|
+
sorting: { ...d.value },
|
|
130
131
|
search: y.value
|
|
131
132
|
});
|
|
132
133
|
}, Y = b(() => [
|
|
@@ -144,7 +145,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
144
145
|
}
|
|
145
146
|
), te(() => {
|
|
146
147
|
x();
|
|
147
|
-
}), (e, t) => (
|
|
148
|
+
}), (e, t) => (n(), i("div", fe, [
|
|
148
149
|
C(me, {
|
|
149
150
|
modelValue: y.value,
|
|
150
151
|
"onUpdate:modelValue": t[1] || (t[1] = (s) => y.value = s),
|
|
@@ -161,7 +162,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
161
162
|
e.$slots?.["toolbar-right"] || o.value.size > 0 ? {
|
|
162
163
|
name: "right",
|
|
163
164
|
fn: T(() => [
|
|
164
|
-
o.value.size > 0 ? (
|
|
165
|
+
o.value.size > 0 ? (n(), D(re, {
|
|
165
166
|
key: 0,
|
|
166
167
|
rounded: "full",
|
|
167
168
|
variant: "ghost",
|
|
@@ -174,23 +175,23 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
174
175
|
key: "1"
|
|
175
176
|
} : void 0
|
|
176
177
|
]), 1032, ["modelValue", "show-search", "placeholder"]),
|
|
177
|
-
|
|
178
|
+
r("div", {
|
|
178
179
|
class: B(Y.value)
|
|
179
180
|
}, [
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
r("div", he, [
|
|
182
|
+
r("table", {
|
|
182
183
|
class: B([Z.value, ""])
|
|
183
184
|
}, [
|
|
184
|
-
|
|
185
|
+
r("thead", {
|
|
185
186
|
class: B([
|
|
186
187
|
"[&_tr]:border-b [&_tr]:border-border/70! bg-muted",
|
|
187
188
|
a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
|
|
188
189
|
])
|
|
189
190
|
}, [
|
|
190
|
-
|
|
191
|
-
a.selectable ? (
|
|
192
|
-
|
|
193
|
-
C(
|
|
191
|
+
r("tr", ve, [
|
|
192
|
+
a.selectable ? (n(), i("th", ge, [
|
|
193
|
+
r("div", pe, [
|
|
194
|
+
C(ne, {
|
|
194
195
|
"model-value": z.value,
|
|
195
196
|
indeterminate: E.value,
|
|
196
197
|
size: "xs",
|
|
@@ -198,10 +199,10 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
198
199
|
}, null, 8, ["model-value", "indeterminate"])
|
|
199
200
|
])
|
|
200
201
|
])) : I("", !0),
|
|
201
|
-
(
|
|
202
|
+
(n(!0), i(R, null, $(a.headers, (s) => (n(), D(ue, {
|
|
202
203
|
key: s.field,
|
|
203
204
|
header: s,
|
|
204
|
-
"sort-config":
|
|
205
|
+
"sort-config": d.value,
|
|
205
206
|
compact: a.compact,
|
|
206
207
|
"table-sortable": a.sortable,
|
|
207
208
|
onSort: H,
|
|
@@ -212,28 +213,28 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
212
213
|
}, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
|
|
213
214
|
])
|
|
214
215
|
], 2),
|
|
215
|
-
|
|
216
|
-
L.value ? (
|
|
216
|
+
r("tbody", we, [
|
|
217
|
+
L.value ? (n(!0), i(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (n(), i("tr", {
|
|
217
218
|
key: "skeleton-" + s,
|
|
218
219
|
class: "border-b border-border/50 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
|
|
219
220
|
}, [
|
|
220
|
-
a.selectable ? (
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
a.selectable ? (n(), i("td", ye, [...t[4] || (t[4] = [
|
|
222
|
+
r("div", { class: "flex items-center justify-center" }, [
|
|
223
|
+
r("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
|
|
223
224
|
], -1)
|
|
224
225
|
])])) : I("", !0),
|
|
225
|
-
(
|
|
226
|
+
(n(!0), i(R, null, $(a.headers, (c) => (n(), i("td", {
|
|
226
227
|
key: c.field,
|
|
227
228
|
class: B(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
|
|
228
229
|
}, [
|
|
229
|
-
|
|
230
|
+
r("div", {
|
|
230
231
|
class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
|
|
231
232
|
style: A({
|
|
232
233
|
width: `${50 + Math.random() * 40}%`
|
|
233
234
|
})
|
|
234
235
|
}, null, 4)
|
|
235
236
|
], 2))), 128))
|
|
236
|
-
]))), 128)) : a.rows.length > 0 ? (
|
|
237
|
+
]))), 128)) : a.rows.length > 0 ? (n(!0), i(R, { key: 1 }, $(a.rows, (s, c) => (n(), D(ce, {
|
|
237
238
|
key: j(s),
|
|
238
239
|
row: s,
|
|
239
240
|
headers: a.headers,
|
|
@@ -254,25 +255,25 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
254
255
|
S(e.$slots, m.field, le({ ref_for: !0 }, f), void 0, !0)
|
|
255
256
|
])
|
|
256
257
|
}))
|
|
257
|
-
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (
|
|
258
|
-
|
|
258
|
+
]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (n(), i("tr", be, [
|
|
259
|
+
r("td", {
|
|
259
260
|
colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
|
|
260
261
|
class: "h-96 text-center align-middle hover:bg-transparent"
|
|
261
262
|
}, [
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
r("div", Pe, [
|
|
264
|
+
r("div", xe, [
|
|
264
265
|
C(oe, {
|
|
265
266
|
icon: a.emptyIcon,
|
|
266
267
|
class: "h-6 w-6 text-muted-foreground/80"
|
|
267
268
|
}, null, 8, ["icon"])
|
|
268
269
|
]),
|
|
269
|
-
|
|
270
|
-
|
|
270
|
+
r("h3", Ce, M(a.emptyTitle), 1),
|
|
271
|
+
r("p", Se, [
|
|
271
272
|
S(e.$slots, "empty-description", {}, () => [
|
|
272
273
|
ae(M(a.emptyDescription), 1)
|
|
273
274
|
], !0)
|
|
274
275
|
]),
|
|
275
|
-
e.$slots["empty-action"] ? (
|
|
276
|
+
e.$slots["empty-action"] ? (n(), i("div", Ie, [
|
|
276
277
|
S(e.$slots, "empty-action", {}, void 0, !0)
|
|
277
278
|
])) : I("", !0)
|
|
278
279
|
])
|
|
@@ -282,8 +283,8 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
282
283
|
], 2)
|
|
283
284
|
])
|
|
284
285
|
], 2),
|
|
285
|
-
a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (
|
|
286
|
-
C(se(
|
|
286
|
+
a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (n(), i("div", $e, [
|
|
287
|
+
C(se(de), {
|
|
287
288
|
"current-page": h.value,
|
|
288
289
|
"total-pages": a.pageInfo.totalPages,
|
|
289
290
|
"show-page-info": !1,
|
|
@@ -291,11 +292,12 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
|
|
|
291
292
|
"items-per-page": k.value,
|
|
292
293
|
"items-per-page-options": a.itemsPerPageOptions,
|
|
293
294
|
"nav-type": "icon",
|
|
295
|
+
alignment: l.paginationPosition,
|
|
294
296
|
onChange: J,
|
|
295
297
|
"onUpdate:itemsPerPage": K
|
|
296
|
-
}, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options"])
|
|
298
|
+
}, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options", "alignment"])
|
|
297
299
|
])) : I("", !0),
|
|
298
|
-
C(
|
|
300
|
+
C(ie, {
|
|
299
301
|
show: P.value,
|
|
300
302
|
"onUpdate:show": t[2] || (t[2] = (s) => P.value = s),
|
|
301
303
|
title: "Confirm Deletion",
|
|
@@ -54,6 +54,7 @@ export interface DataTableProps {
|
|
|
54
54
|
emptyDescription?: string;
|
|
55
55
|
emptyIcon?: string;
|
|
56
56
|
showPagination?: boolean;
|
|
57
|
+
paginationPosition?: 'start' | 'center' | 'end' | 'between';
|
|
57
58
|
pageInfo?: PageInfo;
|
|
58
59
|
itemsPerPage?: number;
|
|
59
60
|
itemsPerPageOptions?: number[];
|
|
@@ -6,23 +6,31 @@ type __VLS_Props = {
|
|
|
6
6
|
value?: any;
|
|
7
7
|
mode: DatePickerMode;
|
|
8
8
|
minDate?: string;
|
|
9
|
+
maxDate?: string;
|
|
10
|
+
disabledDates?: {
|
|
11
|
+
start: string;
|
|
12
|
+
end?: string;
|
|
13
|
+
}[];
|
|
9
14
|
icon?: string;
|
|
10
15
|
size?: ButtonSize;
|
|
11
16
|
variant?: ButtonVariant;
|
|
12
17
|
btnProps?: any;
|
|
13
18
|
teleport?: boolean;
|
|
14
19
|
minuteInterval?: number;
|
|
20
|
+
timeFormat?: '12h' | '24h';
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
readonly?: boolean;
|
|
15
23
|
};
|
|
16
24
|
declare function __VLS_template(): {
|
|
17
25
|
attrs: Partial<{}>;
|
|
18
26
|
slots: {
|
|
19
27
|
default?(_: {
|
|
20
28
|
value: any;
|
|
21
|
-
displayValue:
|
|
29
|
+
displayValue: any;
|
|
22
30
|
}): any;
|
|
23
31
|
};
|
|
24
32
|
refs: {};
|
|
25
|
-
rootEl:
|
|
33
|
+
rootEl: any;
|
|
26
34
|
};
|
|
27
35
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
28
36
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -34,7 +42,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
34
42
|
}>, {
|
|
35
43
|
teleport: boolean;
|
|
36
44
|
minuteInterval: number;
|
|
37
|
-
|
|
45
|
+
timeFormat: "12h" | "24h";
|
|
46
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
38
47
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
39
48
|
export default _default;
|
|
40
49
|
type __VLS_WithTemplateSlots<T, S> = T & {
|