Tracking de l'application VApp (IHM du jeu)

This commit is contained in:
2025-05-11 18:04:12 +02:00
commit 89e9db9b62
17763 changed files with 3718499 additions and 0 deletions

View File

@ -0,0 +1,134 @@
.v-data-table {
width: 100%;
}
.v-data-table__table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
}
.v-data-table__tr--focus {
border: 1px dotted black;
}
.v-data-table__tr--clickable {
cursor: pointer;
}
.v-data-table .v-table__wrapper > table > thead > tr > td.v-data-table-column--align-end,
.v-data-table .v-table__wrapper > table > thead > tr th.v-data-table-column--align-end,
.v-data-table .v-table__wrapper > table tbody > tr > td.v-data-table-column--align-end,
.v-data-table .v-table__wrapper > table tbody > tr th.v-data-table-column--align-end {
text-align: end;
}
.v-data-table .v-table__wrapper > table > thead > tr > td.v-data-table-column--align-end .v-data-table-header__content,
.v-data-table .v-table__wrapper > table > thead > tr th.v-data-table-column--align-end .v-data-table-header__content,
.v-data-table .v-table__wrapper > table tbody > tr > td.v-data-table-column--align-end .v-data-table-header__content,
.v-data-table .v-table__wrapper > table tbody > tr th.v-data-table-column--align-end .v-data-table-header__content {
flex-direction: row-reverse;
}
.v-data-table .v-table__wrapper > table > thead > tr > td.v-data-table-column--align-center,
.v-data-table .v-table__wrapper > table > thead > tr th.v-data-table-column--align-center,
.v-data-table .v-table__wrapper > table tbody > tr > td.v-data-table-column--align-center,
.v-data-table .v-table__wrapper > table tbody > tr th.v-data-table-column--align-center {
text-align: center;
}
.v-data-table .v-table__wrapper > table > thead > tr > td.v-data-table-column--align-center .v-data-table-header__content,
.v-data-table .v-table__wrapper > table > thead > tr th.v-data-table-column--align-center .v-data-table-header__content,
.v-data-table .v-table__wrapper > table tbody > tr > td.v-data-table-column--align-center .v-data-table-header__content,
.v-data-table .v-table__wrapper > table tbody > tr th.v-data-table-column--align-center .v-data-table-header__content {
justify-content: center;
}
.v-data-table .v-table__wrapper > table > thead > tr > td.v-data-table-column--no-padding,
.v-data-table .v-table__wrapper > table > thead > tr th.v-data-table-column--no-padding,
.v-data-table .v-table__wrapper > table tbody > tr > td.v-data-table-column--no-padding,
.v-data-table .v-table__wrapper > table tbody > tr th.v-data-table-column--no-padding {
padding: 0 8px;
}
.v-data-table .v-table__wrapper > table > thead > tr > th,
.v-data-table .v-table__wrapper > table tbody > tr > th {
align-items: center;
}
.v-data-table .v-table__wrapper > table > thead > tr > th.v-data-table__th--fixed,
.v-data-table .v-table__wrapper > table tbody > tr > th.v-data-table__th--fixed {
position: sticky;
}
.v-data-table .v-table__wrapper > table > thead > tr > th.v-data-table__th--sortable:hover,
.v-data-table .v-table__wrapper > table tbody > tr > th.v-data-table__th--sortable:hover {
cursor: pointer;
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity));
}
.v-data-table .v-table__wrapper > table > thead > tr > th:not(.v-data-table__th--sorted) .v-data-table-header__sort-icon,
.v-data-table .v-table__wrapper > table tbody > tr > th:not(.v-data-table__th--sorted) .v-data-table-header__sort-icon {
opacity: 0;
}
.v-data-table .v-table__wrapper > table > thead > tr > th:not(.v-data-table__th--sorted):hover .v-data-table-header__sort-icon,
.v-data-table .v-table__wrapper > table tbody > tr > th:not(.v-data-table__th--sorted):hover .v-data-table-header__sort-icon {
opacity: 0.5;
}
.v-data-table-column--fixed,
.v-data-table__th--sticky {
background: rgb(var(--v-theme-surface));
position: sticky !important;
left: 0;
z-index: 1;
}
.v-data-table-column--last-fixed {
border-right: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
}
.v-data-table.v-table--fixed-header > .v-table__wrapper > table > thead > tr > th.v-data-table-column--fixed {
z-index: 2;
}
.v-data-table-group-header-row td {
background: rgba(var(--v-theme-surface));
color: rgba(var(--v-theme-on-surface));
}
.v-data-table-group-header-row td > span {
padding-left: 5px;
}
.v-data-table--loading .v-data-table__td {
opacity: 0.3;
}
.v-data-table-group-header-row__column {
padding-left: calc(var(--v-data-table-group-header-row-depth) * 16px) !important;
}
.v-data-table-header__content {
display: flex;
align-items: center;
}
.v-data-table-header__sort-badge {
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 0.875rem;
padding: 4px;
border-radius: 50%;
background: rgba(var(--v-border-color), var(--v-border-opacity));
min-width: 20px;
min-height: 20px;
width: 20px;
height: 20px;
}
.v-data-table-progress > th {
border: none !important;
height: auto !important;
padding: 0 !important;
}
.v-data-table-progress__loader {
position: relative;
}
.v-data-table-rows-loading,
.v-data-table-rows-no-data {
text-align: center;
}

View File

@ -0,0 +1,214 @@
import { mergeProps as _mergeProps, createVNode as _createVNode, resolveDirective as _resolveDirective, Fragment as _Fragment } from "vue";
// Styles
import "./VDataTable.css";
// Components
import { makeVDataTableFooterProps, VDataTableFooter } from "./VDataTableFooter.mjs";
import { makeVDataTableHeadersProps, VDataTableHeaders } from "./VDataTableHeaders.mjs";
import { makeVDataTableRowsProps, VDataTableRows } from "./VDataTableRows.mjs";
import { VDivider } from "../VDivider/index.mjs";
import { makeVTableProps, VTable } from "../VTable/VTable.mjs"; // Composables
import { makeDataTableExpandProps, provideExpanded } from "./composables/expand.mjs";
import { createGroupBy, makeDataTableGroupProps, provideGroupBy, useGroupedItems } from "./composables/group.mjs";
import { createHeaders, makeDataTableHeaderProps } from "./composables/headers.mjs";
import { makeDataTableItemsProps, useDataTableItems } from "./composables/items.mjs";
import { useOptions } from "./composables/options.mjs";
import { createPagination, makeDataTablePaginateProps, providePagination, usePaginatedItems } from "./composables/paginate.mjs";
import { makeDataTableSelectProps, provideSelection } from "./composables/select.mjs";
import { createSort, makeDataTableSortProps, provideSort, useSortedItems } from "./composables/sort.mjs";
import { provideDefaults } from "../../composables/defaults.mjs";
import { makeFilterProps, useFilter } from "../../composables/filter.mjs"; // Utilities
import { computed, toRef } from 'vue';
import { genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeDataTableProps = propsFactory({
...makeVDataTableRowsProps(),
width: [String, Number],
search: String,
...makeDataTableExpandProps(),
...makeDataTableGroupProps(),
...makeDataTableHeaderProps(),
...makeDataTableItemsProps(),
...makeDataTableSelectProps(),
...makeDataTableSortProps(),
...makeVDataTableHeadersProps(),
...makeVTableProps()
}, 'DataTable');
export const makeVDataTableProps = propsFactory({
...makeDataTablePaginateProps(),
...makeDataTableProps(),
...makeFilterProps(),
...makeVDataTableFooterProps()
}, 'VDataTable');
export const VDataTable = genericComponent()({
name: 'VDataTable',
props: makeVDataTableProps(),
emits: {
'update:modelValue': value => true,
'update:page': value => true,
'update:itemsPerPage': value => true,
'update:sortBy': value => true,
'update:options': value => true,
'update:groupBy': value => true,
'update:expanded': value => true,
'update:currentItems': value => true
},
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const {
groupBy
} = createGroupBy(props);
const {
sortBy,
multiSort,
mustSort
} = createSort(props);
const {
page,
itemsPerPage
} = createPagination(props);
const {
columns,
headers,
sortFunctions,
sortRawFunctions,
filterFunctions
} = createHeaders(props, {
groupBy,
showSelect: toRef(props, 'showSelect'),
showExpand: toRef(props, 'showExpand')
});
const {
items
} = useDataTableItems(props, columns);
const search = toRef(props, 'search');
const {
filteredItems
} = useFilter(props, items, search, {
transform: item => item.columns,
customKeyFilter: filterFunctions
});
const {
toggleSort
} = provideSort({
sortBy,
multiSort,
mustSort,
page
});
const {
sortByWithGroups,
opened,
extractRows,
isGroupOpen,
toggleGroup
} = provideGroupBy({
groupBy,
sortBy
});
const {
sortedItems
} = useSortedItems(props, filteredItems, sortByWithGroups, sortFunctions, sortRawFunctions);
const {
flatItems
} = useGroupedItems(sortedItems, groupBy, opened);
const itemsLength = computed(() => flatItems.value.length);
const {
startIndex,
stopIndex,
pageCount,
setItemsPerPage
} = providePagination({
page,
itemsPerPage,
itemsLength
});
const {
paginatedItems
} = usePaginatedItems({
items: flatItems,
startIndex,
stopIndex,
itemsPerPage
});
const paginatedItemsWithoutGroups = computed(() => extractRows(paginatedItems.value));
const {
isSelected,
select,
selectAll,
toggleSelect,
someSelected,
allSelected
} = provideSelection(props, {
allItems: items,
currentPage: paginatedItemsWithoutGroups
});
const {
isExpanded,
toggleExpand
} = provideExpanded(props);
useOptions({
page,
itemsPerPage,
sortBy,
groupBy,
search
});
provideDefaults({
VDataTableRows: {
hideNoData: toRef(props, 'hideNoData'),
noDataText: toRef(props, 'noDataText'),
loading: toRef(props, 'loading'),
loadingText: toRef(props, 'loadingText')
}
});
const slotProps = computed(() => ({
page: page.value,
itemsPerPage: itemsPerPage.value,
sortBy: sortBy.value,
pageCount: pageCount.value,
toggleSort,
setItemsPerPage,
someSelected: someSelected.value,
allSelected: allSelected.value,
isSelected,
select,
selectAll,
toggleSelect,
isExpanded,
toggleExpand,
isGroupOpen,
toggleGroup,
items: paginatedItemsWithoutGroups.value.map(item => item.raw),
internalItems: paginatedItemsWithoutGroups.value,
groupedItems: paginatedItems.value,
columns: columns.value,
headers: headers.value
}));
useRender(() => {
const dataTableFooterProps = VDataTableFooter.filterProps(props);
const dataTableHeadersProps = VDataTableHeaders.filterProps(props);
const dataTableRowsProps = VDataTableRows.filterProps(props);
const tableProps = VTable.filterProps(props);
return _createVNode(VTable, _mergeProps({
"class": ['v-data-table', {
'v-data-table--show-select': props.showSelect,
'v-data-table--loading': props.loading
}, props.class],
"style": props.style
}, tableProps), {
top: () => slots.top?.(slotProps.value),
default: () => slots.default ? slots.default(slotProps.value) : _createVNode(_Fragment, null, [slots.colgroup?.(slotProps.value), _createVNode("thead", null, [_createVNode(VDataTableHeaders, dataTableHeadersProps, slots)]), slots.thead?.(slotProps.value), _createVNode("tbody", null, [slots['body.prepend']?.(slotProps.value), slots.body ? slots.body(slotProps.value) : _createVNode(VDataTableRows, _mergeProps(attrs, dataTableRowsProps, {
"items": paginatedItems.value
}), slots), slots['body.append']?.(slotProps.value)]), slots.tbody?.(slotProps.value), slots.tfoot?.(slotProps.value)]),
bottom: () => slots.bottom ? slots.bottom(slotProps.value) : _createVNode(_Fragment, null, [_createVNode(VDivider, null, null), _createVNode(VDataTableFooter, dataTableFooterProps, {
prepend: slots['footer.prepend']
})])
});
});
return {};
}
});
//# sourceMappingURL=VDataTable.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,119 @@
@use '../../styles/settings'
@use '../../styles/tools'
@use '../../components/VTable/variables' as *
@use './variables' as *
.v-data-table
width: 100%
.v-data-table__table
width: 100%
border-collapse: separate
border-spacing: 0
.v-data-table__tr
&--focus
border: 1px dotted black
&--clickable
cursor: pointer
.v-data-table
.v-table__wrapper
> table
> thead,
tbody
> tr
> td,
th
&.v-data-table-column--align-end
text-align: end
.v-data-table-header__content
flex-direction: row-reverse
&.v-data-table-column--align-center
text-align: center
.v-data-table-header__content
justify-content: center
&.v-data-table-column--no-padding
padding: 0 8px
> th
align-items: center
> th.v-data-table__th--fixed
position: sticky
> th.v-data-table__th--sortable:hover
cursor: pointer
color: rgba(var(--v-theme-on-surface), var(--v-high-emphasis-opacity))
> th:not(.v-data-table__th--sorted)
.v-data-table-header__sort-icon
opacity: 0
&:hover
.v-data-table-header__sort-icon
opacity: 0.5
.v-data-table-column--fixed,
.v-data-table__th--sticky
background: $table-background
position: sticky !important
left: 0
z-index: 1
.v-data-table-column--last-fixed
border-right: 1px solid rgba(var(--v-border-color), var(--v-border-opacity))
.v-data-table.v-table--fixed-header > .v-table__wrapper > table > thead > tr > th.v-data-table-column--fixed
z-index: 2
.v-data-table-group-header-row
td
background: rgba(var(--v-theme-surface))
color: rgba(var(--v-theme-on-surface))
> span
padding-left: 5px
.v-data-table--loading
.v-data-table__td
opacity: 0.3
.v-data-table-group-header-row__column
padding-left: calc(var(--v-data-table-group-header-row-depth) * 16px) !important
.v-data-table-header__content
display: flex
align-items: center
.v-data-table-header__sort-badge
display: inline-flex
justify-content: center
align-items: center
font-size: 0.875rem
padding: 4px
border-radius: 50%
background: $data-table-header-sort-badge-color
min-width: $data-table-header-sort-badge-size
min-height: $data-table-header-sort-badge-size
width: $data-table-header-sort-badge-size
height: $data-table-header-sort-badge-size
.v-data-table-progress
> th
border: none !important
height: auto !important
padding: 0 !important
.v-data-table-progress__loader
position: relative
.v-data-table-rows-loading,
.v-data-table-rows-no-data
text-align: center

View File

@ -0,0 +1,36 @@
import { createVNode as _createVNode } from "vue";
// Utilities
import { convertToUnit, defineFunctionalComponent } from "../../util/index.mjs"; // Types
export const VDataTableColumn = defineFunctionalComponent({
align: {
type: String,
default: 'start'
},
fixed: Boolean,
fixedOffset: [Number, String],
height: [Number, String],
lastFixed: Boolean,
noPadding: Boolean,
tag: String,
width: [Number, String]
}, (props, _ref) => {
let {
slots
} = _ref;
const Tag = props.tag ?? 'td';
return _createVNode(Tag, {
"class": ['v-data-table__td', {
'v-data-table-column--fixed': props.fixed,
'v-data-table-column--last-fixed': props.lastFixed,
'v-data-table-column--no-padding': props.noPadding
}, `v-data-table-column--align-${props.align}`],
"style": {
height: convertToUnit(props.height),
width: convertToUnit(props.width),
left: convertToUnit(props.fixedOffset || null)
}
}, {
default: () => [slots.default?.()]
});
});
//# sourceMappingURL=VDataTableColumn.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"VDataTableColumn.mjs","names":["convertToUnit","defineFunctionalComponent","VDataTableColumn","align","type","String","default","fixed","Boolean","fixedOffset","Number","height","lastFixed","noPadding","tag","width","props","_ref","slots","Tag","_createVNode","left"],"sources":["../../../src/components/VDataTable/VDataTableColumn.tsx"],"sourcesContent":["// Utilities\nimport { convertToUnit, defineFunctionalComponent } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\n\nexport const VDataTableColumn = defineFunctionalComponent({\n align: {\n type: String as PropType<'start' | 'center' | 'end'>,\n default: 'start',\n },\n fixed: Boolean,\n fixedOffset: [Number, String],\n height: [Number, String],\n lastFixed: Boolean,\n noPadding: Boolean,\n tag: String,\n width: [Number, String],\n}, (props, { slots }) => {\n const Tag = props.tag ?? 'td'\n return (\n <Tag\n class={[\n 'v-data-table__td',\n {\n 'v-data-table-column--fixed': props.fixed,\n 'v-data-table-column--last-fixed': props.lastFixed,\n 'v-data-table-column--no-padding': props.noPadding,\n },\n `v-data-table-column--align-${props.align}`,\n ]}\n style={{\n height: convertToUnit(props.height),\n width: convertToUnit(props.width),\n left: convertToUnit(props.fixedOffset || null),\n }}\n >\n { slots.default?.() }\n </Tag>\n )\n})\n"],"mappings":";AAAA;AAAA,SACSA,aAAa,EAAEC,yBAAyB,gCAEjD;AAGA,OAAO,MAAMC,gBAAgB,GAAGD,yBAAyB,CAAC;EACxDE,KAAK,EAAE;IACLC,IAAI,EAAEC,MAA8C;IACpDC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEC,OAAO;EACdC,WAAW,EAAE,CAACC,MAAM,EAAEL,MAAM,CAAC;EAC7BM,MAAM,EAAE,CAACD,MAAM,EAAEL,MAAM,CAAC;EACxBO,SAAS,EAAEJ,OAAO;EAClBK,SAAS,EAAEL,OAAO;EAClBM,GAAG,EAAET,MAAM;EACXU,KAAK,EAAE,CAACL,MAAM,EAAEL,MAAM;AACxB,CAAC,EAAE,CAACW,KAAK,EAAAC,IAAA,KAAgB;EAAA,IAAd;IAAEC;EAAM,CAAC,GAAAD,IAAA;EAClB,MAAME,GAAG,GAAGH,KAAK,CAACF,GAAG,IAAI,IAAI;EAC7B,OAAAM,YAAA,CAAAD,GAAA;IAAA,SAEW,CACL,kBAAkB,EAClB;MACE,4BAA4B,EAAEH,KAAK,CAACT,KAAK;MACzC,iCAAiC,EAAES,KAAK,CAACJ,SAAS;MAClD,iCAAiC,EAAEI,KAAK,CAACH;IAC3C,CAAC,EACA,8BAA6BG,KAAK,CAACb,KAAM,EAAC,CAC5C;IAAA,SACM;MACLQ,MAAM,EAAEX,aAAa,CAACgB,KAAK,CAACL,MAAM,CAAC;MACnCI,KAAK,EAAEf,aAAa,CAACgB,KAAK,CAACD,KAAK,CAAC;MACjCM,IAAI,EAAErB,aAAa,CAACgB,KAAK,CAACP,WAAW,IAAI,IAAI;IAC/C;EAAC;IAAAH,OAAA,EAAAA,CAAA,MAECY,KAAK,CAACZ,OAAO,GAAG,CAAC;EAAA;AAGzB,CAAC,CAAC"}

View File

@ -0,0 +1,36 @@
.v-data-table-footer {
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 4px;
justify-content: flex-end;
}
.v-data-table-footer__items-per-page {
display: flex;
align-items: center;
justify-content: center;
}
.v-data-table-footer__items-per-page > span {
padding-inline-end: 8px;
}
.v-data-table-footer__items-per-page > .v-select {
width: 90px;
}
.v-data-table-footer__info {
display: flex;
justify-content: flex-end;
min-width: 116px;
padding: 0 16px;
}
.v-data-table-footer__pagination {
display: flex;
align-items: center;
margin-inline-start: 16px;
}
.v-data-table-footer__page {
padding: 0 8px;
}

View File

