mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Components added. Build issues fixed
This commit is contained in:
parent
5b66ed1093
commit
18c3721848
344 changed files with 12446 additions and 8758 deletions
|
@ -1,46 +1,68 @@
|
|||
<template>
|
||||
<div :class="containerClass">
|
||||
<div class="p-dataview-header" v-if="$slots.header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<DVPaginator v-if="paginatorTop" :rows="d_rows" :first="d_first" :totalRecords="getTotalRecords" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate" :class="{'p-paginator-top': paginatorTop}" :alwaysShow="alwaysShowPaginator" @page="onPage($event)">
|
||||
<template #start v-if="$slots.paginatorstart">
|
||||
<slot name="paginatorstart"></slot>
|
||||
</template>
|
||||
<template #end v-if="$slots.paginatorend">
|
||||
<slot name="paginatorend"></slot>
|
||||
</template>
|
||||
</DVPaginator>
|
||||
<div class="p-dataview-content">
|
||||
<div class="p-grid p-nogutter grid grid-nogutter">
|
||||
<template v-for="(item,index) of items" :key="getKey(item, index)">
|
||||
<slot v-if="$slots.list && layout === 'list'" name="list" :data="item" :index="index"></slot>
|
||||
<slot v-if="$slots.grid && layout === 'grid'" name="grid" :data="item" :index="index"></slot>
|
||||
</template>
|
||||
<div v-if="empty" class="p-col col">
|
||||
<div :class="containerClass">
|
||||
<div v-if="$slots.header" class="p-dataview-header">
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
<DVPaginator
|
||||
v-if="paginatorTop"
|
||||
:rows="d_rows"
|
||||
:first="d_first"
|
||||
:totalRecords="getTotalRecords"
|
||||
:pageLinkSize="pageLinkSize"
|
||||
:template="paginatorTemplate"
|
||||
:rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate"
|
||||
:class="{ 'p-paginator-top': paginatorTop }"
|
||||
:alwaysShow="alwaysShowPaginator"
|
||||
@page="onPage($event)"
|
||||
>
|
||||
<template v-if="$slots.paginatorstart" #start>
|
||||
<slot name="paginatorstart"></slot>
|
||||
</template>
|
||||
<template v-if="$slots.paginatorend" #end>
|
||||
<slot name="paginatorend"></slot>
|
||||
</template>
|
||||
</DVPaginator>
|
||||
<div class="p-dataview-content">
|
||||
<div class="p-grid p-nogutter grid grid-nogutter">
|
||||
<template v-for="(item, index) of items" :key="getKey(item, index)">
|
||||
<slot v-if="$slots.list && layout === 'list'" name="list" :data="item" :index="index"></slot>
|
||||
<slot v-if="$slots.grid && layout === 'grid'" name="grid" :data="item" :index="index"></slot>
|
||||
</template>
|
||||
<div v-if="empty" class="p-col col">
|
||||
<div class="p-dataview-emptymessage">
|
||||
<slot name="empty"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DVPaginator v-if="paginatorBottom" :rows="d_rows" :first="d_first" :totalRecords="getTotalRecords" :pageLinkSize="pageLinkSize" :template="paginatorTemplate" :rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate" :class="{'p-paginator-bottom': paginatorBottom}" :alwaysShow="alwaysShowPaginator" @page="onPage($event)">
|
||||
<template #start v-if="$slots.paginatorstart">
|
||||
<slot name="paginatorstart"></slot>
|
||||
</template>
|
||||
<template #end v-if="$slots.paginatorend">
|
||||
<slot name="paginatorend"></slot>
|
||||
</template>
|
||||
</DVPaginator>
|
||||
<div class="p-dataview-footer" v-if="$slots.footer">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DVPaginator
|
||||
v-if="paginatorBottom"
|
||||
:rows="d_rows"
|
||||
:first="d_first"
|
||||
:totalRecords="getTotalRecords"
|
||||
:pageLinkSize="pageLinkSize"
|
||||
:template="paginatorTemplate"
|
||||
:rowsPerPageOptions="rowsPerPageOptions"
|
||||
:currentPageReportTemplate="currentPageReportTemplate"
|
||||
:class="{ 'p-paginator-bottom': paginatorBottom }"
|
||||
:alwaysShow="alwaysShowPaginator"
|
||||
@page="onPage($event)"
|
||||
>
|
||||
<template v-if="$slots.paginatorstart" #start>
|
||||
<slot name="paginatorstart"></slot>
|
||||
</template>
|
||||
<template v-if="$slots.paginatorend" #end>
|
||||
<slot name="paginatorend"></slot>
|
||||
</template>
|
||||
</DVPaginator>
|
||||
<div v-if="$slots.footer" class="p-dataview-footer">
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {ObjectUtils} from 'primevue/utils';
|
||||
import { ObjectUtils } from 'primevue/utils';
|
||||
import Paginator from 'primevue/paginator';
|
||||
|
||||
export default {
|
||||
|
@ -116,7 +138,7 @@ export default {
|
|||
return {
|
||||
d_first: this.first,
|
||||
d_rows: this.rows
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
first(newValue) {
|
||||
|
@ -153,23 +175,17 @@ export default {
|
|||
let value2 = ObjectUtils.resolveFieldData(data2, this.sortField);
|
||||
let result = null;
|
||||
|
||||
if (value1 == null && value2 != null)
|
||||
result = -1;
|
||||
else if (value1 != null && value2 == null)
|
||||
result = 1;
|
||||
else if (value1 == null && value2 == null)
|
||||
result = 0;
|
||||
else if (typeof value1 === 'string' && typeof value2 === 'string')
|
||||
result = value1.localeCompare(value2, undefined, { numeric: true });
|
||||
else
|
||||
result = (value1 < value2) ? -1 : (value1 > value2) ? 1 : 0;
|
||||
if (value1 == null && value2 != null) result = -1;
|
||||
else if (value1 != null && value2 == null) result = 1;
|
||||
else if (value1 == null && value2 == null) result = 0;
|
||||
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2, undefined, { numeric: true });
|
||||
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
||||
|
||||
return (this.sortOrder * result);
|
||||
return this.sortOrder * result;
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
@ -180,20 +196,20 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
containerClass() {
|
||||
return ['p-dataview p-component', {
|
||||
'p-dataview-list': (this.layout === 'list'),
|
||||
'p-dataview-grid': (this.layout === 'grid')
|
||||
return [
|
||||
'p-dataview p-component',
|
||||
{
|
||||
'p-dataview-list': this.layout === 'list',
|
||||
'p-dataview-grid': this.layout === 'grid'
|
||||
}
|
||||
]
|
||||
];
|
||||
},
|
||||
getTotalRecords() {
|
||||
if (this.totalRecords)
|
||||
return this.totalRecords;
|
||||
else
|
||||
return this.value ? this.value.length : 0;
|
||||
if (this.totalRecords) return this.totalRecords;
|
||||
else return this.value ? this.value.length : 0;
|
||||
},
|
||||
empty() {
|
||||
return (!this.value || this.value.length === 0);
|
||||
return !this.value || this.value.length === 0;
|
||||
},
|
||||
paginatorTop() {
|
||||
return this.paginator && (this.paginatorPosition !== 'bottom' || this.paginatorPosition === 'both');
|
||||
|
@ -211,20 +227,18 @@ export default {
|
|||
|
||||
if (this.paginator) {
|
||||
const first = this.lazy ? 0 : this.d_first;
|
||||
|
||||
return data.slice(first, first + this.d_rows);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'DVPaginator': Paginator
|
||||
DVPaginator: Paginator
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue