Documentation: SidebarTreeMap Component (English)
1. Overview
SidebarTreeMap is a high-level layout component that combines a hierarchical tree-based sidebar with the powerful MejikDataMap controller. It is the ultimate tool for creating applications that require visual filtering of searchable and paginated geospatial data.
This component operates on an “inversion of control” pattern. Its primary role is to aggregate parameters from all user interactions (tree selection, map movement, search, pagination) and pass them to a parent-provided loader function, which is responsible for the actual data fetching.
2. Features
- Geospatial Filtering: The map view is dynamically updated based on the selected node in the sidebar tree.
- Parent-Controlled Data Loading: Provides maximum flexibility by letting the parent component handle the API calls via a
loaderfunction prop. - State Aggregation: Combines filter state from the tree, viewport state (bounding box, zoom) from the map, and UI state (search, pagination) from
MejikDataMapbefore calling the loader. - Full Pass-Through Functionality: All unrecognized props (like
selectionMode,visibleLayers) and events (like@more-info-click) are passed directly toMejikDataMap, allowing full customization of the map’s features from the parent page. - CRUD Events: Emits events for tree management, allowing the parent to handle create, edit, and delete logic.
3. Props
4. Pass-Through Props & Events
This component acts as a transparent proxy toMejikDataMap. Any prop not listed above will be passed directly down. This means you can control all of LeafletMap’s features from here.
Examples of Pass-Through Props:
:selection-mode="'multi'":visible-layers="['live-position']":selected-features.sync="mySelectionArray":center="[newLat, newLng]"
MejikDataMap and LeafletMap (e.g., @feature-click, @more-info-click) are automatically passed up to the parent.
5. The loader Function Contract
The parent component must provide a loader function. This function is called whenever the data needs to be refreshed. It receives one argument: a params object with all aggregated parameters:
6. Emitted Events (Originating from SidebarTreeMap)
7. Usage Example
Dokumentasi: Komponen SidebarTreeMap (Bahasa Indonesia)
1. Gambaran Umum
SidebarTreeMap adalah komponen tata letak tingkat tinggi yang menggabungkan sidebar berbasis pohon hierarkis dengan pengontrol MejikDataMap yang kuat. Ini adalah alat utama untuk membuat aplikasi yang memerlukan pemfilteran visual dari data geospasial yang dapat dicari dan dipaginasi.
Komponen ini beroperasi dengan pola “inversion of control”. Peran utamanya adalah untuk menggabungkan parameter dari semua interaksi pengguna (pemilihan pohon, pergerakan peta, pencarian, paginasi) dan meneruskannya ke fungsi loader yang disediakan oleh induk, yang bertanggung jawab untuk pengambilan data yang sebenarnya.
2. Fitur
- Filter Geospasial: Tampilan peta diperbarui secara dinamis berdasarkan node yang dipilih di sidebar.
- Pemuatan Data Dikontrol Induk: Memberikan fleksibilitas maksimum dengan membiarkan komponen induk menangani panggilan API melalui prop fungsi
loader. - Agregasi State: Menggabungkan state filter dari pohon, state viewport (bounding box, zoom) dari peta, dan state UI (pencarian, paginasi) dari
MejikDataMapsebelum memanggil loader. - Fungsionalitas Penerusan Penuh (Pass-Through): Semua props (seperti
selectionMode,visibleLayers) dan event (seperti@more-info-click) yang tidak dikenali diteruskan langsung keMejikDataMap, memungkinkan kustomisasi penuh fitur peta dari halaman induk. - Event CRUD: Memancarkan event untuk manajemen pohon, memungkinkan induk menangani logika buat, edit, dan hapus.
3. Props
4. Props & Event Penerus (Pass-Through)
Komponen ini bertindak sebagai perantara transparan keMejikDataMap. Setiap prop yang tidak tercantum di atas akan diteruskan langsung ke bawah. Ini berarti Anda dapat mengontrol semua fitur LeafletMap dari sini.
Contoh Props Penerus:
:selection-mode="'multi'":visible-layers="['live-position']":selected-features.sync="arraySeleksiSaya":center="[latBaru, lngBaru]"
MejikDataMap dan LeafletMap (misalnya, @feature-click, @more-info-click) secara otomatis diteruskan ke atas ke induk.
5. Kontrak Fungsi loader
Komponen induk wajib menyediakan fungsi loader. Fungsi ini dipanggil setiap kali data perlu diperbarui. Ia menerima satu argumen: objek params dengan semua parameter yang digabungkan:
