Skip to content

feat(gui-editor): add multi-layer data-bound Map component to No-Code editor - #185

Open
prasadadhav wants to merge 2 commits into
BESSER-PEARL:mainfrom
prasadadhav:feat/maps_webapp_component
Open

feat(gui-editor): add multi-layer data-bound Map component to No-Code editor#185
prasadadhav wants to merge 2 commits into
BESSER-PEARL:mainfrom
prasadadhav:feat/maps_webapp_component

Conversation

@prasadadhav

@prasadadhav prasadadhav commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the frontend editor side of the Map component feature requested in BESSER-PEARL/BESSER#479.

Adds a fully configurable, data-bound Map block to the GrapesJS-based No-Code editor. Users can drag-and-drop a Map onto any screen, attach domain classes as data sources, and configure multiple typed layers (points, geojson, choropleth, heatmap) through a repeatable layer-manager trait, all without writing code.

Changes

Layer Manager Trait

  • Add registerLayerManagerTrait.ts: custom GrapesJS TraitManager type
    that serialises the full layer stack to a single map-layers JSON attribute
  • Each layer exposes: type selector, data-source class picker, and
    conditional field selects populated dynamically from the bound class

Map Block

  • Rewrite mapConfig.ts: remove flat field traits, wire layer-manager trait
  • Rewrite registerMapComponent.ts: rebuild live preview on every
    attribute change; fix: remove map from removeUnwantedBlocks (our
    block id was being deleted on every editor load)
  • Rewrite MapComponent.tsx: per-layer badge strip in the editor preview
  • Replace flat OSM iframe preview with react-leaflet MapContainer + TileLayer
  • Inject Leaflet CSS into GrapesJS iframe canvas to fix tile/marker rendering

Dependencies

  • Add leaflet ^1.9.4, react-leaflet ^4.2.1, @types/leaflet to package.json

i18n

  • Add layerManager.title, addLayer, traits.layers keys to all six
    locale files: en, de, fr, es, ca, lb

Relates to

Acceptance Criteria Covered

  • User can drag-and-drop a Map block onto a screen
  • Map component can be configured with center, zoom, and layer/marker bindings
  • Component round-trips through JSON serialization
  • i18n complete across all supported locales

- Replace OSM iframe preview with react-leaflet MapContainer + TileLayer
- Add data-source trait (class picker) + latitude-field, longitude-field,
  marker-label-field selects; geo-field options populate dynamically when
  a class is chosen
- Inject Leaflet CSS into GrapesJS iframe canvas to fix tile/marker rendering
- Fix: remove 'map' from removeUnwantedBlocks — our custom block used the
  same id and was being deleted on every editor load
- Add leaflet ^1.9.4, react-leaflet ^4.2.1, @types/leaflet to package.json
- Add latitudeField, longitudeField, markerLabelField i18n keys to all 6 locales
- registerMapComponent.ts, mapConfig.ts, MapComponent.tsx wired into editor
Replace the flat data-source/field traits on the Map block with a
repeatable layer-manager trait. Each layer has its own type selector
(points / geojson / choropleth / heatmap), data-source picker, and
conditional field selects driven by the bound class's attributes.

- Add registerLayerManagerTrait.ts — custom GrapesJS TraitManager type
  serialising layers to a single `map-layers` JSON attribute
- Rewrite mapConfig.ts — remove flat field traits, add layer-manager trait
- Rewrite registerMapComponent.ts — wire layer-manager; rebuild preview
  on every attribute change
- Rewrite MapComponent.tsx — show per-layer badge strip in the editor preview
- Add i18n keys (layerManager.title / addLayer / traits.layers) to all
  six locale files (en, de, fr, es, ca, lb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant