Refactor #3832 - Update DataTable & TreeTable

pull/3861/head
Tuğçe Küçükoğlu 2023-04-13 21:05:42 +03:00
parent 661d4dc718
commit 62ddc47f4d
14 changed files with 60 additions and 26 deletions

View File

@ -40,13 +40,13 @@
</template> </template>
<template v-else-if="editMode === 'row' && columnProp('rowEditor')"> <template v-else-if="editMode === 'row' && columnProp('rowEditor')">
<button v-if="!d_editing" v-ripple class="p-row-editor-init p-link" type="button" :aria-label="initButtonAriaLabel" @click="onRowEditInit"> <button v-if="!d_editing" v-ripple class="p-row-editor-init p-link" type="button" :aria-label="initButtonAriaLabel" @click="onRowEditInit">
<component :is="(column.children && !column.children.roweditoriniticon) || 'PencilIcon'" class="p-row-editor-init-icon pi-fw" /> <component :is="(column.children && column.children.roweditoriniticon) || 'PencilIcon'" class="p-row-editor-init-icon pi-fw" />
</button> </button>
<button v-if="d_editing" v-ripple class="p-row-editor-save p-link" type="button" :aria-label="saveButtonAriaLabel" @click="onRowEditSave"> <button v-if="d_editing" v-ripple class="p-row-editor-save p-link" type="button" :aria-label="saveButtonAriaLabel" @click="onRowEditSave">
<component :is="(column.children && !column.children.roweditorsaveicon) || 'CheckIcon'" class="p-row-editor-save-icon pi-fw" /> <component :is="(column.children && column.children.roweditorsaveicon) || 'CheckIcon'" class="p-row-editor-save-icon pi-fw" />
</button> </button>
<button v-if="d_editing" v-ripple class="p-row-editor-cancel p-link" type="button" :aria-label="cancelButtonAriaLabel" @click="onRowEditCancel"> <button v-if="d_editing" v-ripple class="p-row-editor-cancel p-link" type="button" :aria-label="cancelButtonAriaLabel" @click="onRowEditCancel">
<component :is="(column.children && !column.children.roweditorcancelicon) || 'TimesIcon'" class="p-row-editor-cancel-icon pi-fw" /> <component :is="(column.children && column.children.roweditorcancelicon) || 'TimesIcon'" class="p-row-editor-cancel-icon pi-fw" />
</button> </button>
</template> </template>
<template v-else>{{ resolveFieldData() }}</template> <template v-else>{{ resolveFieldData() }}</template>

View File

@ -176,15 +176,42 @@ export default {
type: Number, type: Number,
default: 2 default: 2
}, },
filterElement: null, filterElement: {
filterHeaderTemplate: null, type: Function,
filterFooterTemplate: null, default: null
filterClearTemplate: null, },
filterApplyTemplate: null, filterHeaderTemplate: {
filterIconTemplate: null, type: Function,
filterAddIconTemplate: null, default: null
filterRemoveIconTemplate: null, },
filterClearIconTemplate: null, filterFooterTemplate: {
type: Function,
default: null
},
filterClearTemplate: {
type: Function,
default: null
},
filterApplyTemplate: {
type: Function,
default: null
},
filterIconTemplate: {
type: Function,
default: null
},
filterAddIconTemplate: {
type: Function,
default: null
},
filterRemoveIconTemplate: {
type: Function,
default: null
},
filterClearIconTemplate: {
type: Function,
default: null
},
filters: { filters: {
type: Object, type: Object,
default: null default: null

View File

@ -12,7 +12,7 @@ export default {
name: 'FooterCell', name: 'FooterCell',
props: { props: {
column: { column: {
type: null, type: Object,
default: null default: null
} }
}, },

View File

@ -157,7 +157,7 @@ export default {
default: null default: null
}, },
headerCheckboxIconTemplate: { headerCheckboxIconTemplate: {
type: null, type: Function,
default: null default: null
} }
}, },

View File

@ -20,7 +20,7 @@ export default {
checked: null, checked: null,
disabled: null, disabled: null,
headerCheckboxIconTemplate: { headerCheckboxIconTemplate: {
type: null, type: Function,
default: null default: null
} }
}, },

View File

@ -20,7 +20,7 @@ export default {
value: null, value: null,
checked: null, checked: null,
rowCheckboxIconTemplate: { rowCheckboxIconTemplate: {
type: null, type: Function,
default: null default: null
} }
}, },

View File

@ -27,7 +27,7 @@ export default {
default: null default: null
}, },
columns: { columns: {
type: null, type: Object,
default: null default: null
} }
}, },

View File

@ -209,7 +209,7 @@ export default {
default: null default: null
}, },
headerCheckboxIconTemplate: { headerCheckboxIconTemplate: {
type: null, type: Function,
default: null default: null
} }
}, },

View File

@ -67,7 +67,7 @@ export default {
default: false default: false
}, },
templates: { templates: {
type: null, type: Object,
default: null default: null
} }
}, },

View File

@ -4,7 +4,7 @@
<component v-if="column.children && column.children.header" :is="column.children.header" :column="column" /> <component v-if="column.children && column.children.header" :is="column.children.header" :column="column" />
<span v-if="columnProp('header')" class="p-column-title">{{ columnProp('header') }}</span> <span v-if="columnProp('header')" class="p-column-title">{{ columnProp('header') }}</span>
<span v-if="columnProp('sortable')"> <span v-if="columnProp('sortable')">
<component :is="templates ? templates : findSortIcon" :sorted="sortableColumnIcon[1].sorted" :sortOrder="sortableColumnIcon[1].sortOrder" class="p-sortable-column-icon pi-fw" /> <component :is="(column.children && column.children.sorticon) || findSortIcon" :sorted="sortableColumnIcon[1].sorted" :sortOrder="sortableColumnIcon[1].sortOrder" class="p-sortable-column-icon pi-fw" />
</span> </span>
<span v-if="isMultiSorted()" class="p-sortable-column-badge">{{ getMultiSortMetaIndex() + 1 }}</span> <span v-if="isMultiSorted()" class="p-sortable-column-badge">{{ getMultiSortMetaIndex() + 1 }}</span>
</th> </th>
@ -43,10 +43,6 @@ export default {
sortMode: { sortMode: {
type: String, type: String,
default: 'single' default: 'single'
},
templates: {
type: Function,
default: null
} }
}, },
data() { data() {

View File

@ -43,7 +43,6 @@
:sortOrder="d_sortOrder" :sortOrder="d_sortOrder"
:multiSortMeta="d_multiSortMeta" :multiSortMeta="d_multiSortMeta"
:sortMode="sortMode" :sortMode="sortMode"
:templates="$slots['sorticon']"
@column-click="onColumnHeaderClick" @column-click="onColumnHeaderClick"
@column-resizestart="onColumnResizeStart" @column-resizestart="onColumnResizeStart"
></TTHeaderCell> ></TTHeaderCell>

View File

@ -108,7 +108,7 @@ export default {
default: null default: null
}, },
templates: { templates: {
type: null, type: Object,
default: null default: null
} }
}, },

View File

@ -15,6 +15,9 @@
</template> </template>
<template #empty> No customers found. </template> <template #empty> No customers found. </template>
<template #loading> Loading customers data. Please wait. </template> <template #loading> Loading customers data. Please wait. </template>
<template #filtericon>
<i class="pi pi-discord" />
</template>
<Column field="name" header="Name" style="min-width: 12rem"> <Column field="name" header="Name" style="min-width: 12rem">
<template #body="{ data }"> <template #body="{ data }">
{{ data.name }} {{ data.name }}
@ -22,6 +25,9 @@
<template #filter="{ filterModel }"> <template #filter="{ filterModel }">
<InputText v-model="filterModel.value" type="text" class="p-column-filter" placeholder="Search by name" /> <InputText v-model="filterModel.value" type="text" class="p-column-filter" placeholder="Search by name" />
</template> </template>
<template #filtericon>
<i class="pi pi-discord" />
</template>
</Column> </Column>
<Column header="Country" filterField="country.name" style="min-width: 12rem"> <Column header="Country" filterField="country.name" style="min-width: 12rem">
<template #body="{ data }"> <template #body="{ data }">

View File

@ -18,6 +18,9 @@
</template> </template>
<template #empty> No customers found. </template> <template #empty> No customers found. </template>
<template #loading> Loading customers data. Please wait. </template> <template #loading> Loading customers data. Please wait. </template>
<template #filtericon>
<i class="pi pi-discord" />
</template>
<Column field="name" header="Name" style="min-width: 12rem"> <Column field="name" header="Name" style="min-width: 12rem">
<template #body="{ data }"> <template #body="{ data }">
{{ data.name }} {{ data.name }}
@ -25,6 +28,9 @@
<template #filter="{ filterModel, filterCallback }"> <template #filter="{ filterModel, filterCallback }">
<InputText v-model="filterModel.value" type="text" @input="filterCallback()" class="p-column-filter" placeholder="Search by name" /> <InputText v-model="filterModel.value" type="text" @input="filterCallback()" class="p-column-filter" placeholder="Search by name" />
</template> </template>
<template #filtericon>
<i class="pi pi-discord" />
</template>
</Column> </Column>
<Column header="Country" filterField="country.name" style="min-width: 12rem"> <Column header="Country" filterField="country.name" style="min-width: 12rem">
<template #body="{ data }"> <template #body="{ data }">