@dereekb/dbx-web 9.7.2 → 9.7.3

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.
Files changed (45) hide show
  1. package/esm2020/lib/layout/list/index.mjs +2 -1
  2. package/esm2020/lib/layout/list/list.grid.view.component.mjs +3 -3
  3. package/esm2020/lib/layout/list/list.track.mjs +9 -0
  4. package/esm2020/lib/layout/list/list.view.directive.mjs +1 -1
  5. package/esm2020/lib/layout/list/list.view.mjs +1 -1
  6. package/esm2020/lib/layout/list/list.view.value.component.mjs +5 -3
  7. package/esm2020/lib/layout/text/text.chips.component.mjs +6 -3
  8. package/esm2020/mapbox/lib/index.mjs +2 -1
  9. package/esm2020/mapbox/lib/mapbox.cdref.service.mjs +3 -1
  10. package/esm2020/mapbox/lib/mapbox.change.service.mjs +44 -0
  11. package/esm2020/mapbox/lib/mapbox.marker.component.mjs +21 -11
  12. package/esm2020/mapbox/lib/mapbox.marker.mjs +1 -1
  13. package/esm2020/mapbox/lib/mapbox.markers.component.mjs +14 -17
  14. package/fesm2015/dereekb-dbx-web-mapbox.mjs +74 -26
  15. package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  16. package/fesm2015/dereekb-dbx-web.mjs +21 -7
  17. package/fesm2015/dereekb-dbx-web.mjs.map +1 -1
  18. package/fesm2020/dereekb-dbx-web-mapbox.mjs +68 -20
  19. package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  20. package/fesm2020/dereekb-dbx-web.mjs +21 -7
  21. package/fesm2020/dereekb-dbx-web.mjs.map +1 -1
  22. package/lib/layout/list/index.d.ts +1 -0
  23. package/lib/layout/list/list.track.d.ts +6 -0
  24. package/lib/layout/list/list.view.d.ts +5 -1
  25. package/lib/layout/list/list.view.directive.d.ts +2 -1
  26. package/lib/layout/list/list.view.value.component.d.ts +2 -0
  27. package/lib/layout/text/text.chips.component.d.ts +1 -0
  28. package/mapbox/esm2020/lib/index.mjs +2 -1
  29. package/mapbox/esm2020/lib/mapbox.cdref.service.mjs +3 -1
  30. package/mapbox/esm2020/lib/mapbox.change.service.mjs +44 -0
  31. package/mapbox/esm2020/lib/mapbox.marker.component.mjs +21 -11
  32. package/mapbox/esm2020/lib/mapbox.marker.mjs +1 -1
  33. package/mapbox/esm2020/lib/mapbox.markers.component.mjs +14 -17
  34. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +74 -26
  35. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  36. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +68 -20
  37. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  38. package/mapbox/lib/index.d.ts +1 -0
  39. package/mapbox/lib/mapbox.cdref.service.d.ts +2 -0
  40. package/mapbox/lib/mapbox.change.service.d.ts +21 -0
  41. package/mapbox/lib/mapbox.marker.component.d.ts +9 -5
  42. package/mapbox/lib/mapbox.marker.d.ts +3 -3
  43. package/mapbox/lib/mapbox.markers.component.d.ts +4 -6
  44. package/mapbox/package.json +3 -3
  45. package/package.json +3 -3
@@ -1,18 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Host, Optional, Inject, Directive, Component, ElementRef, ViewChild, Input, ChangeDetectionStrategy, SkipSelf, Injector, NgModule } from '@angular/core';
3
3
  import * as i2 from '@dereekb/dbx-core';
4
- import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, tapSafeMarkForCheck, DbxInjectionComponentModule } from '@dereekb/dbx-core';
5
- import * as i2$1 from '@angular/common';
6
- import { CommonModule } from '@angular/common';
4
+ import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
5
+ import { switchMap as switchMap$1 } from 'rxjs/operators';
7
6
  import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, asObservable } from '@dereekb/rxjs';
7
+ import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, merge, throttleTime, BehaviorSubject, combineLatestWith } from 'rxjs';
8
8
  import { latLngPointFunction, latLngBoundFunction, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter, LAT_LONG_10M_PRECISION, roundNumberToStepFunction } from '@dereekb/util';
9
9
  import { ComponentStore } from '@ngrx/component-store';
10
- import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime, combineLatestWith } from 'rxjs';
11
10
  import * as MapboxGl from 'mapbox-gl';
12
11
  import { bounds } from '@mapbox/geo-viewport';
12
+ import * as i2$1 from '@angular/common';
13
+ import { CommonModule } from '@angular/common';
13
14
  import * as i1 from 'ngx-mapbox-gl';
14
15
  import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
15
- import * as i3$1 from '@dereekb/dbx-web';
16
+ import * as i4$1 from '@dereekb/dbx-web';
16
17
  import { dbxColorBackground, disableRightClickInCdkBackdrop, DbxRouterAnchorModule } from '@dereekb/dbx-web';
