Merge branch 'table-improvements-2' of github.com:Budibase/budibase into conditional-table-colours
This commit is contained in:
commit
1ccdb4de56
|
@ -4,7 +4,7 @@ import { MinColumnWidth } from "../lib/constants"
|
||||||
export const deriveStores = context => {
|
export const deriveStores = context => {
|
||||||
const {
|
const {
|
||||||
rowHeight,
|
rowHeight,
|
||||||
visibleColumns,
|
scrollableColumns,
|
||||||
rows,
|
rows,
|
||||||
scrollTop,
|
scrollTop,
|
||||||
scrollLeft,
|
scrollLeft,
|
||||||
|
@ -60,33 +60,31 @@ export const deriveStores = context => {
|
||||||
return Math.round($scrollLeft / interval) * interval
|
return Math.round($scrollLeft / interval) * interval
|
||||||
})
|
})
|
||||||
const columnRenderMap = derived(
|
const columnRenderMap = derived(
|
||||||
[visibleColumns, scrollLeftRounded, width],
|
[scrollableColumns, scrollLeftRounded, width],
|
||||||
([$visibleColumns, $scrollLeft, $width]) => {
|
([$scrollableColumns, $scrollLeft, $width]) => {
|
||||||
if (!$visibleColumns.length) {
|
if (!$scrollableColumns.length) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
let startColIdx = 0
|
let startColIdx = 0
|
||||||
let rightEdge = $visibleColumns[0].width
|
let rightEdge = $scrollableColumns[0].width
|
||||||
while (
|
while (
|
||||||
rightEdge < $scrollLeft &&
|
rightEdge < $scrollLeft &&
|
||||||
startColIdx < $visibleColumns.length - 1
|
startColIdx < $scrollableColumns.length - 1
|
||||||
) {
|
) {
|
||||||
startColIdx++
|
startColIdx++
|
||||||
rightEdge += $visibleColumns[startColIdx].width
|
rightEdge += $scrollableColumns[startColIdx].width
|
||||||
}
|
}
|
||||||
let endColIdx = startColIdx + 1
|
let endColIdx = startColIdx + 1
|
||||||
let leftEdge = rightEdge
|
let leftEdge = rightEdge
|
||||||
while (
|
while (
|
||||||
leftEdge < $width + $scrollLeft &&
|
leftEdge < $width + $scrollLeft &&
|
||||||
endColIdx < $visibleColumns.length
|
endColIdx < $scrollableColumns.length
|
||||||
) {
|
) {
|
||||||
leftEdge += $visibleColumns[endColIdx].width
|
leftEdge += $scrollableColumns[endColIdx].width
|
||||||
endColIdx++
|
endColIdx++
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only update the store if different
|
|
||||||
let next = {}
|
let next = {}
|
||||||
$visibleColumns
|
$scrollableColumns
|
||||||
.slice(Math.max(0, startColIdx), endColIdx)
|
.slice(Math.max(0, startColIdx), endColIdx)
|
||||||
.forEach(col => {
|
.forEach(col => {
|
||||||
next[col.name] = true
|
next[col.name] = true
|
||||||
|
|
Loading…
Reference in New Issue