@ -0,0 +1,140 @@
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
// Styles
import "./VDataTableFooter.css";
// Components
import { VPagination } from "../VPagination/index.mjs";
import { VSelect } from "../VSelect/index.mjs"; // Composables
import { usePagination } from "./composables/paginate.mjs";
import { useLocale } from "../../composables/locale.mjs"; // Utilities
import { computed } from 'vue';
import { genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableFooterProps = propsFactory({
prevIcon: {
type: String,
default: '$prev'
},
nextIcon: {
type: String,
default: '$next'
},
firstIcon: {
type: String,
default: '$first'
},
lastIcon: {
type: String,
default: '$last'
},
itemsPerPageText: {
type: String,
default: '$vuetify.dataFooter.itemsPerPageText'
},
pageText: {
type: String,
default: '$vuetify.dataFooter.pageText'
},
firstPageLabel: {
type: String,
default: '$vuetify.dataFooter.firstPage'
},
prevPageLabel: {
type: String,
default: '$vuetify.dataFooter.prevPage'
},
nextPageLabel: {
type: String,
default: '$vuetify.dataFooter.nextPage'
},
lastPageLabel: {
type: String,
default: '$vuetify.dataFooter.lastPage'
},
itemsPerPageOptions: {
type: Array,
default: () => [{
value: 10,
title: '10'
}, {
value: 25,
title: '25'
}, {
value: 50,
title: '50'
}, {
value: 100,
title: '100'
}, {
value: -1,
title: '$vuetify.dataFooter.itemsPerPageAll'
}]
},
showCurrentPage: Boolean
}, 'VDataTableFooter');
export const VDataTableFooter = genericComponent()({
name: 'VDataTableFooter',
props: makeVDataTableFooterProps(),
setup(props, _ref) {
let {
slots
} = _ref;
const {
t
} = useLocale();
const {
page,
pageCount,
startIndex,
stopIndex,
itemsLength,
itemsPerPage,
setItemsPerPage
} = usePagination();
const itemsPerPageOptions = computed(() => props.itemsPerPageOptions.map(option => {
if (typeof option === 'number') {
return {
value: option,
title: option === -1 ? t('$vuetify.dataFooter.itemsPerPageAll') : String(option)
};
}
return {
...option,
title: t(option.title)
};
}));
useRender(() => {
const paginationProps = VPagination.filterProps(props);
return _createVNode("div", {
"class": "v-data-table-footer"
}, [slots.prepend?.(), _createVNode("div", {
"class": "v-data-table-footer__items-per-page"
}, [_createVNode("span", null, [t(props.itemsPerPageText)]), _createVNode(VSelect, {
"items": itemsPerPageOptions.value,
"modelValue": itemsPerPage.value,
"onUpdate:modelValue": v => setItemsPerPage(Number(v)),
"density": "compact",
"variant": "outlined",
"hide-details": true
}, null)]), _createVNode("div", {
"class": "v-data-table-footer__info"
}, [_createVNode("div", null, [t(props.pageText, !itemsLength.value ? 0 : startIndex.value + 1, stopIndex.value, itemsLength.value)])]), _createVNode("div", {
"class": "v-data-table-footer__pagination"
}, [_createVNode(VPagination, _mergeProps({
"modelValue": page.value,
"onUpdate:modelValue": $event => page.value = $event,
"density": "comfortable",
"first-aria-label": props.firstPageLabel,
"last-aria-label": props.lastPageLabel,
"length": pageCount.value,
"next-aria-label": props.nextPageLabel,
"previous-aria-label": props.prevPageLabel,
"rounded": true,
"show-first-last-page": true,
"total-visible": props.showCurrentPage ? 1 : 0,
"variant": "plain"
}, paginationProps), null)])]);
});
return {};
}
});
//# sourceMappingURL=VDataTableFooter.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,35 @@
@forward './variables'
@use '../../styles/tools'
@use './variables' as *
.v-data-table-footer
display: flex
align-items: center
flex-wrap: wrap
padding: $data-table-footer-padding
justify-content: flex-end
.v-data-table-footer__items-per-page
display: flex
align-items: center
justify-content: center
> span
padding-inline-end: $data-table-footer-items-per-page-padding
> .v-select
width: $data-table-footer-select-width
.v-data-table-footer__info
display: flex
justify-content: flex-end
min-width: $data-table-footer-info-min-width
padding: $data-table-footer-info-padding
.v-data-table-footer__pagination
display: flex
align-items: center
margin-inline-start: $data-table-footer-pagination-margin-inline-start
.v-data-table-footer__page
padding: 0 8px

View File

@ -0,0 +1,87 @@
import { createTextVNode as _createTextVNode, createVNode as _createVNode } from "vue";
// Components
import { VDataTableColumn } from "./VDataTableColumn.mjs";
import { VBtn } from "../VBtn/index.mjs";
import { VCheckboxBtn } from "../VCheckbox/index.mjs"; // Composables
import { useGroupBy } from "./composables/group.mjs";
import { useHeaders } from "./composables/headers.mjs";
import { useSelection } from "./composables/select.mjs"; // Utilities
import { computed } from 'vue';
import { genericComponent, propsFactory } from "../../util/index.mjs"; // Types
export const makeVDataTableGroupHeaderRowProps = propsFactory({
item: {
type: Object,
required: true
}
}, 'VDataTableGroupHeaderRow');
export const VDataTableGroupHeaderRow = genericComponent()({
name: 'VDataTableGroupHeaderRow',
props: makeVDataTableGroupHeaderRowProps(),
setup(props, _ref) {
let {
slots
} = _ref;
const {
isGroupOpen,
toggleGroup,
extractRows
} = useGroupBy();
const {
isSelected,
isSomeSelected,
select
} = useSelection();
const {
columns
} = useHeaders();
const rows = computed(() => {
return extractRows([props.item]);
});
return () => _createVNode("tr", {
"class": "v-data-table-group-header-row",
"style": {
'--v-data-table-group-header-row-depth': props.item.depth
}
}, [columns.value.map(column => {
if (column.key === 'data-table-group') {
const icon = isGroupOpen(props.item) ? '$expand' : '$next';
const onClick = () => toggleGroup(props.item);
return slots['data-table-group']?.({
item: props.item,
count: rows.value.length,
props: {
icon,
onClick
}
}) ?? _createVNode(VDataTableColumn, {
"class": "v-data-table-group-header-row__column"
}, {
default: () => [_createVNode(VBtn, {
"size": "small",
"variant": "text",
"icon": icon,
"onClick": onClick
}, null), _createVNode("span", null, [props.item.value]), _createVNode("span", null, [_createTextVNode("("), rows.value.length, _createTextVNode(")")])]
});
}
if (column.key === 'data-table-select') {
const modelValue = isSelected(rows.value);
const indeterminate = isSomeSelected(rows.value) && !modelValue;
const selectGroup = v => select(rows.value, v);
return slots['data-table-select']?.({
props: {
modelValue,
indeterminate,
'onUpdate:modelValue': selectGroup
}
}) ?? _createVNode("td", null, [_createVNode(VCheckboxBtn, {
"modelValue": modelValue,
"indeterminate": indeterminate,
"onUpdate:modelValue": selectGroup
}, null)]);
}
return _createVNode("td", null, null);
})]);
}
});
//# sourceMappingURL=VDataTableGroupHeaderRow.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,168 @@
import { resolveDirective as _resolveDirective, Fragment as _Fragment, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
// Components
import { VDataTableColumn } from "./VDataTableColumn.mjs";
import { VCheckboxBtn } from "../VCheckbox/index.mjs";
import { VIcon } from "../VIcon/index.mjs"; // Composables
import { useHeaders } from "./composables/headers.mjs";
import { useSelection } from "./composables/select.mjs";
import { useSort } from "./composables/sort.mjs";
import { useBackgroundColor } from "../../composables/color.mjs";
import { IconValue } from "../../composables/icons.mjs";
import { LoaderSlot, makeLoaderProps, useLoader } from "../../composables/loader.mjs"; // Utilities
import { computed, mergeProps } from 'vue';
import { convertToUnit, genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableHeadersProps = propsFactory({
color: String,
sticky: Boolean,
multiSort: Boolean,
sortAscIcon: {
type: IconValue,
default: '$sortAsc'
},
sortDescIcon: {
type: IconValue,
default: '$sortDesc'
},
headerProps: {
type: Object
},
...makeLoaderProps()
}, 'VDataTableHeaders');
export const VDataTableHeaders = genericComponent()({
name: 'VDataTableHeaders',
props: makeVDataTableHeadersProps(),
setup(props, _ref) {
let {
slots
} = _ref;
const {
toggleSort,
sortBy,
isSorted
} = useSort();
const {
someSelected,
allSelected,
selectAll,
showSelectAll
} = useSelection();
const {
columns,
headers
} = useHeaders();
const {
loaderClasses
} = useLoader(props);
function getFixedStyles(column, y) {
if (!props.sticky && !column.fixed) return undefined;
return {
position: 'sticky',
left: column.fixed ? convertToUnit(column.fixedOffset) : undefined,
top: props.sticky ? `calc(var(--v-table-header-height) * ${y})` : undefined
};
}
function getSortIcon(column) {
const item = sortBy.value.find(item => item.key === column.key);
if (!item) return props.sortAscIcon;
return item.order === 'asc' ? props.sortAscIcon : props.sortDescIcon;
}
const {
backgroundColorClasses,
backgroundColorStyles
} = useBackgroundColor(props, 'color');
const slotProps = computed(() => ({
headers: headers.value,
columns: columns.value,
toggleSort,
isSorted,
sortBy: sortBy.value,
someSelected: someSelected.value,
allSelected: allSelected.value,
selectAll,
getSortIcon
}));
const VDataTableHeaderCell = _ref2 => {
let {
column,
x,
y
} = _ref2;
const noPadding = column.key === 'data-table-select' || column.key === 'data-table-expand';
const headerProps = mergeProps(props.headerProps ?? {}, column.headerProps ?? {});
return _createVNode(VDataTableColumn, _mergeProps({
"tag": "th",
"align": column.align,
"class": ['v-data-table__th', {
'v-data-table__th--sortable': column.sortable,
'v-data-table__th--sorted': isSorted(column),
'v-data-table__th--fixed': column.fixed,
'v-data-table__th--sticky': props.sticky
}, loaderClasses.value],
"style": {
width: convertToUnit(column.width),
minWidth: convertToUnit(column.minWidth),
...getFixedStyles(column, y)
},
"colspan": column.colspan,
"rowspan": column.rowspan,
"onClick": column.sortable ? () => toggleSort(column) : undefined,
"fixed": column.fixed,
"lastFixed": column.lastFixed,
"noPadding": noPadding
}, headerProps), {
default: () => {
const columnSlotName = `header.${column.key}`;
const columnSlotProps = {
column,
selectAll,
isSorted,
toggleSort,
sortBy: sortBy.value,
someSelected: someSelected.value,
allSelected: allSelected.value,
getSortIcon
};
if (slots[columnSlotName]) return slots[columnSlotName](columnSlotProps);
if (column.key === 'data-table-select') {
return slots['header.data-table-select']?.(columnSlotProps) ?? (showSelectAll && _createVNode(VCheckboxBtn, {
"modelValue": allSelected.value,
"indeterminate": someSelected.value && !allSelected.value,
"onUpdate:modelValue": selectAll
}, null));
}
return _createVNode("div", {
"class": "v-data-table-header__content"
}, [_createVNode("span", null, [column.title]), column.sortable && _createVNode(VIcon, {
"key": "icon",
"class": "v-data-table-header__sort-icon",
"icon": getSortIcon(column)
}, null), props.multiSort && isSorted(column) && _createVNode("div", {
"key": "badge",
"class": ['v-data-table-header__sort-badge', ...backgroundColorClasses.value],
"style": backgroundColorStyles.value
}, [sortBy.value.findIndex(x => x.key === column.key) + 1])]);
}
});
};
useRender(() => {
return _createVNode(_Fragment, null, [slots.headers ? slots.headers(slotProps.value) : headers.value.map((row, y) => _createVNode("tr", null, [row.map((column, x) => _createVNode(VDataTableHeaderCell, {
"column": column,
"x": x,
"y": y
}, null))])), props.loading && _createVNode("tr", {
"class": "v-data-table-progress"
}, [_createVNode("th", {
"colspan": columns.value.length
}, [_createVNode(LoaderSlot, {
"name": "v-data-table-progress",
"absolute": true,
"active": true,
"color": typeof props.loading === 'boolean' ? undefined : props.loading,
"indeterminate": true
}, {
default: slots.loader
})])])]);
});
}
});
//# sourceMappingURL=VDataTableHeaders.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,102 @@
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
// Components
import { VBtn } from "../VBtn/index.mjs";
import { VCheckboxBtn } from "../VCheckbox/index.mjs"; // Composables
import { useExpanded } from "./composables/expand.mjs";
import { useHeaders } from "./composables/headers.mjs";
import { useSelection } from "./composables/select.mjs";
import { VDataTableColumn } from "./VDataTableColumn.mjs"; // Utilities
import { toDisplayString, withModifiers } from 'vue';
import { EventProp, genericComponent, getObjectValueByPath, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableRowProps = propsFactory({
index: Number,
item: Object,
cellProps: [Object, Function],
onClick: EventProp(),
onContextmenu: EventProp(),
onDblclick: EventProp()
}, 'VDataTableRow');
export const VDataTableRow = genericComponent()({
name: 'VDataTableRow',
props: makeVDataTableRowProps(),
setup(props, _ref) {
let {
slots
} = _ref;
const {
isSelected,
toggleSelect
} = useSelection();
const {
isExpanded,
toggleExpand
} = useExpanded();
const {
columns
} = useHeaders();
useRender(() => _createVNode("tr", {
"class": ['v-data-table__tr', {
'v-data-table__tr--clickable': !!(props.onClick || props.onContextmenu || props.onDblclick)
}],
"onClick": props.onClick,
"onContextmenu": props.onContextmenu,
"onDblclick": props.onDblclick
}, [props.item && columns.value.map((column, i) => {
const item = props.item;
const slotName = `item.${column.key}`;
const slotProps = {
index: props.index,
item: item.raw,
internalItem: item,
value: getObjectValueByPath(item.columns, column.key),
column,
isSelected,
toggleSelect,
isExpanded,
toggleExpand
};
const cellProps = typeof props.cellProps === 'function' ? props.cellProps({
index: slotProps.index,
item: slotProps.item,
internalItem: slotProps.internalItem,
value: slotProps.value,
column
}) : props.cellProps;
const columnCellProps = typeof column.cellProps === 'function' ? column.cellProps({
index: slotProps.index,
item: slotProps.item,
internalItem: slotProps.internalItem,
value: slotProps.value
}) : column.cellProps;
return _createVNode(VDataTableColumn, _mergeProps({
"align": column.align,
"fixed": column.fixed,
"fixedOffset": column.fixedOffset,
"lastFixed": column.lastFixed,
"noPadding": column.key === 'data-table-select' || column.key === 'data-table-expand',
"width": column.width
}, cellProps, columnCellProps), {
default: () => {
if (slots[slotName]) return slots[slotName](slotProps);
if (column.key === 'data-table-select') {
return slots['item.data-table-select']?.(slotProps) ?? _createVNode(VCheckboxBtn, {
"disabled": !item.selectable,
"modelValue": isSelected([item]),
"onClick": withModifiers(() => toggleSelect(item), ['stop'])
}, null);
}
if (column.key === 'data-table-expand') {
return slots['item.data-table-expand']?.(slotProps) ?? _createVNode(VBtn, {
"icon": isExpanded(item) ? '$collapse' : '$expand',
"size": "small",
"variant": "text",
"onClick": withModifiers(() => toggleExpand(item), ['stop'])
}, null);
}
return toDisplayString(slotProps.value);
}
});
})]));
}
});
//# sourceMappingURL=VDataTableRow.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,127 @@
import { mergeProps as _mergeProps, resolveDirective as _resolveDirective, Fragment as _Fragment, createVNode as _createVNode } from "vue";
// Components
import { VDataTableGroupHeaderRow } from "./VDataTableGroupHeaderRow.mjs";
import { VDataTableRow } from "./VDataTableRow.mjs"; // Composables
import { useExpanded } from "./composables/expand.mjs";
import { useGroupBy } from "./composables/group.mjs";
import { useHeaders } from "./composables/headers.mjs";
import { useSelection } from "./composables/select.mjs";
import { useLocale } from "../../composables/locale.mjs"; // Utilities
import { Fragment, mergeProps } from 'vue';
import { genericComponent, getPrefixedEventHandlers, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableRowsProps = propsFactory({
loading: [Boolean, String],
loadingText: {
type: String,
default: '$vuetify.dataIterator.loadingText'
},
hideNoData: Boolean,
items: {
type: Array,
default: () => []
},
noDataText: {
type: String,
default: '$vuetify.noDataText'
},
rowProps: [Object, Function],
cellProps: [Object, Function]
}, 'VDataTableRows');
export const VDataTableRows = genericComponent()({
name: 'VDataTableRows',
inheritAttrs: false,
props: makeVDataTableRowsProps(),
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const {
columns
} = useHeaders();
const {
expandOnClick,
toggleExpand,
isExpanded
} = useExpanded();
const {
isSelected,
toggleSelect
} = useSelection();
const {
toggleGroup,
isGroupOpen
} = useGroupBy();
const {
t
} = useLocale();
useRender(() => {
if (props.loading && (!props.items.length || slots.loading)) {
return _createVNode("tr", {
"class": "v-data-table-rows-loading",
"key": "loading"
}, [_createVNode("td", {
"colspan": columns.value.length
}, [slots.loading?.() ?? t(props.loadingText)])]);
}
if (!props.loading && !props.items.length && !props.hideNoData) {
return _createVNode("tr", {
"class": "v-data-table-rows-no-data",
"key": "no-data"
}, [_createVNode("td", {
"colspan": columns.value.length
}, [slots['no-data']?.() ?? t(props.noDataText)])]);
}
return _createVNode(_Fragment, null, [props.items.map((item, index) => {
if (item.type === 'group') {
const slotProps = {
index,
item,
columns: columns.value,
isExpanded,
toggleExpand,
isSelected,
toggleSelect,
toggleGroup,
isGroupOpen
};
return slots['group-header'] ? slots['group-header'](slotProps) : _createVNode(VDataTableGroupHeaderRow, _mergeProps({
"key": `group-header_${item.id}`,
"item": item
}, getPrefixedEventHandlers(attrs, ':group-header', () => slotProps)), slots);
}
const slotProps = {
index,
item: item.raw,
internalItem: item,
columns: columns.value,
isExpanded,
toggleExpand,
isSelected,
toggleSelect
};
const itemSlotProps = {
...slotProps,
props: mergeProps({
key: `item_${item.key ?? item.index}`,
onClick: expandOnClick.value ? () => {
toggleExpand(item);
} : undefined,
index,
item,
cellProps: props.cellProps
}, getPrefixedEventHandlers(attrs, ':row', () => slotProps), typeof props.rowProps === 'function' ? props.rowProps({
item: slotProps.item,
index: slotProps.index,
internalItem: slotProps.internalItem
}) : props.rowProps)
};
return _createVNode(_Fragment, {
"key": itemSlotProps.props.key
}, [slots.item ? slots.item(itemSlotProps) : _createVNode(VDataTableRow, itemSlotProps.props, slots), isExpanded(item) && slots['expanded-row']?.(slotProps)]);
})]);
});
return {};
}
});
//# sourceMappingURL=VDataTableRows.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,185 @@
import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective, Fragment as _Fragment } from "vue";
// Components
import { makeDataTableProps } from "./VDataTable.mjs";
import { makeVDataTableFooterProps, VDataTableFooter } from "./VDataTableFooter.mjs";
import { VDataTableHeaders } from "./VDataTableHeaders.mjs";
import { VDataTableRows } from "./VDataTableRows.mjs";
import { VTable } from "../VTable/index.mjs"; // Composables
import { provideExpanded } from "./composables/expand.mjs";
import { createGroupBy, provideGroupBy, useGroupedItems } from "./composables/group.mjs";
import { createHeaders } from "./composables/headers.mjs";
import { useDataTableItems } from "./composables/items.mjs";
import { useOptions } from "./composables/options.mjs";
import { createPagination, makeDataTablePaginateProps, providePagination } from "./composables/paginate.mjs";
import { provideSelection } from "./composables/select.mjs";
import { createSort, provideSort } from "./composables/sort.mjs";
import { provideDefaults } from "../../composables/defaults.mjs"; // Utilities
import { computed, provide, toRef } from 'vue';
import { genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableServerProps = propsFactory({
itemsLength: {
type: [Number, String],
required: true
},
...makeDataTablePaginateProps(),
...makeDataTableProps(),
...makeVDataTableFooterProps()
}, 'VDataTableServer');
export const VDataTableServer = genericComponent()({
name: 'VDataTableServer',
props: makeVDataTableServerProps(),
emits: {
'update:modelValue': value => true,
'update:page': page => true,
'update:itemsPerPage': page => true,
'update:sortBy': sortBy => true,
'update:options': options => true,
'update:expanded': options => true,
'update:groupBy': value => true
},
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const {
groupBy
} = createGroupBy(props);
const {
sortBy,
multiSort,
mustSort
} = createSort(props);
const {
page,
itemsPerPage
} = createPagination(props);
const itemsLength = computed(() => parseInt(props.itemsLength, 10));
const {
columns,
headers
} = createHeaders(props, {
groupBy,
showSelect: toRef(props, 'showSelect'),
showExpand: toRef(props, 'showExpand')
});
const {
items
} = useDataTableItems(props, columns);
const {
toggleSort
} = provideSort({
sortBy,
multiSort,
mustSort,
page
});
const {
opened,
isGroupOpen,
toggleGroup,
extractRows
} = provideGroupBy({
groupBy,
sortBy
});
const {
pageCount,
setItemsPerPage
} = providePagination({
page,
itemsPerPage,
itemsLength
});
const {
flatItems
} = useGroupedItems(items, groupBy, opened);
const {
isSelected,
select,
selectAll,
toggleSelect,
someSelected,
allSelected
} = provideSelection(props, {
allItems: items,
currentPage: items
});
const {
isExpanded,
toggleExpand
} = provideExpanded(props);
const itemsWithoutGroups = computed(() => extractRows(items.value));
useOptions({
page,
itemsPerPage,
sortBy,
groupBy,
search: toRef(props, 'search')
});
provide('v-data-table', {
toggleSort,
sortBy
});
provideDefaults({
VDataTableRows: {
hideNoData: toRef(props, 'hideNoData'),
noDataText: toRef(props, 'noDataText'),
loading: toRef(props, 'loading'),
loadingText: toRef(props, 'loadingText')
}
});
const slotProps = computed(() => ({
page: page.value,
itemsPerPage: itemsPerPage.value,
sortBy: sortBy.value,
pageCount: pageCount.value,
toggleSort,
setItemsPerPage,
someSelected: someSelected.value,
allSelected: allSelected.value,
isSelected,
select,
selectAll,
toggleSelect,
isExpanded,
toggleExpand,
isGroupOpen,
toggleGroup,
items: itemsWithoutGroups.value.map(item => item.raw),
internalItems: itemsWithoutGroups.value,
groupedItems: flatItems.value,
columns: columns.value,
headers: headers.value
}));
useRender(() => {
const dataTableFooterProps = VDataTableFooter.filterProps(props);
const dataTableHeadersProps = VDataTableHeaders.filterProps(props);
const dataTableRowsProps = VDataTableRows.filterProps(props);
const tableProps = VTable.filterProps(props);
return _createVNode(VTable, _mergeProps({
"class": ['v-data-table', {
'v-data-table--loading': props.loading
}, props.class],
"style": props.style
}, tableProps), {
top: () => slots.top?.(slotProps.value),
default: () => slots.default ? slots.default(slotProps.value) : _createVNode(_Fragment, null, [slots.colgroup?.(slotProps.value), _createVNode("thead", {
"class": "v-data-table__thead",
"role": "rowgroup"
}, [_createVNode(VDataTableHeaders, _mergeProps(dataTableHeadersProps, {
"sticky": props.fixedHeader
}), slots)]), slots.thead?.(slotProps.value), _createVNode("tbody", {
"class": "v-data-table__tbody",
"role": "rowgroup"
}, [slots['body.prepend']?.(slotProps.value), slots.body ? slots.body(slotProps.value) : _createVNode(VDataTableRows, _mergeProps(attrs, dataTableRowsProps, {
"items": flatItems.value
}), slots), slots['body.append']?.(slotProps.value)]), slots.tbody?.(slotProps.value), slots.tfoot?.(slotProps.value)]),
bottom: () => slots.bottom ? slots.bottom(slotProps.value) : _createVNode(VDataTableFooter, dataTableFooterProps, {
prepend: slots['footer.prepend']
})
});
});
}
});
//# sourceMappingURL=VDataTableServer.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,228 @@
import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from "vue";
// Components
import { makeDataTableProps } from "./VDataTable.mjs";
import { VDataTableHeaders } from "./VDataTableHeaders.mjs";
import { VDataTableRow } from "./VDataTableRow.mjs";
import { VDataTableRows } from "./VDataTableRows.mjs";
import { VTable } from "../VTable/index.mjs";
import { VVirtualScrollItem } from "../VVirtualScroll/VVirtualScrollItem.mjs"; // Composables
import { provideExpanded } from "./composables/expand.mjs";
import { createGroupBy, makeDataTableGroupProps, provideGroupBy, useGroupedItems } from "./composables/group.mjs";
import { createHeaders } from "./composables/headers.mjs";
import { useDataTableItems } from "./composables/items.mjs";
import { useOptions } from "./composables/options.mjs";
import { provideSelection } from "./composables/select.mjs";
import { createSort, provideSort, useSortedItems } from "./composables/sort.mjs";
import { provideDefaults } from "../../composables/defaults.mjs";
import { makeFilterProps, useFilter } from "../../composables/filter.mjs";
import { makeVirtualProps, useVirtual } from "../../composables/virtual.mjs"; // Utilities
import { computed, shallowRef, toRef } from 'vue';
import { convertToUnit, genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
export const makeVDataTableVirtualProps = propsFactory({
...makeDataTableProps(),
...makeDataTableGroupProps(),
...makeVirtualProps(),
...makeFilterProps()
}, 'VDataTableVirtual');
export const VDataTableVirtual = genericComponent()({
name: 'VDataTableVirtual',
props: makeVDataTableVirtualProps(),
emits: {
'update:modelValue': value => true,
'update:sortBy': value => true,
'update:options': value => true,
'update:groupBy': value => true,
'update:expanded': value => true
},
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const {
groupBy
} = createGroupBy(props);
const {
sortBy,
multiSort,
mustSort
} = createSort(props);
const {
columns,
headers,
filterFunctions,
sortFunctions,
sortRawFunctions
} = createHeaders(props, {
groupBy,
showSelect: toRef(props, 'showSelect'),
showExpand: toRef(props, 'showExpand')
});
const {
items
} = useDataTableItems(props, columns);
const search = toRef(props, 'search');
const {
filteredItems
} = useFilter(props, items, search, {
transform: item => item.columns,
customKeyFilter: filterFunctions
});
const {
toggleSort
} = provideSort({
sortBy,
multiSort,
mustSort
});
const {
sortByWithGroups,
opened,
extractRows,
isGroupOpen,
toggleGroup
} = provideGroupBy({
groupBy,
sortBy
});
const {
sortedItems
} = useSortedItems(props, filteredItems, sortByWithGroups, sortFunctions, sortRawFunctions);
const {
flatItems
} = useGroupedItems(sortedItems, groupBy, opened);
const allItems = computed(() => extractRows(flatItems.value));
const {
isSelected,
select,
selectAll,
toggleSelect,
someSelected,
allSelected
} = provideSelection(props, {
allItems,
currentPage: allItems
});
const {
isExpanded,
toggleExpand
} = provideExpanded(props);
const {
containerRef,
markerRef,
paddingTop,
paddingBottom,
computedItems,
handleItemResize,
handleScroll,
handleScrollend
} = useVirtual(props, flatItems);
const displayItems = computed(() => computedItems.value.map(item => item.raw));
useOptions({
sortBy,
page: shallowRef(1),
itemsPerPage: shallowRef(-1),
groupBy,
search
});
provideDefaults({
VDataTableRows: {
hideNoData: toRef(props, 'hideNoData'),
noDataText: toRef(props, 'noDataText'),
loading: toRef(props, 'loading'),
loadingText: toRef(props, 'loadingText')
}
});
const slotProps = computed(() => ({
sortBy: sortBy.value,
toggleSort,
someSelected: someSelected.value,
allSelected: allSelected.value,
isSelected,
select,
selectAll,
toggleSelect,
isExpanded,
toggleExpand,
isGroupOpen,
toggleGroup,
items: allItems.value.map(item => item.raw),
internalItems: allItems.value,
groupedItems: flatItems.value,
columns: columns.value,
headers: headers.value
}));
useRender(() => {
const dataTableHeadersProps = VDataTableHeaders.filterProps(props);
const dataTableRowsProps = VDataTableRows.filterProps(props);
const tableProps = VTable.filterProps(props);
return _createVNode(VTable, _mergeProps({
"class": ['v-data-table', {
'v-data-table--loading': props.loading
}, props.class],
"style": props.style
}, tableProps), {
top: () => slots.top?.(slotProps.value),
wrapper: () => _createVNode("div", {
"ref": containerRef,
"onScrollPassive": handleScroll,
"onScrollend": handleScrollend,
"class": "v-table__wrapper",
"style": {
height: convertToUnit(props.height)
}
}, [_createVNode("table", null, [slots.colgroup?.(slotProps.value), _createVNode("thead", null, [_createVNode(VDataTableHeaders, _mergeProps(dataTableHeadersProps, {
"sticky": props.fixedHeader
}), slots)]), _createVNode("tbody", null, [_createVNode("tr", {
"ref": markerRef,
"style": {
height: convertToUnit(paddingTop.value),
border: 0
}
}, [_createVNode("td", {
"colspan": columns.value.length,
"style": {
height: 0,
border: 0
}
}, null)]), slots['body.prepend']?.(slotProps.value), _createVNode(VDataTableRows, _mergeProps(attrs, dataTableRowsProps, {
"items": displayItems.value
}), {
...slots,
item: itemSlotProps => _createVNode(VVirtualScrollItem, {
"key": itemSlotProps.internalItem.index,
"renderless": true,
"onUpdate:height": height => handleItemResize(itemSlotProps.internalItem.index, height)
}, {
default: _ref2 => {
let {
itemRef
} = _ref2;
return slots.item?.({
...itemSlotProps,
itemRef
}) ?? _createVNode(VDataTableRow, _mergeProps(itemSlotProps.props, {
"ref": itemRef,
"key": itemSlotProps.internalItem.index,
"index": itemSlotProps.internalItem.index
}), slots);
}
})
}), slots['body.append']?.(slotProps.value), _createVNode("tr", {
"style": {
height: convertToUnit(paddingBottom.value),
border: 0
}
}, [_createVNode("td", {
"colspan": columns.value.length,
"style": {
height: 0,
border: 0
}
}, null)])])])]),
bottom: () => slots.bottom?.(slotProps.value)
});
});
}
});
//# sourceMappingURL=VDataTableVirtual.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
@use '../../styles/settings';
@use '../../styles/tools';
$data-table-footer-info-min-width: 116px !default;
$data-table-footer-info-padding: 0 16px !default;
$data-table-footer-padding: 4px !default;
$data-table-footer-pagination-margin-inline-start: 16px !default;
$data-table-footer-select-width: 90px !default;
$data-table-footer-items-per-page-padding: 8px !default;
$data-table-header-sort-badge-size: 20px !default;
$data-table-header-sort-badge-color: rgba(var(--v-border-color), var(--v-border-opacity)) !default;

View File

@ -0,0 +1,51 @@
// Composables
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
import { inject, provide, toRef } from 'vue';
import { propsFactory } from "../../../util/index.mjs"; // Types
export const makeDataTableExpandProps = propsFactory({
expandOnClick: Boolean,
showExpand: Boolean,
expanded: {
type: Array,
default: () => []
}
}, 'DataTable-expand');
export const VDataTableExpandedKey = Symbol.for('vuetify:datatable:expanded');
export function provideExpanded(props) {
const expandOnClick = toRef(props, 'expandOnClick');
const expanded = useProxiedModel(props, 'expanded', props.expanded, v => {
return new Set(v);
}, v => {
return [...v.values()];
});
function expand(item, value) {
const newExpanded = new Set(expanded.value);
if (!value) {
newExpanded.delete(item.value);
} else {
newExpanded.add(item.value);
}
expanded.value = newExpanded;
}
function isExpanded(item) {
return expanded.value.has(item.value);
}
function toggleExpand(item) {
expand(item, !isExpanded(item));
}
const data = {
expand,
expanded,
expandOnClick,
isExpanded,
toggleExpand
};
provide(VDataTableExpandedKey, data);
return data;
}
export function useExpanded() {
const data = inject(VDataTableExpandedKey);
if (!data) throw new Error('foo');
return data;
}
//# sourceMappingURL=expand.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"expand.mjs","names":["useProxiedModel","inject","provide","toRef","propsFactory","makeDataTableExpandProps","expandOnClick","Boolean","showExpand","expanded","type","Array","default","VDataTableExpandedKey","Symbol","for","provideExpanded","props","v","Set","values","expand","item","value","newExpanded","delete","add","isExpanded","has","toggleExpand","data","useExpanded","Error"],"sources":["../../../../src/components/VDataTable/composables/expand.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { inject, provide, toRef } from 'vue'\nimport { propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { DataTableItem } from '../types'\n\nexport const makeDataTableExpandProps = propsFactory({\n expandOnClick: Boolean,\n showExpand: Boolean,\n expanded: {\n type: Array as PropType<readonly string[]>,\n default: () => ([]),\n },\n}, 'DataTable-expand')\n\nexport const VDataTableExpandedKey: InjectionKey<{\n expand: (item: DataTableItem, value: boolean) => void\n expanded: Ref<Set<string>>\n expandOnClick: Ref<boolean | undefined>\n isExpanded: (item: DataTableItem) => boolean\n toggleExpand: (item: DataTableItem) => void\n}> = Symbol.for('vuetify:datatable:expanded')\n\ntype ExpandProps = {\n expandOnClick: boolean\n expanded: readonly string[]\n 'onUpdate:expanded': ((value: any[]) => void) | undefined\n}\n\nexport function provideExpanded (props: ExpandProps) {\n const expandOnClick = toRef(props, 'expandOnClick')\n const expanded = useProxiedModel(props, 'expanded', props.expanded, v => {\n return new Set(v)\n }, v => {\n return [...v.values()]\n })\n\n function expand (item: DataTableItem, value: boolean) {\n const newExpanded = new Set(expanded.value)\n\n if (!value) {\n newExpanded.delete(item.value)\n } else {\n newExpanded.add(item.value)\n }\n\n expanded.value = newExpanded\n }\n\n function isExpanded (item: DataTableItem) {\n return expanded.value.has(item.value)\n }\n\n function toggleExpand (item: DataTableItem) {\n expand(item, !isExpanded(item))\n }\n\n const data = { expand, expanded, expandOnClick, isExpanded, toggleExpand }\n\n provide(VDataTableExpandedKey, data)\n\n return data\n}\n\nexport function useExpanded () {\n const data = inject(VDataTableExpandedKey)\n\n if (!data) throw new Error('foo')\n\n return data\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,iDAExB;AACA,SAASC,MAAM,EAAEC,OAAO,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACnCC,YAAY,mCAErB;AAIA,OAAO,MAAMC,wBAAwB,GAAGD,YAAY,CAAC;EACnDE,aAAa,EAAEC,OAAO;EACtBC,UAAU,EAAED,OAAO;EACnBE,QAAQ,EAAE;IACRC,IAAI,EAAEC,KAAoC;IAC1CC,OAAO,EAAEA,CAAA,KAAO;EAClB;AACF,CAAC,EAAE,kBAAkB,CAAC;AAEtB,OAAO,MAAMC,qBAMX,GAAGC,MAAM,CAACC,GAAG,CAAC,4BAA4B,CAAC;AAQ7C,OAAO,SAASC,eAAeA,CAAEC,KAAkB,EAAE;EACnD,MAAMX,aAAa,GAAGH,KAAK,CAACc,KAAK,EAAE,eAAe,CAAC;EACnD,MAAMR,QAAQ,GAAGT,eAAe,CAACiB,KAAK,EAAE,UAAU,EAAEA,KAAK,CAACR,QAAQ,EAAES,CAAC,IAAI;IACvE,OAAO,IAAIC,GAAG,CAACD,CAAC,CAAC;EACnB,CAAC,EAAEA,CAAC,IAAI;IACN,OAAO,CAAC,GAAGA,CAAC,CAACE,MAAM,CAAC,CAAC,CAAC;EACxB,CAAC,CAAC;EAEF,SAASC,MAAMA,CAAEC,IAAmB,EAAEC,KAAc,EAAE;IACpD,MAAMC,WAAW,GAAG,IAAIL,GAAG,CAACV,QAAQ,CAACc,KAAK,CAAC;IAE3C,IAAI,CAACA,KAAK,EAAE;MACVC,WAAW,CAACC,MAAM,CAACH,IAAI,CAACC,KAAK,CAAC;IAChC,CAAC,MAAM;MACLC,WAAW,CAACE,GAAG,CAACJ,IAAI,CAACC,KAAK,CAAC;IAC7B;IAEAd,QAAQ,CAACc,KAAK,GAAGC,WAAW;EAC9B;EAEA,SAASG,UAAUA,CAAEL,IAAmB,EAAE;IACxC,OAAOb,QAAQ,CAACc,KAAK,CAACK,GAAG,CAACN,IAAI,CAACC,KAAK,CAAC;EACvC;EAEA,SAASM,YAAYA,CAAEP,IAAmB,EAAE;IAC1CD,MAAM,CAACC,IAAI,EAAE,CAACK,UAAU,CAACL,IAAI,CAAC,CAAC;EACjC;EAEA,MAAMQ,IAAI,GAAG;IAAET,MAAM;IAAEZ,QAAQ;IAAEH,aAAa;IAAEqB,UAAU;IAAEE;EAAa,CAAC;EAE1E3B,OAAO,CAACW,qBAAqB,EAAEiB,IAAI,CAAC;EAEpC,OAAOA,IAAI;AACb;AAEA,OAAO,SAASC,WAAWA,CAAA,EAAI;EAC7B,MAAMD,IAAI,GAAG7B,MAAM,CAACY,qBAAqB,CAAC;EAE1C,IAAI,CAACiB,IAAI,EAAE,MAAM,IAAIE,KAAK,CAAC,KAAK,CAAC;EAEjC,OAAOF,IAAI;AACb"}

View File

@ -0,0 +1,142 @@
// Composables
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
import { computed, inject, provide, ref } from 'vue';
import { getObjectValueByPath, propsFactory } from "../../../util/index.mjs"; // Types
export const makeDataTableGroupProps = propsFactory({
groupBy: {
type: Array,
default: () => []
}
}, 'DataTable-group');
const VDataTableGroupSymbol = Symbol.for('vuetify:data-table-group');
export function createGroupBy(props) {
const groupBy = useProxiedModel(props, 'groupBy');
return {
groupBy
};
}
export function provideGroupBy(options) {
const {
groupBy,
sortBy
} = options;
const opened = ref(new Set());
const sortByWithGroups = computed(() => {
return groupBy.value.map(val => ({
...val,
order: val.order ?? false
})).concat(sortBy.value);
});
function isGroupOpen(group) {
return opened.value.has(group.id);
}
function toggleGroup(group) {
const newOpened = new Set(opened.value);
if (!isGroupOpen(group)) newOpened.add(group.id);else newOpened.delete(group.id);
opened.value = newOpened;
}
function extractRows(items) {
function dive(group) {
const arr = [];
for (const item of group.items) {
if ('type' in item && item.type === 'group') {
arr.push(...dive(item));
} else {
arr.push(item);
}
}
return arr;
}
return dive({
type: 'group',
items,
id: 'dummy',
key: 'dummy',
value: 'dummy',
depth: 0
});
}
// onBeforeMount(() => {
// for (const key of groupedItems.value.keys()) {
// opened.value.add(key)
// }
// })
const data = {
sortByWithGroups,
toggleGroup,
opened,
groupBy,
extractRows,
isGroupOpen
};
provide(VDataTableGroupSymbol, data);
return data;
}
export function useGroupBy() {
const data = inject(VDataTableGroupSymbol);
if (!data) throw new Error('Missing group!');
return data;
}
function groupItemsByProperty(items, groupBy) {
if (!items.length) return [];
const groups = new Map();
for (const item of items) {
const value = getObjectValueByPath(item.raw, groupBy);
if (!groups.has(value)) {
groups.set(value, []);
}
groups.get(value).push(item);
}
return groups;
}
function groupItems(items, groupBy) {
let depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let prefix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'root';
if (!groupBy.length) return [];
const groupedItems = groupItemsByProperty(items, groupBy[0]);
const groups = [];
const rest = groupBy.slice(1);
groupedItems.forEach((items, value) => {
const key = groupBy[0];
const id = `${prefix}_${key}_${value}`;
groups.push({
depth,
id,
key,
value,
items: rest.length ? groupItems(items, rest, depth + 1, id) : items,
type: 'group'
});
});
return groups;
}
function flattenItems(items, opened) {
const flatItems = [];
for (const item of items) {
// TODO: make this better
if ('type' in item && item.type === 'group') {
if (item.value != null) {
flatItems.push(item);
}
if (opened.has(item.id) || item.value == null) {
flatItems.push(...flattenItems(item.items, opened));
}
} else {
flatItems.push(item);
}
}
return flatItems;
}
export function useGroupedItems(items, groupBy, opened) {
const flatItems = computed(() => {
if (!groupBy.value.length) return items.value;
const groupedItems = groupItems(items.value, groupBy.value.map(item => item.key));
return flattenItems(groupedItems, opened.value);
});
return {
flatItems
};
}
//# sourceMappingURL=group.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,265 @@
// Utilities
import { capitalize, inject, provide, ref, watchEffect } from 'vue';
import { consoleError, propsFactory } from "../../../util/index.mjs"; // Types
export const makeDataTableHeaderProps = propsFactory({
headers: Array
}, 'DataTable-header');
export const VDataTableHeadersSymbol = Symbol.for('vuetify:data-table-headers');
const defaultHeader = {
title: '',
sortable: false
};
const defaultActionHeader = {
...defaultHeader,
width: 48
};
function priorityQueue() {
let arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
const queue = arr.map(element => ({
element,
priority: 0
}));
return {
enqueue: (element, priority) => {
let added = false;
for (let i = 0; i < queue.length; i++) {
const item = queue[i];
if (item.priority > priority) {
queue.splice(i, 0, {
element,
priority
});
added = true;
break;
}
}
if (!added) queue.push({
element,
priority
});
},
size: () => queue.length,
count: () => {
let count = 0;
if (!queue.length) return 0;
const whole = Math.floor(queue[0].priority);
for (let i = 0; i < queue.length; i++) {
if (Math.floor(queue[i].priority) === whole) count += 1;
}
return count;
},
dequeue: () => {
return queue.shift();
}
};
}
function extractLeaves(item) {
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
if (!item.children) {
columns.push(item);
} else {
for (const child of item.children) {
extractLeaves(child, columns);
}
}
return columns;
}
function extractKeys(headers) {
let keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
for (const item of headers) {
if (item.key) keys.add(item.key);
if (item.children) {
extractKeys(item.children, keys);
}
}
return keys;
}
function getDefaultItem(item) {
if (!item.key) return undefined;
if (item.key === 'data-table-group') return defaultHeader;
if (['data-table-expand', 'data-table-select'].includes(item.key)) return defaultActionHeader;
return undefined;
}
function getDepth(item) {
let depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!item.children) return depth;
return Math.max(depth, ...item.children.map(child => getDepth(child, depth + 1)));
}
function parseFixedColumns(items) {
let seenFixed = false;
function setFixed(item) {
let parentFixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!item) return;
if (parentFixed) {
item.fixed = true;
}
if (item.fixed) {
if (item.children) {
for (let i = item.children.length - 1; i >= 0; i--) {
setFixed(item.children[i], true);
}
} else {
if (!seenFixed) {
item.lastFixed = true;
} else if (isNaN(+item.width)) {
consoleError(`Multiple fixed columns should have a static width (key: ${item.key})`);
}
seenFixed = true;
}
} else {
if (item.children) {
for (let i = item.children.length - 1; i >= 0; i--) {
setFixed(item.children[i]);
}
} else {
seenFixed = false;
}
}
}
for (let i = items.length - 1; i >= 0; i--) {
setFixed(items[i]);
}
function setFixedOffset(item) {
let fixedOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!item) return fixedOffset;
if (item.children) {
item.fixedOffset = fixedOffset;
for (const child of item.children) {
fixedOffset = setFixedOffset(child, fixedOffset);
}
} else if (item.fixed) {
item.fixedOffset = fixedOffset;
fixedOffset += parseFloat(item.width || '0') || 0;
}
return fixedOffset;
}
let fixedOffset = 0;
for (const item of items) {
fixedOffset = setFixedOffset(item, fixedOffset);
}
}
function parse(items, maxDepth) {
const headers = [];
let currentDepth = 0;
const queue = priorityQueue(items);
while (queue.size() > 0) {
let rowSize = queue.count();
const row = [];
let fraction = 1;
while (rowSize > 0) {
const {
element: item,
priority
} = queue.dequeue();
const diff = maxDepth - currentDepth - getDepth(item);
row.push({
...item,
rowspan: diff ?? 1,
colspan: item.children ? extractLeaves(item).length : 1
});
if (item.children) {
for (const child of item.children) {
// This internally sorts items that are on the same priority "row"
const sort = priority % 1 + fraction / Math.pow(10, currentDepth + 2);
queue.enqueue(child, currentDepth + diff + sort);
}
}
fraction += 1;
rowSize -= 1;
}
currentDepth += 1;
headers.push(row);
}
const columns = items.map(item => extractLeaves(item)).flat();
return {
columns,
headers
};
}
function convertToInternalHeaders(items) {
const internalHeaders = [];
for (const item of items) {
const defaultItem = {
...getDefaultItem(item),
...item
};
const key = defaultItem.key ?? (typeof defaultItem.value === 'string' ? defaultItem.value : null);
const value = defaultItem.value ?? key ?? null;
const internalItem = {
...defaultItem,
key,
value,
sortable: defaultItem.sortable ?? (defaultItem.key != null || !!defaultItem.sort),
children: defaultItem.children ? convertToInternalHeaders(defaultItem.children) : undefined
};
internalHeaders.push(internalItem);
}
return internalHeaders;
}
export function createHeaders(props, options) {
const headers = ref([]);
const columns = ref([]);
const sortFunctions = ref({});
const sortRawFunctions = ref({});
const filterFunctions = ref({});
watchEffect(() => {
const _headers = props.headers || Object.keys(props.items[0] ?? {}).map(key => ({
key,
title: capitalize(key)
}));
const items = _headers.slice();
const keys = extractKeys(items);
if (options?.groupBy?.value.length && !keys.has('data-table-group')) {
items.unshift({
key: 'data-table-group',
title: 'Group'
});
}
if (options?.showSelect?.value && !keys.has('data-table-select')) {
items.unshift({
key: 'data-table-select'
});
}
if (options?.showExpand?.value && !keys.has('data-table-expand')) {
items.push({
key: 'data-table-expand'
});
}
const internalHeaders = convertToInternalHeaders(items);
parseFixedColumns(internalHeaders);
const maxDepth = Math.max(...internalHeaders.map(item => getDepth(item))) + 1;
const parsed = parse(internalHeaders, maxDepth);
headers.value = parsed.headers;
columns.value = parsed.columns;
const flatHeaders = parsed.headers.flat(1);
for (const header of flatHeaders) {
if (!header.key) continue;
if (header.sortable) {
if (header.sort) {
sortFunctions.value[header.key] = header.sort;
}
if (header.sortRaw) {
sortRawFunctions.value[header.key] = header.sortRaw;
}
}
if (header.filter) {
filterFunctions.value[header.key] = header.filter;
}
}
});
const data = {
headers,
columns,
sortFunctions,
sortRawFunctions,
filterFunctions
};
provide(VDataTableHeadersSymbol, data);
return data;
}
export function useHeaders() {
const data = inject(VDataTableHeadersSymbol);
if (!data) throw new Error('Missing headers!');
return data;
}
//# sourceMappingURL=headers.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,48 @@
// Utilities
import { computed } from 'vue';
import { getPropertyFromItem, propsFactory } from "../../../util/index.mjs"; // Types
// Composables
export const makeDataTableItemsProps = propsFactory({
items: {
type: Array,
default: () => []
},
itemValue: {
type: [String, Array, Function],
default: 'id'
},
itemSelectable: {
type: [String, Array, Function],
default: null
},
rowProps: [Object, Function],
cellProps: [Object, Function],
returnObject: Boolean
}, 'DataTable-items');
export function transformItem(props, item, index, columns) {
const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue);
const selectable = getPropertyFromItem(item, props.itemSelectable, true);
const itemColumns = columns.reduce((obj, column) => {
if (column.key != null) obj[column.key] = getPropertyFromItem(item, column.value);
return obj;
}, {});
return {
type: 'item',
key: props.returnObject ? getPropertyFromItem(item, props.itemValue) : value,
index,
value,
selectable,
columns: itemColumns,
raw: item
};
}
export function transformItems(props, items, columns) {
return items.map((item, index) => transformItem(props, item, index, columns));
}
export function useDataTableItems(props, columns) {
const items = computed(() => transformItems(props, props.items, columns.value));
return {
items
};
}
//# sourceMappingURL=items.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"items.mjs","names":["computed","getPropertyFromItem","propsFactory","makeDataTableItemsProps","items","type","Array","default","itemValue","String","Function","itemSelectable","rowProps","Object","cellProps","returnObject","Boolean","transformItem","props","item","index","columns","value","selectable","itemColumns","reduce","obj","column","key","raw","transformItems","map","useDataTableItems"],"sources":["../../../../src/components/VDataTable/composables/items.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getPropertyFromItem, propsFactory } from '@/util'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { CellProps, DataTableItem, InternalDataTableHeader, RowProps } from '../types'\nimport type { SelectItemKey } from '@/util'\n\nexport interface DataTableItemProps {\n items: any[]\n itemValue: SelectItemKey\n itemSelectable: SelectItemKey\n returnObject: boolean\n}\n\n// Composables\nexport const makeDataTableItemsProps = propsFactory({\n items: {\n type: Array as PropType<DataTableItemProps['items']>,\n default: () => ([]),\n },\n itemValue: {\n type: [String, Array, Function] as PropType<SelectItemKey>,\n default: 'id',\n },\n itemSelectable: {\n type: [String, Array, Function] as PropType<SelectItemKey>,\n default: null,\n },\n rowProps: [Object, Function] as PropType<RowProps<any>>,\n cellProps: [Object, Function] as PropType<CellProps<any>>,\n returnObject: Boolean,\n}, 'DataTable-items')\n\nexport function transformItem (\n props: Omit<DataTableItemProps, 'items'>,\n item: any,\n index: number,\n columns: InternalDataTableHeader[]\n): DataTableItem {\n const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue)\n const selectable = getPropertyFromItem(item, props.itemSelectable, true)\n const itemColumns = columns.reduce((obj, column) => {\n if (column.key != null) obj[column.key] = getPropertyFromItem(item, column.value!)\n return obj\n }, {} as Record<string, unknown>)\n\n return {\n type: 'item',\n key: props.returnObject ? getPropertyFromItem(item, props.itemValue) : value,\n index,\n value,\n selectable,\n columns: itemColumns,\n raw: item,\n }\n}\n\nexport function transformItems (\n props: Omit<DataTableItemProps, 'items'>,\n items: DataTableItemProps['items'],\n columns: InternalDataTableHeader[]\n): DataTableItem[] {\n return items.map((item, index) => transformItem(props, item, index, columns))\n}\n\nexport function useDataTableItems (props: DataTableItemProps, columns: Ref<InternalDataTableHeader[]>) {\n const items = computed(() => transformItems(props, props.items, columns.value))\n\n return { items }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,KAAK;AAAA,SACrBC,mBAAmB,EAAEC,YAAY,mCAE1C;AAYA;AACA,OAAO,MAAMC,uBAAuB,GAAGD,YAAY,CAAC;EAClDE,KAAK,EAAE;IACLC,IAAI,EAAEC,KAA8C;IACpDC,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDC,SAAS,EAAE;IACTH,IAAI,EAAE,CAACI,MAAM,EAAEH,KAAK,EAAEI,QAAQ,CAA4B;IAC1DH,OAAO,EAAE;EACX,CAAC;EACDI,cAAc,EAAE;IACdN,IAAI,EAAE,CAACI,MAAM,EAAEH,KAAK,EAAEI,QAAQ,CAA4B;IAC1DH,OAAO,EAAE;EACX,CAAC;EACDK,QAAQ,EAAE,CAACC,MAAM,EAAEH,QAAQ,CAA4B;EACvDI,SAAS,EAAE,CAACD,MAAM,EAAEH,QAAQ,CAA6B;EACzDK,YAAY,EAAEC;AAChB,CAAC,EAAE,iBAAiB,CAAC;AAErB,OAAO,SAASC,aAAaA,CAC3BC,KAAwC,EACxCC,IAAS,EACTC,KAAa,EACbC,OAAkC,EACnB;EACf,MAAMC,KAAK,GAAGJ,KAAK,CAACH,YAAY,GAAGI,IAAI,GAAGlB,mBAAmB,CAACkB,IAAI,EAAED,KAAK,CAACV,SAAS,CAAC;EACpF,MAAMe,UAAU,GAAGtB,mBAAmB,CAACkB,IAAI,EAAED,KAAK,CAACP,cAAc,EAAE,IAAI,CAAC;EACxE,MAAMa,WAAW,GAAGH,OAAO,CAACI,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;IAClD,IAAIA,MAAM,CAACC,GAAG,IAAI,IAAI,EAAEF,GAAG,CAACC,MAAM,CAACC,GAAG,CAAC,GAAG3B,mBAAmB,CAACkB,IAAI,EAAEQ,MAAM,CAACL,KAAM,CAAC;IAClF,OAAOI,GAAG;EACZ,CAAC,EAAE,CAAC,CAA4B,CAAC;EAEjC,OAAO;IACLrB,IAAI,EAAE,MAAM;IACZuB,GAAG,EAAEV,KAAK,CAACH,YAAY,GAAGd,mBAAmB,CAACkB,IAAI,EAAED,KAAK,CAACV,SAAS,CAAC,GAAGc,KAAK;IAC5EF,KAAK;IACLE,KAAK;IACLC,UAAU;IACVF,OAAO,EAAEG,WAAW;IACpBK,GAAG,EAAEV;EACP,CAAC;AACH;AAEA,OAAO,SAASW,cAAcA,CAC5BZ,KAAwC,EACxCd,KAAkC,EAClCiB,OAAkC,EACjB;EACjB,OAAOjB,KAAK,CAAC2B,GAAG,CAAC,CAACZ,IAAI,EAAEC,KAAK,KAAKH,aAAa,CAACC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,CAAC,CAAC;AAC/E;AAEA,OAAO,SAASW,iBAAiBA,CAAEd,KAAyB,EAAEG,OAAuC,EAAE;EACrG,MAAMjB,KAAK,GAAGJ,QAAQ,CAAC,MAAM8B,cAAc,CAACZ,KAAK,EAAEA,KAAK,CAACd,KAAK,EAAEiB,OAAO,CAACC,KAAK,CAAC,CAAC;EAE/E,OAAO;IAAElB;EAAM,CAAC;AAClB"}

View File

@ -0,0 +1,35 @@
// Utilities
import { computed, watch } from 'vue';
import { deepEqual, getCurrentInstance } from "../../../util/index.mjs"; // Types
export function useOptions(_ref) {
let {
page,
itemsPerPage,
sortBy,
groupBy,
search
} = _ref;
const vm = getCurrentInstance('VDataTable');
const options = computed(() => ({
page: page.value,
itemsPerPage: itemsPerPage.value,
sortBy: sortBy.value,
groupBy: groupBy.value,
search: search.value
}));
let oldOptions = null;
watch(options, () => {
if (deepEqual(oldOptions, options.value)) return;
// Reset page when searching
if (oldOptions?.search !== options.value.search) {
page.value = 1;
}
vm.emit('update:options', options.value);
oldOptions = options.value;
}, {
deep: true,
immediate: true
});
}
//# sourceMappingURL=options.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"options.mjs","names":["computed","watch","deepEqual","getCurrentInstance","useOptions","_ref","page","itemsPerPage","sortBy","groupBy","search","vm","options","value","oldOptions","emit","deep","immediate"],"sources":["../../../../src/components/VDataTable/composables/options.ts"],"sourcesContent":["// Utilities\nimport { computed, watch } from 'vue'\nimport { deepEqual, getCurrentInstance } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\nimport type { SortItem } from './sort'\n\nexport function useOptions ({\n page,\n itemsPerPage,\n sortBy,\n groupBy,\n search,\n}: {\n page: Ref<number>\n itemsPerPage: Ref<number>\n sortBy: Ref<readonly SortItem[]>\n groupBy: Ref<readonly SortItem[]>\n search: Ref<string | undefined>\n}) {\n const vm = getCurrentInstance('VDataTable')\n\n const options = computed(() => ({\n page: page.value,\n itemsPerPage: itemsPerPage.value,\n sortBy: sortBy.value,\n groupBy: groupBy.value,\n search: search.value,\n }))\n\n let oldOptions: typeof options.value | null = null\n watch(options, () => {\n if (deepEqual(oldOptions, options.value)) return\n\n // Reset page when searching\n if (oldOptions?.search !== options.value.search) {\n page.value = 1\n }\n\n vm.emit('update:options', options.value)\n oldOptions = options.value\n }, { deep: true, immediate: true })\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5BC,SAAS,EAAEC,kBAAkB,mCAEtC;AAIA,OAAO,SAASC,UAAUA,CAAAC,IAAA,EAYvB;EAAA,IAZyB;IAC1BC,IAAI;IACJC,YAAY;IACZC,MAAM;IACNC,OAAO;IACPC;EAOF,CAAC,GAAAL,IAAA;EACC,MAAMM,EAAE,GAAGR,kBAAkB,CAAC,YAAY,CAAC;EAE3C,MAAMS,OAAO,GAAGZ,QAAQ,CAAC,OAAO;IAC9BM,IAAI,EAAEA,IAAI,CAACO,KAAK;IAChBN,YAAY,EAAEA,YAAY,CAACM,KAAK;IAChCL,MAAM,EAAEA,MAAM,CAACK,KAAK;IACpBJ,OAAO,EAAEA,OAAO,CAACI,KAAK;IACtBH,MAAM,EAAEA,MAAM,CAACG;EACjB,CAAC,CAAC,CAAC;EAEH,IAAIC,UAAuC,GAAG,IAAI;EAClDb,KAAK,CAACW,OAAO,EAAE,MAAM;IACnB,IAAIV,SAAS,CAACY,UAAU,EAAEF,OAAO,CAACC,KAAK,CAAC,EAAE;;IAE1C;IACA,IAAIC,UAAU,EAAEJ,MAAM,KAAKE,OAAO,CAACC,KAAK,CAACH,MAAM,EAAE;MAC/CJ,IAAI,CAACO,KAAK,GAAG,CAAC;IAChB;IAEAF,EAAE,CAACI,IAAI,CAAC,gBAAgB,EAAEH,OAAO,CAACC,KAAK,CAAC;IACxCC,UAAU,GAAGF,OAAO,CAACC,KAAK;EAC5B,CAAC,EAAE;IAAEG,IAAI,EAAE,IAAI;IAAEC,SAAS,EAAE;EAAK,CAAC,CAAC;AACrC"}

