diff --git a/src/store/data.js b/src/store/data.js index 75fc23a92f..1ef85f989e 100644 --- a/src/store/data.js +++ b/src/store/data.js @@ -91,24 +91,27 @@ export const useDataStore = defineStore('data', { this.loading[stateId] = false return columns }, - + async loadColumnsFromBE({ view, tableId }) { let allColumns = await this.getColumnsFromBE({ tableId, viewId: view?.id }) if (view) { - // Transform array to object for faster access + // Meta columns aren't real DB columns, so they never come back + // from the fetch above -- append any this view has settings for. const columnSettingsMap = view.columnSettings?.reduce((acc, item) => { acc[item.columnId] = item return acc }, {}) ?? {} - allColumns = allColumns.concat(MetaColumns.filter(col => columnSettingsMap[col.id])) - if (view.columnSettings) { - allColumns = allColumns.sort((a, b) => { - const orderA = columnSettingsMap[a.id]?.order ?? Number.MAX_SAFE_INTEGER - const orderB = columnSettingsMap[b.id]?.order ?? Number.MAX_SAFE_INTEGER - return orderA - orderB - }) - } + + // Real columns carry their own order via viewColumnInformation; + // meta columns fall back to columnSettingsMap since they were + // just concatenated above and never went through server-side + // enhancement. + allColumns = allColumns.sort((a, b) => { + const orderA = a.viewColumnInformation?.order ?? columnSettingsMap[a.id]?.order ?? Number.MAX_SAFE_INTEGER + const orderB = b.viewColumnInformation?.order ?? columnSettingsMap[b.id]?.order ?? Number.MAX_SAFE_INTEGER + return orderA - orderB + }) } else { // no view: keep the backend-ordered result (ColumnService::findAllByTable already applies columnOrder) } @@ -116,7 +119,7 @@ export const useDataStore = defineStore('data', { this.columns[stateId] = allColumns return true }, - + async loadPublicColumnsFromBE({ token }) { const stateId = 'public-' + token this.loading[stateId] = true diff --git a/src/views/ContentReferenceWidget.vue b/src/views/ContentReferenceWidget.vue index f4749867d1..fca62f12d6 100644 --- a/src/views/ContentReferenceWidget.vue +++ b/src/views/ContentReferenceWidget.vue @@ -19,17 +19,18 @@
- + @@ -249,14 +278,18 @@ export default { .tables-content-widget { min-height: max(50vh, 200px); - height: 50vh; + height: auto; + max-height: calc(100dvh - 40px); overflow: scroll; + overscroll-behavior: contain; + isolation: isolate; & .header { position: sticky; top: 0; inset-inline-start: 0; - z-index: 1; + z-index: 7; + background-color: var(--color-main-background); :where(.options) { position: sticky; @@ -285,8 +318,11 @@ export default { .nc-table { min-width: var(--widget-content-width); - :where(.options.row) { - display: none; + :deep(.options.row) { + height: 0 !important; + overflow: hidden !important; + margin: 0 !important; + padding: 0 !important; } :where(thead) {