diff --git a/packages/nocodb/src/helpers/getAst.ts b/packages/nocodb/src/helpers/getAst.ts index 01328ac2a4..0d948820af 100644 --- a/packages/nocodb/src/helpers/getAst.ts +++ b/packages/nocodb/src/helpers/getAst.ts @@ -43,6 +43,7 @@ const getAst = async ({ dependencyFields.fieldsSet = dependencyFields.fieldsSet || new Set(); let coverImageId; + let dependencyFieldsForCalenderView; if (view && view.type === ViewTypes.GALLERY) { const gallery = await GalleryView.get(view.id); coverImageId = gallery.fk_cover_image_col_id; @@ -52,6 +53,14 @@ const getAst = async ({ } else if (view && view.type === ViewTypes.CALENDAR) { const calendar = await CalendarView.get(view.id); coverImageId = calendar.fk_cover_image_col_id; + const calenderRanges = await CalendarRange.read(view.id); + if (calenderRanges) { + dependencyFieldsForCalenderView = calenderRanges.ranges + .flatMap((obj) => + [obj.fk_from_column_id, obj.fk_to_column_id].filter(Boolean), + ) + .map(String); + } } if (!model.columns?.length) await model.getColumns(); @@ -102,6 +111,11 @@ const getAst = async ({ if (coverImageId) { allowedCols[coverImageId] = 1; } + if (dependencyFieldsForCalenderView) { + dependencyFieldsForCalenderView.forEach((id) => { + allowedCols[id] = 1; + }); + } } const ast = await model.columns.reduce(async (obj, col: Column) => { diff --git a/packages/nocodb/src/models/index.ts b/packages/nocodb/src/models/index.ts index 7d398cf46d..2e62d9a533 100644 --- a/packages/nocodb/src/models/index.ts +++ b/packages/nocodb/src/models/index.ts @@ -5,6 +5,7 @@ export { default as Source } from './Source'; export { default as Column } from './Column'; export { default as CalendarView } from './CalendarView'; export { default as CalendarViewColumn } from './CalendarViewColumn'; +export { default as CalendarRange } from './CalendarRange'; export { default as Filter } from './Filter'; export { default as FormulaColumn } from './FormulaColumn'; export { default as FormView } from './FormView';