mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 17:06:01 +00:00
feat: format fileSize cols in summary databases
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import TableControl from '../elements/TableControl.svelte';
|
||||
import formatFileSize from '../utility/formatFileSize';
|
||||
|
||||
export let rows: any[] = [];
|
||||
export let columns: any[] = [];
|
||||
@@ -7,6 +8,13 @@
|
||||
const tableColumns = columns.map(col => ({
|
||||
header: col.header,
|
||||
fieldName: col.fieldName,
|
||||
type: col.type || 'data',
|
||||
formatter: (row, col) => {
|
||||
const value = row[col.fieldName];
|
||||
|
||||
if (col.type === 'fileSize') return formatFileSize(value);
|
||||
return value;
|
||||
},
|
||||
}));
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user