297 lines
6.7 KiB
Vue
297 lines
6.7 KiB
Vue
<script>
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
import DataTableStyle from 'primevue/datatable/style';
|
|
|
|
export default {
|
|
name: 'BaseDataTable',
|
|
extends: BaseComponent,
|
|
props: {
|
|
value: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
dataKey: {
|
|
type: [String, Function],
|
|
default: null
|
|
},
|
|
rows: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
first: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
totalRecords: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
paginator: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
paginatorPosition: {
|
|
type: String,
|
|
default: 'bottom'
|
|
},
|
|
alwaysShowPaginator: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
paginatorTemplate: {
|
|
type: [Object, String],
|
|
default: 'FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown'
|
|
},
|
|
pageLinkSize: {
|
|
type: Number,
|
|
default: 5
|
|
},
|
|
rowsPerPageOptions: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
currentPageReportTemplate: {
|
|
type: String,
|
|
default: '({currentPage} of {totalPages})'
|
|
},
|
|
lazy: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
loading: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
loadingIcon: {
|
|
type: String,
|
|
default: undefined
|
|
},
|
|
sortField: {
|
|
type: [String, Function],
|
|
default: null
|
|
},
|
|
sortOrder: {
|
|
type: Number,
|
|
default: null
|
|
},
|
|
defaultSortOrder: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
nullSortOrder: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
multiSortMeta: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
sortMode: {
|
|
type: String,
|
|
default: 'single'
|
|
},
|
|
removableSort: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
filters: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
filterDisplay: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
globalFilterFields: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
filterLocale: {
|
|
type: String,
|
|
default: undefined
|
|
},
|
|
selection: {
|
|
type: [Array, Object],
|
|
default: null
|
|
},
|
|
selectionMode: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
compareSelectionBy: {
|
|
type: String,
|
|
default: 'deepEquals'
|
|
},
|
|
metaKeySelection: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
contextMenu: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
contextMenuSelection: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
selectAll: {
|
|
type: Boolean,
|
|
default: null
|
|
},
|
|
rowHover: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
csvSeparator: {
|
|
type: String,
|
|
default: ','
|
|
},
|
|
exportFilename: {
|
|
type: String,
|
|
default: 'download'
|
|
},
|
|
exportFunction: {
|
|
type: Function,
|
|
default: null
|
|
},
|
|
resizableColumns: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
columnResizeMode: {
|
|
type: String,
|
|
default: 'fit'
|
|
},
|
|
reorderableColumns: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
expandedRows: {
|
|
type: [Array, Object],
|
|
default: null
|
|
},
|
|
expandedRowIcon: {
|
|
type: String,
|
|
default: undefined
|
|
},
|
|
collapsedRowIcon: {
|
|
type: String,
|
|
default: undefined
|
|
},
|
|
rowGroupMode: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
groupRowsBy: {
|
|
type: [Array, String, Function],
|
|
default: null
|
|
},
|
|
expandableRowGroups: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
expandedRowGroups: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
stateStorage: {
|
|
type: String,
|
|
default: 'session'
|
|
},
|
|
stateKey: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
editMode: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
editingRows: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
rowClass: {
|
|
type: Function,
|
|
default: null
|
|
},
|
|
rowStyle: {
|
|
type: Function,
|
|
default: null
|
|
},
|
|
scrollable: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
virtualScrollerOptions: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
scrollHeight: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
frozenValue: {
|
|
type: Array,
|
|
default: null
|
|
},
|
|
responsiveLayout: {
|
|
type: String,
|
|
default: 'scroll'
|
|
},
|
|
breakpoint: {
|
|
type: String,
|
|
default: '960px'
|
|
},
|
|
showGridlines: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
stripedRows: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
highlightOnSelect: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
size: {
|
|
type: String,
|
|
default: null
|
|
},
|
|
tableStyle: {
|
|
type: null,
|
|
default: null
|
|
},
|
|
tableClass: {
|
|
type: [String, Object],
|
|
default: null
|
|
},
|
|
tableProps: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
filterInputProps: {
|
|
type: null,
|
|
default: null
|
|
},
|
|
filterButtonProps: {
|
|
type: Object,
|
|
default() {
|
|
return {
|
|
addRule: { severity: 'info', text: true, size: 'small' },
|
|
removeRule: { severity: 'danger', text: true, size: 'small' },
|
|
apply: { size: 'small' },
|
|
clear: { outlined: true, size: 'small' }
|
|
};
|
|
}
|
|
}
|
|
},
|
|
style: DataTableStyle,
|
|
provide() {
|
|
return {
|
|
$parentInstance: this
|
|
};
|
|
}
|
|
};
|
|
</script>
|