2023-06-02 06:52:13 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
2023-10-02 10:46:09 +00:00
|
|
|
import DataTableStyle from 'primevue/datatable/style';
|
2023-06-02 06:52:13 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
},
|
2023-10-06 02:00:36 +00:00
|
|
|
nullSortOrder: {
|
|
|
|
type: Number,
|
|
|
|
default: 1
|
|
|
|
},
|
2023-06-02 06:52:13 +00:00
|
|
|
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,
|
2023-12-20 10:28:13 +00:00
|
|
|
default: false
|
2023-06-02 06:52:13 +00:00
|
|
|
},
|
|
|
|
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: {
|
2023-12-18 14:16:35 +00:00
|
|
|
type: [Array, Object],
|
2023-06-02 06:52:13 +00:00
|
|
|
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: {
|
2024-03-14 10:23:02 +00:00
|
|
|
type: Function,
|
2023-06-02 06:52:13 +00:00
|
|
|
default: null
|
|
|
|
},
|
|
|
|
rowStyle: {
|
2024-03-14 10:29:43 +00:00
|
|
|
type: Function,
|
2023-06-02 06:52:13 +00:00
|
|
|
default: null
|
|
|
|
},
|
|
|
|
scrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
virtualScrollerOptions: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
scrollHeight: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
frozenValue: {
|
|
|
|
type: Array,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
breakpoint: {
|
|
|
|
type: String,
|
|
|
|
default: '960px'
|
|
|
|
},
|
|
|
|
showGridlines: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
stripedRows: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
2024-01-18 13:05:30 +00:00
|
|
|
highlightOnSelect: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
2023-07-19 12:01:49 +00:00
|
|
|
size: {
|
|
|
|
type: String,
|
|
|
|
default: null
|
|
|
|
},
|
2023-06-02 06:52:13 +00:00
|
|
|
tableStyle: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
|
|
|
},
|
|
|
|
tableClass: {
|
2024-02-19 06:12:35 +00:00
|
|
|
type: [String, Object],
|
2023-06-02 06:52:13 +00:00
|
|
|
default: null
|
|
|
|
},
|
|
|
|
tableProps: {
|
2024-02-19 06:12:35 +00:00
|
|
|
type: Object,
|
2023-06-02 06:52:13 +00:00
|
|
|
default: null
|
|
|
|
},
|
|
|
|
filterInputProps: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
2024-03-26 12:37:21 +00:00
|
|
|
},
|
|
|
|
filterButtonProps: {
|
|
|
|
type: Object,
|
|
|
|
default() {
|
|
|
|
return {
|
2024-04-29 09:55:47 +00:00
|
|
|
filter: { severity: 'secondary', text: true, rounded: true },
|
|
|
|
inline: {
|
|
|
|
clear: { severity: 'secondary', text: true, rounded: true }
|
|
|
|
},
|
|
|
|
popover: {
|
|
|
|
addRule: { severity: 'info', text: true, size: 'small' },
|
|
|
|
removeRule: { severity: 'danger', text: true, size: 'small' },
|
|
|
|
apply: { size: 'small' },
|
|
|
|
clear: { outlined: true, size: 'small' }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
editButtonProps: {
|
|
|
|
type: Object,
|
|
|
|
default() {
|
|
|
|
return {
|
|
|
|
init: { severity: 'secondary', text: true, rounded: true },
|
|
|
|
save: { severity: 'secondary', text: true, rounded: true },
|
|
|
|
cancel: { severity: 'secondary', text: true, rounded: true }
|
2024-03-26 12:37:21 +00:00
|
|
|
};
|
|
|
|
}
|
2023-06-02 06:52:13 +00:00
|
|
|
}
|
|
|
|
},
|
2023-10-02 10:46:09 +00:00
|
|
|
style: DataTableStyle,
|
2023-06-02 06:52:13 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
2024-04-25 01:26:06 +00:00
|
|
|
$pcDataTable: this,
|
2023-06-02 06:52:13 +00:00
|
|
|
$parentInstance: this
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|