Redo changes

This commit is contained in:
Andrew Kingston 2024-04-17 14:53:27 +01:00
parent 0f7e576f19
commit 5df34310d4
1 changed files with 12 additions and 6 deletions

View File

@ -48,22 +48,28 @@ export const createStores = () => {
export const deriveStores = context => {
const { columns, stickyColumn } = context
// Derive if we have any normal columns
const hasNonAutoColumn = derived(
// Quick access to all columns
const allColumns = derived(
[columns, stickyColumn],
([$columns, $stickyColumn]) => {
let allCols = $columns || []
if ($stickyColumn) {
allCols = [...allCols, $stickyColumn]
}
const normalCols = allCols.filter(column => {
return !column.schema?.autocolumn
})
return normalCols.length > 0
return allCols
}
)
// Derive if we have any normal columns
const hasNonAutoColumn = derived(allColumns, $allColumns => {
const normalCols = $allColumns.filter(column => {
return !column.schema?.autocolumn
})
return normalCols.length > 0
})
return {
allColumns,
hasNonAutoColumn,
}
}