17
18
  import * as i3 from '@angular/material/sidenav';
18
19
  import { MatDrawerContainer, MatSidenavModule } from '@angular/material/sidenav';
@@ -26,6 +27,8 @@ import * as i2$2 from '@angular/material/menu';
26
27
 
27
28
  /**
28
29
  * Provided in the parent component that allows children to import the parent's cdRef for use.
30
+ *
31
+ * @Deprecated consider using DbxMapboxChangeService instead.
29
32
  */
30
33
  class DbxMapboxChangeDetectorRefService {
31
34
  constructor(cdRef) {
@@ -498,6 +501,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
498
501
  args: [DbxMapboxService]
499
502
  }] }]; } });
500
503
 
504
+ /**
505
+ * Provided in the parent component that allows children to emit events related to their lifecycles.
506
+ */
507
+ class DbxMapboxChangeService {
508
+ constructor(dbxMapboxMapStore) {
509
+ this.dbxMapboxMapStore = dbxMapboxMapStore;
510
+ this._markerDestroyed = new Subject();
511
+ this._applyChanges = new Subject();
512
+ this.markerDestroyed$ = this._markerDestroyed;
513
+ this.applyChanges$ = merge(this._applyChanges, this.markerDestroyed$).pipe(throttleTime(100, undefined, { leading: false, trailing: true }));
514
+ this._applyChangesSub = new SubscriptionObject(this.dbxMapboxMapStore.mapService$
515
+ .pipe(switchMap$1((mapService) => this.applyChanges$.pipe(tap(() => {
516
+ mapService.applyChanges();
517
+ }))))
518
+ .subscribe());
519
+ }
520
+ applyChanges() {
521
+ this._applyChanges.next();
522
+ }
523
+ emitMarkerDestroyed() {
524
+ this._markerDestroyed.next();
525
+ }
526
+ ngOnDestroy() {
527
+ this._markerDestroyed.complete();
528
+ this._applyChanges.complete();
529
+ this._applyChangesSub.destroy();
530
+ }
531
+ }
532
+ DbxMapboxChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, deps: [{ token: DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Injectable });
533
+ DbxMapboxChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, providedIn: null });
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, decorators: [{
535
+ type: Injectable,
536
+ args: [{
537
+ providedIn: null
538
+ }]
539
+ }], ctorParameters: function () { return [{ type: DbxMapboxMapStore }]; } });
540
+
501
541
  /**
502
542
  * Directive that configures a MapComponent with content from DbxMapboxService. Connects a host MapService to a parent DbxMapboxMapStore if available.
503
543
  */
@@ -847,6 +887,9 @@ function provideMapboxStoreIfParentIsUnavailable() {
847
887
  }
848
888
 
849
889
  class DbxMapboxMarkerComponent {
890
+ constructor(_dbxMapboxChangeService) {
891
+ this._dbxMapboxChangeService = _dbxMapboxChangeService;
892
+ }
850
893
  get marker() {
851
894
  return this._marker;
852
895
  }
@@ -904,11 +947,14 @@ class DbxMapboxMarkerComponent {
904
947
  };
905
948
  return style;
906
949
  }
950
+ ngOnDestroy() {
951
+ this._dbxMapboxChangeService?.emitMarkerDestroyed();
952
+ }
907
953
  }
908
954
  DbxMapboxMarkerComponent._latLngPoint = latLngPointFunction({ wrap: true });
