✨ feature: Data table component updated
This commit is contained in:
parent
7ee1b3fefd
commit
a3a8fa05b9
|
@ -4,8 +4,8 @@ import type { DataTableProps, DataTableSlots } from 'primevue/datatable';
|
||||||
import { useId, ref, watch, computed } from 'vue';
|
import { useId, ref, watch, computed } from 'vue';
|
||||||
|
|
||||||
export interface IVDataTable extends Partial<Omit<DataTableProps, 'pt' | 'dt' | 'ptOptions' | 'unstyled'>>{
|
export interface IVDataTable extends Partial<Omit<DataTableProps, 'pt' | 'dt' | 'ptOptions' | 'unstyled'>>{
|
||||||
id: string
|
id?: string
|
||||||
title: string
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<IVDataTable>(), {
|
const props = withDefaults(defineProps<IVDataTable>(), {
|
||||||
|
@ -80,7 +80,12 @@ const props = withDefaults(defineProps<IVDataTable>(), {
|
||||||
multiSortMeta: undefined,
|
multiSortMeta: undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
const slots = defineSlots<DataTableSlots>();
|
type VDataTableSlots = DataTableSlots & {
|
||||||
|
default?: (props: Record<string, unknown>) => unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
const slots = defineSlots<VDataTableSlots>();
|
||||||
|
|
||||||
|
|
||||||
const dataTableSlotKeys = [
|
const dataTableSlotKeys = [
|
||||||
'header',
|
'header',
|
||||||
|
@ -91,9 +96,7 @@ const dataTableSlotKeys = [
|
||||||
'loading',
|
'loading',
|
||||||
'expansion',
|
'expansion',
|
||||||
'loadingicon',
|
'loadingicon',
|
||||||
'reorderindicatorupicon', // deprecated
|
|
||||||
'rowreorderindicatorupicon',
|
'rowreorderindicatorupicon',
|
||||||
'reorderindicatordownicon', // deprecated
|
|
||||||
'rowreorderindicatordownicon',
|
'rowreorderindicatordownicon',
|
||||||
'rowgrouptogglericon',
|
'rowgrouptogglericon',
|
||||||
'paginatorcontainer',
|
'paginatorcontainer',
|
||||||
|
@ -402,6 +405,7 @@ watch(localEditingRows, (newVal) => {
|
||||||
@stateRestore="emit('state-restore', $event)"
|
@stateRestore="emit('state-restore', $event)"
|
||||||
@stateSave="emit('state-save', $event)"
|
@stateSave="emit('state-save', $event)"
|
||||||
@selectAllChange="emit('select-all-change', $event)"
|
@selectAllChange="emit('select-all-change', $event)"
|
||||||
|
class="p-datatable"
|
||||||
>
|
>
|
||||||
<template
|
<template
|
||||||
v-for="([name]) in availableSlots"
|
v-for="([name]) in availableSlots"
|
||||||
|
@ -410,5 +414,12 @@ watch(localEditingRows, (newVal) => {
|
||||||
>
|
>
|
||||||
<slot :name="name" v-bind="slotProps" />
|
<slot :name="name" v-bind="slotProps" />
|
||||||
</template>
|
</template>
|
||||||
|
<slot></slot>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="css" scoped>
|
||||||
|
.p-datatable{
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user