View File

@ -0,0 +1,99 @@
// Composables
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
import { computed, inject, provide, watch, watchEffect } from 'vue';
import { clamp, getCurrentInstance, propsFactory } from "../../../util/index.mjs"; // Types
export const makeDataTablePaginateProps = propsFactory({
page: {
type: [Number, String],
default: 1
},
itemsPerPage: {
type: [Number, String],
default: 10
}
}, 'DataTable-paginate');
const VDataTablePaginationSymbol = Symbol.for('vuetify:data-table-pagination');
export function createPagination(props) {
const page = useProxiedModel(props, 'page', undefined, value => +(value ?? 1));
const itemsPerPage = useProxiedModel(props, 'itemsPerPage', undefined, value => +(value ?? 10));
return {
page,
itemsPerPage
};
}
export function providePagination(options) {
const {
page,
itemsPerPage,
itemsLength
} = options;
const startIndex = computed(() => {
if (itemsPerPage.value === -1) return 0;
return itemsPerPage.value * (page.value - 1);
});
const stopIndex = computed(() => {
if (itemsPerPage.value === -1) return itemsLength.value;
return Math.min(itemsLength.value, startIndex.value + itemsPerPage.value);
});
const pageCount = computed(() => {
if (itemsPerPage.value === -1 || itemsLength.value === 0) return 1;
return Math.ceil(itemsLength.value / itemsPerPage.value);
});
watchEffect(() => {
if (page.value > pageCount.value) {
page.value = pageCount.value;
}
});
function setItemsPerPage(value) {
itemsPerPage.value = value;
page.value = 1;
}
function nextPage() {
page.value = clamp(page.value + 1, 1, pageCount.value);
}
function prevPage() {
page.value = clamp(page.value - 1, 1, pageCount.value);
}
function setPage(value) {
page.value = clamp(value, 1, pageCount.value);
}
const data = {
page,
itemsPerPage,
startIndex,
stopIndex,
pageCount,
itemsLength,
nextPage,
prevPage,
setPage,
setItemsPerPage
};
provide(VDataTablePaginationSymbol, data);
return data;
}
export function usePagination() {
const data = inject(VDataTablePaginationSymbol);
if (!data) throw new Error('Missing pagination!');
return data;
}
export function usePaginatedItems(options) {
const vm = getCurrentInstance('usePaginatedItems');
const {
items,
startIndex,
stopIndex,
itemsPerPage
} = options;
const paginatedItems = computed(() => {
if (itemsPerPage.value <= 0) return items.value;
return items.value.slice(startIndex.value, stopIndex.value);
});
watch(paginatedItems, val => {
vm.emit('update:currentItems', val);
});
return {
paginatedItems
};
}
//# sourceMappingURL=paginate.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,180 @@
// Composables
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
import { computed, inject, provide } from 'vue';
import { deepEqual, propsFactory, wrapInArray } from "../../../util/index.mjs"; // Types
const singleSelectStrategy = {
showSelectAll: false,
allSelected: () => [],
select: _ref => {
let {
items,
value
} = _ref;
return new Set(value ? [items[0]?.value] : []);
},
selectAll: _ref2 => {
let {
selected
} = _ref2;
return selected;
}
};
const pageSelectStrategy = {
showSelectAll: true,
allSelected: _ref3 => {
let {
currentPage
} = _ref3;
return currentPage;
},
select: _ref4 => {
let {
items,
value,
selected
} = _ref4;
for (const item of items) {
if (value) selected.add(item.value);else selected.delete(item.value);
}
return selected;
},
selectAll: _ref5 => {
let {
value,
currentPage,
selected
} = _ref5;
return pageSelectStrategy.select({
items: currentPage,
value,
selected
});
}
};
const allSelectStrategy = {
showSelectAll: true,
allSelected: _ref6 => {
let {
allItems
} = _ref6;
return allItems;
},
select: _ref7 => {
let {
items,
value,
selected
} = _ref7;
for (const item of items) {
if (value) selected.add(item.value);else selected.delete(item.value);
}
return selected;
},
selectAll: _ref8 => {
let {
value,
allItems,
selected
} = _ref8;
return allSelectStrategy.select({
items: allItems,
value,
selected
});
}
};
export const makeDataTableSelectProps = propsFactory({
showSelect: Boolean,
selectStrategy: {
type: [String, Object],
default: 'page'
},
modelValue: {
type: Array,
default: () => []
},
valueComparator: {
type: Function,
default: deepEqual
}
}, 'DataTable-select');
export const VDataTableSelectionSymbol = Symbol.for('vuetify:data-table-selection');
export function provideSelection(props, _ref9) {
let {
allItems,
currentPage
} = _ref9;
const selected = useProxiedModel(props, 'modelValue', props.modelValue, v => {
return new Set(wrapInArray(v).map(v => {
return allItems.value.find(item => props.valueComparator(v, item.value))?.value ?? v;
}));
}, v => {
return [...v.values()];
});
const allSelectable = computed(() => allItems.value.filter(item => item.selectable));
const currentPageSelectable = computed(() => currentPage.value.filter(item => item.selectable));
const selectStrategy = computed(() => {
if (typeof props.selectStrategy === 'object') return props.selectStrategy;
switch (props.selectStrategy) {
case 'single':
return singleSelectStrategy;
case 'all':
return allSelectStrategy;
case 'page':
default:
return pageSelectStrategy;
}
});
function isSelected(items) {
return wrapInArray(items).every(item => selected.value.has(item.value));
}
function isSomeSelected(items) {
return wrapInArray(items).some(item => selected.value.has(item.value));
}
function select(items, value) {
const newSelected = selectStrategy.value.select({
items,
value,
selected: new Set(selected.value)
});
selected.value = newSelected;
}
function toggleSelect(item) {
select([item], !isSelected([item]));
}
function selectAll(value) {
const newSelected = selectStrategy.value.selectAll({
value,
allItems: allSelectable.value,
currentPage: currentPageSelectable.value,
selected: new Set(selected.value)
});
selected.value = newSelected;
}
const someSelected = computed(() => selected.value.size > 0);
const allSelected = computed(() => {
const items = selectStrategy.value.allSelected({
allItems: allSelectable.value,
currentPage: currentPageSelectable.value
});
return !!items.length && isSelected(items);
});
const data = {
toggleSelect,
select,
selectAll,
isSelected,
isSomeSelected,
someSelected,
allSelected,
showSelectAll: selectStrategy.value.showSelectAll
};
provide(VDataTableSelectionSymbol, data);
return data;
}
export function useSelection() {
const data = inject(VDataTableSelectionSymbol);
if (!data) throw new Error('Missing selection!');
return data;
}
//# sourceMappingURL=select.mjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,135 @@
// Composables
import { useLocale } from "../../../composables/index.mjs";
import { useProxiedModel } from "../../../composables/proxiedModel.mjs"; // Utilities
import { computed, inject, provide, toRef } from 'vue';
import { getObjectValueByPath, isEmpty, propsFactory } from "../../../util/index.mjs"; // Types
export const makeDataTableSortProps = propsFactory({
sortBy: {
type: Array,
default: () => []
},
customKeySort: Object,
multiSort: Boolean,
mustSort: Boolean
}, 'DataTable-sort');
const VDataTableSortSymbol = Symbol.for('vuetify:data-table-sort');
export function createSort(props) {
const sortBy = useProxiedModel(props, 'sortBy');
const mustSort = toRef(props, 'mustSort');
const multiSort = toRef(props, 'multiSort');
return {
sortBy,
mustSort,
multiSort
};
}
export function provideSort(options) {
const {
sortBy,
mustSort,
multiSort,
page
} = options;
const toggleSort = column => {
if (column.key == null) return;
let newSortBy = sortBy.value.map(x => ({
...x
})) ?? [];
const item = newSortBy.find(x => x.key === column.key);
if (!item) {
if (multiSort.value) newSortBy = [...newSortBy, {
key: column.key,
order: 'asc'
}];else newSortBy = [{
key: column.key,
order: 'asc'
}];
} else if (item.order === 'desc') {
if (mustSort.value) {
item.order = 'asc';
} else {
newSortBy = newSortBy.filter(x => x.key !== column.key);
}
} else {
item.order = 'desc';
}
sortBy.value = newSortBy;
if (page) page.value = 1;
};
function isSorted(column) {
return !!sortBy.value.find(item => item.key === column.key);
}
const data = {
sortBy,
toggleSort,
isSorted
};
provide(VDataTableSortSymbol, data);
return data;
}
export function useSort() {
const data = inject(VDataTableSortSymbol);
if (!data) throw new Error('Missing sort!');
return data;
}
// TODO: abstract into project composable
export function useSortedItems(props, items, sortBy, sortFunctions, sortRawFunctions) {
const locale = useLocale();
const sortedItems = computed(() => {
if (!sortBy.value.length) return items.value;
return sortItems(items.value, sortBy.value, locale.current.value, {
...props.customKeySort,
...sortFunctions?.value
}, sortRawFunctions?.value);
});
return {
sortedItems
};
}
export function sortItems(items, sortByItems, locale, customSorters, customRawSorters) {
const stringCollator = new Intl.Collator(locale, {
sensitivity: 'accent',
usage: 'sort'
});
return [...items].sort((a, b) => {
for (let i = 0; i < sortByItems.length; i++) {
const sortKey = sortByItems[i].key;
const sortOrder = sortByItems[i].order ?? 'asc';
if (sortOrder === false) continue;
let sortA = getObjectValueByPath(a.raw, sortKey);
let sortB = getObjectValueByPath(b.raw, sortKey);
let sortARaw = a.raw;
let sortBRaw = b.raw;
if (sortOrder === 'desc') {
[sortA, sortB] = [sortB, sortA];
[sortARaw, sortBRaw] = [sortBRaw, sortARaw];
}
if (customRawSorters?.[sortKey]) {
const customResult = customRawSorters[sortKey](sortARaw, sortBRaw);
if (!customResult) continue;
return customResult;
}
if (customSorters?.[sortKey]) {
const customResult = customSorters[sortKey](sortA, sortB);
if (!customResult) continue;
return customResult;
}
// Dates should be compared numerically
if (sortA instanceof Date && sortB instanceof Date) {
return sortA.getTime() - sortB.getTime();
}
[sortA, sortB] = [sortA, sortB].map(s => s != null ? s.toString().toLocaleLowerCase() : s);
if (sortA !== sortB) {
if (isEmpty(sortA) && isEmpty(sortB)) return 0;
if (isEmpty(sortA)) return -1;
if (isEmpty(sortB)) return 1;
if (!isNaN(sortA) && !isNaN(sortB)) return Number(sortA) - Number(sortB);
return stringCollator.compare(sortA, sortB);
}
}
return 0;
});
}
//# sourceMappingURL=sort.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
export { VDataTable } from "./VDataTable.mjs";
export { VDataTableFooter } from "./VDataTableFooter.mjs";
export { VDataTableRows } from "./VDataTableRows.mjs";
export { VDataTableRow } from "./VDataTableRow.mjs";
export { VDataTableVirtual } from "./VDataTableVirtual.mjs";
export { VDataTableServer } from "./VDataTableServer.mjs";
//# sourceMappingURL=index.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.mjs","names":["VDataTable","VDataTableFooter","VDataTableRows","VDataTableRow","VDataTableVirtual","VDataTableServer"],"sources":["../../../src/components/VDataTable/index.ts"],"sourcesContent":["export { VDataTable } from './VDataTable'\nexport { VDataTableFooter } from './VDataTableFooter'\nexport { VDataTableRows } from './VDataTableRows'\nexport { VDataTableRow } from './VDataTableRow'\nexport { VDataTableVirtual } from './VDataTableVirtual'\nexport { VDataTableServer } from './VDataTableServer'\n"],"mappings":"SAASA,UAAU;AAAA,SACVC,gBAAgB;AAAA,SAChBC,cAAc;AAAA,SACdC,aAAa;AAAA,SACbC,iBAAiB;AAAA,SACjBC,gBAAgB"}

