vlite3 1.5.11 → 1.5.13
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 +20 -8
- package/components/Accordion/AccordionContent.vue.js +2 -2
- package/components/CategoryManager/CategoryManager2.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Form/{AccordionView.vue.js → AccordionView2.vue.js} +2 -2
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/index2.vue.js +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
- package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Splitter/Splitter.vue.d.ts +7 -0
- package/components/Splitter/Splitter.vue.js +33 -29
- package/components/Tabes/Tabes.vue.js +2 -2
- package/docs/README.md +17 -0
- package/docs/all-components.md +89 -0
- package/docs/component-index.md +313 -0
- package/docs/components/accordion.md +52 -0
- package/docs/components/alert.md +34 -0
- package/docs/components/app-shell.md +371 -0
- package/docs/components/async-select.md +264 -0
- package/docs/components/attachments-list.md +231 -0
- package/docs/components/avatar-group.md +74 -0
- package/docs/components/avatar-uploader.md +61 -0
- package/docs/components/avatar.md +28 -0
- package/docs/components/badge.md +81 -0
- package/docs/components/barcode.md +42 -0
- package/docs/components/beacon.md +29 -0
- package/docs/components/breadcrumb.md +317 -0
- package/docs/components/button-group.md +35 -0
- package/docs/components/button.md +86 -0
- package/docs/components/calendar.md +95 -0
- package/docs/components/carousel.md +122 -0
- package/docs/components/cart.md +533 -0
- package/docs/components/category-manager.md +269 -0
- package/docs/components/category-menu.md +251 -0
- package/docs/components/charts.md +1456 -0
- package/docs/components/chat.md +330 -0
- package/docs/components/checkbox.md +31 -0
- package/docs/components/chip.md +137 -0
- package/docs/components/choice-box.md +40 -0
- package/docs/components/clipboard.md +105 -0
- package/docs/components/clock.md +70 -0
- package/docs/components/color-picker.md +82 -0
- package/docs/components/command-palette.md +214 -0
- package/docs/components/comment-thread.md +171 -0
- package/docs/components/confirmation-modal.md +50 -0
- package/docs/components/custom-fields-display.md +94 -0
- package/docs/components/custom-fields.md +97 -0
- package/docs/components/data-list.md +93 -0
- package/docs/components/data-table.md +922 -0
- package/docs/components/date-picker.md +58 -0
- package/docs/components/date-range-picker.md +24 -0
- package/docs/components/date-time.md +104 -0
- package/docs/components/dropdown.md +740 -0
- package/docs/components/empty.md +100 -0
- package/docs/components/export-data.md +320 -0
- package/docs/components/file-picker.md +83 -0
- package/docs/components/file-preview.md +42 -0
- package/docs/components/file-tree.md +144 -0
- package/docs/components/footer.md +251 -0
- package/docs/components/forms.md +776 -0
- package/docs/components/gantt-chart.md +767 -0
- package/docs/components/google-login.md +67 -0
- package/docs/components/google-map.md +128 -0
- package/docs/components/heatmap.md +80 -0
- package/docs/components/icon-picker.md +58 -0
- package/docs/components/icon.md +176 -0
- package/docs/components/image-comparison.md +51 -0
- package/docs/components/image-magnifier.md +26 -0
- package/docs/components/import-data.md +521 -0
- package/docs/components/input.md +58 -0
- package/docs/components/invoice.md +339 -0
- package/docs/components/kanban.md +302 -0
- package/docs/components/label.md +25 -0
- package/docs/components/list.md +419 -0
- package/docs/components/masonry.md +55 -0
- package/docs/components/modal.md +133 -0
- package/docs/components/multi-select.md +54 -0
- package/docs/components/navbar.md +403 -0
- package/docs/components/number-input.md +41 -0
- package/docs/components/otp-input.md +68 -0
- package/docs/components/pagination.md +83 -0
- package/docs/components/pan-zoom-viewport.md +245 -0
- package/docs/components/permission-editor.md +322 -0
- package/docs/components/persona.md +56 -0
- package/docs/components/price.md +106 -0
- package/docs/components/pricing-plan.md +68 -0
- package/docs/components/progress-bar.md +53 -0
- package/docs/components/qr-code.md +59 -0
- package/docs/components/rating.md +59 -0
- package/docs/components/rich-text-editor.md +210 -0
- package/docs/components/scale-generator.md +101 -0
- package/docs/components/screen.md +208 -0
- package/docs/components/seo-provider.md +189 -0
- package/docs/components/side-panel.md +94 -0
- package/docs/components/sidebar-menu.md +422 -0
- package/docs/components/skeleton.md +115 -0
- package/docs/components/slider.md +48 -0
- package/docs/components/spinner.md +27 -0
- package/docs/components/splitter.md +97 -0
- package/docs/components/stats.md +234 -0
- package/docs/components/status-chip.md +232 -0
- package/docs/components/switch.md +23 -0
- package/docs/components/tabs.md +335 -0
- package/docs/components/tag-input.md +55 -0
- package/docs/components/textarea.md +31 -0
- package/docs/components/theme-provider.md +130 -0
- package/docs/components/theme-toggle.md +36 -0
- package/docs/components/thumbnail-selector.md +186 -0
- package/docs/components/timeline.md +225 -0
- package/docs/components/toast-notification.md +89 -0
- package/docs/components/tooltip.md +31 -0
- package/docs/components/workbook.md +102 -0
- package/docs/composables/use-theme.md +59 -0
- package/docs/getting-started/setup.md +176 -0
- package/docs/guides/draggable.md +211 -0
- package/docs/guides/internationalization.md +281 -0
- package/docs/guides/performance.md +118 -0
- package/docs/guides/testing-forms.md +154 -0
- package/docs/guides/testing-overlays.md +131 -0
- package/docs/guides/theming.md +124 -0
- package/docs/utilities/search.md +580 -0
- package/docs/utilities/utilities.md +371 -0
- package/docs-manifest.json +339 -0
- package/package.json +6 -15
- package/scripts/generate-docs-manifest.js +207 -0
- package/scripts/sync-docs.js +754 -0
- package/style.css +1 -1
- /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# List
|
|
2
|
+
|
|
3
|
+
**Import:** `import { List } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A schema-driven key-value information display component. Renders structured data records in a clean, accessible grid layout with support for multiple columns, variants, conditional fields, sensitive masking, custom formatters, Vue component injection, named slot overrides, and loading skeletons.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { List } from 'vlite3'
|
|
14
|
+
import type { ListField } from 'vlite3'
|
|
15
|
+
|
|
16
|
+
const user = { name: 'Alice', email: 'alice@example.com', status: 'active' }
|
|
17
|
+
|
|
18
|
+
const fields: ListField[] = [
|
|
19
|
+
{ key: 'name', title: 'Full Name' },
|
|
20
|
+
{ key: 'email', title: 'Email' },
|
|
21
|
+
{ key: 'status', title: 'Status', addStatusColor: true },
|
|
22
|
+
]
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<List :fields="fields" :data="user" title="User Info" />
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Props
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Default | Description |
|
|
35
|
+
| :------------------- | :-------------------- | :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
36
|
+
| `fields` | `ListField[]` | **required** | Array of field definitions (schema). |
|
|
37
|
+
| `data` | `Record<string, any>` | **required** | The data record to display. |
|
|
38
|
+
| `title` | `string` | — | Optional section title shown in a header bar. |
|
|
39
|
+
| `titleI18n` | `string` | — | i18n translation key for the title. |
|
|
40
|
+
| `titleIcon` | `string` | — | Iconify icon ID displayed beside the title. |
|
|
41
|
+
| `columns` | `1 \| 2 \| 3` | `2` | Number of columns for field layout. |
|
|
42
|
+
| `variant` | `ListVariant` | `'default'` | Visual style of the container. |
|
|
43
|
+
| `class` | `string` | `''` | Extra Tailwind classes on the root element. |
|
|
44
|
+
| `showColon` | `boolean` | `true` | Append `:` after each field label. |
|
|
45
|
+
| `loading` | `boolean` | `false` | Show animated skeleton rows instead of data. |
|
|
46
|
+
| `skeletonRows` | `number` | `6` | Number of skeleton rows rendered per column while loading. |
|
|
47
|
+
| `stackedBorderStyle` | `StackedBorderStyle` | `'none'` | Controls border dividers between cells in the `stacked` variant. `'none'` — no borders (default). `'divider'` — left border on non-first cells per row with extra left padding. |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## ListField Schema
|
|
52
|
+
|
|
53
|
+
Each object in the `fields` array describes one row.
|
|
54
|
+
|
|
55
|
+
| Property | Type | Description |
|
|
56
|
+
| :--------------- | :------------------------------------ | :----------------------------------------------------------------------------------- |
|
|
57
|
+
| `key` | `string` | **Required.** Path to the value in `data`. Supports dot-notation: `'location.city'`. |
|
|
58
|
+
| `title` | `string` | Display label. Falls back to `key` if omitted. |
|
|
59
|
+
| `titleI18n` | `string` | i18n key for the label — takes priority over `title`. |
|
|
60
|
+
| `icon` | `string` | Iconify icon ID displayed beside the label. |
|
|
61
|
+
| `lineByLine` | `boolean` | When `true`, the field spans the full component width (below the column grid). |
|
|
62
|
+
| `lineByLineLayout` | `'block' \| 'inline'` | Controls layout for full-width items. `'block'` (default) is stacked, `'inline'` is same line. |
|
|
63
|
+
| `whenTrue` | `boolean` | Only render this row when the resolved value is truthy. |
|
|
64
|
+
| `when` | `(value: any, data: any) => boolean` | Custom visibility predicate — receives the resolved value and the full data object. |
|
|
65
|
+
| `format` | `(value: any, data: any) => string` | Custom formatter. Return a plain string or an HTML string. |
|
|
66
|
+
| `isSensitive` | `boolean` | Mask the value with dots and show an eye-toggle button. |
|
|
67
|
+
| `addStatusColor` | `boolean` | Apply a semantic color class based on the string value (e.g. `active` → green). |
|
|
68
|
+
| `type` | `ListFieldType` | Built-in rendering type applied automatically when no `format` is provided. |
|
|
69
|
+
| `class` | `string \| ((value, data) => string)` | Static or dynamic Tailwind class(es) applied to the value cell. |
|
|
70
|
+
| `component` | `Component` | A Vue component rendered in the value cell. Receives `{ data, value }` props. |
|
|
71
|
+
| `emptyText` | `string` | Fallback text when the value is `null`, `undefined`, or `''`. Defaults to `'--'`. |
|
|
72
|
+
|
|
73
|
+
### `ListFieldType` values
|
|
74
|
+
|
|
75
|
+
| Value | Output |
|
|
76
|
+
| :--------- | :----------------------------------------------- |
|
|
77
|
+
| `text` | Plain string (default). |
|
|
78
|
+
| `date` | Formatted date: `Apr 15, 2023`. |
|
|
79
|
+
| `dateTime` | Formatted date + time: `Apr 15, 2023, 09:30 AM`. |
|
|
80
|
+
| `time` | Alias for `dateTime`. |
|
|
81
|
+
| `price` | USD currency: `$1,234.50`. |
|
|
82
|
+
| `number` | Locale number: `1,234`. |
|
|
83
|
+
| `boolean` | `'Yes'` / `'No'`. |
|
|
84
|
+
| `image` | Renders a `32×32` rounded avatar image. |
|
|
85
|
+
| `html` | Renders raw HTML via `v-html`. |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Variants
|
|
90
|
+
|
|
91
|
+
| Value | Description |
|
|
92
|
+
| :-------------- | :------------------------------------------------------------------------ |
|
|
93
|
+
| `default` | Simple border + rounded container. Standard choice. |
|
|
94
|
+
| `card` | Larger border-radius, card background, subtle shadow. |
|
|
95
|
+
| `minimal` | No border, no background. Zero-chrome display. |
|
|
96
|
+
| `striped` | Alternating row background on odd rows. |
|
|
97
|
+
| `compact` | Reduced vertical padding (`py-1.5`) for dense data grids. |
|
|
98
|
+
| `bordered-rows` | Full border wrapping with per-row dividers. |
|
|
99
|
+
| `stacked` | Label on top, value below — grid of vertical cells. Ideal for info cards. |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Slots
|
|
104
|
+
|
|
105
|
+
### `title`
|
|
106
|
+
|
|
107
|
+
Override the entire title bar content.
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<List :fields="fields" :data="data">
|
|
111
|
+
<template #title>
|
|
112
|
+
<span class="font-bold text-primary">Custom Header</span>
|
|
113
|
+
</template>
|
|
114
|
+
</List>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### `footer`
|
|
118
|
+
|
|
119
|
+
Rendered in a bordered footer at the bottom of the component.
|
|
120
|
+
|
|
121
|
+
```vue
|
|
122
|
+
<List :fields="fields" :data="data">
|
|
123
|
+
<template #footer>
|
|
124
|
+
<Button variant="ghost" size="sm">Edit</Button>
|
|
125
|
+
</template>
|
|
126
|
+
</List>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Per-field named slots
|
|
130
|
+
|
|
131
|
+
Override the value area of any specific field using its `key` as the slot name.
|
|
132
|
+
The slot receives `{ value, resolved, data }`.
|
|
133
|
+
|
|
134
|
+
| Slot prop | Type | Description |
|
|
135
|
+
| :--------- | :------- | :--------------------------------------- |
|
|
136
|
+
| `value` | `any` | Raw value from `data[field.key]`. |
|
|
137
|
+
| `resolved` | `string` | Formatted value (after `format`/`type`). |
|
|
138
|
+
| `data` | `object` | The full data record. |
|
|
139
|
+
|
|
140
|
+
```vue
|
|
141
|
+
<List :fields="fields" :data="user">
|
|
142
|
+
<template #status="{ value }">
|
|
143
|
+
<span
|
|
144
|
+
class="px-2 py-0.5 rounded-full text-xs font-semibold"
|
|
145
|
+
:class="value === 'active' ? 'bg-success-light text-success-dark' : 'bg-danger-light text-danger-dark'">
|
|
146
|
+
{{ value }}
|
|
147
|
+
</span>
|
|
148
|
+
</template>
|
|
149
|
+
</List>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## lineByLine — Full-Width Rows
|
|
155
|
+
|
|
156
|
+
Fields with `lineByLine: true` are pulled out of the column grid and rendered
|
|
157
|
+
below it in a full-width section. A single `border-t` separates the two
|
|
158
|
+
sections — **no double borders**.
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
const fields: ListField[] = [
|
|
162
|
+
{ key: 'name', title: 'Name' }, // goes into column grid
|
|
163
|
+
{ key: 'email', title: 'Email' }, // goes into column grid
|
|
164
|
+
{ key: 'notes', title: 'Notes', lineByLine: true }, // full-width below (stacked)
|
|
165
|
+
{ key: 'terms', title: 'Terms', lineByLine: true, lineByLineLayout: 'inline' }, // full-width below (single line)
|
|
166
|
+
]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### lineByLineLayout
|
|
170
|
+
|
|
171
|
+
Use `lineByLineLayout: 'inline'` to force a full-width item to display its label and value on the same line.
|
|
172
|
+
|
|
173
|
+
| Value | Description |
|
|
174
|
+
| :--------- | :-------------------------------------------------------------------------- |
|
|
175
|
+
| `'block'` | **Default.** Label on top, value below. |
|
|
176
|
+
| `'inline'` | Label on left, value on right (standard row style but spanning full width). |
|
|
177
|
+
|
|
178
|
+
> **Border rule:** The last row in each column suppresses its own `border-b`
|
|
179
|
+
> when `lineByLine` items are present. The full-width wrapper's `border-t`
|
|
180
|
+
> acts as the sole visual separator — one clean 1 px line, never doubled.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Stacked Variant
|
|
185
|
+
|
|
186
|
+
The `stacked` variant renders each field as a vertical cell — small muted label on top, bold value below — in a responsive CSS grid. Perfect for personal information cards, account details, and any UI where label-value pairs should be visually grouped in a compact grid.
|
|
187
|
+
|
|
188
|
+
```vue
|
|
189
|
+
<script setup lang="ts">
|
|
190
|
+
import { List } from 'vlite3'
|
|
191
|
+
import type { ListField } from 'vlite3'
|
|
192
|
+
|
|
193
|
+
const person = {
|
|
194
|
+
gender: 'Female',
|
|
195
|
+
dateOfBirth: '1996-03-05T00:00:00Z',
|
|
196
|
+
nationality: 'Vietnam',
|
|
197
|
+
language: 'Vietnamese, English',
|
|
198
|
+
maritalStatus: 'Single',
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const fields: ListField[] = [
|
|
202
|
+
{ key: 'gender', title: 'Gender' },
|
|
203
|
+
{ key: 'dateOfBirth', title: 'Date of birth', type: 'date' },
|
|
204
|
+
{ key: 'nationality', title: 'Nationality' },
|
|
205
|
+
{ key: 'language', title: 'Language' },
|
|
206
|
+
{ key: 'maritalStatus', title: 'Marital status' },
|
|
207
|
+
]
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<template>
|
|
211
|
+
<List
|
|
212
|
+
:fields="fields"
|
|
213
|
+
:data="person"
|
|
214
|
+
title="Personal information"
|
|
215
|
+
title-icon="lucide:user"
|
|
216
|
+
variant="stacked"
|
|
217
|
+
:show-colon="false"
|
|
218
|
+
:columns="2" />
|
|
219
|
+
</template>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
> **Layout:** Cells are arranged in a responsive CSS grid. The `columns` prop
|
|
223
|
+
> controls how many columns appear at wider breakpoints. On small screens
|
|
224
|
+
> (`< sm`), the layout automatically falls back to the default horizontal
|
|
225
|
+
> row style (label left, value right, with border dividers) for optimal
|
|
226
|
+
> readability on narrow viewports.
|
|
227
|
+
|
|
228
|
+
### `stackedBorderStyle`
|
|
229
|
+
|
|
230
|
+
Controls whether left-border dividers appear between cells in the stacked grid.
|
|
231
|
+
|
|
232
|
+
| Value | Description |
|
|
233
|
+
| :---------- | :------------------------------------------------------------------------ |
|
|
234
|
+
| `'none'` | No borders between cells. Default stock look. |
|
|
235
|
+
| `'divider'` | Left border on every non-first cell per row, plus increased left padding. |
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<!-- Default: no cell dividers -->
|
|
239
|
+
<List variant="stacked" stacked-border-style="none" ... />
|
|
240
|
+
|
|
241
|
+
<!-- With dividers between columns -->
|
|
242
|
+
<List variant="stacked" stacked-border-style="divider" ... />
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Conditional Fields
|
|
248
|
+
|
|
249
|
+
### `whenTrue`
|
|
250
|
+
|
|
251
|
+
Field is only rendered when its resolved value is truthy.
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
{ key: 'adminCode', title: 'Admin Code', whenTrue: true }
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### `when`
|
|
258
|
+
|
|
259
|
+
Custom predicate. The field is rendered when the function returns `true`.
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
{
|
|
263
|
+
key: 'notes',
|
|
264
|
+
title: 'Notes',
|
|
265
|
+
when: (value) => !!value, // hide when empty string
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
{
|
|
269
|
+
key: 'discount',
|
|
270
|
+
title: 'Discount',
|
|
271
|
+
when: (value, data) => data.role === 'admin', // only for admins
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Sensitive Fields
|
|
278
|
+
|
|
279
|
+
Fields with `isSensitive: true` mask the value with bullet dots and show an
|
|
280
|
+
eye-toggle button. The value is revealed on click and hidden again on second
|
|
281
|
+
click. Ideal for passwords, SSNs, bank account numbers, etc.
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
{ key: 'ssn', title: 'SSN', isSensitive: true }
|
|
285
|
+
{ key: 'accountNumber', title: 'Account No.', isSensitive: true }
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Status Colors
|
|
291
|
+
|
|
292
|
+
Fields with `addStatusColor: true` apply a semantic Tailwind color class
|
|
293
|
+
based on the string value. Matching is case-insensitive and ignores `-`, `_`,
|
|
294
|
+
and spaces.
|
|
295
|
+
|
|
296
|
+
| Value keyword | Color class applied |
|
|
297
|
+
| :-------------------------------------------------------------- | :------------------------------ |
|
|
298
|
+
| `active`, `success`, `completed`, `yes`, `true`, `enabled` | `text-success-dark font-medium` |
|
|
299
|
+
| `pending`, `warning`, `medium` | `text-warning-dark font-medium` |
|
|
300
|
+
| `cancelled`, `failed`, `error`, `danger`, `high`, `no`, `false` | `text-danger-dark font-medium` |
|
|
301
|
+
| `inactive`, `disabled`, `low` | `text-muted-foreground` |
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
{ key: 'status', title: 'Status', addStatusColor: true }
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Custom Formatters
|
|
310
|
+
|
|
311
|
+
Use `format` to return any string (including HTML).
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
// Boolean flag
|
|
315
|
+
{ key: 'isVerified', title: 'Verified', format: (v) => v ? 'Yes' : 'No' }
|
|
316
|
+
|
|
317
|
+
// Computed from multiple fields
|
|
318
|
+
{ key: 'firstName', title: 'Full Name', format: (v, data) => `${v} ${data.lastName}` }
|
|
319
|
+
|
|
320
|
+
// HTML badge
|
|
321
|
+
{
|
|
322
|
+
key: 'priority',
|
|
323
|
+
title: 'Priority',
|
|
324
|
+
format: (v) => `<span class="text-danger-dark font-semibold">${v}</span>`,
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Dot-Notation Keys
|
|
331
|
+
|
|
332
|
+
Resolve values from nested objects using dot-notation paths.
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
const data = {
|
|
336
|
+
location: {
|
|
337
|
+
city: 'San Francisco',
|
|
338
|
+
country: 'United States',
|
|
339
|
+
},
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const fields: ListField[] = [
|
|
343
|
+
{ key: 'location.city', title: 'City' },
|
|
344
|
+
{ key: 'location.country', title: 'Country' },
|
|
345
|
+
]
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Full Example
|
|
351
|
+
|
|
352
|
+
```vue
|
|
353
|
+
<script setup lang="ts">
|
|
354
|
+
import { List } from 'vlite3'
|
|
355
|
+
import type { ListField } from 'vlite3'
|
|
356
|
+
|
|
357
|
+
const customer = {
|
|
358
|
+
name: 'Olivia Bennett',
|
|
359
|
+
email: 'olivia@example.com',
|
|
360
|
+
phone: '+1 (555) 234-5678',
|
|
361
|
+
status: 'active',
|
|
362
|
+
createdAt: '2023-04-15T09:30:00Z',
|
|
363
|
+
totalAmount: 128450.75,
|
|
364
|
+
ssn: '123-45-6789',
|
|
365
|
+
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=olivia',
|
|
366
|
+
notes: 'Prefers contact via email. Do not call before 9am.',
|
|
367
|
+
location: { city: 'San Francisco', country: 'United States' },
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const fields: ListField[] = [
|
|
371
|
+
{ key: 'name', title: 'Full Name', icon: 'lucide:user' },
|
|
372
|
+
{ key: 'email', title: 'Email', icon: 'lucide:mail' },
|
|
373
|
+
{ key: 'phone', title: 'Phone', isSensitive: true },
|
|
374
|
+
{ key: 'status', title: 'Status', addStatusColor: true },
|
|
375
|
+
{ key: 'createdAt', title: 'Member Since', type: 'date' },
|
|
376
|
+
{ key: 'totalAmount', title: 'Total', type: 'price' },
|
|
377
|
+
{ key: 'ssn', title: 'SSN', isSensitive: true, whenTrue: true },
|
|
378
|
+
{ key: 'avatar', title: 'Avatar', type: 'image' },
|
|
379
|
+
{ key: 'location.city', title: 'City' },
|
|
380
|
+
{ key: 'location.country', title: 'Country' },
|
|
381
|
+
// Full-width rows rendered below the grid
|
|
382
|
+
{ key: 'notes', title: 'Notes', lineByLine: true, when: (v) => !!v },
|
|
383
|
+
]
|
|
384
|
+
</script>
|
|
385
|
+
|
|
386
|
+
<template>
|
|
387
|
+
<List
|
|
388
|
+
:fields="fields"
|
|
389
|
+
:data="customer"
|
|
390
|
+
title="Customer Information"
|
|
391
|
+
title-icon="lucide:user-circle"
|
|
392
|
+
variant="card"
|
|
393
|
+
:columns="2"
|
|
394
|
+
:show-colon="true"
|
|
395
|
+
stacked-border-style="none">
|
|
396
|
+
<!-- Custom slot override for status field -->
|
|
397
|
+
<template #status="{ value }">
|
|
398
|
+
<span
|
|
399
|
+
class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold"
|
|
400
|
+
:class="
|
|
401
|
+
value === 'active'
|
|
402
|
+
? 'bg-success-light text-success-dark'
|
|
403
|
+
: 'bg-danger-light text-danger-dark'
|
|
404
|
+
">
|
|
405
|
+
<span
|
|
406
|
+
class="w-1.5 h-1.5 rounded-full"
|
|
407
|
+
:class="value === 'active' ? 'bg-success' : 'bg-danger'" />
|
|
408
|
+
{{ value }}
|
|
409
|
+
</span>
|
|
410
|
+
</template>
|
|
411
|
+
<!-- Footer -->
|
|
412
|
+
<template #footer>
|
|
413
|
+
<div class="flex justify-end gap-2">
|
|
414
|
+
<Button variant="ghost" size="sm" icon="lucide:pencil">Edit</Button>
|
|
415
|
+
</div>
|
|
416
|
+
</template>
|
|
417
|
+
</List>
|
|
418
|
+
</template>
|
|
419
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Masonry
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Masonry } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :-------- | :------------------------------------------- | :----------------------------- | :--------------------------------------------- |
|
|
9
|
+
| `data` | `any[]` | required | Array of items to render |
|
|
10
|
+
| `cols` | `number \| Record<string \| number, number>` | `{ default: 1, sm: 2, lg: 3 }` | Column configuration for different breakpoints |
|
|
11
|
+
| `gap` | `number` | `16` | Space between items in pixels |
|
|
12
|
+
| `tag` | `string` | `'div'` | Root container HTML tag |
|
|
13
|
+
| `itemKey` | `string` | `'id'` | Unique key property in data items |
|
|
14
|
+
|
|
15
|
+
### Breakpoints
|
|
16
|
+
|
|
17
|
+
Default numeric values for named breakpoints:
|
|
18
|
+
|
|
19
|
+
- `sm`: 640px
|
|
20
|
+
- `md`: 768px
|
|
21
|
+
- `lg`: 1024px
|
|
22
|
+
- `xl`: 1280px
|
|
23
|
+
- `2xl`: 1536px
|
|
24
|
+
|
|
25
|
+
### Slots
|
|
26
|
+
|
|
27
|
+
| Slot | Description | Props |
|
|
28
|
+
| :-------- | :----------------------------- | :-------------------------- |
|
|
29
|
+
| `default` | Template for each masonry item | `{ data, index, colIndex }` |
|
|
30
|
+
|
|
31
|
+
### Usage
|
|
32
|
+
|
|
33
|
+
#### Basic Usage (Fixed Columns)
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<Masonry :data="items" :cols="3" :gap="20">
|
|
37
|
+
<template #default="{ data }">
|
|
38
|
+
<div class="card">{{ data.title }}</div>
|
|
39
|
+
</template>
|
|
40
|
+
</Masonry>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Responsive Grid
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<Masonry :data="images" :cols="{ default: 1, sm: 2, md: 3, lg: 4 }" :gap="16">
|
|
47
|
+
<template #default="{ data }">
|
|
48
|
+
<img :src="data.url" class="rounded-lg w-full h-auto" />
|
|
49
|
+
</template>
|
|
50
|
+
</Masonry>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Performance Optimization
|
|
54
|
+
|
|
55
|
+
The `Masonry` component uses `content-visibility: auto` and `ResizeObserver` to ensure high performance even with thousands of items by skipping rendering for off-screen content.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Modal
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Modal } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :---------------- | :---------- | :------------ | :------------------------------------------ |
|
|
9
|
+
| `show` | `boolean` | `false` | Binding (`v-model:show`) - Visibility state |
|
|
10
|
+
| `title` | `string` | — | Modal title text |
|
|
11
|
+
| `titleI18n` | `string` | — | I18n key for the title text |
|
|
12
|
+
| `description` | `string` | — | Helper text below title |
|
|
13
|
+
| `descriptionI18n` | `string` | — | I18n key for the helper text |
|
|
14
|
+
| `maxWidth` | `string` | `sm:max-w-lg` | Tailwind max-width class (e.g. `max-w-2xl`) |
|
|
15
|
+
| `closeOutside` | `boolean` | `true` | Close when clicking backdrop |
|
|
16
|
+
| `backdrop` | `boolean` | `true` | Show dark overlay |
|
|
17
|
+
| `triggerClass` | `string` | — | Classes for the trigger wrapper |
|
|
18
|
+
| `headerClass` | `string` | — | Classes for the header section |
|
|
19
|
+
| `bodyClass` | `string` | — | Classes for the content section |
|
|
20
|
+
| `footerClass` | `string` | — | Classes for the footer section |
|
|
21
|
+
| `body` | `Component` | — | Component to render lazily inside |
|
|
22
|
+
| `bodyProps` | `object` | — | Props to pass to the `body` component |
|
|
23
|
+
|
|
24
|
+
### Events
|
|
25
|
+
|
|
26
|
+
- `@close`: Emitted when the modal is closed
|
|
27
|
+
- `@update:show`: Emitted to update the v-model
|
|
28
|
+
- `@onOpen`: Emitted when the modal opens
|
|
29
|
+
|
|
30
|
+
### Slots
|
|
31
|
+
|
|
32
|
+
| Slot | Description | Props |
|
|
33
|
+
| :-------- | :------------------------------------ | :---------------------- |
|
|
34
|
+
| `trigger` | Element that opens the modal on click | — |
|
|
35
|
+
| `default` | Main content of the modal | `{ close: () => void }` |
|
|
36
|
+
| `footer` | Footer content (buttons, etc.) | `{ close: () => void }` |
|
|
37
|
+
|
|
38
|
+
### Usage
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<Modal title="Edit User">
|
|
42
|
+
<template #trigger>
|
|
43
|
+
<Button>Open Modal</Button>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<div class="space-y-4">
|
|
47
|
+
<p>User details form goes here...</p>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<template #footer="{ close }">
|
|
51
|
+
<Button variant="outline" @click="close">Cancel</Button>
|
|
52
|
+
<Button @click="save">Save</Button>
|
|
53
|
+
</template>
|
|
54
|
+
</Modal>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Programmatic Control
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<Modal v-model:show="isOpen" title="Programmatic" description="Controlled via v-model">
|
|
61
|
+
<p>Content...</p>
|
|
62
|
+
</Modal>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
# Lazy Modal & SidePanel
|
|
66
|
+
|
|
67
|
+
**Import:** `import { Modal, SidePanel } from 'vlite3'`
|
|
68
|
+
|
|
69
|
+
### Description
|
|
70
|
+
|
|
71
|
+
For performance optimization, especially when dealing with heavy API calls or complex components, use the `body` prop to lazy-load the content. The component passed to `body` will only be rendered when the Modal or SidePanel is opened.
|
|
72
|
+
|
|
73
|
+
### Usage
|
|
74
|
+
|
|
75
|
+
#### 1. Define the Lazy Component (`UserInfo.vue`)
|
|
76
|
+
|
|
77
|
+
This component executes its setup/API calls only when mounted (i.e., when the modal opens).
|
|
78
|
+
|
|
79
|
+
```vue
|
|
80
|
+
<script setup lang="ts">
|
|
81
|
+
// Props passed from the parent via 'body-props' or direct binding on Modal/SidePanel
|
|
82
|
+
const props = defineProps<{
|
|
83
|
+
user: { name: string; email: string }
|
|
84
|
+
close?: () => void // Automatically passed by Modal/SidePanel
|
|
85
|
+
}>()
|
|
86
|
+
|
|
87
|
+
// Operations here (e.g., fetching details) run only when modal opens
|
|
88
|
+
console.log('UserInfo mounted, fetching data for:', props.user.name)
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<div class="space-y-4">
|
|
93
|
+
<h2 class="text-lg font-bold">{{ user.name }}</h2>
|
|
94
|
+
<p class="text-gray-600">{{ user.email }}</p>
|
|
95
|
+
<div class="flex justify-end">
|
|
96
|
+
<button @click="close" class="btn btn-secondary">Close</button>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### 2. Implement Parent (`Users.vue`)
|
|
103
|
+
|
|
104
|
+
Pass the component reference to the `body` prop.
|
|
105
|
+
Any additional props set on the `Modal` (like `:user="user"`) are automatically passed to the `body` component. You can also use `:body-props="{ user: currentUser }"` for explicit prop passing.
|
|
106
|
+
|
|
107
|
+
```vue
|
|
108
|
+
<script setup lang="ts">
|
|
109
|
+
import { ref } from 'vue'
|
|
110
|
+
import UserInfo from './UserInfo.vue' // Import the component definition, do not instantiate
|
|
111
|
+
import { Modal, Button } from 'vlite3'
|
|
112
|
+
|
|
113
|
+
const currentUser = ref({
|
|
114
|
+
name: 'John Doe',
|
|
115
|
+
email: 'john@example.com',
|
|
116
|
+
})
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<Modal title="Edit User" :body="UserInfo" :user="currentUser">
|
|
121
|
+
<!-- :user="currentUser" is automatically passed to UserInfo props -->
|
|
122
|
+
<template #trigger>
|
|
123
|
+
<Button>Open User Info</Button>
|
|
124
|
+
</template>
|
|
125
|
+
</Modal>
|
|
126
|
+
</template>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Key Benefits
|
|
130
|
+
|
|
131
|
+
- **Performance**: Child components are not mounted/created until the modal is actually opened.
|
|
132
|
+
- **Efficiency**: Heavy operations (API calls, complex computations) in the child's `setup` or `onMounted` hook are deferred.
|
|
133
|
+
- **Clean State**: Each open creates a fresh instance of the component (unless kept alive externally), avoiding stale state issues.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# MultiSelect
|
|
2
|
+
|
|
3
|
+
**Import:** `import { MultiSelect } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :---------------- | :---------------------------------- | :------------------ | :------------------------------- |
|
|
9
|
+
| `modelValue` | `any[]` | `[]` | Selected values |
|
|
10
|
+
| `options` | `IDropdownOptions` | `[]` | Options to display |
|
|
11
|
+
| `placeholder` | `string` | `'Select items...'` | Placeholder text |
|
|
12
|
+
| `placeholderI18n` | `string` | — | I18n key for the placeholder |
|
|
13
|
+
| `searchable` | `boolean` | `true` | Enable search functionality |
|
|
14
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
15
|
+
| `loading` | `boolean` | `false` | Show loading state |
|
|
16
|
+
| `variant` | `'default' \| 'outline' \| 'solid'` | `'outline'` | Visual style variant |
|
|
17
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Component size |
|
|
18
|
+
| `maxVisible` | `number` | `2` | Max tags to show before +N badge |
|
|
19
|
+
| `hasMore` | `boolean` | `false` | Show "Load More" trigger |
|
|
20
|
+
| `remote` | `boolean` | `false` | Enable remote search mode |
|
|
21
|
+
| `layout` | `'default' \| 'grouped'` | `'default'` | Option layout mode |
|
|
22
|
+
|
|
23
|
+
### Events
|
|
24
|
+
|
|
25
|
+
- `@update:modelValue`: Emitted when selection changes
|
|
26
|
+
- `@change`: Emitted when selection changes
|
|
27
|
+
- `@search`: Emitted when search query changes
|
|
28
|
+
- `@load-more`: Emitted when scrolling to bottom
|
|
29
|
+
|
|
30
|
+
### Usage
|
|
31
|
+
|
|
32
|
+
#### Basic Usage
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<MultiSelect v-model="selected" :options="options" placeholder="Select frameworks" />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Remote Search
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<MultiSelect v-model="selected" :options="results" remote :loading="isLoading" @search="onSearch" />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Grouped Options
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<MultiSelect v-model="selected" :options="groupedOptions" layout="grouped" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Pagination
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<MultiSelect v-model="selected" :options="items" :has-more="hasMore" @load-more="loadNextPage" />
|
|
54
|
+
```
|