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,339 @@
|
|
|
1
|
+
# Invoice Component
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Invoice, InvoiceTotals } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A highly-sophisticated, production-grade invoice and receipt engine for Vue 3. It provides 4 distinct visual variants designed to handle everything from legal enterprise billing to thermal POS receipts and modern service invoices.
|
|
8
|
+
|
|
9
|
+
The component is strictly typed, accessible, and print-optimized with built-in support for barcodes (CODE128), QR codes, and semantic status coloring.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| :-------- | :--------------- | :----------- | :------------------------------------------------------------------------------------ |
|
|
17
|
+
| `data` | `InvoiceData` | **Required** | The complete data object powering the invoice. |
|
|
18
|
+
| `variant` | `InvoiceVariant` | `'Variant1'` | selects the visual style: `'Variant1'`, `'Variant2'`, `'Variant3'`, or `'Variant4'`. |
|
|
19
|
+
| `compact` | `boolean` | `false` | When true, scales down padding and typography. See **CSS Variables** for fine-tuning. |
|
|
20
|
+
| `labels` | `InvoiceLabels` | `{}` | Custom static text labels (e.g. overriding "Invoice", "Issued"). |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### Data Models (API Reference)
|
|
25
|
+
|
|
26
|
+
#### `InvoiceData`
|
|
27
|
+
|
|
28
|
+
The root object passed to the `:data` prop.
|
|
29
|
+
|
|
30
|
+
| Field | Type | Description |
|
|
31
|
+
| :-------------- | :--------------------- | :----------------------------------------------------------------------- |
|
|
32
|
+
| `invoiceNumber` | `string` | **Required.** Primary identifier (e.g., "INV-2024-001"). |
|
|
33
|
+
| `items` | `InvoiceLineItem[]` | **Required.** Array of products/services. |
|
|
34
|
+
| `totals` | `InvoiceTotal[]` | **Required.** Array of summary rows (Subtotal, Tax, Final). |
|
|
35
|
+
| `brandTitle` | `string?` | Custom header title (e.g., "COMMERCIAL INVOICE"). Defaults to "Invoice". |
|
|
36
|
+
| `brandName` | `string?` | Your company name shown in the header. |
|
|
37
|
+
| `brandLogo` | `string?` | URL for the brand logo. Transparent PNG/SVG recommended. |
|
|
38
|
+
| `status` | `string?` | Raw status string (e.g. "Paid"). Affects semantic coloring. |
|
|
39
|
+
| `issuedDate` | `string \| Date?` | Date the invoice was generated. |
|
|
40
|
+
| `dueDate` | `string \| Date?` | Deadline for payment. |
|
|
41
|
+
| `companyInfo` | `InvoiceCompanyInfo?` | Nested object for issuer details (From). |
|
|
42
|
+
| `customerInfo` | `InvoiceCustomerInfo?` | Nested object for recipient details (Billed To). |
|
|
43
|
+
| `shippingInfo` | `InvoiceCustomerInfo?` | Nested object for shipping details (Ship To). |
|
|
44
|
+
| `paymentMethod` | `string?` | Payment method used or expected. |
|
|
45
|
+
| `shippingMethod`| `string?` | Shipping method used or expected. |
|
|
46
|
+
| `barcode` | `string?` | Renders a CODE128 barcode at the bottom. |
|
|
47
|
+
| `qrcode` | `string?` | QR value encoded exactly as provided. |
|
|
48
|
+
| `qrcodeSize` | `number?` | Overrides the visual variant's default QR size. |
|
|
49
|
+
| `notes` | `string?` | Multi-line text for memos or additional terms. |
|
|
50
|
+
| `footerText` | `string?` | Legal small print at the very bottom. |
|
|
51
|
+
|
|
52
|
+
#### `InvoiceLineItem`
|
|
53
|
+
|
|
54
|
+
Fields for individual row items in the document.
|
|
55
|
+
|
|
56
|
+
| Field | Type | Description |
|
|
57
|
+
| :-------------- | :----------------- | :----------------------------------------------------- |
|
|
58
|
+
| `id` | `string \| number` | Unique item ID (used as Vue key). |
|
|
59
|
+
| `name` | `string` | **Required.** Display name of the product/service. |
|
|
60
|
+
| `quantity` | `number` | **Required.** Quantity of items. |
|
|
61
|
+
| `price` | `number` | **Required.** Unit price (before discounts). |
|
|
62
|
+
| `total` | `number` | **Required.** Final calculated total for the line. |
|
|
63
|
+
| `sku` | `string?` | Stock Keeping Unit or internal part number. |
|
|
64
|
+
| `thumbnail` | `string?` | URL for a small product preview image. |
|
|
65
|
+
| `description` | `string?` | Detailed subtitle (hidden in compact/POS views). |
|
|
66
|
+
| `size` | `string?` | Specific variant detail (e.g., "Large", "42", "Blue"). |
|
|
67
|
+
| `discount` | `number?` | The amount subtracted from the subtotal for this line. |
|
|
68
|
+
| `discountLabel` | `string?` | Short text for the discount (e.g., "10% OFF", "BOGO"). |
|
|
69
|
+
|
|
70
|
+
#### `InvoiceCustomerInfo` & `InvoiceCompanyInfo`
|
|
71
|
+
|
|
72
|
+
Detailed contact structures for parties involved (From, Billed To, Ship To).
|
|
73
|
+
|
|
74
|
+
| Field | Type | Description |
|
|
75
|
+
| :-------- | :-------- | :---------------------------------------- |
|
|
76
|
+
| `name` | `string` | Person or Entity name. |
|
|
77
|
+
| `address` | `string?` | Street address / Suite. |
|
|
78
|
+
| `city` | `string?` | City name. |
|
|
79
|
+
| `state` | `string?` | State / Province / Region. |
|
|
80
|
+
| `zip` | `string?` | Postal / Zip code. |
|
|
81
|
+
| `country` | `string?` | Country name. |
|
|
82
|
+
| `email` | `string?` | Contact email address. |
|
|
83
|
+
| `phone` | `string?` | Contact phone number. |
|
|
84
|
+
| `website` | `string?` | (Company Only) Corporate website URL. |
|
|
85
|
+
| `taxId` | `string?` | VAT #, Tax #, or Business Registration #. |
|
|
86
|
+
|
|
87
|
+
#### `InvoiceTotal`
|
|
88
|
+
|
|
89
|
+
Defines the final summary rows.
|
|
90
|
+
|
|
91
|
+
| Field | Type | Description |
|
|
92
|
+
| :------------- | :--------- | :------------------------------------------------------------ |
|
|
93
|
+
| `label` | `string` | Display label (e.g., "VAT (15%)"). |
|
|
94
|
+
| `value` | `number` | The numeric amount. |
|
|
95
|
+
| `isSubtotal` | `boolean?` | If true, applies light emphasis styling. |
|
|
96
|
+
| `isTax` | `boolean?` | If true, identifies row as a tax type. |
|
|
97
|
+
| `isDiscount` | `boolean?` | If true, identifies row as a deduction. |
|
|
98
|
+
| `isGrandTotal` | `boolean?` | If true, renders large, bold, and with a primary color theme. |
|
|
99
|
+
|
|
100
|
+
#### `InvoiceLabels`
|
|
101
|
+
|
|
102
|
+
Dictionary used to override static English text inside the component via the `labels` prop.
|
|
103
|
+
|
|
104
|
+
| Field | Type | Description |
|
|
105
|
+
| :--------- | :-------- | :---------------------------------- |
|
|
106
|
+
| `invoice` | `string?` | Replaces "Invoice". |
|
|
107
|
+
| `issued` | `string?` | Replaces "Issued" or "Issue Date". |
|
|
108
|
+
| `due` | `string?` | Replaces "Due" or "Due Date". |
|
|
109
|
+
| `from` | `string?` | Replaces "From". |
|
|
110
|
+
| `billedTo` | `string?` | Replaces "Billed To" or "Customer". |
|
|
111
|
+
| `shipTo` | `string?` | Replaces "Ship To" or "Delivery". |
|
|
112
|
+
| `item` | `string?` | Replaces "Description" or "Item". |
|
|
113
|
+
| `price` | `string?` | Replaces "Unit Price" or "Price". |
|
|
114
|
+
| `qty` | `string?` | Replaces "Qty". |
|
|
115
|
+
| `total` | `string?` | Replaces "Total" or "Amount". |
|
|
116
|
+
| `notes` | `string?` | Replaces "Notes". |
|
|
117
|
+
| `taxId` | `string?` | Replaces "Tax ID" or "VAT". |
|
|
118
|
+
| `sku` | `string?` | Replaces "SKU". |
|
|
119
|
+
| `paymentMethod` | `string?` | Replaces "Payment Method" or "Payment". |
|
|
120
|
+
| `shippingMethod`| `string?` | Replaces "Shipping Method" or "Shipping".|
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Customization & Logic
|
|
125
|
+
|
|
126
|
+
#### Automatic Status Colors
|
|
127
|
+
|
|
128
|
+
The component maps specific status strings to semantic colors automatically.
|
|
129
|
+
|
|
130
|
+
| Status Category | Colors | Example Keywords |
|
|
131
|
+
| :-------------- | :------------ | :---------------------------------- |
|
|
132
|
+
| **Positive** | Green | Paid, Success, Completed, Delivered |
|
|
133
|
+
| **Warning** | Yellow/Orange | Pending, Overdue, Expiring, Waiting |
|
|
134
|
+
| **Negative** | Red/Pink | Rejected, Cancelled, Failed, Danger |
|
|
135
|
+
| **Information** | Blue/Indigo | Processing, Started, In Progress |
|
|
136
|
+
| **Neutral** | Gray | Draft, Archived, Disabled, Void |
|
|
137
|
+
|
|
138
|
+
#### CSS Variable Hooks
|
|
139
|
+
|
|
140
|
+
For advanced users needing to fine-tune the "Compact" or standard output (especially for print), the following CSS variables are supported on the component container:
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
/* Example: Customizing font scale for specific printing needs */
|
|
144
|
+
.v-invoice-container {
|
|
145
|
+
--text-sm: 13.5px; /* Base small text e.g. address */
|
|
146
|
+
--text-xs: 10px; /* Extra small text e.g. SKU info */
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### Data Contract for AI Agents (JSON Template)
|
|
153
|
+
|
|
154
|
+
Use this exhaustive object to generate or validate a full-featured invoice payload.
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"brandTitle": "COMMERCIAL INVOICE",
|
|
159
|
+
"brandName": "Vertex Systems LLC",
|
|
160
|
+
"brandLogo": "[https://cdn.example.com/logo.svg](https://cdn.example.com/logo.svg)",
|
|
161
|
+
"invoiceNumber": "VXT-8842-2024",
|
|
162
|
+
"status": "Paid",
|
|
163
|
+
"issuedDate": "2024-03-30",
|
|
164
|
+
"dueDate": "2024-04-15",
|
|
165
|
+
"paymentMethod": "Wire Transfer (Net 15)",
|
|
166
|
+
"shippingMethod": "FedEx Priority",
|
|
167
|
+
"companyInfo": {
|
|
168
|
+
"name": "Vertex Systems LLC",
|
|
169
|
+
"address": "1200 Innovation Way",
|
|
170
|
+
"city": "Austin",
|
|
171
|
+
"state": "TX",
|
|
172
|
+
"zip": "78701",
|
|
173
|
+
"country": "USA",
|
|
174
|
+
"email": "billing@vertex.io",
|
|
175
|
+
"taxId": "VAT-TX12345678"
|
|
176
|
+
},
|
|
177
|
+
"customerInfo": {
|
|
178
|
+
"name": "Global Logistics Inc.",
|
|
179
|
+
"address": "400 Harbor Drive",
|
|
180
|
+
"city": "Miami",
|
|
181
|
+
"state": "FL",
|
|
182
|
+
"zip": "33101",
|
|
183
|
+
"email": "procurement@global.log"
|
|
184
|
+
},
|
|
185
|
+
"shippingInfo": {
|
|
186
|
+
"name": "Global Logistics Inc. (Receiving)",
|
|
187
|
+
"address": "400 Harbor Drive, Dock 4",
|
|
188
|
+
"city": "Miami",
|
|
189
|
+
"state": "FL",
|
|
190
|
+
"zip": "33101",
|
|
191
|
+
"phone": "+1 (555) 019-8833"
|
|
192
|
+
},
|
|
193
|
+
"items": [
|
|
194
|
+
{
|
|
195
|
+
"id": "1",
|
|
196
|
+
"name": "Enterprise Shield - Annual Subscription",
|
|
197
|
+
"sku": "V-SHD-ENT",
|
|
198
|
+
"quantity": 1,
|
|
199
|
+
"price": 12000,
|
|
200
|
+
"total": 11000,
|
|
201
|
+
"discount": 1000,
|
|
202
|
+
"discountLabel": "MULTI-YEAR DISCOUNT",
|
|
203
|
+
"size": "Enterprise Tier"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"totals": [
|
|
207
|
+
{ "label": "Subtotal", "value": 12000, "isSubtotal": true },
|
|
208
|
+
{ "label": "Customer Discount", "value": -1000, "isDiscount": true },
|
|
209
|
+
{ "label": "Sales Tax (0%)", "value": 0, "isTax": true },
|
|
210
|
+
{ "label": "Total Amount due", "value": 11000, "isGrandTotal": true }
|
|
211
|
+
],
|
|
212
|
+
"barcode": "VXT-8842-2024",
|
|
213
|
+
"qrcode": "[https://pay.vertex.io/VXT-8842-2024](https://pay.vertex.io/VXT-8842-2024)",
|
|
214
|
+
"qrcodeSize": 200,
|
|
215
|
+
"notes": "Thank you for your business. Terms: Net 15.",
|
|
216
|
+
"footerText": "Vertex Systems LLC is a registered trademark in TX."
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Pre-encoded QR values can be passed directly without decoding or transformation:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
const invoiceData = {
|
|
224
|
+
// ...invoice fields
|
|
225
|
+
qrcode: invoice.qrValue,
|
|
226
|
+
qrcodeSize: 300,
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### Standalone Components
|
|
233
|
+
|
|
234
|
+
#### `InvoiceTotals`
|
|
235
|
+
|
|
236
|
+
The totals section of the invoice can be used completely independently of the main `Invoice` component. This is useful for custom checkout pages, standalone receipt modals, or custom layouts that need to display standard invoice calculations natively.
|
|
237
|
+
|
|
238
|
+
**Props:**
|
|
239
|
+
|
|
240
|
+
| Prop | Type | Default | Description |
|
|
241
|
+
| :--------------- | :--------------------------------------------- | :---------- | :------------------------------------------------------------------- |
|
|
242
|
+
| `totals` | `InvoiceTotal[]` | **Required**| Array of summary rows (Subtotal, Tax, Final). |
|
|
243
|
+
| `compact` | `boolean` | `false` | When true, scales down padding and typography. |
|
|
244
|
+
| `variant` | `InvoiceVariant \| 'default'` | `'default'` | Matches the visual style to a specific invoice variant. |
|
|
245
|
+
| `containerClass` | `string \| any[] \| Record<string, boolean>` | `undefined` | Custom class to override the wrapper container styles. |
|
|
246
|
+
|
|
247
|
+
**Example:**
|
|
248
|
+
|
|
249
|
+
```vue
|
|
250
|
+
<script setup>
|
|
251
|
+
import { InvoiceTotals } from 'vlite3'
|
|
252
|
+
|
|
253
|
+
const checkoutTotals = [
|
|
254
|
+
{ label: 'Subtotal', value: 250, isSubtotal: true },
|
|
255
|
+
{ label: 'Promo Code (SAVE20)', value: -50, isDiscount: true },
|
|
256
|
+
{ label: 'Estimated Tax', value: 15, isTax: true },
|
|
257
|
+
{ label: 'Total Due', value: 215, isGrandTotal: true }
|
|
258
|
+
]
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<template>
|
|
262
|
+
<div class="max-w-sm p-5 border rounded-xl bg-card">
|
|
263
|
+
<InvoiceTotals :totals="checkoutTotals" variant="Variant4" />
|
|
264
|
+
</div>
|
|
265
|
+
</template>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### Implementation Examples
|
|
271
|
+
|
|
272
|
+
#### 1. Standard Sales Invoice (Variant 1)
|
|
273
|
+
|
|
274
|
+
```vue
|
|
275
|
+
<script setup>
|
|
276
|
+
import { Invoice } from 'vlite3'
|
|
277
|
+
|
|
278
|
+
const invoiceData = {
|
|
279
|
+
brandName: 'Acme Corp.',
|
|
280
|
+
invoiceNumber: 'INV-2024-001',
|
|
281
|
+
items: [{ name: 'UI/UX Design', quantity: 1, price: 1200, total: 1200 }],
|
|
282
|
+
totals: [{ label: 'Total', value: 1200, isGrandTotal: true }],
|
|
283
|
+
}
|
|
284
|
+
</script>
|
|
285
|
+
|
|
286
|
+
<template>
|
|
287
|
+
<Invoice :data="invoiceData" variant="Variant1" />
|
|
288
|
+
</template>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### 2. POS Thermal Receipt (Variant 2)
|
|
292
|
+
|
|
293
|
+
Variant 2 follows a narrow vertical layout optimized for small thermal prints and retail environments.
|
|
294
|
+
|
|
295
|
+
```vue
|
|
296
|
+
<template>
|
|
297
|
+
<Invoice :data="posData" variant="Variant2" :compact="true" />
|
|
298
|
+
</template>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### 3. Professional Service with Discounts (Variant 4)
|
|
302
|
+
|
|
303
|
+
```vue
|
|
304
|
+
<script setup>
|
|
305
|
+
const serviceData = {
|
|
306
|
+
brandTitle: 'SERVICE INVOICE',
|
|
307
|
+
items: [
|
|
308
|
+
{
|
|
309
|
+
name: 'Software Development',
|
|
310
|
+
quantity: 40,
|
|
311
|
+
price: 150,
|
|
312
|
+
discount: 600,
|
|
313
|
+
discountLabel: 'Volume Discount',
|
|
314
|
+
total: 5400,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
totals: [
|
|
318
|
+
{ label: 'Subtotal', value: 6000, isSubtotal: true },
|
|
319
|
+
{ label: 'Discount', value: -600, isDiscount: true },
|
|
320
|
+
{ label: 'Total Due', value: 5400, isGrandTotal: true },
|
|
321
|
+
],
|
|
322
|
+
}
|
|
323
|
+
</script>
|
|
324
|
+
|
|
325
|
+
<template>
|
|
326
|
+
<Invoice :data="serviceData" variant="Variant4" />
|
|
327
|
+
</template>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### Senior Engineer's Implementation Notes
|
|
333
|
+
|
|
334
|
+
1. **Strict Math**: The component **does not** compute totals. It is a presentational layer. This is by design to prevent "floating-point drift" where the UI shows one value and the backend expects another. Always pass final, pre-calculated values.
|
|
335
|
+
2. **Adaptive Columns**: The `Size` and `Discount` columns are truly dynamic. If half your items have a size and the other half don't, the component will render empty space for the missing values to maintain alignment. If **no** items have these fields, the columns are removed from the DOM entirely.
|
|
336
|
+
3. **Variant Selection**:
|
|
337
|
+
- **Variant 2** is the only one that uses `print:max-w-[300px]`, making it dedicated to roll-based thermal printers.
|
|
338
|
+
- **Variant 4** uses `hero` header backgrounds; ensure you have a high-contrast logo (either white or dark) defined in `brandLogo`.
|
|
339
|
+
4. **Responsive Print**: Use `compact: true` specifically for email attachments or physical printing to minimize page count.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# Kanban Board
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Kanban } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A high-performance, production-ready Kanban system built for Vue 3. It supports cross-column drag-and-drop, infinite scrolling per column, intelligent auto-grouping from flat arrays, consolidated fractional indexing for optimal database performance, and granular disabled/locked controls at both the board and item level.
|
|
8
|
+
|
|
9
|
+
### Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| :--- | :--- | :--- | :--- |
|
|
13
|
+
| `columns` | `KanbanColumn[]` | **Required** | Defines the vertical boards/status columns. |
|
|
14
|
+
| `rawData` | `any[]` | `undefined` | **Recommended.** Provide a flat array. The board will automatically group, sort, and manage drag-and-drop positions internally. |
|
|
15
|
+
| `groupKey` | `string` | `'status'` | The object property used to group flat `rawData` into columns (e.g., `'status'` or `'stage'`). Changing this rebuilds the board from `rawData`. |
|
|
16
|
+
| `positionKey` | `string` | `'position'` | The object property used to define the sorting order within a column. |
|
|
17
|
+
| `emptyColumnId` | `string \| number` | `undefined` | Column id that receives null / blank group values (e.g. a **No Priority** lane). |
|
|
18
|
+
| `unmappedColumnId` | `string \| number` | `undefined` | Column id that receives values that do not match any configured column (e.g. **Unmapped**). |
|
|
19
|
+
| `includeOrphanColumns` | `boolean` | `true` | When true, unmatched group values become visible columns so cards never silently disappear. |
|
|
20
|
+
| `data` | `Record<string, any[]>` | `{}` | Legacy manual grouping structure. (Supports `v-model:data`) |
|
|
21
|
+
| `group` | `string` | `'kanban-group'` | Unique identifier to allow dragging between different Kanban instances. |
|
|
22
|
+
| `itemKey` | `string` | `'id'` | The property name used as a unique identifier for items. |
|
|
23
|
+
| `loadData` | `Function` | `undefined` | Async function for infinite scrolling: `(colId, page) => Promise<r>`. |
|
|
24
|
+
| `boardClass` | `string` | `undefined` | Custom CSS class for the column container. |
|
|
25
|
+
| `isItemDisabled` | `(item: any) => boolean` | `undefined` | Predicate called per item. Return `true` to lock that specific item in place — it cannot be dragged to any column. The item still renders normally. |
|
|
26
|
+
| `onItemMoved` | `KanbanItemMovedHandler` | `undefined` | Async confirm handler for drops. Bound via `@item-moved` or `:on-item-moved`. See [Auto-revert on failed mutations](#auto-revert-on-failed-mutations). |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
### `KanbanColumn` Shape
|
|
31
|
+
|
|
32
|
+
| Property | Type | Default | Description |
|
|
33
|
+
| :--- | :--- | :--- | :--- |
|
|
34
|
+
| `id` | `string \| number` | **Required** | Unique column identifier. Must match the value of `groupKey` in your data. |
|
|
35
|
+
| `title` | `string` | **Required** | Display title rendered in the column header. |
|
|
36
|
+
| `titleI18n` | `string` | `undefined` | i18n key. When provided, takes precedence over `title`. |
|
|
37
|
+
| `disabled` | `boolean` | `undefined` | When `true`, the entire column is locked. Items cannot be dragged **into** or **out of** this column. A 🔒 badge is shown in the default header. |
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Events
|
|
42
|
+
|
|
43
|
+
| Event | Payload | Description |
|
|
44
|
+
| :--- | :--- | :--- |
|
|
45
|
+
| `@item-moved` | `(itemId, toColumnId, newPosition, item, meta?)` | **Confirm handler (prop).** The board awaits this function after an optimistic drop. Reject / return `false` → card auto-reverts. `meta.revert()` is also available for manual undo. |
|
|
46
|
+
| `@move` | `KanbanMoveEvent` | High-level move event detailing `fromColumn`, `toColumn`, `oldIndex`, `newIndex` (fires regardless of confirm outcome). |
|
|
47
|
+
| `@item-move-failed` | `{ itemId, fromColumnId, toColumnId, newPosition, item, error }` | Fired after an automatic revert caused by a rejected / `false` confirm handler. |
|
|
48
|
+
| `@update:data` | `Record<string, any[]>` | Emitted when the manual `data` structure changes. |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### Implementation Guide
|
|
53
|
+
|
|
54
|
+
#### The Auto-Calculation Approach (Recommended)
|
|
55
|
+
By supplying a flat array (`rawData`), the `<Kanban>` component fully abstracts away complex grouping watchers, map sorting, and the mathematical fractional indexing required to compute exact drag-and-drop placements (LexoRank style positioning).
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<script setup>
|
|
59
|
+
import { Kanban } from 'vlite3'
|
|
60
|
+
|
|
61
|
+
// 1. Just fetch your flat array of tasks
|
|
62
|
+
const data = [{ id: 1, title: 'Task A', status: 'todo', position: 1024 }]
|
|
63
|
+
const columns = [{ id: 'todo', title: 'To Do' }, { id: 'done', title: 'Done' }]
|
|
64
|
+
|
|
65
|
+
// 2. Await your API mutation — throw / return false on failure and the card snaps back
|
|
66
|
+
const syncWithBackend = async (id, newStatus, newPosition) => {
|
|
67
|
+
await api.tasks.update(id, { status: newStatus, position: newPosition })
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<Kanban
|
|
73
|
+
:raw-data="data"
|
|
74
|
+
group-key="status"
|
|
75
|
+
position-key="position"
|
|
76
|
+
:columns="columns"
|
|
77
|
+
@item-moved="syncWithBackend"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
#### Auto-revert on failed mutations
|
|
85
|
+
|
|
86
|
+
Drops are optimistic: the card moves immediately. The board then **awaits** `@item-moved` / `:on-item-moved`.
|
|
87
|
+
|
|
88
|
+
| Handler result | Board behaviour |
|
|
89
|
+
| :--- | :--- |
|
|
90
|
+
| resolves / returns `void` \| `true` | Keep the new column & position |
|
|
91
|
+
| returns `false` | Snap the card back to its previous column & index |
|
|
92
|
+
| rejects / throws | Snap back, then emit `@item-move-failed` |
|
|
93
|
+
|
|
94
|
+
No parent refetch or manual DOM undo is required — every consumer of `<Kanban>` gets this for free.
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<script setup>
|
|
98
|
+
import { Kanban, showToast } from 'vlite3'
|
|
99
|
+
|
|
100
|
+
const onItemMoved = async (id, toColumnId, newPosition) => {
|
|
101
|
+
try {
|
|
102
|
+
await api.tasks.move(id, { statusId: toColumnId, position: newPosition })
|
|
103
|
+
} catch (e) {
|
|
104
|
+
showToast(e.message || 'Move failed', 'error')
|
|
105
|
+
throw e // required — signals Kanban to revert
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<Kanban
|
|
112
|
+
:raw-data="tasks"
|
|
113
|
+
:columns="columns"
|
|
114
|
+
group-key="statusId"
|
|
115
|
+
position-key="position"
|
|
116
|
+
@item-moved="onItemMoved"
|
|
117
|
+
/>
|
|
118
|
+
</template>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`meta` (5th argument) exposes `{ fromColumnId, oldIndex, newIndex, previousPosition, revert }` if you ever need an imperative undo outside the promise contract.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
#### Disabling an Entire Column (Board-Level Lock)
|
|
126
|
+
|
|
127
|
+
Set `disabled: true` on any column definition to fully lock that board. Sortable.js will natively reject all drag attempts into or out of it — no workarounds needed. The column receives a visual tint and a 🔒 badge in the default header.
|
|
128
|
+
|
|
129
|
+
**Use case:** "Archived", "Closed", "Released" columns that must remain read-only.
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
<script setup>
|
|
133
|
+
import { Kanban } from 'vlite3'
|
|
134
|
+
|
|
135
|
+
const columns = [
|
|
136
|
+
{ id: 'active', title: 'Active' },
|
|
137
|
+
{ id: 'archived', title: 'Archived', disabled: true }, // 🔒 fully locked
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
const data = [
|
|
141
|
+
{ id: 1, title: 'Live feature', status: 'active', position: 1024 },
|
|
142
|
+
{ id: 2, title: 'Retired feature', status: 'archived', position: 1024 },
|
|
143
|
+
]
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<Kanban :raw-data="data" :columns="columns" group-key="status" position-key="position" />
|
|
148
|
+
</template>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
#### Disabling Specific Items (Item-Level Lock)
|
|
154
|
+
|
|
155
|
+
Pass an `:is-item-disabled` predicate. Any item for which the predicate returns `true` is individually locked — it cannot be dragged anywhere, but it still renders and is visible. Other items in the same column remain freely draggable.
|
|
156
|
+
|
|
157
|
+
**Use case:** Tasks that are "in review", "assigned to another user", or flagged with a `locked` property.
|
|
158
|
+
|
|
159
|
+
```vue
|
|
160
|
+
<script setup>
|
|
161
|
+
import { Kanban } from 'vlite3'
|
|
162
|
+
|
|
163
|
+
const columns = [
|
|
164
|
+
{ id: 'todo', title: 'To Do' },
|
|
165
|
+
{ id: 'in-progress', title: 'In Progress' },
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
const data = [
|
|
169
|
+
{ id: 1, title: 'Normal task', status: 'todo', position: 1024, locked: false },
|
|
170
|
+
{ id: 2, title: 'Locked task', status: 'todo', position: 2048, locked: true }, // 🔒 item locked
|
|
171
|
+
{ id: 3, title: 'Another task', status: 'todo', position: 3072, locked: false },
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
// Return true for any item that should be undraggable
|
|
175
|
+
const isItemDisabled = (item) => item.locked === true
|
|
176
|
+
</script>
|
|
177
|
+
|
|
178
|
+
<template>
|
|
179
|
+
<Kanban
|
|
180
|
+
:raw-data="data"
|
|
181
|
+
:columns="columns"
|
|
182
|
+
group-key="status"
|
|
183
|
+
position-key="position"
|
|
184
|
+
:is-item-disabled="isItemDisabled"
|
|
185
|
+
/>
|
|
186
|
+
</template>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
#### Combining Both: Locked Column + Locked Items
|
|
192
|
+
|
|
193
|
+
Both controls are fully composable. You can lock a whole column **and** lock individual items in other columns at the same time.
|
|
194
|
+
|
|
195
|
+
```vue
|
|
196
|
+
<script setup>
|
|
197
|
+
import { Kanban } from 'vlite3'
|
|
198
|
+
|
|
199
|
+
const columns = [
|
|
200
|
+
{ id: 'active', title: 'Active' },
|
|
201
|
+
{ id: 'archived', title: 'Archived', disabled: true }, // board-level lock
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
const data = [
|
|
205
|
+
{ id: 1, title: 'Free task', status: 'active', position: 1024, locked: false },
|
|
206
|
+
{ id: 2, title: 'Locked task', status: 'active', position: 2048, locked: true }, // item-level lock
|
|
207
|
+
{ id: 3, title: 'Archived A', status: 'archived', position: 1024, locked: false },
|
|
208
|
+
]
|
|
209
|
+
|
|
210
|
+
const isItemDisabled = (item) => item.locked === true
|
|
211
|
+
</script>
|
|
212
|
+
|
|
213
|
+
<template>
|
|
214
|
+
<Kanban
|
|
215
|
+
:raw-data="data"
|
|
216
|
+
:columns="columns"
|
|
217
|
+
group-key="status"
|
|
218
|
+
position-key="position"
|
|
219
|
+
:is-item-disabled="isItemDisabled"
|
|
220
|
+
/>
|
|
221
|
+
</template>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
#### Slots Customization
|
|
227
|
+
|
|
228
|
+
| Slot Name | Scoped Props | Usage |
|
|
229
|
+
| :--- | :--- | :--- |
|
|
230
|
+
| `column-header` | `{ column, pageInfo }` | Replace the entire header UI. |
|
|
231
|
+
| `prepend-item` | `{ column, items }` | Add a "Create Task" button at the top of a column. |
|
|
232
|
+
| `item` | `{ item, column, isDisabled }` | **Crucial.** Customize the card design. `isDisabled` is `true` when the item or its board is locked. |
|
|
233
|
+
| `append-item` | `{ column, items }` | Add footers or summary info at the bottom. |
|
|
234
|
+
|
|
235
|
+
The `isDisabled` scoped prop on the `#item` slot lets you apply custom visual styling to locked items without duplicating the disable logic:
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<template #item="{ item, isDisabled }">
|
|
239
|
+
<div
|
|
240
|
+
:class="[
|
|
241
|
+
'p-3 rounded-lg border transition-colors',
|
|
242
|
+
isDisabled
|
|
243
|
+
? 'opacity-60 cursor-not-allowed border-border'
|
|
244
|
+
: 'cursor-grab hover:border-primary border-border',
|
|
245
|
+
]">
|
|
246
|
+
<h4 class="text-sm font-medium">{{ item.title }}</h4>
|
|
247
|
+
<span v-if="item.locked" class="text-xs text-amber-600">🔒 Locked</span>
|
|
248
|
+
</div>
|
|
249
|
+
</template>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Reactive grouping lifecycle
|
|
255
|
+
|
|
256
|
+
`rawData`, `columns`, `groupKey`, and `positionKey` are all reactive inputs. Whenever any of them change, the board rebuilds its internal column→item map from the original flat `rawData` using one shared resolver (`resolveKanbanGroupKey` — trim + case-insensitive match to canonical column ids).
|
|
257
|
+
|
|
258
|
+
Do **not** remount the board with `:key="groupBy"` to force a regroup — that is a workaround. Switch the `groupKey` / `columns` and the same cards redistribute immediately.
|
|
259
|
+
|
|
260
|
+
```vue
|
|
261
|
+
<script setup>
|
|
262
|
+
import { computed, ref } from 'vue'
|
|
263
|
+
import { Kanban } from 'vlite3'
|
|
264
|
+
|
|
265
|
+
const groupBy = ref('status')
|
|
266
|
+
const groupKey = computed(() => (groupBy.value === 'priority' ? 'priority' : 'statusId'))
|
|
267
|
+
const columns = computed(() =>
|
|
268
|
+
groupBy.value === 'priority'
|
|
269
|
+
? [
|
|
270
|
+
{ id: 'LOW', title: 'Low' },
|
|
271
|
+
{ id: 'HIGH', title: 'High' },
|
|
272
|
+
{ id: '__no_priority__', title: 'No Priority', disabled: true },
|
|
273
|
+
{ id: '__unmapped__', title: 'Unmapped', disabled: true },
|
|
274
|
+
]
|
|
275
|
+
: [
|
|
276
|
+
{ id: 'todo', title: 'To Do' },
|
|
277
|
+
{ id: 'done', title: 'Done' },
|
|
278
|
+
],
|
|
279
|
+
)
|
|
280
|
+
</script>
|
|
281
|
+
|
|
282
|
+
<template>
|
|
283
|
+
<Kanban
|
|
284
|
+
:raw-data="tasks"
|
|
285
|
+
:columns="columns"
|
|
286
|
+
:group-key="groupKey"
|
|
287
|
+
position-key="position"
|
|
288
|
+
empty-column-id="__no_priority__"
|
|
289
|
+
unmapped-column-id="__unmapped__"
|
|
290
|
+
/>
|
|
291
|
+
</template>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Senior Engineer's Notes (Best Practices)
|
|
295
|
+
|
|
296
|
+
1. **Stop writing boilerplate:** Always prefer `:raw-data` and `@item-moved` over manually managing a `Record<string, any[]>` grouping state and computing next/prev positions manually.
|
|
297
|
+
2. **Optimistic UI + automatic rollback:** The board updates locally on drop, awaits your `@item-moved` handler, and snaps the card back if the Promise rejects or returns `false`. Always `throw` (or `return false`) from a failed mutation — swallowing the error leaves a stale card in the wrong column.
|
|
298
|
+
3. **Performance:** The board uses `v-memo` internally on items and explicitly prevents parent state reactivity death-loops by shallow cloning your `rawData` input.
|
|
299
|
+
4. **Prefer board-level `disabled` for whole-column locks:** Setting `disabled: true` on a column delegates rejection to Sortable.js natively — it is zero-cost and happens before any Vue event fires.
|
|
300
|
+
5. **Prefer `:is-item-disabled` over CSS tricks for item locks:** The predicate hooks into Sortable.js's `filter` option, so the drag is cancelled at the library level, not patched after the fact. This means `@item-moved` and `@move` are never called for disabled items — your backend stays safe without extra guards.
|
|
301
|
+
6. **Use `isDisabled` in the `#item` slot for visual feedback:** The slot prop is already computed for you — no need to call your predicate again inside the template.
|
|
302
|
+
7. **Never let cards vanish on regroup:** Provide `emptyColumnId` / `unmappedColumnId` (or rely on `includeOrphanColumns`) so null and stale group values stay visible.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Label } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :------ | :--------------------------- | :------ | :---------------------------- |
|
|
9
|
+
| `for` | `string` | — | ID of the target form element |
|
|
10
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg'` | `md` | Size of the label |
|
|
11
|
+
| `class` | `string` | — | Custom CSS class |
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<Label size="xs">Extra Small Label</Label>
|
|
17
|
+
<Label size="sm">Small Label</Label>
|
|
18
|
+
<Label size="md">Medium Label (Default)</Label>
|
|
19
|
+
<Label size="lg">Large Label</Label>
|
|
20
|
+
|
|
21
|
+
<div class="mt-4">
|
|
22
|
+
<Label for="email">Email Address</Label>
|
|
23
|
+
<Input id="email" />
|
|
24
|
+
</div>
|
|
25
|
+
```
|