View File

@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.mjs.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.mjs","names":[],"sources":["../../../src/components/VDataTable/types.ts"],"sourcesContent":["// Types\nimport type { provideExpanded } from './composables/expand'\nimport type { Group, GroupableItem, provideGroupBy } from './composables/group'\nimport type { provideSelection, SelectableItem } from './composables/select'\nimport type { FilterFunction, InternalItem } from '@/composables/filter'\nimport type { SelectItemKey } from '@/util'\n\nexport type DataTableCompareFunction<T = any> = (a: T, b: T) => number\n\nexport type DataTableHeader = {\n key?: 'data-table-group' | 'data-table-select' | 'data-table-expand' | (string & {})\n value?: SelectItemKey\n title?: string\n\n fixed?: boolean\n align?: 'start' | 'end' | 'center'\n\n width?: number | string\n minWidth?: string\n maxWidth?: string\n\n headerProps?: Record<string, any>\n cellProps?: HeaderCellProps\n\n sortable?: boolean\n sort?: DataTableCompareFunction\n sortRaw?: DataTableCompareFunction\n filter?: FilterFunction\n\n children?: DataTableHeader[]\n}\n\nexport type InternalDataTableHeader = Omit<DataTableHeader, 'key' | 'value' | 'children'> & {\n key: string | null\n value: SelectItemKey | null\n sortable: boolean\n fixedOffset?: number\n lastFixed?: boolean\n colspan?: number\n rowspan?: number\n children?: InternalDataTableHeader[]\n}\n\nexport interface DataTableItem<T = any> extends InternalItem<T>, GroupableItem<T>, SelectableItem {\n key: any\n index: number\n columns: {\n [key: string]: any\n }\n}\n\nexport type GroupHeaderSlot = {\n index: number\n item: Group\n columns: InternalDataTableHeader[]\n isExpanded: ReturnType<typeof provideExpanded>['isExpanded']\n toggleExpand: ReturnType<typeof provideExpanded>['toggleExpand']\n isSelected: ReturnType<typeof provideSelection>['isSelected']\n toggleSelect: ReturnType<typeof provideSelection>['toggleSelect']\n toggleGroup: ReturnType<typeof provideGroupBy>['toggleGroup']\n isGroupOpen: ReturnType<typeof provideGroupBy>['isGroupOpen']\n}\n\ntype ItemSlotBase<T> = {\n index: number\n item: T\n internalItem: DataTableItem<T>\n isExpanded: ReturnType<typeof provideExpanded>['isExpanded']\n toggleExpand: ReturnType<typeof provideExpanded>['toggleExpand']\n isSelected: ReturnType<typeof provideSelection>['isSelected']\n toggleSelect: ReturnType<typeof provideSelection>['toggleSelect']\n}\n\nexport type ItemSlot<T> = ItemSlotBase<T> & {\n columns: InternalDataTableHeader[]\n}\n\nexport type ItemKeySlot<T> = ItemSlotBase<T> & {\n value: any\n column: InternalDataTableHeader\n}\n\nexport type RowProps<T> =\n | Record<string, any>\n | ((data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem'>) => Record<string, any>)\n\nexport type CellProps<T> =\n | Record<string, any>\n | ((data: Pick<ItemKeySlot<T>, 'index' | 'item' | 'internalItem' | 'value' | 'column'>) => Record<string, any>)\n\nexport type HeaderCellProps =\n | Record<string, any>\n | ((data: Pick<ItemKeySlot<any>, 'index' | 'item' | 'internalItem' | 'value'>) => Record<string, any>)\n"],"mappings":""}