|
|
@ -312,19 +312,23 @@ export default { |
|
|
|
columnsWidth: {type: Object} |
|
|
|
columnsWidth: {type: Object} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
setTimeout(() => { |
|
|
|
this.calculateColumnWidth(); |
|
|
|
const obj = {}; |
|
|
|
|
|
|
|
this.meta && this.meta.columns && this.meta.columns.forEach(c => { |
|
|
|
|
|
|
|
obj[c._cn] = columnStyling[c.uidt] && columnStyling[c.uidt].w || undefined; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Array.from(this.$el.querySelectorAll('th')).forEach(el => { |
|
|
|
|
|
|
|
const width = el.getBoundingClientRect().width; |
|
|
|
|
|
|
|
obj[el.dataset.col] = obj[el.dataset.col] || ((width < 100 ? 100 : width) + 'px'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.$emit('update:columnsWidth', {...obj, ...(this.columnWidth || {})}) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
calculateColumnWidth() { |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
const obj = {}; |
|
|
|
|
|
|
|
this.meta && this.meta.columns && this.meta.columns.forEach(c => { |
|
|
|
|
|
|
|
debugger |
|
|
|
|
|
|
|
obj[c._cn] = columnStyling[c.uidt] && columnStyling[c.uidt].w || undefined; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
Array.from(this.$el.querySelectorAll('th')).forEach(el => { |
|
|
|
|
|
|
|
const width = el.getBoundingClientRect().width; |
|
|
|
|
|
|
|
obj[el.dataset.col] = obj[el.dataset.col] || ((width < 100 ? 100 : width) + 'px'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.$emit('update:columnsWidth', {...obj, ...(this.columnWidth || {})}) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
isCentrallyAligned(col) { |
|
|
|
isCentrallyAligned(col) { |
|
|
|
return !['SingleLineText', |
|
|
|
return !['SingleLineText', |
|
|
|
'LongText', |
|
|
|
'LongText', |
|
|
@ -796,5 +800,9 @@ th:first-child, td:first-child { |
|
|
|
transform: rotate(90deg); |
|
|
|
transform: rotate(90deg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
th{ |
|
|
|
|
|
|
|
min-width:100px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |
|
|
|