@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';
7
- 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';
8
- import * as i1 from 'ngx-mapbox-gl';
9
- import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
4
+ import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
5
+ import { switchMap as switchMap$1 } from 'rxjs/operators';
10
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
+ 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';
11
9
  import { ComponentStore } from '@ngrx/component-store';
12
- import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime, combineLatestWith } from 'rxjs';
13
10
  import * as MapboxGl from 'mapbox-gl';
14
11
  import { bounds } from '@mapbox/geo-viewport';
15
- import * as i3$1 from '@dereekb/dbx-web';
12
+ import * as i2$1 from '@angular/common';
13
+ import { CommonModule } from '@angular/common';
14
+ import * as i1 from 'ngx-mapbox-gl';
15
+ import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
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) {
@@ -511,6 +514,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
511
514
  }] }];
512
515
  } });
513
516
 
517
+ /**
518
+ * Provided in the parent component that allows children to emit events related to their lifecycles.
519
+ */
520
+ class DbxMapboxChangeService {
521
+ constructor(dbxMapboxMapStore) {
522
+ this.dbxMapboxMapStore = dbxMapboxMapStore;
523
+ this._markerDestroyed = new Subject();
524
+ this._applyChanges = new Subject();
525
+ this.markerDestroyed$ = this._markerDestroyed;
526
+ this.applyChanges$ = merge(this._applyChanges, this.markerDestroyed$).pipe(throttleTime(100, undefined, { leading: false, trailing: true }));
527
+ this._applyChangesSub = new SubscriptionObject(this.dbxMapboxMapStore.mapService$
528
+ .pipe(switchMap$1((mapService) => this.applyChanges$.pipe(tap(() => {
529
+ mapService.applyChanges();
530
+ }))))
531
+ .subscribe());
532
+ }
533
+ applyChanges() {
534
+ this._applyChanges.next();
535
+ }
536
+ emitMarkerDestroyed() {
537
+ this._markerDestroyed.next();
538
+ }
539
+ ngOnDestroy() {
540
+ this._markerDestroyed.complete();
541
+ this._applyChanges.complete();
542
+ this._applyChangesSub.destroy();
543
+ }
544
+ }
545
+ DbxMapboxChangeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, deps: [{ token: DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Injectable });
546
+ DbxMapboxChangeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, providedIn: null });
547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxChangeService, decorators: [{
548
+ type: Injectable,
549
+ args: [{
550
+ providedIn: null
551
+ }]
552
+ }], ctorParameters: function () { return [{ type: DbxMapboxMapStore }]; } });
553
+
514
554
  /**
515
555
  * Directive that configures a MapComponent with content from DbxMapboxService. Connects a host MapService to a parent DbxMapboxMapStore if available.
516
556
  */
@@ -866,6 +906,9 @@ function provideMapboxStoreIfParentIsUnavailable() {
866
906
  }
867
907
 
868
908
  class DbxMapboxMarkerComponent {
909
+ constructor(_dbxMapboxChangeService) {
910
+ this._dbxMapboxChangeService = _dbxMapboxChangeService;
911
+ }
869
912
  get marker() {
870
913
  return this._marker;
871
914
  }
@@ -922,11 +965,15 @@ class DbxMapboxMarkerComponent {
922
965
  const style = Object.assign(Object.assign({}, (_c = this._marker) === null || _c === void 0 ? void 0 : _c.style), { width: width + 'px', height: height + 'px', 'font-size': width + 'px', 'background-image': image });
923
966
  return style;
924
967
  }
968
+ ngOnDestroy() {
969
+ var _a;
970
+ (_a = this._dbxMapboxChangeService) === null || _a === void 0 ? void 0 : _a.emitMarkerDestroyed();
971
+ }
925
972
  }
926
973
  DbxMapboxMarkerComponent._latLngPoint = latLngPointFunction({ wrap: true });
927
- DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
974
+ 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 });
928
975
  DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: { marker: "marker" }, ngImport: i0, template: `
929
- <mgl-marker *ngIf="marker" [lngLat]="latLng">
976
+ <mgl-marker [lngLat]="latLng">
930
977
  <dbx-anchor [anchor]="anchor">
931
978
  <div class="dbx-mapbox-marker">
932
979
  <div class="dbx-mapbox-marker-content" [ngStyle]="style">
@@ -936,11 +983,11 @@ DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0
936
983
  </div>
937
984
  </dbx-anchor>
938
985
  </mgl-marker>
939
- `, 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 });
986
+ `, 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 });
940
987
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, decorators: [{
941
988
  type: Component,
942
989
  args: [{ selector: 'dbx-mapbox-marker', template: `
