@memberjunction/ng-map-view 5.32.0 → 5.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,9 +24,12 @@ export declare class MapViewComponent implements OnInit, AfterViewInit, OnDestro
24
24
  Entity: EntityInfo;
25
25
  /** Array of entity records to render on the map. Accepts BaseEntity[] or plain Record objects. */
26
26
  Records: Record<string, unknown>[];
27
- /** Latitude field name. Defaults to __mj_Latitude. */
27
+ /**
28
+ * Latitude field name. If left at the default, auto-resolves to the field
29
+ * on `Entity` tagged with `ExtendedType='GeoLatitude'`.
30
+ */
28
31
  LatitudeField: string;
29
- /** Longitude field name. Defaults to __mj_Longitude. */
32
+ /** Longitude field name. Same auto-resolution as LatitudeField. */
30
33
  LongitudeField: string;
31
34
  /** Current render mode. */
32
35
  RenderMode: MapRenderMode;
@@ -51,10 +54,20 @@ export declare class MapViewComponent implements OnInit, AfterViewInit, OnDestro
51
54
  private engine;
52
55
  private visibilityObserver;
53
56
  private pendingRender;
57
+ private autoModeApplied;
54
58
  IsLoading: boolean;
55
59
  MarkerCount: number;
56
60
  /** Whether the displayed records are truncated (more exist than were loaded). */
57
61
  get IsTruncated(): boolean;
62
+ /** True when the entity has a per-record boundary GeoJSON field — gates the Boundary toolbar button. */
63
+ get HasBoundaryField(): boolean;
64
+ /**
65
+ * Resolve a lat/lng field name. Explicit override wins; otherwise picks the
66
+ * field tagged with the matching `ExtendedType` on `Entity`.
67
+ */
68
+ private resolveGeoField;
69
+ private get effectiveLatitudeField();
70
+ private get effectiveLongitudeField();
58
71
  ngOnInit(): void;
59
72
  ngAfterViewInit(): void;
60
73
  ngOnChanges(changes: SimpleChanges): void;
@@ -67,6 +80,10 @@ export declare class MapViewComponent implements OnInit, AfterViewInit, OnDestro
67
80
  * Render records using the current mode, update marker count.
68
81
  */
69
82
  private DoRender;
83
+ /**
84
+ * True if at least one loaded record carries a non-empty value in the boundary field.
85
+ */
86
+ private RecordsHaveBoundaryData;
70
87
  /**
71
88
  * Set rendering mode (called from template toolbar buttons).
72
89
  */
