Documentation: SidebarTreeCalendar Component (English)
1. Overview
SidebarTreeCalendar is a powerful layout component that combines a hierarchical tree-based sidebar with the ResourceCalendarView. It is designed for scenarios where you need to filter calendar or timeline events based on a structured category, such as projects, departments, locations, or any other hierarchical data.
When a user selects an item in the tree, the component automatically re-fetches the calendar data, applying the selected item’s ID as a filter.
2. Features
- Dynamic Filtering: The calendar view is dynamically updated based on the selected node in the sidebar tree.
- Collapsible Sidebar: The sidebar can be toggled to maximize the calendar viewing area.
- Searchable Tree: Includes a search input to quickly find nodes within the tree.
- Inherited Power: Leverages all the features of
ResourceCalendarView, including its dual views, on-demand loading, and resource pagination. - Highly Configurable: All API endpoints, titles, and filter keys are customizable via props.
- CRUD Events: Emits events for tree management (add, edit, delete), allowing the parent page to handle the logic (e.g., by opening modals).
3. Props
4. Pass-Through Props
This component automatically passes any unrecognized props (likedayLabels or rowHeight) directly down to the underlying ResourceCalendarView component. This allows you to customize the calendar’s appearance from the parent page.
5. Emitted Events
6. Backend API Requirements
- Tree API (
nodesUrl):
- Must be a
POSTendpoint that can accept asearchterm. - Should return an array of node objects, each with at least
id,name, and an optionalchildrenarray for nesting.
- Calendar/Resource APIs (
eventsEndpoint,resourcesEndpoint):
- Must be able to handle an additional query parameter based on the
filterKeyprop. For example, iffilterKeyis'categoryId', your Laravel controller should check forrequest('categoryId')and add awhereclause to the query.
7. Usage Example
Dokumentasi: Komponen SidebarTreeCalendar (Bahasa Indonesia)
1. Gambaran Umum
SidebarTreeCalendar adalah komponen tata letak (layout) yang menggabungkan sidebar berbasis pohon hierarkis dengan ResourceCalendarView. Komponen ini dirancang untuk skenario di mana Anda perlu menyaring (filter) event di kalender atau timeline berdasarkan kategori terstruktur, seperti proyek, departemen, lokasi, atau data hierarkis lainnya.
Ketika pengguna memilih sebuah item di pohon, komponen akan secara otomatis mengambil ulang data kalender, dengan menerapkan ID item yang dipilih sebagai filter.
2. Fitur
- Filter Dinamis: Tampilan kalender diperbarui secara dinamis berdasarkan node yang dipilih di sidebar.
- Sidebar Lipat: Sidebar dapat disembunyikan untuk memaksimalkan area tampilan kalender.
- Pohon yang Dapat Dicari: Menyertakan input pencarian untuk menemukan node di dalam pohon dengan cepat.
- Mewarisi Kekuatan
ResourceCalendarView: Memanfaatkan semua fitur dariResourceCalendarView, termasuk tampilan ganda, pemuatan on-demand, dan paginasi resource. - Sangat Mudah Dikonfigurasi: Semua endpoint API, judul, dan kunci filter dapat disesuaikan melalui props.
- Event CRUD: Memancarkan event untuk manajemen pohon (tambah, edit, hapus), memungkinkan halaman induk untuk menangani logika (misalnya, dengan membuka modal).
3. Props
4. Props Penerus (Pass-Through Props)
Komponen ini secara otomatis meneruskan props yang tidak dikenali (sepertidayLabels atau rowHeight) langsung ke komponen ResourceCalendarView di dalamnya. Ini memungkinkan Anda untuk menyesuaikan tampilan kalender dari halaman induk.
5. Event yang Di-emit
6. Kebutuhan API Backend
- API Pohon (
nodesUrl):
- Harus berupa endpoint
POSTyang dapat menerima istilahsearch. - Harus mengembalikan sebuah array objek node, masing-masing dengan setidaknya
id,name, dan arraychildren(opsional) untuk data bersarang.
- API Kalender/Resource (
eventsEndpoint,resourcesEndpoint):
- Harus dapat menangani parameter query tambahan berdasarkan prop
filterKey. Contohnya, jikafilterKeyadalah'categoryId', controller Laravel Anda harus memeriksarequest('categoryId')dan menambahkan klausawherepada query.
