nuxt-unified-ui 0.5.13 → 0.5.14
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.
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
const props = defineProps({
|
|
6
6
|
columns: Array,
|
|
7
|
+
ui: Object,
|
|
7
8
|
loading: Boolean,
|
|
8
9
|
data: Array,
|
|
9
10
|
hidePagination: Boolean,
|
|
10
11
|
totalItems: Number,
|
|
12
|
+
itemsPerPageItems: Array,
|
|
13
|
+
rowTo: Function,
|
|
14
|
+
stickyActions: Boolean,
|
|
11
15
|
actions: Array,
|
|
12
16
|
extraActions: Array,
|
|
13
|
-
stickyActions: Boolean,
|
|
14
|
-
ui: Object,
|
|
15
17
|
meta: Object,
|
|
16
18
|
});
|
|
17
19
|
|
|
@@ -66,8 +68,12 @@ const columnPinning = computed(() => {
|
|
|
66
68
|
|
|
67
69
|
const tableUi = computed(() => {
|
|
68
70
|
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
...(props.ui ?? {}),
|
|
72
|
+
tr: [
|
|
73
|
+
'data-[expanded=true]:bg-elevated!',
|
|
74
|
+
props.rowTo ? 'cursor-pointer' : '',
|
|
75
|
+
(props.ui ?? {}).tr,
|
|
76
|
+
].filter(Boolean).join(' '),
|
|
71
77
|
};
|
|
72
78
|
});
|
|
73
79
|
|
|
@@ -140,13 +146,20 @@ function getExtraActionItems(row) {
|
|
|
140
146
|
|
|
141
147
|
/* pagination */
|
|
142
148
|
|
|
143
|
-
const pageSizeItems =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
const pageSizeItems = computed(() => {
|
|
150
|
+
if (props.itemsPerPageItems?.length) {
|
|
151
|
+
return props.itemsPerPageItems;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return [
|
|
155
|
+
5,
|
|
156
|
+
10,
|
|
157
|
+
25,
|
|
158
|
+
50,
|
|
159
|
+
100,
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
150
163
|
|
|
151
164
|
</script>
|
|
152
165
|
|
package/package.json
CHANGED
|
@@ -523,7 +523,7 @@ Practical shortcuts:
|
|
|
523
523
|
- `u-button`: `variant` → `color` → `size` → `icon` → label/value → `block` → `disabled` → `loading-auto` → events
|
|
524
524
|
- `u-input` / `u-select*`: user-facing props (`:placeholder`, `:label`) → transient state (`:loading`, `:disabled`) → data source (`:items`) → `class` → `v-model` → events
|
|
525
525
|
- Action objects (`:actions`, `:append-actions`, table row actions): `vIf` → `actionType` → `color` → `icon` → `label` → `tooltip` → `warning` → `disabled` → `to` → `href` → `onClick` → `items`
|
|
526
|
-
- `un-table`: `:columns` → `class` / `:ui` → `:loading` → `:data` → `hide-pagination` → `:total-items` → `v-model:items-per-page` → `v-model:current-page` → `sticky-actions` → `:actions` → `:extra-actions` → `:meta` (omit unused). Full table rules → [tables.md](tables.md)
|
|
526
|
+
- `un-table`: `:columns` → `class` / `:ui` → `:loading` → `:data` → `hide-pagination` → `:total-items` → `:items-per-page-items` → `:row-to` → `v-model:items-per-page` → `v-model:current-page` → `sticky-actions` → `:actions` → `:extra-actions` → `:meta` (omit unused). Full table rules → [tables.md](tables.md)
|
|
527
527
|
- Tab / select item objects: `value` → `icon` → `label`
|
|
528
528
|
|
|
529
529
|
### Default attribute values (omit noise)
|
|
@@ -27,9 +27,11 @@ Do **not** add sort, filter, or selection props to `un-table`. Resource dashboar
|
|
|
27
27
|
| `actions` | Visible row buttons; adds the trailing `actions` column |
|
|
28
28
|
| `extraActions` | Overflow `u-dropdown-menu` (ellipsis); also creates the column |
|
|
29
29
|
| `stickyActions` | Pin the `actions` column to the right |
|
|
30
|
-
| `
|
|
30
|
+
| `rowTo` | Adds `cursor-pointer` on rows; parent still owns navigation |
|
|
31
|
+
| `ui` | Merged into `u-table` `:ui`. Default `tr` classes (`data-[expanded=true]:bg-elevated!`, plus `cursor-pointer` when `rowTo` is set) are prepended to `ui.tr` |
|
|
31
32
|
| `meta` | Passed through to `u-table` |
|
|
32
33
|
| `v-model:itemsPerPage` | Page size (default `'25'`; choices 5 / 10 / 25 / 50 / 100) |
|
|
34
|
+
| `itemsPerPageItems` | Overrides the page-size select options |
|
|
33
35
|
| `v-model:currentPage` | Page number (default `'1'`) |
|
|
34
36
|
|
|
35
37
|
The actions column is added when **either** `actions` or `extraActions` has length. `#actions-cell` is then owned by the wrapper — do not override it.
|
|
@@ -46,12 +48,14 @@ Omit unused props. When present, write them in this order:
|
|
|
46
48
|
4. `:data`
|
|
47
49
|
5. `hide-pagination`
|
|
48
50
|
6. `:total-items`
|
|
49
|
-
7.
|
|
50
|
-
8.
|
|
51
|
-
9. `
|
|
52
|
-
10.
|
|
53
|
-
11.
|
|
54
|
-
12. `:
|
|
51
|
+
7. `:items-per-page-items`
|
|
52
|
+
8. `:row-to`
|
|
53
|
+
9. `v-model:items-per-page`
|
|
54
|
+
10. `v-model:current-page`
|
|
55
|
+
11. `sticky-actions`
|
|
56
|
+
12. `:actions`
|
|
57
|
+
13. `:extra-actions`
|
|
58
|
+
14. `:meta`
|
|
55
59
|
|
|
56
60
|
Models are always **page size, then page**. Closing `>` sits on the same line as the last attribute.
|
|
57
61
|
|
|
@@ -281,6 +285,7 @@ const currentPage = ref(1);
|
|
|
281
285
|
```
|
|
282
286
|
|
|
283
287
|
- Layer default page size is `25` if the parent does not bind the model. Host pages often use `10` or `20` — set the ref explicitly.
|
|
288
|
+
- Page-size choices default to `5 / 10 / 25 / 50 / 100`. Pass `:items-per-page-items` to replace that list.
|
|
284
289
|
- Server lists: `skip = (currentPage - 1) * itemsPerPage`, `limit = itemsPerPage`, `total-items` from the `/count` endpoint.
|
|
285
290
|
- Client lists: pass `data` already sliced; `total-items` is the uncut length.
|
|
286
291
|
- Reset `currentPage` to `1` when page size, filters, or the resource path change.
|