@@ -1 +1 @@
1
- {"version":3,"file":"map-view.component.d.ts","sourceRoot":"","sources":["../../src/lib/map-view.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,YAAY,EACZ,MAAM,EACN,SAAS,EACT,SAAS,EACT,aAAa,EAIb,aAAa,EAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;;AAK5G;;;;;;;;;;;;;;GAcG;AACH,qBAMa,gBAAiB,YAAW,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS;IAChF,OAAO,CAAC,GAAG,CAA6B;IAGxC,OAAO,CAAC,YAAY,CAA8B;IAElD,iDAAiD;IACxC,MAAM,EAAG,UAAU,CAAC;IAE7B,kGAAkG;IACzF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAM;IAEjD,sDAAsD;IAC7C,aAAa,EAAE,MAAM,CAAmB;IAEjD,wDAAwD;IAC/C,cAAc,EAAE,MAAM,CAAoB;IAEnD,2BAA2B;IAClB,UAAU,EAAE,aAAa,CAAW;IAE7C,sFAAsF;IAC7E,aAAa,EAAE,MAAM,CAAqB;IAGnD,6CAA6C;IACpC,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAQ;IAE9D;;;;OAIG;IACM,gBAAgB,EAAE,MAAM,CAAK;IAEtC,wCAAwC;IAC9B,WAAW,oCAA2C;IAEhE,mDAAmD;IACzC,WAAW,oCAA2C;IAEhE,4DAA4D;IAClD,kBAAkB,gCAAuC;IAEnE,mFAAmF;IACzE,gBAAgB,8BAAqC;IAE/D,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,kBAAkB,CAAqC;IAC/D,OAAO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angular/common";
7
7
  const _c0 = ["mapContainer"];
8
- function MapViewComponent_Conditional_17_Template(rf, ctx) { if (rf & 1) {
8
+ function MapViewComponent_Conditional_6_Template(rf, ctx) { if (rf & 1) {
9
+ const _r2 = i0.ɵɵgetCurrentView();
10
+ i0.ɵɵelementStart(0, "button", 4);
11
+ i0.ɵɵlistener("click", function MapViewComponent_Conditional_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.SetRenderMode("boundary")); });
12
+ i0.ɵɵelement(1, "i", 13);
13
+ i0.ɵɵtext(2, " Boundary ");
14
+ i0.ɵɵelementEnd();
15
+ } if (rf & 2) {
16
+ const ctx_r2 = i0.ɵɵnextContext();
17
+ i0.ɵɵclassProp("active", ctx_r2.RenderMode === "boundary");
18
+ } }
19
+ function MapViewComponent_Conditional_15_Template(rf, ctx) { if (rf & 1) {
9
20
  i0.ɵɵelementStart(0, "span", 10);
10
21
  i0.ɵɵpipe(1, "number");
11
22
  i0.ɵɵpipe(2, "number");
12
- i0.ɵɵelement(3, "i", 13);
23
+ i0.ɵɵelement(3, "i", 14);
13
24
  i0.ɵɵtext(4);
14
25
  i0.ɵɵpipe(5, "number");
15
26
  i0.ɵɵpipe(6, "number");
16
27
  i0.ɵɵelementEnd();
17
28
  } if (rf & 2) {
18
- const ctx_r1 = i0.ɵɵnextContext();
19
- i0.ɵɵproperty("title", i0.ɵɵinterpolate2("Not all records are displayed. Showing ", i0.ɵɵpipeBind1(1, 5, ctx_r1.Records.length), " of ", i0.ɵɵpipeBind1(2, 7, ctx_r1.TotalRecordCount), " total records."));
29
+ const ctx_r2 = i0.ɵɵnextContext();
30
+ i0.ɵɵproperty("title", i0.ɵɵinterpolate2("Not all records are displayed. Showing ", i0.ɵɵpipeBind1(1, 5, ctx_r2.Records.length), " of ", i0.ɵɵpipeBind1(2, 7, ctx_r2.TotalRecordCount), " total records."));
20
31
  i0.ɵɵadvance(4);
21
- i0.ɵɵtextInterpolate2(" Showing ", i0.ɵɵpipeBind1(5, 9, ctx_r1.Records.length), " of ", i0.ɵɵpipeBind1(6, 11, ctx_r1.TotalRecordCount), " ");
32
+ i0.ɵɵtextInterpolate2(" Showing ", i0.ɵɵpipeBind1(5, 9, ctx_r2.Records.length), " of ", i0.ɵɵpipeBind1(6, 11, ctx_r2.TotalRecordCount), " ");
22
33
  } }
23
- function MapViewComponent_Conditional_18_Template(rf, ctx) { if (rf & 1) {
34
+ function MapViewComponent_Conditional_16_Template(rf, ctx) { if (rf & 1) {
24
35
  i0.ɵɵelementStart(0, "div", 11);
25
- i0.ɵɵelement(1, "mj-loading", 14);
36
+ i0.ɵɵelement(1, "mj-loading", 15);
26
37
  i0.ɵɵelementEnd();
27
38
  } }
28
39
  // Leaflet is loaded as a global script at runtime via angular.json scripts array.
@@ -49,9 +60,12 @@ export class MapViewComponent {
49
60
  Entity;
50
61
  /** Array of entity records to render on the map. Accepts BaseEntity[] or plain Record objects. */
51
62
  Records = [];
52
- /** Latitude field name. Defaults to __mj_Latitude. */
63
+ /**
64
+ * Latitude field name. If left at the default, auto-resolves to the field
65
+ * on `Entity` tagged with `ExtendedType='GeoLatitude'`.
66
+ */
53
67
  LatitudeField = '__mj_Latitude';
54
- /** Longitude field name. Defaults to __mj_Longitude. */
68
+ /** Longitude field name. Same auto-resolution as LatitudeField. */
55
69
  LongitudeField = '__mj_Longitude';
56
70
  /** Current render mode. */
57
71
  RenderMode = 'point';
@@ -76,14 +90,47 @@ export class MapViewComponent {
76
90
  engine = null;
77
91
  visibilityObserver = null;
78
92
  pendingRender = false;
93
+ autoModeApplied = false;
79
94
  IsLoading = true;
80
95
  MarkerCount = 0;
81
96
  /** Whether the displayed records are truncated (more exist than were loaded). */
82
97
  get IsTruncated() {
83
98
  return this.TotalRecordCount > 0 && this.Records.length < this.TotalRecordCount;
84
99
  }
100
+ /** True when the entity has a per-record boundary GeoJSON field — gates the Boundary toolbar button. */
101
+ get HasBoundaryField() {
102
+ if (!this.Entity)
103
+ return false;
104
+ const fieldName = this.BoundaryField || 'BoundaryGeoJSON';
105
+ return this.Entity.Fields.some(f => f.Name === fieldName);
106
+ }
107
+ /**
108
+ * Resolve a lat/lng field name. Explicit override wins; otherwise picks the
109
+ * field tagged with the matching `ExtendedType` on `Entity`.
110
+ */
111
+ resolveGeoField(input, defaultName, extendedType) {
112
+ if (input && input !== defaultName)
113
+ return input; // explicit override
114
+ if (this.Entity) {
115
+ const tagged = this.Entity.Fields.find(f => f.ExtendedType === extendedType);
116
+ if (tagged)
117
+ return tagged.Name;
118
+ }
119
+ return input || defaultName;
120
+ }
121
+ get effectiveLatitudeField() {
122
+ return this.resolveGeoField(this.LatitudeField, '__mj_Latitude', 'GeoLatitude');
123
+ }
124
+ get effectiveLongitudeField() {
125
+ return this.resolveGeoField(this.LongitudeField, '__mj_Longitude', 'GeoLongitude');
126
+ }
85
127
  ngOnInit() {
86
- // Map initialization happens when the component becomes visible
128
+ // Snap saved 'boundary' → 'point' when the entity has no boundary field
129
+ // (the button is hidden, so the user would be stuck on it).
130
+ if (this.RenderMode === 'boundary' && !this.HasBoundaryField) {
131
+ this.RenderMode = 'point';
132
+ this.RenderModeChange.emit(this.RenderMode);
133
+ }
87
134
  }
88
135
  ngAfterViewInit() {
89
136
  // Use IntersectionObserver to detect when the map container becomes visible.
@@ -109,6 +156,23 @@ export class MapViewComponent {
109
156
  }
110
157
  }
111
158
  ngOnChanges(changes) {
159
+ // Entity change invalidates per-Entity config (lat/lng field names,
160
+ // Boundary visibility) cached at engine-init. Tear down so the next
161
+ // render rebuilds against the new Entity.
162
+ if (changes['Entity'] && !changes['Entity'].firstChange && this.engine) {
163
+ this.engine.destroy();
164
+ this.engine = null;
165
+ this.autoModeApplied = false;
166
+ this.IsLoading = true;
167
+ this.cdr.detectChanges();
168
+ if (this.mapContainer?.nativeElement) {
169
+ this.InitializeMap();
170
+ }
171
+ else {
172
+ this.pendingRender = true;
173
+ }
174
+ return;
175
+ }
112
176
  if (changes['Records'] || changes['RenderMode']) {
113
177
  if (this.engine) {
114
178
  setTimeout(() => {
@@ -147,8 +211,8 @@ export class MapViewComponent {
147
211
  lng: this.DisplayState?.CenterLng ?? 0
148
212
  },
149
213
  zoom: this.DisplayState?.ZoomLevel ?? 2,
150
- latitudeField: this.LatitudeField,
151
- longitudeField: this.LongitudeField,
214
+ latitudeField: this.effectiveLatitudeField,
215
+ longitudeField: this.effectiveLongitudeField,
152
216
  boundaryField: this.BoundaryField,
153
217
  geoResolver: GeoDataEngine.Instance,
154
218
  getRecordId: (record) => {
@@ -227,6 +291,29 @@ export class MapViewComponent {
227
291
  this.engine.render(this.Records, this.RenderMode);
228
292
  this.MarkerCount = this.engine.getStats().markerCount;
229
293
  this.cdr.detectChanges();
294
+ // One-shot: if 'point' rendered nothing but records carry GeoJSON
295
+ // (e.g. MJ: Countries), flip to 'boundary' so the map isn't blank.
296
+ // autoModeApplied prevents second-guessing manual mode changes.
297
+ if (!this.autoModeApplied
298
+ && this.RenderMode === 'point'
299
+ && this.MarkerCount === 0
300
+ && this.Records.length > 0
301
+ && this.RecordsHaveBoundaryData()) {
302
+ this.autoModeApplied = true;
303
+ this.SetRenderMode('boundary');
304
+ }
305
+ }
306
+ /**
307
+ * True if at least one loaded record carries a non-empty value in the boundary field.
308
+ */
309
+ RecordsHaveBoundaryData() {
310
+ const field = this.BoundaryField;
311
+ for (const record of this.Records) {
312
+ const val = this.GetField(record, field);
313
+ if (val != null && val !== '')
314
+ return true;
315
+ }
316
+ return false;
230
317
  }
231
318
  /**
232
319
  * Set rendering mode (called from template toolbar buttons).
@@ -261,55 +348,51 @@ export class MapViewComponent {
261
348
  } if (rf & 2) {
262
349
  let _t;
263
350
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.mapContainer = _t.first);
264
- } }, inputs: { Entity: "Entity", Records: "Records", LatitudeField: "LatitudeField", LongitudeField: "LongitudeField", RenderMode: "RenderMode", BoundaryField: "BoundaryField", DisplayState: "DisplayState", TotalRecordCount: "TotalRecordCount" }, outputs: { MarkerClick: "MarkerClick", RegionClick: "RegionClick", DisplayStateChange: "DisplayStateChange", RenderModeChange: "RenderModeChange" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 21, vars: 12, consts: [["mapContainer", ""], [1, "mj-map-view-wrapper"], [1, "mj-map-toolbar"], [1, "mj-map-mode-buttons"], [1, "mj-map-mode-btn", 3, "click"], [1, "fa-solid", "fa-location-dot"], [1, "fa-solid", "fa-draw-polygon"], [1, "fa-solid", "fa-map"], [1, "fa-solid", "fa-fire"], [1, "mj-map-info"], [1, "mj-map-truncated", 3, "title"], [1, "mj-map-loading"], [1, "mj-map-container"], [1, "fa-solid", "fa-triangle-exclamation"], ["text", "Loading map..."]], template: function MapViewComponent_Template(rf, ctx) { if (rf & 1) {
351
+ } }, inputs: { Entity: "Entity", Records: "Records", LatitudeField: "LatitudeField", LongitudeField: "LongitudeField", RenderMode: "RenderMode", BoundaryField: "BoundaryField", DisplayState: "DisplayState", TotalRecordCount: "TotalRecordCount" }, outputs: { MarkerClick: "MarkerClick", RegionClick: "RegionClick", DisplayStateChange: "DisplayStateChange", RenderModeChange: "RenderModeChange" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 19, vars: 11, consts: [["mapContainer", ""], [1, "mj-map-view-wrapper"], [1, "mj-map-toolbar"], [1, "mj-map-mode-buttons"], [1, "mj-map-mode-btn", 3, "click"], [1, "fa-solid", "fa-location-dot"], [1, "mj-map-mode-btn", 3, "active"], [1, "fa-solid", "fa-map"], [1, "fa-solid", "fa-fire"], [1, "mj-map-info"], [1, "mj-map-truncated", 3, "title"], [1, "mj-map-loading"], [1, "mj-map-container"], [1, "fa-solid", "fa-draw-polygon"], [1, "fa-solid", "fa-triangle-exclamation"], ["text", "Loading map..."]], template: function MapViewComponent_Template(rf, ctx) { if (rf & 1) {
265
352
  const _r1 = i0.ɵɵgetCurrentView();
266
353
  i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "div", 3)(3, "button", 4);
267
354
  i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("point")); });
268
355
  i0.ɵɵelement(4, "i", 5);
269
356
  i0.ɵɵtext(5, " Points ");
270
357
  i0.ɵɵelementEnd();
271
- i0.ɵɵelementStart(6, "button", 4);
272
- i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("boundary")); });
273
- i0.ɵɵelement(7, "i", 6);
274
- i0.ɵɵtext(8, " Boundary ");
358
+ i0.ɵɵconditionalCreate(6, MapViewComponent_Conditional_6_Template, 3, 2, "button", 6);
359
+ i0.ɵɵelementStart(7, "button", 4);
360
+ i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("choropleth")); });
361
+ i0.ɵɵelement(8, "i", 7);
362
+ i0.ɵɵtext(9, " Regions ");
275
363
  i0.ɵɵelementEnd();
276
- i0.ɵɵelementStart(9, "button", 4);
277
- i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_9_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("choropleth")); });
278
- i0.ɵɵelement(10, "i", 7);
279
- i0.ɵɵtext(11, " Regions ");
280
- i0.ɵɵelementEnd();
281
- i0.ɵɵelementStart(12, "button", 4);
282
- i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_12_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("heatmap")); });
283
- i0.ɵɵelement(13, "i", 8);
284
- i0.ɵɵtext(14, " Heat Map ");
364
+ i0.ɵɵelementStart(10, "button", 4);
365
+ i0.ɵɵlistener("click", function MapViewComponent_Template_button_click_10_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.SetRenderMode("heatmap")); });
366
+ i0.ɵɵelement(11, "i", 8);
367
+ i0.ɵɵtext(12, " Heat Map ");
285
368
  i0.ɵɵelementEnd()();
286
- i0.ɵɵelementStart(15, "div", 9);
287
- i0.ɵɵtext(16);
288
- i0.ɵɵconditionalCreate(17, MapViewComponent_Conditional_17_Template, 7, 13, "span", 10);
369
+ i0.ɵɵelementStart(13, "div", 9);
370
+ i0.ɵɵtext(14);
371
+ i0.ɵɵconditionalCreate(15, MapViewComponent_Conditional_15_Template, 7, 13, "span", 10);
289
372
  i0.ɵɵelementEnd()();
290
- i0.ɵɵconditionalCreate(18, MapViewComponent_Conditional_18_Template, 2, 0, "div", 11);
291
- i0.ɵɵelement(19, "div", 12, 0);
373
+ i0.ɵɵconditionalCreate(16, MapViewComponent_Conditional_16_Template, 2, 0, "div", 11);
374
+ i0.ɵɵelement(17, "div", 12, 0);
292
375
  i0.ɵɵelementEnd();
293
376
  } if (rf & 2) {
294
377
  i0.ɵɵadvance(3);
295
378
  i0.ɵɵclassProp("active", ctx.RenderMode === "point");
296
379
  i0.ɵɵadvance(3);
297
- i0.ɵɵclassProp("active", ctx.RenderMode === "boundary");
298
- i0.ɵɵadvance(3);
380
+ i0.ɵɵconditional(ctx.HasBoundaryField ? 6 : -1);
381
+ i0.ɵɵadvance();
299
382
  i0.ɵɵclassProp("active", ctx.RenderMode === "choropleth");
300
383
  i0.ɵɵadvance(3);
301
384
  i0.ɵɵclassProp("active", ctx.RenderMode === "heatmap");
302
385
  i0.ɵɵadvance(4);
303
386
  i0.ɵɵtextInterpolate2(" ", ctx.MarkerCount, " location", ctx.MarkerCount !== 1 ? "s" : "", " mapped ");
304
387
  i0.ɵɵadvance();
305
- i0.ɵɵconditional(ctx.IsTruncated ? 17 : -1);
388
+ i0.ɵɵconditional(ctx.IsTruncated ? 15 : -1);
306
389
  i0.ɵɵadvance();
307
- i0.ɵɵconditional(ctx.IsLoading ? 18 : -1);
390
+ i0.ɵɵconditional(ctx.IsLoading ? 16 : -1);
308
391
  } }, dependencies: [i1.LoadingComponent, i2.DecimalPipe], styles: ["[_nghost-%COMP%] {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.mj-map-view-wrapper[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.mj-map-toolbar[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: var(--mj-bg-surface-card);\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n z-index: 1000;\n}\n\n.mj-map-mode-buttons[_ngcontent-%COMP%] {\n display: flex;\n gap: 4px;\n}\n\n.mj-map-mode-btn[_ngcontent-%COMP%] {\n padding: 6px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n cursor: pointer;\n font-size: 13px;\n transition: all 0.15s ease;\n}\n\n.mj-map-mode-btn[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n}\n\n.mj-map-mode-btn.active[_ngcontent-%COMP%] {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-color: var(--mj-brand-primary);\n}\n\n.mj-map-info[_ngcontent-%COMP%] {\n font-size: 13px;\n color: var(--mj-text-muted);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-map-truncated[_ngcontent-%COMP%] {\n color: var(--mj-status-warning-text);\n font-size: 12px;\n}\n\n.mj-map-loading[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 500;\n background: var(--mj-bg-surface);\n}\n\n.mj-map-container[_ngcontent-%COMP%] {\n flex: 1;\n min-height: 400px;\n width: 100%;\n}\n\n.mj-map-container.hidden[_ngcontent-%COMP%] {\n display: none;\n}\n\n\n\n\n\n[_nghost-%COMP%] .leaflet-popup-content-wrapper {\n border-radius: 6px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n\n[_nghost-%COMP%] .leaflet-popup-content {\n color: #1e293b;\n font-size: 13px;\n margin: 10px 14px;\n}\n\n\n\n[_nghost-%COMP%] .leaflet-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n\n\n[_nghost-%COMP%] .leaflet-control-attribution {\n font-size: 9px;\n padding: 1px 5px;\n background: rgba(255, 255, 255, 0.6);\n color: #666;\n}\n\n[_nghost-%COMP%] .leaflet-control-attribution a {\n color: #666;\n}"] });
309
392
  }
310
393
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MapViewComponent, [{
311
394
  type: Component,
312
- args: [{ standalone: false, selector: 'mj-map-view', template: "<div class=\"mj-map-view-wrapper\">\n <div class=\"mj-map-toolbar\">\n <div class=\"mj-map-mode-buttons\">\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'point'\"\n (click)=\"SetRenderMode('point')\">\n <i class=\"fa-solid fa-location-dot\"></i> Points\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'boundary'\"\n (click)=\"SetRenderMode('boundary')\">\n <i class=\"fa-solid fa-draw-polygon\"></i> Boundary\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'choropleth'\"\n (click)=\"SetRenderMode('choropleth')\">\n <i class=\"fa-solid fa-map\"></i> Regions\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'heatmap'\"\n (click)=\"SetRenderMode('heatmap')\">\n <i class=\"fa-solid fa-fire\"></i> Heat Map\n </button>\n </div>\n <div class=\"mj-map-info\">\n {{ MarkerCount }} location{{ MarkerCount !== 1 ? 's' : '' }} mapped\n @if (IsTruncated) {\n <span class=\"mj-map-truncated\" title=\"Not all records are displayed. Showing {{ Records.length | number }} of {{ TotalRecordCount | number }} total records.\">\n <i class=\"fa-solid fa-triangle-exclamation\"></i> Showing {{ Records.length | number }} of {{ TotalRecordCount | number }}\n </span>\n }\n </div>\n </div>\n @if (IsLoading) {\n <div class=\"mj-map-loading\">\n <mj-loading text=\"Loading map...\"></mj-loading>\n </div>\n }\n <div #mapContainer class=\"mj-map-container\"></div>\n</div>\n", styles: [":host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.mj-map-view-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.mj-map-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: var(--mj-bg-surface-card);\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n z-index: 1000;\n}\n\n.mj-map-mode-buttons {\n display: flex;\n gap: 4px;\n}\n\n.mj-map-mode-btn {\n padding: 6px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n cursor: pointer;\n font-size: 13px;\n transition: all 0.15s ease;\n}\n\n.mj-map-mode-btn:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n}\n\n.mj-map-mode-btn.active {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-color: var(--mj-brand-primary);\n}\n\n.mj-map-info {\n font-size: 13px;\n color: var(--mj-text-muted);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-map-truncated {\n color: var(--mj-status-warning-text);\n font-size: 12px;\n}\n\n.mj-map-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 500;\n background: var(--mj-bg-surface);\n}\n\n.mj-map-container {\n flex: 1;\n min-height: 400px;\n width: 100%;\n}\n\n.mj-map-container.hidden {\n display: none;\n}\n\n/* Leaflet popup styling \u2014 use hardcoded colors, NOT design tokens.\n Leaflet has its own light theme and popups are always white background.\n Using --mj-text-primary would make text white in dark mode = invisible. */\n:host ::ng-deep .leaflet-popup-content-wrapper {\n border-radius: 6px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n\n:host ::ng-deep .leaflet-popup-content {\n color: #1e293b;\n font-size: 13px;\n margin: 10px 14px;\n}\n\n/* Ensure Leaflet container fills its parent */\n:host ::ng-deep .leaflet-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n/* Compact attribution \u2014 required by OSM terms but unobtrusive */\n:host ::ng-deep .leaflet-control-attribution {\n font-size: 9px;\n padding: 1px 5px;\n background: rgba(255, 255, 255, 0.6);\n color: #666;\n}\n\n:host ::ng-deep .leaflet-control-attribution a {\n color: #666;\n}\n"] }]
395
+ args: [{ standalone: false, selector: 'mj-map-view', template: "<div class=\"mj-map-view-wrapper\">\n <div class=\"mj-map-toolbar\">\n <div class=\"mj-map-mode-buttons\">\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'point'\"\n (click)=\"SetRenderMode('point')\">\n <i class=\"fa-solid fa-location-dot\"></i> Points\n </button>\n @if (HasBoundaryField) {\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'boundary'\"\n (click)=\"SetRenderMode('boundary')\">\n <i class=\"fa-solid fa-draw-polygon\"></i> Boundary\n </button>\n }\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'choropleth'\"\n (click)=\"SetRenderMode('choropleth')\">\n <i class=\"fa-solid fa-map\"></i> Regions\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'heatmap'\"\n (click)=\"SetRenderMode('heatmap')\">\n <i class=\"fa-solid fa-fire\"></i> Heat Map\n </button>\n </div>\n <div class=\"mj-map-info\">\n {{ MarkerCount }} location{{ MarkerCount !== 1 ? 's' : '' }} mapped\n @if (IsTruncated) {\n <span class=\"mj-map-truncated\" title=\"Not all records are displayed. Showing {{ Records.length | number }} of {{ TotalRecordCount | number }} total records.\">\n <i class=\"fa-solid fa-triangle-exclamation\"></i> Showing {{ Records.length | number }} of {{ TotalRecordCount | number }}\n </span>\n }\n </div>\n </div>\n @if (IsLoading) {\n <div class=\"mj-map-loading\">\n <mj-loading text=\"Loading map...\"></mj-loading>\n </div>\n }\n <div #mapContainer class=\"mj-map-container\"></div>\n</div>\n", styles: [":host {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.mj-map-view-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.mj-map-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: var(--mj-bg-surface-card);\n border-bottom: 1px solid var(--mj-border-default);\n flex-shrink: 0;\n z-index: 1000;\n}\n\n.mj-map-mode-buttons {\n display: flex;\n gap: 4px;\n}\n\n.mj-map-mode-btn {\n padding: 6px 12px;\n border: 1px solid var(--mj-border-default);\n border-radius: 4px;\n background: var(--mj-bg-surface);\n color: var(--mj-text-secondary);\n cursor: pointer;\n font-size: 13px;\n transition: all 0.15s ease;\n}\n\n.mj-map-mode-btn:hover {\n background: var(--mj-bg-surface-hover);\n color: var(--mj-text-primary);\n}\n\n.mj-map-mode-btn.active {\n background: var(--mj-brand-primary);\n color: var(--mj-text-inverse);\n border-color: var(--mj-brand-primary);\n}\n\n.mj-map-info {\n font-size: 13px;\n color: var(--mj-text-muted);\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.mj-map-truncated {\n color: var(--mj-status-warning-text);\n font-size: 12px;\n}\n\n.mj-map-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 500;\n background: var(--mj-bg-surface);\n}\n\n.mj-map-container {\n flex: 1;\n min-height: 400px;\n width: 100%;\n}\n\n.mj-map-container.hidden {\n display: none;\n}\n\n/* Leaflet popup styling \u2014 use hardcoded colors, NOT design tokens.\n Leaflet has its own light theme and popups are always white background.\n Using --mj-text-primary would make text white in dark mode = invisible. */\n:host ::ng-deep .leaflet-popup-content-wrapper {\n border-radius: 6px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n\n:host ::ng-deep .leaflet-popup-content {\n color: #1e293b;\n font-size: 13px;\n margin: 10px 14px;\n}\n\n/* Ensure Leaflet container fills its parent */\n:host ::ng-deep .leaflet-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n/* Compact attribution \u2014 required by OSM terms but unobtrusive */\n:host ::ng-deep .leaflet-control-attribution {\n font-size: 9px;\n padding: 1px 5px;\n background: rgba(255, 255, 255, 0.6);\n color: #666;\n}\n\n:host ::ng-deep .leaflet-control-attribution a {\n color: #666;\n}\n"] }]
313
396
  }], null, { mapContainer: [{
314
397
  type: ViewChild,
315
398
  args: ['mapContainer', { static: false }]
@@ -1 +1 @@
1
- {"version":3,"file":"map-view.component.js","sourceRoot":"","sources":["../../src/lib/map-view.component.ts","../../src/lib/map-view.component.html"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EAMZ,SAAS,EACT,iBAAiB,EAEjB,MAAM,EACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;;;;;;ICSpC,gCAA8J;;;IAC1J,wBAAgD;IAAC,YACrD;;;IAAA,iBAAO;;;IAFwB,uBAAA,mLAA8H,CAAA;IACxG,eACrD;IADqD,4IACrD;;;IAKR,+BAA4B;IACxB,iCAA+C;IACnD,iBAAM;;ADjBd,kFAAkF;AAClF,kFAAkF;AAElF;;;;;;;;;;;;;;GAcG;AAOH,MAAM,OAAO,gBAAgB;IACjB,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAGhC,YAAY,CAA8B;IAElD,iDAAiD;IACxC,MAAM,CAAc;IAE7B,kGAAkG;IACzF,OAAO,GAA8B,EAAE,CAAC;IAEjD,sDAAsD;IAC7C,aAAa,GAAW,eAAe,CAAC;IAEjD,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B;YACrB,aACA;YAAA,uFAAmB;YAM3B,AADI,iBAAM,EACJ;YACN,qFAAiB;YAKjB,8BAAkD;YACtD,iBAAM;;YAnCc,eAAuC;YAAvC,oDAAuC;YAKvC,eAA0C;YAA1C,uDAA0C;YAK1C,eAA4C;YAA5C,yDAA4C;YAK5C,eAAyC;YAAzC,sDAAyC;YAMjD,eACA;YADA,sGACA;YAAA,cAIC;YAJD,2CAIC;YAGT,cAIC;YAJD,yCAIC;;;iFDMQ,gBAAgB;cAN5B,SAAS;6BACM,KAAK,YACP,aAAa;;kBAOtB,SAAS;mBAAC,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAI3C,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAIL,KAAK;;kBAOL,KAAK;;kBAGL,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kFA7CE,gBAAgB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n OnInit,\n OnDestroy,\n OnChanges,\n SimpleChanges,\n ElementRef,\n ViewChild,\n ChangeDetectorRef,\n AfterViewInit,\n inject\n} from '@angular/core';\nimport { EntityInfo } from '@memberjunction/core';\nimport { GeoDataEngine } from '@memberjunction/core-entities';\nimport { MapRenderMode, MapDisplayState, MapMarkerClickEvent, MapRegionClickEvent } from './map-view.types';\nimport * as MapCore from '@memberjunction/geo-maps';\n// Leaflet is loaded as a global script at runtime via angular.json scripts array.\n// The L namespace is available globally — see leaflet.d.ts for type declarations.\n\n/**\n * MapViewComponent — Leaflet-based map visualization for geo-enabled MJ entities.\n *\n * Reads `__mj_Latitude` and `__mj_Longitude` from entity records (or custom field overrides)\n * and renders them as interactive markers on an OpenStreetMap tile layer.\n *\n * Supports three rendering modes:\n * - **point** (default): Individual markers with optional clustering\n * - **choropleth**: Region shading by country/state (requires BoundaryGeoJSON)\n * - **heatmap**: Density visualization\n *\n * Delegates all rendering logic to @memberjunction/geo-maps.\n * This component is a thin Angular wrapper managing lifecycle, inputs/outputs,\n * and IntersectionObserver-based deferred initialization.\n */\n@Component({\n standalone: false,\n selector: 'mj-map-view',\n templateUrl: './map-view.component.html',\n styleUrls: ['./map-view.component.css']\n})\nexport class MapViewComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges {\n private cdr = inject(ChangeDetectorRef);\n\n @ViewChild('mapContainer', { static: false })\n private mapContainer!: ElementRef<HTMLDivElement>;\n\n /** Entity metadata for the displayed records. */\n @Input() Entity!: EntityInfo;\n\n /** Array of entity records to render on the map. Accepts BaseEntity[] or plain Record objects. */\n @Input() Records: Record<string, unknown>[] = [];\n\n /** Latitude field name. Defaults to __mj_Latitude. */\n @Input() LatitudeField: string = '__mj_Latitude';\n\n /** Longitude field name. Defaults to __mj_Longitude. */\n @Input() LongitudeField: string = '__mj_Longitude';\n\n /** Current render mode. */\n @Input() RenderMode: MapRenderMode = 'point';\n\n /** Field name containing GeoJSON boundary data on each record (for boundary mode). */\n @Input() BoundaryField: string = 'BoundaryGeoJSON';\n\n\n /** Persisted display state from UserView. */\n @Input() DisplayState: Partial<MapDisplayState> | null = null;\n\n /**\n * Total record count from the server (before any client-side cap).\n * When this exceeds the number of Records passed in, the map shows\n * a truncation indicator so the user knows not all data is displayed.\n */\n @Input() TotalRecordCount: number = 0;\n\n /** Emitted when a marker is clicked. */\n @Output() MarkerClick = new EventEmitter<MapMarkerClickEvent>();\n\n /** Emitted when a choropleth region is clicked. */\n @Output() RegionClick = new EventEmitter<MapRegionClickEvent>();\n\n /** Emitted when display state changes (for persistence). */\n @Output() DisplayStateChange = new EventEmitter<MapDisplayState>();\n\n /** Emitted when render mode changes (supports two-way binding: [(RenderMode)]). */\n @Output() RenderModeChange = new EventEmitter<MapRenderMode>();\n\n private engine: MapCore.MapEngine | null = null;\n private visibilityObserver: IntersectionObserver | null = null;\n private pendingRender = false;\n IsLoading = true;\n MarkerCount = 0;\n\n /** Whether the displayed records are truncated (more exist than were loaded). */\n get IsTruncated(): boolean {\n return this.TotalRecordCount > 0 && this.Records.length < this.TotalRecordCount;\n }\n\n ngOnInit(): void {\n // Map initialization happens when the component becomes visible\n }\n\n ngAfterViewInit(): void {\n // Use IntersectionObserver to detect when the map container becomes visible.\n // Leaflet requires the container to have actual dimensions before initialization.\n // Since the map starts hidden (grid view is default), we defer init until visible.\n this.visibilityObserver = new IntersectionObserver((entries) => {\n const entry = entries[0];\n if (entry.isIntersecting && !this.engine) {\n // First time visible — initialize the map\n this.InitializeMap();\n } else if (entry.isIntersecting && this.engine) {\n // Becoming visible again — fix tile rendering and re-fit\n this.engine.invalidateSize();\n if (this.pendingRender) {\n this.DoRender();\n this.pendingRender = false;\n }\n }\n }, { threshold: 0.1 });\n\n if (this.mapContainer?.nativeElement) {\n this.visibilityObserver.observe(this.mapContainer.nativeElement);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['Records'] || changes['RenderMode']) {\n if (this.engine) {\n setTimeout(() => {\n if (this.engine) {\n this.engine.invalidateSize();\n this.DoRender();\n }\n }, 100);\n } else {\n // Map not initialized yet — mark for render when visible\n this.pendingRender = true;\n }\n }\n }\n\n ngOnDestroy(): void {\n if (this.visibilityObserver) {\n this.visibilityObserver.disconnect();\n this.visibilityObserver = null;\n }\n if (this.engine) {\n this.engine.destroy();\n this.engine = null;\n }\n }\n\n /**\n * Initialize the map engine via MapCore.\n */\n private InitializeMap(): void {\n if (!this.mapContainer?.nativeElement || this.engine) return;\n\n this.engine = MapCore.createEngine({\n container: this.mapContainer.nativeElement,\n center: {\n lat: this.DisplayState?.CenterLat ?? 20,\n lng: this.DisplayState?.CenterLng ?? 0\n },\n zoom: this.DisplayState?.ZoomLevel ?? 2,\n latitudeField: this.LatitudeField,\n longitudeField: this.LongitudeField,\n boundaryField: this.BoundaryField,\n geoResolver: GeoDataEngine.Instance,\n getRecordId: (record: Record<string, unknown>) => {\n const pkFields = this.Entity?.PrimaryKeys ?? [];\n return pkFields.map(pk => this.GetField(record, pk.Name)).join('||');\n },\n getRecordName: (record: Record<string, unknown>) => {\n const nameField = this.Entity?.NameField;\n return nameField ? String(this.GetField(record, nameField.Name) ?? '') : 'Record';\n },\n onMarkerClick: (event: MapCore.MarkerClickEvent) => {\n this.MarkerClick.emit({\n RecordID: event.recordId,\n Latitude: event.lat,\n Longitude: event.lng,\n Record: event.record\n });\n },\n onRegionClick: (event: MapCore.RegionClickEvent) => {\n this.RegionClick.emit({\n RegionName: event.regionName,\n GroupBy: event.groupBy as 'country' | 'state_province',\n RecordCount: event.recordCount,\n Records: event.records\n });\n },\n onPopupRecordClick: (recordId: string) => {\n const record = this.Records.find(r => {\n const pkFields = this.Entity?.PrimaryKeys ?? [];\n const id = pkFields.map(pk => this.GetField(r, pk.Name)).join('||');\n return id === recordId;\n });\n if (record) {\n const lat = this.GetNumericField(record, this.LatitudeField) ?? 0;\n const lng = this.GetNumericField(record, this.LongitudeField) ?? 0;\n this.MarkerClick.emit({\n RecordID: recordId,\n Latitude: lat,\n Longitude: lng,\n Record: record\n });\n }\n },\n onMoveEnd: (state: MapCore.MoveEndEvent) => {\n this.DisplayStateChange.emit({\n ZoomLevel: state.zoom,\n CenterLat: state.centerLat,\n CenterLng: state.centerLng,\n ClusterMarkers: true\n });\n },\n maxPopupRecords: 5\n });\n\n // invalidateSize after a short delay to ensure tile rendering is correct\n // then render markers and fit bounds\n setTimeout(() => {\n if (this.engine) {\n this.engine.invalidateSize();\n this.DoRender();\n this.IsLoading = false;\n this.cdr.detectChanges();\n\n // Double-invalidate after tiles start loading to fix partial rendering\n setTimeout(() => {\n if (this.engine) this.engine.invalidateSize();\n }, 500);\n }\n }, 100);\n }\n\n /**\n * Render records using the current mode, update marker count.\n */\n private DoRender(): void {\n if (!this.engine) return;\n this.engine.render(this.Records, this.RenderMode);\n this.MarkerCount = this.engine.getStats().markerCount;\n this.cdr.detectChanges();\n }\n\n /**\n * Set rendering mode (called from template toolbar buttons).\n */\n SetRenderMode(mode: MapRenderMode): void {\n this.RenderMode = mode;\n this.RenderModeChange.emit(mode);\n this.DoRender();\n }\n\n /**\n * Get a field value from a record, supporting both BaseEntity (with .Get()) and plain objects.\n */\n private GetField(record: Record<string, unknown>, fieldName: string): unknown {\n if ('Get' in record && typeof record['Get'] === 'function') {\n return (record as { Get: (name: string) => unknown }).Get(fieldName);\n }\n return record[fieldName];\n }\n\n /**\n * Get a numeric field value from a record, returning null if not a valid number.\n */\n private GetNumericField(record: Record<string, unknown>, fieldName: string): number | null {\n const val = this.GetField(record, fieldName);\n if (val == null) return null;\n const num = Number(val);\n return isNaN(num) ? null : num;\n }\n}\n","<div class=\"mj-map-view-wrapper\">\n <div class=\"mj-map-toolbar\">\n <div class=\"mj-map-mode-buttons\">\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'point'\"\n (click)=\"SetRenderMode('point')\">\n <i class=\"fa-solid fa-location-dot\"></i> Points\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'boundary'\"\n (click)=\"SetRenderMode('boundary')\">\n <i class=\"fa-solid fa-draw-polygon\"></i> Boundary\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'choropleth'\"\n (click)=\"SetRenderMode('choropleth')\">\n <i class=\"fa-solid fa-map\"></i> Regions\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'heatmap'\"\n (click)=\"SetRenderMode('heatmap')\">\n <i class=\"fa-solid fa-fire\"></i> Heat Map\n </button>\n </div>\n <div class=\"mj-map-info\">\n {{ MarkerCount }} location{{ MarkerCount !== 1 ? 's' : '' }} mapped\n @if (IsTruncated) {\n <span class=\"mj-map-truncated\" title=\"Not all records are displayed. Showing {{ Records.length | number }} of {{ TotalRecordCount | number }} total records.\">\n <i class=\"fa-solid fa-triangle-exclamation\"></i> Showing {{ Records.length | number }} of {{ TotalRecordCount | number }}\n </span>\n }\n </div>\n </div>\n @if (IsLoading) {\n <div class=\"mj-map-loading\">\n <mj-loading text=\"Loading map...\"></mj-loading>\n </div>\n }\n <div #mapContainer class=\"mj-map-container\"></div>\n</div>\n"]}
1
+ {"version":3,"file":"map-view.component.js","sourceRoot":"","sources":["../../src/lib/map-view.component.ts","../../src/lib/map-view.component.html"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EAMZ,SAAS,EACT,iBAAiB,EAEjB,MAAM,EACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC;;;;;;;ICTpC,iCAE4C;IAApC,oLAAS,qBAAc,UAAU,CAAC,KAAC;IACvC,wBAAwC;IAAC,0BAC7C;IAAA,iBAAS;;;IAHD,0DAA0C;;;IAmBlD,gCAA8J;;;IAC1J,wBAAgD;IAAC,YACrD;;;IAAA,iBAAO;;;IAFwB,uBAAA,mLAA8H,CAAA;IACxG,eACrD;IADqD,4IACrD;;;IAKR,+BAA4B;IACxB,iCAA+C;IACnD,iBAAM;;ADnBd,kFAAkF;AAClF,kFAAkF;AAElF;;;;;;;;;;;;;;GAcG;AAOH,MAAM,OAAO,gBAAgB;IACjB,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAGhC,YAAY,CAA8B;IAElD,iDAAiD;IACxC,MAAM,CAAc;IAE7B,kGAAkG;IACzF,OAAO,GAA8B,EAAE,CAAC;IAEjD;;;OAGG;IACM,aAAa,GAAW,eAAe,CAAC;IAEjD,mEAAmE;IAC1D,cAAc,GAAW,gBAAgB,CAAC;IAEnD,2BAA2B;IAClB,UAAU,GAAkB,OAAO,CAAC;IAE7C,sFAAsF;IAC7E,aAAa,GAAW,iBAAiB,CAAC;IAGnD,6CAA6C;IACpC,YAAY,GAAoC,IAAI,CAAC;IAE9D;;;;OAIG;IACM,gBAAgB,GAAW,CAAC,CAAC;IAEtC,wCAAwC;IAC9B,W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D,yCAIC;;;iFDIQ,gBAAgB;cAN5B,SAAS;6BACM,KAAK,YACP,aAAa;;kBAOtB,SAAS;mBAAC,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAI3C,KAAK;;kBAGL,KAAK;;kBAML,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAIL,KAAK;;kBAOL,KAAK;;kBAGL,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kFAhDE,gBAAgB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n OnInit,\n OnDestroy,\n OnChanges,\n SimpleChanges,\n ElementRef,\n ViewChild,\n ChangeDetectorRef,\n AfterViewInit,\n inject\n} from '@angular/core';\nimport { EntityInfo } from '@memberjunction/core';\nimport { GeoDataEngine } from '@memberjunction/core-entities';\nimport { MapRenderMode, MapDisplayState, MapMarkerClickEvent, MapRegionClickEvent } from './map-view.types';\nimport * as MapCore from '@memberjunction/geo-maps';\n// Leaflet is loaded as a global script at runtime via angular.json scripts array.\n// The L namespace is available globally — see leaflet.d.ts for type declarations.\n\n/**\n * MapViewComponent — Leaflet-based map visualization for geo-enabled MJ entities.\n *\n * Reads `__mj_Latitude` and `__mj_Longitude` from entity records (or custom field overrides)\n * and renders them as interactive markers on an OpenStreetMap tile layer.\n *\n * Supports three rendering modes:\n * - **point** (default): Individual markers with optional clustering\n * - **choropleth**: Region shading by country/state (requires BoundaryGeoJSON)\n * - **heatmap**: Density visualization\n *\n * Delegates all rendering logic to @memberjunction/geo-maps.\n * This component is a thin Angular wrapper managing lifecycle, inputs/outputs,\n * and IntersectionObserver-based deferred initialization.\n */\n@Component({\n standalone: false,\n selector: 'mj-map-view',\n templateUrl: './map-view.component.html',\n styleUrls: ['./map-view.component.css']\n})\nexport class MapViewComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges {\n private cdr = inject(ChangeDetectorRef);\n\n @ViewChild('mapContainer', { static: false })\n private mapContainer!: ElementRef<HTMLDivElement>;\n\n /** Entity metadata for the displayed records. */\n @Input() Entity!: EntityInfo;\n\n /** Array of entity records to render on the map. Accepts BaseEntity[] or plain Record objects. */\n @Input() Records: Record<string, unknown>[] = [];\n\n /**\n * Latitude field name. If left at the default, auto-resolves to the field\n * on `Entity` tagged with `ExtendedType='GeoLatitude'`.\n */\n @Input() LatitudeField: string = '__mj_Latitude';\n\n /** Longitude field name. Same auto-resolution as LatitudeField. */\n @Input() LongitudeField: string = '__mj_Longitude';\n\n /** Current render mode. */\n @Input() RenderMode: MapRenderMode = 'point';\n\n /** Field name containing GeoJSON boundary data on each record (for boundary mode). */\n @Input() BoundaryField: string = 'BoundaryGeoJSON';\n\n\n /** Persisted display state from UserView. */\n @Input() DisplayState: Partial<MapDisplayState> | null = null;\n\n /**\n * Total record count from the server (before any client-side cap).\n * When this exceeds the number of Records passed in, the map shows\n * a truncation indicator so the user knows not all data is displayed.\n */\n @Input() TotalRecordCount: number = 0;\n\n /** Emitted when a marker is clicked. */\n @Output() MarkerClick = new EventEmitter<MapMarkerClickEvent>();\n\n /** Emitted when a choropleth region is clicked. */\n @Output() RegionClick = new EventEmitter<MapRegionClickEvent>();\n\n /** Emitted when display state changes (for persistence). */\n @Output() DisplayStateChange = new EventEmitter<MapDisplayState>();\n\n /** Emitted when render mode changes (supports two-way binding: [(RenderMode)]). */\n @Output() RenderModeChange = new EventEmitter<MapRenderMode>();\n\n private engine: MapCore.MapEngine | null = null;\n private visibilityObserver: IntersectionObserver | null = null;\n private pendingRender = false;\n private autoModeApplied = false;\n IsLoading = true;\n MarkerCount = 0;\n\n /** Whether the displayed records are truncated (more exist than were loaded). */\n get IsTruncated(): boolean {\n return this.TotalRecordCount > 0 && this.Records.length < this.TotalRecordCount;\n }\n\n /** True when the entity has a per-record boundary GeoJSON field — gates the Boundary toolbar button. */\n get HasBoundaryField(): boolean {\n if (!this.Entity) return false;\n const fieldName = this.BoundaryField || 'BoundaryGeoJSON';\n return this.Entity.Fields.some(f => f.Name === fieldName);\n }\n\n /**\n * Resolve a lat/lng field name. Explicit override wins; otherwise picks the\n * field tagged with the matching `ExtendedType` on `Entity`.\n */\n private resolveGeoField(input: string, defaultName: string, extendedType: 'GeoLatitude' | 'GeoLongitude'): string {\n if (input && input !== defaultName) return input; // explicit override\n if (this.Entity) {\n const tagged = this.Entity.Fields.find(f => f.ExtendedType === extendedType);\n if (tagged) return tagged.Name;\n }\n return input || defaultName;\n }\n private get effectiveLatitudeField(): string {\n return this.resolveGeoField(this.LatitudeField, '__mj_Latitude', 'GeoLatitude');\n }\n private get effectiveLongitudeField(): string {\n return this.resolveGeoField(this.LongitudeField, '__mj_Longitude', 'GeoLongitude');\n }\n\n ngOnInit(): void {\n // Snap saved 'boundary' → 'point' when the entity has no boundary field\n // (the button is hidden, so the user would be stuck on it).\n if (this.RenderMode === 'boundary' && !this.HasBoundaryField) {\n this.RenderMode = 'point';\n this.RenderModeChange.emit(this.RenderMode);\n }\n }\n\n ngAfterViewInit(): void {\n // Use IntersectionObserver to detect when the map container becomes visible.\n // Leaflet requires the container to have actual dimensions before initialization.\n // Since the map starts hidden (grid view is default), we defer init until visible.\n this.visibilityObserver = new IntersectionObserver((entries) => {\n const entry = entries[0];\n if (entry.isIntersecting && !this.engine) {\n // First time visible — initialize the map\n this.InitializeMap();\n } else if (entry.isIntersecting && this.engine) {\n // Becoming visible again — fix tile rendering and re-fit\n this.engine.invalidateSize();\n if (this.pendingRender) {\n this.DoRender();\n this.pendingRender = false;\n }\n }\n }, { threshold: 0.1 });\n\n if (this.mapContainer?.nativeElement) {\n this.visibilityObserver.observe(this.mapContainer.nativeElement);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n // Entity change invalidates per-Entity config (lat/lng field names,\n // Boundary visibility) cached at engine-init. Tear down so the next\n // render rebuilds against the new Entity.\n if (changes['Entity'] && !changes['Entity'].firstChange && this.engine) {\n this.engine.destroy();\n this.engine = null;\n this.autoModeApplied = false;\n this.IsLoading = true;\n this.cdr.detectChanges();\n if (this.mapContainer?.nativeElement) {\n this.InitializeMap();\n } else {\n this.pendingRender = true;\n }\n return;\n }\n\n if (changes['Records'] || changes['RenderMode']) {\n if (this.engine) {\n setTimeout(() => {\n if (this.engine) {\n this.engine.invalidateSize();\n this.DoRender();\n }\n }, 100);\n } else {\n // Map not initialized yet — mark for render when visible\n this.pendingRender = true;\n }\n }\n }\n\n ngOnDestroy(): void {\n if (this.visibilityObserver) {\n this.visibilityObserver.disconnect();\n this.visibilityObserver = null;\n }\n if (this.engine) {\n this.engine.destroy();\n this.engine = null;\n }\n }\n\n /**\n * Initialize the map engine via MapCore.\n */\n private InitializeMap(): void {\n if (!this.mapContainer?.nativeElement || this.engine) return;\n\n this.engine = MapCore.createEngine({\n container: this.mapContainer.nativeElement,\n center: {\n lat: this.DisplayState?.CenterLat ?? 20,\n lng: this.DisplayState?.CenterLng ?? 0\n },\n zoom: this.DisplayState?.ZoomLevel ?? 2,\n latitudeField: this.effectiveLatitudeField,\n longitudeField: this.effectiveLongitudeField,\n boundaryField: this.BoundaryField,\n geoResolver: GeoDataEngine.Instance,\n getRecordId: (record: Record<string, unknown>) => {\n const pkFields = this.Entity?.PrimaryKeys ?? [];\n return pkFields.map(pk => this.GetField(record, pk.Name)).join('||');\n },\n getRecordName: (record: Record<string, unknown>) => {\n const nameField = this.Entity?.NameField;\n return nameField ? String(this.GetField(record, nameField.Name) ?? '') : 'Record';\n },\n onMarkerClick: (event: MapCore.MarkerClickEvent) => {\n this.MarkerClick.emit({\n RecordID: event.recordId,\n Latitude: event.lat,\n Longitude: event.lng,\n Record: event.record\n });\n },\n onRegionClick: (event: MapCore.RegionClickEvent) => {\n this.RegionClick.emit({\n RegionName: event.regionName,\n GroupBy: event.groupBy as 'country' | 'state_province',\n RecordCount: event.recordCount,\n Records: event.records\n });\n },\n onPopupRecordClick: (recordId: string) => {\n const record = this.Records.find(r => {\n const pkFields = this.Entity?.PrimaryKeys ?? [];\n const id = pkFields.map(pk => this.GetField(r, pk.Name)).join('||');\n return id === recordId;\n });\n if (record) {\n const lat = this.GetNumericField(record, this.LatitudeField) ?? 0;\n const lng = this.GetNumericField(record, this.LongitudeField) ?? 0;\n this.MarkerClick.emit({\n RecordID: recordId,\n Latitude: lat,\n Longitude: lng,\n Record: record\n });\n }\n },\n onMoveEnd: (state: MapCore.MoveEndEvent) => {\n this.DisplayStateChange.emit({\n ZoomLevel: state.zoom,\n CenterLat: state.centerLat,\n CenterLng: state.centerLng,\n ClusterMarkers: true\n });\n },\n maxPopupRecords: 5\n });\n\n // invalidateSize after a short delay to ensure tile rendering is correct\n // then render markers and fit bounds\n setTimeout(() => {\n if (this.engine) {\n this.engine.invalidateSize();\n this.DoRender();\n this.IsLoading = false;\n this.cdr.detectChanges();\n\n // Double-invalidate after tiles start loading to fix partial rendering\n setTimeout(() => {\n if (this.engine) this.engine.invalidateSize();\n }, 500);\n }\n }, 100);\n }\n\n /**\n * Render records using the current mode, update marker count.\n */\n private DoRender(): void {\n if (!this.engine) return;\n this.engine.render(this.Records, this.RenderMode);\n this.MarkerCount = this.engine.getStats().markerCount;\n this.cdr.detectChanges();\n\n // One-shot: if 'point' rendered nothing but records carry GeoJSON\n // (e.g. MJ: Countries), flip to 'boundary' so the map isn't blank.\n // autoModeApplied prevents second-guessing manual mode changes.\n if (!this.autoModeApplied\n && this.RenderMode === 'point'\n && this.MarkerCount === 0\n && this.Records.length > 0\n && this.RecordsHaveBoundaryData()) {\n this.autoModeApplied = true;\n this.SetRenderMode('boundary');\n }\n }\n\n /**\n * True if at least one loaded record carries a non-empty value in the boundary field.\n */\n private RecordsHaveBoundaryData(): boolean {\n const field = this.BoundaryField;\n for (const record of this.Records) {\n const val = this.GetField(record, field);\n if (val != null && val !== '') return true;\n }\n return false;\n }\n\n /**\n * Set rendering mode (called from template toolbar buttons).\n */\n SetRenderMode(mode: MapRenderMode): void {\n this.RenderMode = mode;\n this.RenderModeChange.emit(mode);\n this.DoRender();\n }\n\n /**\n * Get a field value from a record, supporting both BaseEntity (with .Get()) and plain objects.\n */\n private GetField(record: Record<string, unknown>, fieldName: string): unknown {\n if ('Get' in record && typeof record['Get'] === 'function') {\n return (record as { Get: (name: string) => unknown }).Get(fieldName);\n }\n return record[fieldName];\n }\n\n /**\n * Get a numeric field value from a record, returning null if not a valid number.\n */\n private GetNumericField(record: Record<string, unknown>, fieldName: string): number | null {\n const val = this.GetField(record, fieldName);\n if (val == null) return null;\n const num = Number(val);\n return isNaN(num) ? null : num;\n }\n}\n","<div class=\"mj-map-view-wrapper\">\n <div class=\"mj-map-toolbar\">\n <div class=\"mj-map-mode-buttons\">\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'point'\"\n (click)=\"SetRenderMode('point')\">\n <i class=\"fa-solid fa-location-dot\"></i> Points\n </button>\n @if (HasBoundaryField) {\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'boundary'\"\n (click)=\"SetRenderMode('boundary')\">\n <i class=\"fa-solid fa-draw-polygon\"></i> Boundary\n </button>\n }\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'choropleth'\"\n (click)=\"SetRenderMode('choropleth')\">\n <i class=\"fa-solid fa-map\"></i> Regions\n </button>\n <button class=\"mj-map-mode-btn\"\n [class.active]=\"RenderMode === 'heatmap'\"\n (click)=\"SetRenderMode('heatmap')\">\n <i class=\"fa-solid fa-fire\"></i> Heat Map\n </button>\n </div>\n <div class=\"mj-map-info\">\n {{ MarkerCount }} location{{ MarkerCount !== 1 ? 's' : '' }} mapped\n @if (IsTruncated) {\n <span class=\"mj-map-truncated\" title=\"Not all records are displayed. Showing {{ Records.length | number }} of {{ TotalRecordCount | number }} total records.\">\n <i class=\"fa-solid fa-triangle-exclamation\"></i> Showing {{ Records.length | number }} of {{ TotalRecordCount | number }}\n </span>\n }\n </div>\n </div>\n @if (IsLoading) {\n <div class=\"mj-map-loading\">\n <mj-loading text=\"Loading map...\"></mj-loading>\n </div>\n }\n <div #mapContainer class=\"mj-map-container\"></div>\n</div>\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-map-view",
3
- "version": "5.32.0",
3
+ "version": "5.34.0",
4
4
  "description": "MemberJunction: Angular Leaflet-based map component for visualizing geo-enabled entity data",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -21,11 +21,11 @@
21
21
  "@angular/core": "21.1.3"
22
22
  },
23
23
  "dependencies": {
24
- "@memberjunction/core": "5.32.0",
25
- "@memberjunction/core-entities": "5.32.0",
26
- "@memberjunction/global": "5.32.0",
27
- "@memberjunction/geo-maps": "5.32.0",
28
- "@memberjunction/ng-shared-generic": "5.32.0",
24
+ "@memberjunction/core": "5.34.0",
25
+ "@memberjunction/core-entities": "5.34.0",
26
+ "@memberjunction/global": "5.34.0",
27
+ "@memberjunction/geo-maps": "5.34.0",
28
+ "@memberjunction/ng-shared-generic": "5.34.0",
29
29
  "leaflet": "^1.9.4",
30
30
  "@types/leaflet": "^1.9.17",
31
31
  "tslib": "^2.8.1",