feat: add inline search to calendar and agenda views

- Add enableSearch config option with UI toggle in Layout section
- Apply search filter before generating calendar events
- Reuse BasesViewBase search infrastructure
- Position search box above calendar
- Filter TaskNotes items across all calendar modes
This commit is contained in:
Renato Mendonca 2025-11-22 22:45:38 +13:00
parent 4a522a8c3d
commit bbda71bdc2
2 changed files with 20 additions and 1 deletions

View file

@ -309,6 +309,11 @@ export class CalendarView extends BasesViewBase {
this.microsoftCalendarToggles.set(cal.id, this.config.get(key) ?? true);
}
}
// Read enableSearch toggle (default: false for backward compatibility)
const enableSearchValue = this.config.get('enableSearch');
this.enableSearch = (enableSearchValue as boolean) ?? false;
// Mark config as successfully loaded
this.configLoaded = true;
@ -330,11 +335,19 @@ export class CalendarView extends BasesViewBase {
this.readViewOptions();
}
// Now that config is loaded, setup search (idempotent: will only create once)
if (this.rootElement) {
this.setupSearch(this.rootElement);
}
try {
// Extract tasks from Bases
const dataItems = this.dataAdapter.extractDataItems();
const taskNotes = await identifyTaskNotesFromBasesData(dataItems, this.plugin);
this.currentTasks = taskNotes;
// Apply search filter
const filteredTasks = this.applySearchFilter(taskNotes);
this.currentTasks = filteredTasks;
// Build Bases entry mapping for task enrichment
this.basesEntryByPath.clear();

View file

@ -319,6 +319,12 @@ export async function registerBasesTaskList(plugin: TaskNotesPlugin): Promise<vo
max: 100,
step: 5,
},
{
type: "toggle",
key: "enableSearch",
displayName: "Enable search box",
default: false,
},
],
},
{