909
- DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
955
+ DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [{ token: DbxMapboxChangeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
910
956
  DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: { marker: "marker" }, ngImport: i0, template: `
911
- <mgl-marker *ngIf="marker" [lngLat]="latLng">
957
+ <mgl-marker [lngLat]="latLng">
912
958
  <dbx-anchor [anchor]="anchor">
913
959
  <div class="dbx-mapbox-marker">
914
960
  <div class="dbx-mapbox-marker-content" [ngStyle]="style">
@@ -918,11 +964,11 @@ DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0
918
964
  </div>
919
965
  </dbx-anchor>
920
966
  </mgl-marker>
921
- `, isInline: true, styles: [".dbx-mapbox-marker{display:flex;align-items:center;flex-direction:column}.dbx-mapbox-marker .dbx-mapbox-marker-content{display:flex;align-items:center;justify-content:center}.dbx-mapbox-marker .dbx-mapbox-marker-content mat-icon{width:100%;height:100%;font-size:inherit}.dbx-mapbox-marker .dbx-mapbox-marker-label{font-size:.9em}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3$1.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { kind: "component", type: i1.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
967
+ `, isInline: true, styles: [".dbx-mapbox-marker{display:flex;align-items:center;flex-direction:column}.dbx-mapbox-marker .dbx-mapbox-marker-content{display:flex;align-items:center;justify-content:center}.dbx-mapbox-marker .dbx-mapbox-marker-content mat-icon{width:100%;height:100%;font-size:inherit}.dbx-mapbox-marker .dbx-mapbox-marker-label{font-size:.9em}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4$1.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { kind: "component", type: i1.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
922
968
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, decorators: [{
923
969
  type: Component,
924
970
  args: [{ selector: 'dbx-mapbox-marker', template: `
925
- <mgl-marker *ngIf="marker" [lngLat]="latLng">
971
+ <mgl-marker [lngLat]="latLng">
926
972
  <dbx-anchor [anchor]="anchor">
927
973
  <div class="dbx-mapbox-marker">
928
974
  <div class="dbx-mapbox-marker-content" [ngStyle]="style">
@@ -933,7 +979,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
933
979
  </dbx-anchor>
934
980
  </mgl-marker>
935
981
  `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".dbx-mapbox-marker{display:flex;align-items:center;flex-direction:column}.dbx-mapbox-marker .dbx-mapbox-marker-content{display:flex;align-items:center;justify-content:center}.dbx-mapbox-marker .dbx-mapbox-marker-content mat-icon{width:100%;height:100%;font-size:inherit}.dbx-mapbox-marker .dbx-mapbox-marker-label{font-size:.9em}\n"] }]
936
- }], propDecorators: { marker: [{
982
+ }], ctorParameters: function () { return [{ type: DbxMapboxChangeService, decorators: [{
983
+ type: Optional
984
+ }] }]; }, propDecorators: { marker: [{
937
985
  type: Input
938
986
  }] } });
939
987
 
@@ -941,8 +989,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
941
989
  * Component used to render a set of DbxMapboxMarker values from the input data and marker factory.
942
990
  */
943
991
  class DbxMapboxMarkersComponent {
944
- constructor(cdRefService) {
945
- this.cdRefService = cdRefService;
992
+ constructor() {
946
993
  this._data = new BehaviorSubject(undefined);
947
994
  this._markerFactory = new BehaviorSubject(undefined);
948
995
  this.markers$ = combineLatest([this._data.pipe(distinctUntilChanged()), this._markerFactory.pipe(distinctUntilChanged())]).pipe(map(([data, markerFactory]) => {
@@ -952,7 +999,10 @@ class DbxMapboxMarkersComponent {
952
999
  else {
953
1000
  return [];
954
1001
  }
955
- }), tapSafeMarkForCheck(this.cdRefService?.cdRef), shareReplay(1));
1002
+ }), shareReplay(1));
1003
+ }
1004
+ trackMarkerById(index, marker) {
1005
+ return marker.id;
956
1006
  }
957
1007
  get data() {
958
1008
  return this._data.value;
@@ -971,22 +1021,20 @@ class DbxMapboxMarkersComponent {
971
1021
  this._markerFactory.complete();
972
1022
  }
973
1023
  }
974
- DbxMapboxMarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkersComponent, deps: [{ token: DbxMapboxChangeDetectorRefService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1024
+ DbxMapboxMarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
975
1025
  DbxMapboxMarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMarkersComponent, selector: "dbx-mapbox-markers", inputs: { data: "data", markerFactory: "markerFactory" }, ngImport: i0, template: `
976
- <dbx-mapbox-marker *ngFor="let marker of markers$ | async" [marker]="marker"></dbx-mapbox-marker>
1026
+ <dbx-mapbox-marker *ngFor="let marker of markers$ | async; trackBy: trackMarkerById" [marker]="marker"></dbx-mapbox-marker>
977
1027
  `, isInline: true, dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: ["marker"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
978
1028
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkersComponent, decorators: [{
979
1029
  type: Component,
980
1030
  args: [{
981
1031
  selector: 'dbx-mapbox-markers',
982
1032
  template: `
983
- <dbx-mapbox-marker *ngFor="let marker of markers$ | async" [marker]="marker"></dbx-mapbox-marker>
1033
+ <dbx-mapbox-marker *ngFor="let marker of markers$ | async; trackBy: trackMarkerById" [marker]="marker"></dbx-mapbox-marker>
984
1034
  `,
985
1035
  changeDetection: ChangeDetectionStrategy.OnPush
986
1036
  }]
987
- }], ctorParameters: function () { return [{ type: DbxMapboxChangeDetectorRefService, decorators: [{
988
- type: Optional
989
- }] }]; }, propDecorators: { data: [{
1037
+ }], propDecorators: { data: [{
990
1038
  type: Input
991
1039
  }], markerFactory: [{
992
1040
  type: Input
@@ -1158,5 +1206,5 @@ function mapboxZoomLevel(input) {
1158
1206
  * Generated bundle index. Do not edit.
1159
1207
  */
1160
1208
 
1161
- export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeDetectorRefService, DbxMapboxConfig, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, mapboxViewportBoundFunction, mapboxZoomLevel, provideMapboxStoreIfParentIsUnavailable };
1209
+ export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeDetectorRefService, DbxMapboxChangeService, DbxMapboxConfig, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, mapboxViewportBoundFunction, mapboxZoomLevel, provideMapboxStoreIfParentIsUnavailable };
1162
1210
  //# sourceMappingURL=dereekb-dbx-web-mapbox.mjs.map