-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: table grouping, provide table defaults, adjust examples
- Loading branch information
Showing
11 changed files
with
988 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { createApp } from 'vue'; | ||
import { createApp, ref } from 'vue'; | ||
import { createRui } from '../src'; | ||
import * as Icons from '../src/icons'; | ||
|
||
const RuiPlugin = createRui({ | ||
theme: { | ||
icons: Object.values(Icons), | ||
} | ||
}) | ||
}, | ||
defaults: { | ||
table: { | ||
itemsPerPage: ref(10), | ||
globalItemsPerPage: false, | ||
limits: [5, 10, 15, 25, 50, 100, 200], | ||
}, | ||
}, | ||
}); | ||
|
||
const app = createApp({ template: '<div />' }); | ||
app | ||
.use(RuiPlugin) | ||
.mount(null); | ||
app.use(RuiPlugin).mount(null); | ||
|
||
export const vueInstance = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,7 @@ const fixedColumns: DataTableColumn<BaseUser>[] = [ | |
{ | ||
key: 'name', | ||
label: 'Full name', | ||
sortable: true, | ||
}, | ||
{ | ||
key: 'username', | ||
|
@@ -164,7 +165,7 @@ const fixedRows: ExtendedUser[] = [ | |
{ | ||
id: 3, | ||
name: 'Clementine Bauch', | ||
username: 'Samantha', | ||
username: 'Kamren', | ||
email: '[email protected]', | ||
website: 'ramiro.info', | ||
'address.street': 'Douglas Extension', | ||
|
@@ -180,14 +181,50 @@ const fixedRows: ExtendedUser[] = [ | |
'address.city': 'Wisokyburgh', | ||
}, | ||
{ | ||
id: 9, | ||
id: 19, | ||
name: 'Glenna Reichert', | ||
username: 'Delphine', | ||
username: 'Kamren', | ||
email: '[email protected]', | ||
website: 'conrad.com', | ||
'address.street': 'Dayna Park', | ||
'address.city': 'Bartholomebury', | ||
}, | ||
{ | ||
id: 15, | ||
name: 'Chelsey Dietrich', | ||
username: 'Kamren', | ||
email: '[email protected]', | ||
website: 'demarco.info', | ||
'address.street': 'Skiles Walks', | ||
'address.city': 'Roscoeview', | ||
}, | ||
{ | ||
id: 110, | ||
name: 'Clementina DuBuque', | ||
username: 'Moriah.Stanton', | ||
email: '[email protected]', | ||
website: 'ambrose.net', | ||
'address.street': 'Kattie Turnpike', | ||
'address.city': 'Lebsackbury', | ||
}, | ||
{ | ||
id: 13, | ||
name: 'Clementine Bauch', | ||
username: 'Kamren', | ||
email: '[email protected]', | ||
website: 'ramiro.info', | ||
'address.street': 'Douglas Extension', | ||
'address.city': 'McKenziehaven', | ||
}, | ||
{ | ||
id: 12, | ||
name: 'Ervin Howell', | ||
username: 'Antonette', | ||
email: '[email protected]', | ||
website: 'anastasia.net', | ||
'address.street': 'Victor Plains', | ||
'address.city': 'Wisokyburgh', | ||
}, | ||
]; | ||
const emptyTables = ref< | ||
|
@@ -256,6 +293,8 @@ const emptyTables = ref< | |
pagination: { limit: 5, page: 1, total: 5 }, | ||
stickyHeader: true, | ||
stickyOffset: 72, | ||
group: ['username'], | ||
collapsed: [], | ||
}, | ||
}, | ||
]); | ||
|
@@ -305,6 +344,8 @@ const expandableTables = ref< | |
sort: [{ column: 'name', direction: 'asc' }], | ||
pagination: { limit: 5, page: 1, total: 5 }, | ||
expanded: [], | ||
stickyHeader: true, | ||
stickyOffset: 72, | ||
}, | ||
}, | ||
]); | ||
|
@@ -510,6 +551,8 @@ const apiDatatables = ref< | |
search: '', | ||
sort: { column: 'name', direction: 'asc' }, | ||
pagination: { limit: 5, page: 1, total: 0 }, | ||
group: ['username'], | ||
collapsed: [], | ||
}, | ||
}, | ||
{ | ||
|
@@ -733,8 +776,11 @@ const toggleRow = (row: any, expanded: any[] | undefined) => { | |
v-model="table.modelValue" | ||
v-model:pagination="table.pagination" | ||
v-model:sort="table.sort" | ||
v-model:group="table.group" | ||
v-model:collapsed="table.collapsed" | ||
:data-cy="`table-empty-${i}`" | ||
> | ||
<template #header.address.city> city custom header</template> | ||
<template #item.actions> | ||
<RuiButton icon variant="text" size="sm"> | ||
<RuiIcon name="more-fill" color="primary" /> | ||
|
@@ -877,6 +923,8 @@ const toggleRow = (row: any, expanded: any[] | undefined) => { | |
v-model="table.modelValue" | ||
v-model:pagination.external="table.pagination" | ||
v-model:sort.external="table.sort" | ||
v-model:group="table.group" | ||
v-model:collapsed="table.collapsed" | ||
:data-cy="`table-api-${i}`" | ||
@update:options="fetchData(i, $event, table.search, true)" | ||
> | ||
|
@@ -885,6 +933,9 @@ const toggleRow = (row: any, expanded: any[] | undefined) => { | |
<RuiIcon name="more-fill" color="primary" /> | ||
</RuiButton> | ||
</template> | ||
<template #group.header.content="{ groupValue }"> | ||
custom group content: {{ groupValue }} | ||
</template> | ||
</RuiDataTable> | ||
|
||
<!-- check types --> | ||
|
@@ -894,6 +945,9 @@ const toggleRow = (row: any, expanded: any[] | undefined) => { | |
<RuiIcon name="more-fill" color="primary" /> | ||
</RuiButton> | ||
</template> | ||
<template #group.header.content="{ groupValue }"> | ||
custom group content: {{ groupValue }} | ||
</template> | ||
</RuiDataTable> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.