@dereekb/dbx-web 9.23.21 → 9.23.22
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/esm2020/lib/calendar.base.component.mjs +2 -2
- package/calendar/esm2020/lib/calendar.store.mjs +8 -3
- package/calendar/fesm2015/dereekb-dbx-web-calendar.mjs +9 -4
- package/calendar/fesm2015/dereekb-dbx-web-calendar.mjs.map +1 -1
- package/calendar/fesm2020/dereekb-dbx-web-calendar.mjs +9 -4
- package/calendar/fesm2020/dereekb-dbx-web-calendar.mjs.map +1 -1
- package/calendar/lib/calendar.store.d.ts +1 -0
- package/calendar/package.json +3 -3
- package/esm2020/calendar/lib/calendar.base.component.mjs +2 -2
- package/esm2020/calendar/lib/calendar.store.mjs +8 -3
- package/esm2020/mapbox/lib/mapbox.rxjs.mjs +1 -1
- package/esm2020/mapbox/lib/mapbox.store.mjs +10 -1
- package/fesm2015/dereekb-dbx-web-calendar.mjs +9 -4
- package/fesm2015/dereekb-dbx-web-calendar.mjs.map +1 -1
- package/fesm2015/dereekb-dbx-web-mapbox.mjs +57 -53
- package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-web-calendar.mjs +9 -4
- package/fesm2020/dereekb-dbx-web-calendar.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-web-mapbox.mjs +61 -53
- package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/mapbox/esm2020/lib/mapbox.rxjs.mjs +1 -1
- package/mapbox/esm2020/lib/mapbox.store.mjs +10 -1
- package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +57 -53
- package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +61 -53
- package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
- package/mapbox/lib/mapbox.rxjs.d.ts +2 -1
- package/mapbox/lib/mapbox.store.d.ts +3 -1
- package/mapbox/package.json +3 -3
- package/package.json +3 -3
- package/table/package.json +3 -3
|
@@ -2,9 +2,9 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, Host, Optional, Inject, Component, ChangeDetectionStrategy, SkipSelf, Directive, Injector, ElementRef, ViewChild, Input, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@dereekb/dbx-core';
|
|
4
4
|
import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
|
|
5
|
-
import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, distinctUntilMapHasDifferentKeys
|
|
6
|
-
import { switchMap,
|
|
7
|
-
import { latLngPointFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter
|
|
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, throttleTime, BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { LAT_LONG_10M_PRECISION, latLngPointFunction, roundNumberToStepFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, 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';
|
|
@@ -99,6 +99,56 @@ function mapboxViewportBoundFunction(config) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Filters the input objects based on their center and zoom values.
|
|
104
|
+
*
|
|
105
|
+
* This function caches the bounds computations for each of the input values.
|
|
106
|
+
*
|
|
107
|
+
* @param config
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
function filterByMapboxViewportBound(config) {
|
|
111
|
+
const { boundDecisionObs: inputBoundDecisionObs, boundFunctionObs: inputBoundFunctionObs, defaultZoom: inputDefaultZoom = 17, readValue, zoomRounding, precision = LAT_LONG_10M_PRECISION } = config;
|
|
112
|
+
const _latLngPoint = latLngPointFunction({ wrap: false, validate: false, precision });
|
|
113
|
+
const _roundZoom = roundNumberToStepFunction(zoomRounding || { step: 0.5, round: 'floor' });
|
|
114
|
+
const boundDecisionObs = asObservable(inputBoundDecisionObs);
|
|
115
|
+
const boundFunctionObs = asObservable(inputBoundFunctionObs);
|
|
116
|
+
return (input) => {
|
|
117
|
+
return boundFunctionObs.pipe(distinctUntilChanged(), switchMap((viewportBoundFunction) => {
|
|
118
|
+
const cache = new Map();
|
|
119
|
+
return input.pipe(map((values) => {
|
|
120
|
+
return values.map((value) => {
|
|
121
|
+
const item = readValue(value);
|
|
122
|
+
const centerLatLng = _latLngPoint(item.center);
|
|
123
|
+
const zoomStep = _roundZoom(item.zoom || inputDefaultZoom);
|
|
124
|
+
const cacheKey = `${zoomStep}_${centerLatLng.lat}_${centerLatLng.lng}`;
|
|
125
|
+
const cachedValue = cache.get(cacheKey);
|
|
126
|
+
let bound;
|
|
127
|
+
if (!cachedValue) {
|
|
128
|
+
bound = viewportBoundFunction({ center: centerLatLng, zoom: zoomStep });
|
|
129
|
+
cache.set(cacheKey, bound);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
bound = cachedValue;
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
value,
|
|
136
|
+
bound
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}), combineLatestWith(boundDecisionObs), map(([items, boundFunction]) => {
|
|
140
|
+
const valuesInBounds = [];
|
|
141
|
+
items.forEach((item) => {
|
|
142
|
+
if (boundFunction(item.bound)) {
|
|
143
|
+
valuesInBounds.push(item.value);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return valuesInBounds;
|
|
147
|
+
}));
|
|
148
|
+
}), shareReplay(1));
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
102
152
|
/**
|
|
103
153
|
* Store used for retrieving information.
|
|
104
154
|
*/
|
|
@@ -510,6 +560,14 @@ class DbxMapboxMapStore extends ComponentStore {
|
|
|
510
560
|
return newCenter;
|
|
511
561
|
}))));
|
|
512
562
|
}
|
|
563
|
+
filterByViewportBound(input) {
|
|
564
|
+
const config = typeof input === 'function' ? { readValue: input } : input;
|
|
565
|
+
return filterByMapboxViewportBound({
|
|
566
|
+
...config,
|
|
567
|
+
boundFunctionObs: this.viewportBoundFunction$,
|
|
568
|
+
boundDecisionObs: this.overlapsBoundFunction$
|
|
569
|
+
});
|
|
570
|
+
}
|
|
513
571
|
}
|
|
514
572
|
DbxMapboxMapStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxMapStore, deps: [{ token: DbxMapboxService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
515
573
|
DbxMapboxMapStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxMapStore });
|
|
@@ -1294,56 +1352,6 @@ function dbxMapboxColoredDotStyle(background, color) {
|
|
|
1294
1352
|
};
|
|
1295
1353
|
}
|
|
1296
1354
|
|
|
1297
|
-
/**
|
|
1298
|
-
* Filters the input objects based on their center and zoom values.
|
|
1299
|
-
*
|
|
1300
|
-
* This function caches the bounds computations for each of the input values.
|
|
1301
|
-
*
|
|
1302
|
-
* @param config
|
|
1303
|
-
* @returns
|
|
1304
|
-
*/
|
|
1305
|
-
function filterByMapboxViewportBound(config) {
|
|
1306
|
-
const { boundDecisionObs: inputBoundDecisionObs, boundFunctionObs: inputBoundFunctionObs, defaultZoom: inputDefaultZoom = 17, readValue, zoomRounding, precision = LAT_LONG_10M_PRECISION } = config;
|
|
1307
|
-
const _latLngPoint = latLngPointFunction({ wrap: false, validate: false, precision });
|
|
1308
|
-
const _roundZoom = roundNumberToStepFunction(zoomRounding || { step: 0.5, round: 'floor' });
|
|
1309
|
-
const boundDecisionObs = asObservable(inputBoundDecisionObs);
|
|
1310
|
-
const boundFunctionObs = asObservable(inputBoundFunctionObs);
|
|
1311
|
-
return (input) => {
|
|
1312
|
-
return boundFunctionObs.pipe(distinctUntilChanged(), switchMap((viewportBoundFunction) => {
|
|
1313
|
-
const cache = new Map();
|
|
1314
|
-
return input.pipe(map((values) => {
|
|
1315
|
-
return values.map((value) => {
|
|
1316
|
-
const item = readValue(value);
|
|
1317
|
-
const centerLatLng = _latLngPoint(item.center);
|
|
1318
|
-
const zoomStep = _roundZoom(item.zoom || inputDefaultZoom);
|
|
1319
|
-
const cacheKey = `${zoomStep}_${centerLatLng.lat}_${centerLatLng.lng}`;
|
|
1320
|
-
const cachedValue = cache.get(cacheKey);
|
|
1321
|
-
let bound;
|
|
1322
|
-
if (!cachedValue) {
|
|
1323
|
-
bound = viewportBoundFunction({ center: centerLatLng, zoom: zoomStep });
|
|
1324
|
-
cache.set(cacheKey, bound);
|
|
1325
|
-
}
|
|
1326
|
-
else {
|
|
1327
|
-
bound = cachedValue;
|
|
1328
|
-
}
|
|
1329
|
-
return {
|
|
1330
|
-
value,
|
|
1331
|
-
bound
|
|
1332
|
-
};
|
|
1333
|
-
});
|
|
1334
|
-
}), combineLatestWith(boundDecisionObs), map(([items, boundFunction]) => {
|
|
1335
|
-
const valuesInBounds = [];
|
|
1336
|
-
items.forEach((item) => {
|
|
1337
|
-
if (boundFunction(item.bound)) {
|
|
1338
|
-
valuesInBounds.push(item.value);
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1341
|
-
return valuesInBounds;
|
|
1342
|
-
}));
|
|
1343
|
-
}), shareReplay(1));
|
|
1344
|
-
};
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
1355
|
const KNOWN_MAPBOX_STYLES = [
|
|
1348
1356
|
//
|
|
1349
1357
|
'mapbox://styles/mapbox/streets-v11',
|