943
- <mgl-marker *ngIf="marker" [lngLat]="latLng">
990
+ <mgl-marker [lngLat]="latLng">
944
991
  <dbx-anchor [anchor]="anchor">
945
992
  <div class="dbx-mapbox-marker">
946
993
  <div class="dbx-mapbox-marker-content" [ngStyle]="style">
@@ -951,7 +998,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
951
998
  </dbx-anchor>
952
999
  </mgl-marker>
953
1000
  `, 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"] }]
954
- }], propDecorators: { marker: [{
1001
+ }], ctorParameters: function () {
1002
+ return [{ type: DbxMapboxChangeService, decorators: [{
1003
+ type: Optional
1004
+ }] }];
1005
+ }, propDecorators: { marker: [{
955
1006
  type: Input
956
1007
  }] } });
957
1008
 
@@ -959,9 +1010,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
959
1010
  * Component used to render a set of DbxMapboxMarker values from the input data and marker factory.
960
1011
  */
961
1012
  class DbxMapboxMarkersComponent {
962
- constructor(cdRefService) {
963
- var _a;
964
- this.cdRefService = cdRefService;
1013
+ constructor() {
965
1014
  this._data = new BehaviorSubject(undefined);
966
1015
  this._markerFactory = new BehaviorSubject(undefined);
967
1016
  this.markers$ = combineLatest([this._data.pipe(distinctUntilChanged()), this._markerFactory.pipe(distinctUntilChanged())]).pipe(map(([data, markerFactory]) => {
@@ -971,7 +1020,10 @@ class DbxMapboxMarkersComponent {
971
1020
  else {
972
1021
  return [];
973
1022
  }
974
- }), tapSafeMarkForCheck((_a = this.cdRefService) === null || _a === void 0 ? void 0 : _a.cdRef), shareReplay(1));
1023
+ }), shareReplay(1));
1024
+ }
1025
+ trackMarkerById(index, marker) {
1026
+ return marker.id;
975
1027
  }
976
1028
  get data() {
977
1029
  return this._data.value;
@@ -990,24 +1042,20 @@ class DbxMapboxMarkersComponent {
990
1042
  this._markerFactory.complete();
991
1043
  }
992
1044
  }
993
- 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 });
1045
+ DbxMapboxMarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
994
1046
  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: `
995
- <dbx-mapbox-marker *ngFor="let marker of markers$ | async" [marker]="marker"></dbx-mapbox-marker>
1047
+ <dbx-mapbox-marker *ngFor="let marker of markers$ | async; trackBy: trackMarkerById" [marker]="marker"></dbx-mapbox-marker>
996
1048
  `, 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 });
997
1049
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkersComponent, decorators: [{
998
1050
  type: Component,
999
1051
  args: [{
1000
1052
  selector: 'dbx-mapbox-markers',
1001
1053
  template: `
1002
- <dbx-mapbox-marker *ngFor="let marker of markers$ | async" [marker]="marker"></dbx-mapbox-marker>
1054
+ <dbx-mapbox-marker *ngFor="let marker of markers$ | async; trackBy: trackMarkerById" [marker]="marker"></dbx-mapbox-marker>
1003
1055
  `,
1004
1056
  changeDetection: ChangeDetectionStrategy.OnPush
1005
1057
  }]
1006
- }], ctorParameters: function () {
1007
- return [{ type: DbxMapboxChangeDetectorRefService, decorators: [{
1008
- type: Optional
1009
- }] }];
1010
- }, propDecorators: { data: [{
1058
+ }], propDecorators: { data: [{
1011
1059
  type: Input
1012
1060
  }], markerFactory: [{
1013
1061
  type: Input
@@ -1183,5 +1231,5 @@ function mapboxZoomLevel(input) {
1183
1231
  * Generated bundle index. Do not edit.
1184
1232
  */
1185
1233
 
1186
- 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 };
1234
+ 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 };
1187
1235
  //# sourceMappingURL=dereekb-dbx-web-mapbox.mjs.map