@dereekb/dbx-web 9.24.41 → 9.24.43
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.
- package/calendar/package.json +2 -2
- package/esm2020/mapbox/lib/mapbox.store.mjs +47 -13
- package/fesm2015/dereekb-dbx-web-mapbox.mjs +47 -13
- package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-web-mapbox.mjs +47 -13
- package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/lib/layout/list/_list.scss +16 -0
- package/mapbox/esm2020/lib/mapbox.store.mjs +47 -13
- package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +47 -13
- package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +47 -13
- package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/mapbox/lib/mapbox.store.d.ts +17 -0
- package/mapbox/package.json +3 -3
- package/package.json +3 -3
- package/table/package.json +3 -3
|
@@ -3,8 +3,8 @@ import { Injectable, Host, Optional, Inject, Component, ChangeDetectionStrategy,
|
|
|
3
3
|
import * as i2 from '@dereekb/dbx-core';
|
|
4
4
|
import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
|
|
5
5
|
import { asObservable, cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, distinctUntilMapHasDifferentKeys } from '@dereekb/rxjs';
|
|
6
|
-
import { distinctUntilChanged, switchMap, map, combineLatestWith, shareReplay, NEVER, defaultIfEmpty, tap, EMPTY, of, combineLatest, filter, first, startWith, interval, Subject, merge,
|
|
7
|
-
import { LAT_LONG_10M_PRECISION, latLngPointFunction, roundNumberToStepFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isSameVector, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint,
|
|
6
|
+
import { distinctUntilChanged, switchMap, map, combineLatestWith, shareReplay, NEVER, defaultIfEmpty, tap, EMPTY, of, combineLatest, filter, first, startWith, throttleTime, interval, Subject, merge, BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { LAT_LONG_10M_PRECISION, latLngPointFunction, roundNumberToStepFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isSameVector, isSameLatLngBound, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, latLngBoundCenterPoint, addLatLngPoints, vectorMinimumSizeResizeFunction, latLngPoint, DestroyFunctionObject, getValueFromGetter } from '@dereekb/util';
|
|
8
8
|
import { ComponentStore } from '@ngrx/component-store';
|
|
9
9
|
import * as MapboxGl from 'mapbox-gl';
|
|
10
10
|
import { bounds } from '@mapbox/geo-viewport';
|
|
@@ -160,7 +160,11 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
160
160
|
zoomState: 'init',
|
|
161
161
|
rotateState: 'init',
|
|
162
162
|
retainContent: true,
|
|
163
|
-
useVirtualBound: true
|
|
163
|
+
useVirtualBound: true,
|
|
164
|
+
boundRefreshSettings: {
|
|
165
|
+
throttle: 300,
|
|
166
|
+
refreshType: 'always'
|
|
167
|
+
}
|
|
164
168
|
});
|
|
165
169
|
this.dbxMapboxService = dbxMapboxService;
|
|
166
170
|
this.safeLatLngPoint = latLngPointFunction({ wrap: true });
|
|
@@ -413,6 +417,7 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
413
417
|
}
|
|
414
418
|
}), distinctUntilChanged(), shareReplay(1));
|
|
415
419
|
this.mapInstance$ = this.currentMapInstance$.pipe(filterMaybe());
|
|
420
|
+
this.boundRefreshSettings$ = this.state$.pipe(map((x) => x.boundRefreshSettings), shareReplay(1));
|
|
416
421
|
this.moveState$ = this.state$.pipe(map((x) => x.moveState), distinctUntilChanged(), shareReplay(1));
|
|
417
422
|
this.lifecycleState$ = this.state$.pipe(map((x) => x.lifecycleState), distinctUntilChanged(), shareReplay(1));
|
|
418
423
|
this.zoomState$ = this.state$.pipe(map((x) => x.zoomState), distinctUntilChanged(), shareReplay(1));
|
|
@@ -463,11 +468,24 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
463
468
|
}
|
|
464
469
|
}), shareReplay(1));
|
|
465
470
|
this.virtualBound$ = this.viewportBoundFunction$.pipe(switchMap((fn) => {
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
+
return this.boundRefreshSettings$.pipe(switchMap((settings) => {
|
|
472
|
+
const { throttle: throttleMs, refreshType } = settings;
|
|
473
|
+
let obs;
|
|
474
|
+
switch (refreshType) {
|
|
475
|
+
case 'always':
|
|
476
|
+
obs = combineLatest([this.centerNow$, this.zoomNow$]);
|
|
477
|
+
break;
|
|
478
|
+
case 'when_not_rendering':
|
|
479
|
+
case 'only_after_render_finishes':
|
|
480
|
+
obs = this.bound$.pipe(switchMap(() => combineLatest([this.centerNow$, this.zoomNow$]))); // refresh whenever the bound refreshes
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
return obs.pipe(throttleTime(throttleMs, undefined, { leading: true, trailing: true }), map(([center, zoom]) => fn({
|
|
484
|
+
center,
|
|
485
|
+
zoom
|
|
486
|
+
})));
|
|
487
|
+
}));
|
|
488
|
+
}), distinctUntilChanged(isSameLatLngBound), shareReplay(1));
|
|
471
489
|
this.margin$ = this.state$.pipe(map((x) => x.margin), distinctUntilChanged((a, b) => a != null && b != null && a.fullWidth === b.fullWidth && a.leftMargin === b.leftMargin && a.rightMargin === b.rightMargin), shareReplay(1));
|
|
472
490
|
this.reverseMargin$ = this.margin$.pipe(map((x) => {
|
|
473
491
|
if (x) {
|
|
@@ -494,17 +512,32 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
494
512
|
const sw = isDefaultLatLngPoint(boundSw) ? swMostLatLngPoint() : { lat: boundSw.lat, lng: boundSw.lng };
|
|
495
513
|
const ne = isDefaultLatLngPoint(boundNe) ? neMostLatLngPoint() : { lat: boundNe.lat, lng: boundNe.lng };
|
|
496
514
|
return this.latLngBound(sw, ne);
|
|
497
|
-
}))), shareReplay(1))
|
|
515
|
+
}))))), distinctUntilChanged(isSameLatLngBound), shareReplay(1));
|
|
498
516
|
this.rawBound$ = this.whenInitialized$.pipe(switchMap(() => {
|
|
499
|
-
return this.
|
|
500
|
-
|
|
517
|
+
return this.boundRefreshSettings$.pipe(switchMap((settings) => {
|
|
518
|
+
const { throttle: throttleMs, refreshType } = settings;
|
|
519
|
+
let obs;
|
|
520
|
+
switch (refreshType) {
|
|
521
|
+
case 'always':
|
|
522
|
+
obs = this.rawBoundNow$;
|
|
523
|
+
break;
|
|
524
|
+
case 'when_not_rendering':
|
|
525
|
+
obs = this.isRendering$.pipe(switchMap((x) => (x ? EMPTY : this.rawBoundNow$)));
|
|
526
|
+
break;
|
|
527
|
+
case 'only_after_render_finishes':
|
|
528
|
+
obs = this.isRendering$.pipe(onTrueToFalse(), switchMap((x) => this.rawBoundNow$.pipe(first())));
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
return obs.pipe(throttleTime(throttleMs, undefined, { leading: true, trailing: true }));
|
|
532
|
+
}));
|
|
533
|
+
}), distinctUntilChanged(isSameLatLngBound), shareReplay(1));
|
|
501
534
|
this.useVirtualBound$ = this.state$.pipe(map((x) => x.useVirtualBound), distinctUntilChanged(), shareReplay(1));
|
|
502
535
|
this.bound$ = this.useVirtualBound$.pipe(switchMap((useVirtualBound) => {
|
|
503
536
|
if (useVirtualBound) {
|
|
504
537
|
return this.virtualBound$;
|
|
505
538
|
}
|
|
506
539
|
else {
|
|
507
|
-
return this.
|
|
540
|
+
return this.rawBound$;
|
|
508
541
|
}
|
|
509
542
|
}), shareReplay(1));
|
|
510
543
|
this.boundSizing$ = this.bound$.pipe(map((x) => diffLatLngBoundPoints(x)), shareReplay(1));
|
|
@@ -532,7 +565,8 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
532
565
|
this.setMargin = this.updater((state, margin) => ({ ...state, margin: margin && (margin.rightMargin !== 0 || margin.leftMargin !== 0) ? margin : undefined }));
|
|
533
566
|
this.setMinimumVirtualViewportSize = this.updater((state, minimumVirtualViewportSize) => ({ ...state, minimumVirtualViewportSize }));
|
|
534
567
|
this.setUseVirtualBound = this.updater((state, useVirtualBound) => ({ ...state, useVirtualBound }));
|
|
535
|
-
this.
|
|
568
|
+
this.setBoundRefreshSettings = this.updater((state, boundRefreshSettings) => ({ ...state, boundRefreshSettings: { ...state.boundRefreshSettings, ...boundRefreshSettings } }));
|
|
569
|
+
this._setMapService = this.updater((state, mapService) => ({ mapService, moveState: 'init', lifecycleState: 'init', zoomState: 'init', rotateState: 'init', retainContent: state.retainContent, content: state.retainContent ? state.content : undefined, useVirtualBound: state.useVirtualBound, boundRefreshSettings: state.boundRefreshSettings }));
|
|
536
570
|
this._setLifecycleState = this.updater((state, lifecycleState) => ({ ...state, lifecycleState }));
|
|
537
571
|
this._setMoveState = this.updater((state, moveState) => ({ ...state, moveState }));
|
|
538
572
|
this._setZoomState = this.updater((state, zoomState) => ({ ...state, zoomState }));
|