1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat(render): field type and length on table header mouse hover

This commit is contained in:
2020-10-17 10:12:40 +02:00
parent 053418ee90
commit 04804b07c7
5 changed files with 29 additions and 6 deletions

View File

@ -39,7 +39,7 @@
:class="`key-${field.key}`"
:title="keyName(field.key)"
/>
<span>{{ field.alias || field.name }}</span>
<span :title="`${field.type} ${fieldLength(field) ? `(${fieldLength(field)})` : ''}`">{{ field.alias || field.name }}</span>
<i
v-if="currentSort === field.name || currentSort === `${field.table}.${field.name}`"
class="mdi sort-icon"
@ -80,6 +80,7 @@
<script>
import { uidGen } from 'common/libs/uidGen';
import { LONG_TEXT, BLOB } from 'common/fieldTypes';
import BaseVirtualScroll from '@/components/BaseVirtualScroll';
import WorkspaceQueryTableRow from '@/components/WorkspaceQueryTableRow';
import TableContext from '@/components/WorkspaceQueryTableContext';
@ -92,6 +93,12 @@ export default {
WorkspaceQueryTableRow,
TableContext
},
filters: {
wrapNumber (num) {
if (!num) return '';
return `(${num})`;
}
},
props: {
results: Array,
tabUid: [String, Number],
@ -193,6 +200,10 @@ export default {
return length;
},
fieldLength (field) {
if ([...BLOB, ...LONG_TEXT].includes(field.type)) return null;
return field.numLength || field.datePrecision || field.charLength || 0;
},
keyName (key) {
switch (key) {
case 'pri':