Skip to content

Commit e6b92c2

Browse files
committed
Refactor calendar configuration to support new field mappings; update ObjectView and task schema for consistency
1 parent 6230cd8 commit e6b92c2

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

apps/console/src/components/ObjectView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ export function ObjectView({ dataSource, objects, onEdit }: any) {
108108
cardFields: activeView.columns
109109
},
110110
calendar: {
111-
startDateField: activeView.dateField || 'due_date',
112-
endDateField: activeView.endField,
111+
startDateField: activeView.startDateField || activeView.dateField || 'due_date',
112+
endDateField: activeView.endDateField || activeView.endField,
113113
titleField: activeView.titleField || 'name',
114+
colorField: activeView.colorField,
115+
allDayField: activeView.allDayField,
114116
}
115117
}
116118
};

examples/todo/src/domains/todo/task.object.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const TodoTask = ObjectSchema.create({
4444
calendar: {
4545
label: 'Calendar',
4646
type: 'calendar',
47-
dateField: 'due_date',
47+
startDateField: 'due_date',
4848
titleField: 'subject'
4949
},
5050
board: {

packages/plugin-calendar/src/ObjectCalendar.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,13 @@ function getCalendarConfig(schema: ObjectGridSchema | CalendarSchema): CalendarC
118118
}
119119

120120
// Check for flat properties (used by ObjectView)
121-
if ((schema as any).dateField) {
121+
if ((schema as any).startDateField || (schema as any).dateField) {
122122
return {
123-
startDateField: (schema as any).dateField,
124-
endDateField: (schema as any).endField,
123+
startDateField: (schema as any).startDateField || (schema as any).dateField,
124+
endDateField: (schema as any).endDateField || (schema as any).endField,
125125
titleField: (schema as any).titleField || 'name',
126-
colorField: (schema as any).colorField
126+
colorField: (schema as any).colorField,
127+
allDayField: (schema as any).allDayField
127128
} as CalendarConfig;
128129
}
129130

0 commit comments

Comments
 (0)