@dereekb/dbx-form 9.3.2 → 9.3.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.
- package/esm2020/mapbox/lib/field/latlng/latlng.field.component.mjs +23 -18
- package/esm2020/mapbox/lib/field/latlng/latlng.module.mjs +5 -1
- package/fesm2015/dereekb-dbx-form-mapbox.mjs +25 -17
- package/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-mapbox.mjs +25 -17
- package/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/mapbox/esm2020/lib/field/latlng/latlng.field.component.mjs +23 -18
- package/mapbox/esm2020/lib/field/latlng/latlng.module.mjs +5 -1
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs +25 -17
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs +25 -17
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/mapbox/lib/field/latlng/latlng.field.component.d.ts +6 -4
- package/mapbox/lib/field/latlng/latlng.module.d.ts +6 -5
- package/mapbox/package.json +4 -4
- package/package.json +3 -3
|
@@ -7,19 +7,21 @@ import { Component, Optional, NgModule } from '@angular/core';
|
|
|
7
7
|
import { FieldType } from '@ngx-formly/material';
|
|
8
8
|
import { BehaviorSubject, switchMap, startWith, shareReplay, map, filter, first } from 'rxjs';
|
|
9
9
|
import { SubscriptionObject, filterMaybe } from '@dereekb/rxjs';
|
|
10
|
+
import * as i3 from '@dereekb/dbx-web/mapbox';
|
|
11
|
+
import { DbxMapboxMapStore, DbxMapboxModule } from '@dereekb/dbx-web/mapbox';
|
|
10
12
|
import * as i2 from '@ng-web-apis/geolocation';
|
|
11
|
-
import * as
|
|
13
|
+
import * as i4 from '@angular/common';
|
|
12
14
|
import { CommonModule } from '@angular/common';
|
|
13
|
-
import * as
|
|
15
|
+
import * as i5 from '@angular/material/icon';
|
|
14
16
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
-
import * as
|
|
17
|
+
import * as i6 from '@angular/material/button';
|
|
16
18
|
import { MatButtonModule } from '@angular/material/button';
|
|
17
|
-
import * as
|
|
19
|
+
import * as i7 from '@angular/forms';
|
|
18
20
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
19
|
-
import * as
|
|
20
|
-
import * as
|
|
21
|
+
import * as i8 from '@angular/material/form-field';
|
|
22
|
+
import * as i9 from '@angular/material/input';
|
|
21
23
|
import { MatInputModule } from '@angular/material/input';
|
|
22
|
-
import * as
|
|
24
|
+
import * as i10 from 'ngx-mapbox-gl';
|
|
23
25
|
import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
|
|
24
26
|
import * as i1$1 from '@ngx-formly/core';
|
|
25
27
|
import { FormlyModule } from '@ngx-formly/core';
|
|
@@ -43,16 +45,17 @@ function mapboxLatLngField(config = {}) {
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
46
|
-
constructor(compact, geolocation
|
|
48
|
+
constructor(compact, geolocation$, dbxMapboxMapStore) {
|
|
47
49
|
var _a;
|
|
48
50
|
super();
|
|
49
51
|
this.compact = compact;
|
|
50
52
|
this.geolocation$ = geolocation$;
|
|
53
|
+
this.dbxMapboxMapStore = dbxMapboxMapStore;
|
|
51
54
|
this.compactClass$ = mapCompactModeObs((_a = this.compact) === null || _a === void 0 ? void 0 : _a.mode$, {
|
|
52
55
|
compact: 'dbx-texteditor-field-compact'
|
|
53
56
|
});
|
|
54
57
|
this._sub = new SubscriptionObject();
|
|
55
|
-
this._zoom = new BehaviorSubject(
|
|
58
|
+
this._zoom = new BehaviorSubject(12);
|
|
56
59
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
57
60
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
58
61
|
this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
|
|
@@ -61,7 +64,7 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
61
64
|
this.zoom$ = this._zoom.asObservable();
|
|
62
65
|
}
|
|
63
66
|
get zoom() {
|
|
64
|
-
return
|
|
67
|
+
return Math.min(this.field.props.zoom || 12, 18);
|
|
65
68
|
}
|
|
66
69
|
get formGroupName() {
|
|
67
70
|
return this.field.key;
|
|
@@ -83,6 +86,8 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
83
86
|
this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);
|
|
84
87
|
this._formControlObs.next(this.formControl);
|
|
85
88
|
this._zoom.next(this.zoom);
|
|
89
|
+
this.dbxMapboxMapStore.setCenter(this.center$);
|
|
90
|
+
this.dbxMapboxMapStore.setZoom(this.zoom$);
|
|
86
91
|
if (this.props.readonly) {
|
|
87
92
|
this.formControl.disable();
|
|
88
93
|
}
|
|
@@ -108,11 +113,11 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
108
113
|
this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
|
-
DbxFormMapboxLatLngFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: [{ token: i1.CompactContextStore, optional: true }, { token: i2.GeolocationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
112
|
-
DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxFormMapboxLatLngFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
|
|
116
|
+
DbxFormMapboxLatLngFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: [{ token: i1.CompactContextStore, optional: true }, { token: i2.GeolocationService }, { token: i3.DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Component });
|
|
117
|
+
DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxFormMapboxLatLngFieldComponent, selector: "ng-component", providers: [DbxMapboxMapStore], usesInheritance: true, ngImport: i0, template: `
|
|
113
118
|
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
114
119
|
<div class="dbx-mapbox-latlng-field-map">
|
|
115
|
-
<mgl-map
|
|
120
|
+
<mgl-map dbxMapboxMap>
|
|
116
121
|
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
117
122
|
</mgl-map>
|
|
118
123
|
</div>
|
|
@@ -126,13 +131,13 @@ DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion
|
|
|
126
131
|
</mat-form-field>
|
|
127
132
|
</div>
|
|
128
133
|
</div>
|
|
129
|
-
`, isInline: true, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"], dependencies: [{ kind: "directive", type:
|
|
134
|
+
`, isInline: true, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i7.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "customMapboxApiUrl", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "minZoom", "maxZoom", "minPitch", "maxPitch", "scrollZoom", "dragRotate", "touchPitch", "touchZoomRotate", "doubleClickZoom", "keyboard", "dragPan", "boxZoom", "style", "center", "maxBounds", "zoom", "bearing", "pitch", "fitBoundsOptions", "renderWorldCopies", "projection", "movingMethod", "movingOptions", "fitBounds", "fitScreenCoordinates", "centerWithPanTo", "panToOptions", "cursorStyle"], outputs: ["mapResize", "mapRemove", "mapMouseDown", "mapMouseUp", "mapMouseMove", "mapClick", "mapDblClick", "mapMouseOver", "mapMouseOut", "mapContextMenu", "mapTouchStart", "mapTouchEnd", "mapTouchMove", "mapTouchCancel", "mapWheel", "moveStart", "move", "moveEnd", "mapDragStart", "mapDrag", "mapDragEnd", "zoomStart", "zoomEvt", "zoomEnd", "rotateStart", "rotate", "rotateEnd", "pitchStart", "pitchEvt", "pitchEnd", "boxZoomStart", "boxZoomEnd", "boxZoomCancel", "webGlContextLost", "webGlContextRestored", "mapLoad", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing", "resize", "remove", "mouseDown", "mouseUp", "mouseMove", "click", "dblClick", "mouseOver", "mouseOut", "contextMenu", "touchStart", "touchEnd", "touchMove", "touchCancel", "wheel", "dragStart", "drag", "dragEnd", "load", "error"] }, { kind: "component", type: i10.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
|
|
130
135
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, decorators: [{
|
|
131
136
|
type: Component,
|
|
132
137
|
args: [{ template: `
|
|
133
138
|
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
134
139
|
<div class="dbx-mapbox-latlng-field-map">
|
|
135
|
-
<mgl-map
|
|
140
|
+
<mgl-map dbxMapboxMap>
|
|
136
141
|
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
137
142
|
</mgl-map>
|
|
138
143
|
</div>
|
|
@@ -146,11 +151,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
146
151
|
</mat-form-field>
|
|
147
152
|
</div>
|
|
148
153
|
</div>
|
|
149
|
-
`, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"] }]
|
|
154
|
+
`, providers: [DbxMapboxMapStore], styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"] }]
|
|
150
155
|
}], ctorParameters: function () {
|
|
151
156
|
return [{ type: i1.CompactContextStore, decorators: [{
|
|
152
157
|
type: Optional
|
|
153
|
-
}] }, { type: i2.GeolocationService }];
|
|
158
|
+
}] }, { type: i2.GeolocationService }, { type: i3.DbxMapboxMapStore }];
|
|
154
159
|
} });
|
|
155
160
|
|
|
156
161
|
class DbxFormMapboxLatLngModule {
|
|
@@ -160,6 +165,7 @@ DbxFormMapboxLatLngModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0
|
|
|
160
165
|
MatIconModule,
|
|
161
166
|
MatButtonModule,
|
|
162
167
|
DbxTextModule,
|
|
168
|
+
DbxMapboxModule,
|
|
163
169
|
FormsModule,
|
|
164
170
|
ReactiveFormsModule,
|
|
165
171
|
MatInputModule, i1$1.FormlyModule, NgxMapboxGLModule] });
|
|
@@ -167,6 +173,7 @@ DbxFormMapboxLatLngModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
|
|
|
167
173
|
MatIconModule,
|
|
168
174
|
MatButtonModule,
|
|
169
175
|
DbxTextModule,
|
|
176
|
+
DbxMapboxModule,
|
|
170
177
|
FormsModule,
|
|
171
178
|
ReactiveFormsModule,
|
|
172
179
|
MatInputModule,
|
|
@@ -182,6 +189,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
182
189
|
MatIconModule,
|
|
183
190
|
MatButtonModule,
|
|
184
191
|
DbxTextModule,
|
|
192
|
+
DbxMapboxModule,
|
|
185
193
|
FormsModule,
|
|
186
194
|
ReactiveFormsModule,
|
|
187
195
|
MatInputModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-mapbox.mjs","sources":["../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.module.ts","../../../../../packages/dbx-form/mapbox/src/lib/mapbox.module.ts","../../../../../packages/dbx-form/mapbox/src/dereekb-dbx-form-mapbox.ts"],"sourcesContent":["import { DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DescriptionFieldConfig, FieldConfig, formlyField, LabeledFieldConfig, propsForFieldConfig, styleWrapper, validatorsForFieldConfig } from '@dereekb/dbx-form';\nimport { LAT_LNG_PATTERN } from '@dereekb/util';\nimport { FormlyFieldConfig } from '@ngx-formly/core';\n\nexport interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig> {}\n\nexport function mapboxLatLngField(config: MapboxLatLngFieldConfig = {}): FormlyFieldConfig {\n const { key = 'latLng' } = config;\n const fieldConfig: FormlyFieldConfig = {\n ...formlyField({\n key,\n type: 'mapbox-latlng-picker',\n ...propsForFieldConfig(config, {\n label: config.label ?? 'Location Picker',\n placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,\n pattern: LAT_LNG_PATTERN,\n autocomplete: false\n })\n }),\n ...validatorsForFieldConfig({\n messages: {\n pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE\n }\n })\n };\n\n return styleWrapper(fieldConfig, {\n classGetter: 'dbx-mat-form-field-disable-underline'\n });\n}\n","import { AbstractControl, FormControl, FormGroup } from '@angular/forms';\nimport { CompactContextStore, mapCompactModeObs } from '@dereekb/dbx-web';\nimport { Component, OnDestroy, OnInit, Optional } from '@angular/core';\nimport { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';\nimport { FieldType } from '@ngx-formly/material';\nimport { Editor, Validators } from 'ngx-editor';\nimport { first, BehaviorSubject, debounceTime, distinctUntilChanged, filter, shareReplay, startWith, switchMap, map, Observable, combineLatest, of } from 'rxjs';\nimport { filterMaybe, SubscriptionObject } from '@dereekb/rxjs';\nimport { Maybe, latLngString, LatLngString, LatLngPoint, LatLngPointFunctionConfig, latLngPoint, LatLngStringFunction, latLngStringFunction } from '@dereekb/util';\nimport { isSameMinute } from 'date-fns';\nimport { GeolocationService } from '@ng-web-apis/geolocation';\nimport { Marker } from 'mapbox-gl';\n\nexport interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {\n zoom?: number;\n latLngConfig?: LatLngPointFunctionConfig;\n}\n\n@Component({\n template: `\n <div class=\"dbx-mapbox-latlng-field\" [ngClass]=\"(compactClass$ | async) ?? ''\" [formGroup]=\"formGroup\">\n <div class=\"dbx-mapbox-latlng-field-map\">\n <mgl-map [style]=\"'mapbox://styles/mapbox/streets-v9'\" [zoom]=\"(zoom$ | async) || [8]\" [center]=\"(center$ | async) || [0, 0]\">\n <mgl-marker [lngLat]=\"(latLng$ | async) || [0, 0]\" [draggable]=\"!isReadonlyOrDisabled\" (markerDragEnd)=\"onDragEnd($event)\"></mgl-marker>\n </mgl-map>\n </div>\n <div class=\"dbx-mapbox-latlng-field-input\">\n <button mat-icon-button (click)=\"useCurrentLocation()\" [disabled]=\"isReadonlyOrDisabled\">\n <mat-icon>my_location</mat-icon>\n </button>\n <mat-form-field class=\"dbx-mapbox-latlng-field-input-field\">\n <mat-label>Coordinates</mat-label>\n <input type=\"text\" matInput [placeholder]=\"placeholder\" [formControl]=\"formControl\" />\n </mat-form-field>\n </div>\n </div>\n `,\n styleUrls: ['./latlng.field.component.scss']\n})\nexport class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {\n private _latLngStringFunction!: LatLngStringFunction;\n\n readonly compactClass$ = mapCompactModeObs(this.compact?.mode$, {\n compact: 'dbx-texteditor-field-compact'\n });\n\n private _sub = new SubscriptionObject();\n private _zoom = new BehaviorSubject<[number]>([12]);\n\n private _formControlObs = new BehaviorSubject<Maybe<AbstractControl>>(undefined);\n readonly formControl$ = this._formControlObs.pipe(filterMaybe());\n\n readonly value$ = this.formControl$.pipe(\n switchMap((control) => control.valueChanges.pipe(startWith(control.value))),\n shareReplay(1)\n );\n\n readonly latLng$: Observable<LatLngPoint> = this.value$.pipe(\n filterMaybe(),\n map((x) => latLngPoint(x)),\n filter((x) => x.lat !== 0 && x.lng !== 0),\n shareReplay(1)\n );\n\n readonly center$ = this.latLng$;\n readonly zoom$ = this._zoom.asObservable();\n\n constructor(@Optional() readonly compact: CompactContextStore, private readonly geolocation$: GeolocationService) {\n super();\n }\n\n get zoom(): [number] {\n return [Math.min(this.field.props.zoom || 12, 18)];\n }\n\n get formGroupName(): string {\n return this.field.key as string;\n }\n\n get formGroup(): FormGroup {\n return this.form as FormGroup;\n }\n\n get label(): Maybe<string> {\n return this.field.props?.label;\n }\n\n get description(): Maybe<string> {\n return this.props.description;\n }\n\n get isReadonlyOrDisabled() {\n return this.props.readonly || this.disabled;\n }\n\n ngOnInit(): void {\n this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);\n this._formControlObs.next(this.formControl);\n this._zoom.next(this.zoom);\n\n if (this.props.readonly) {\n this.formControl.disable();\n }\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this._formControlObs.complete();\n this._zoom.complete();\n this._sub.destroy();\n }\n\n useCurrentLocation() {\n this._sub.subscription = this.geolocation$.pipe(first()).subscribe((position) => {\n if (position) {\n const { latitude: lat, longitude: lng } = position.coords;\n this.setValue({ lat, lng });\n }\n });\n }\n\n onDragEnd(marker: Marker) {\n this.setValue(marker.getLngLat());\n }\n\n setValue(latLng?: Maybe<LatLngPoint>) {\n this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DbxFormMapboxLatLngFieldComponent } from './latlng.field.component';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { DbxTextModule } from '@dereekb/dbx-web';\nimport { NgxMapboxGLModule } from 'ngx-mapbox-gl';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\n\n@NgModule({\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n DbxTextModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n FormlyModule.forChild({\n types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]\n }),\n NgxMapboxGLModule\n ],\n declarations: [DbxFormMapboxLatLngFieldComponent]\n})\nexport class DbxFormMapboxLatLngModule {}\n","import { NgModule } from '@angular/core';\nimport { DbxFormMapboxLatLngModule } from './field/latlng/latlng.module';\n\n@NgModule({\n exports: [DbxFormMapboxLatLngModule]\n})\nexport class DbxFormMapboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMgB,SAAA,iBAAiB,CAAC,MAAA,GAAkC,EAAE,EAAA;;AACpE,IAAA,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;AAClC,IAAA,MAAM,WAAW,GAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACZ,WAAW,CAAA,MAAA,CAAA,MAAA,CAAA,EACZ,GAAG,EACH,IAAI,EAAE,sBAAsB,EAAA,EACzB,mBAAmB,CAAC,MAAM,EAAE;AAC7B,QAAA,KAAK,EAAE,CAAA,EAAA,GAAA,MAAM,CAAC,KAAK,mCAAI,iBAAiB;AACxC,QAAA,WAAW,EAAE,sCAAsC;AACnD,QAAA,OAAO,EAAE,eAAe;AACxB,QAAA,YAAY,EAAE,KAAK;KACpB,CAAC,CAAA,CACF,CACC,EAAA,wBAAwB,CAAC;AAC1B,QAAA,QAAQ,EAAE;AACR,YAAA,OAAO,EAAE,0CAA0C;AACpD,SAAA;AACF,KAAA,CAAC,CACH,CAAC;IAEF,OAAO,YA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AAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;2FAExB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,yBAAyB,CAAC;iBACrC,CAAA;;;ACLD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"dereekb-dbx-form-mapbox.mjs","sources":["../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.module.ts","../../../../../packages/dbx-form/mapbox/src/lib/mapbox.module.ts","../../../../../packages/dbx-form/mapbox/src/dereekb-dbx-form-mapbox.ts"],"sourcesContent":["import { DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DescriptionFieldConfig, FieldConfig, formlyField, LabeledFieldConfig, propsForFieldConfig, styleWrapper, validatorsForFieldConfig } from '@dereekb/dbx-form';\nimport { LAT_LNG_PATTERN } from '@dereekb/util';\nimport { FormlyFieldConfig } from '@ngx-formly/core';\n\nexport interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig> {}\n\nexport function mapboxLatLngField(config: MapboxLatLngFieldConfig = {}): FormlyFieldConfig {\n const { key = 'latLng' } = config;\n const fieldConfig: FormlyFieldConfig = {\n ...formlyField({\n key,\n type: 'mapbox-latlng-picker',\n ...propsForFieldConfig(config, {\n label: config.label ?? 'Location Picker',\n placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,\n pattern: LAT_LNG_PATTERN,\n autocomplete: false\n })\n }),\n ...validatorsForFieldConfig({\n messages: {\n pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE\n }\n })\n };\n\n return styleWrapper(fieldConfig, {\n classGetter: 'dbx-mat-form-field-disable-underline'\n });\n}\n","import { AbstractControl, FormControl, FormGroup } from '@angular/forms';\nimport { CompactContextStore, mapCompactModeObs } from '@dereekb/dbx-web';\nimport { Component, OnDestroy, OnInit, Optional } from '@angular/core';\nimport { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';\nimport { FieldType } from '@ngx-formly/material';\nimport { Editor, Validators } from 'ngx-editor';\nimport { first, BehaviorSubject, debounceTime, distinctUntilChanged, filter, shareReplay, startWith, switchMap, map, Observable, combineLatest, of } from 'rxjs';\nimport { filterMaybe, SubscriptionObject } from '@dereekb/rxjs';\nimport { Maybe, latLngString, LatLngString, LatLngPoint, LatLngPointFunctionConfig, latLngPoint, LatLngStringFunction, latLngStringFunction } from '@dereekb/util';\nimport { isSameMinute } from 'date-fns';\nimport { GeolocationService } from '@ng-web-apis/geolocation';\nimport { Marker } from 'mapbox-gl';\nimport { DbxMapboxMapStore } from '@dereekb/dbx-web/mapbox';\n\nexport interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {\n zoom?: number;\n latLngConfig?: LatLngPointFunctionConfig;\n}\n\n@Component({\n template: `\n <div class=\"dbx-mapbox-latlng-field\" [ngClass]=\"(compactClass$ | async) ?? ''\" [formGroup]=\"formGroup\">\n <div class=\"dbx-mapbox-latlng-field-map\">\n <mgl-map dbxMapboxMap>\n <mgl-marker [lngLat]=\"(latLng$ | async) || [0, 0]\" [draggable]=\"!isReadonlyOrDisabled\" (markerDragEnd)=\"onDragEnd($event)\"></mgl-marker>\n </mgl-map>\n </div>\n <div class=\"dbx-mapbox-latlng-field-input\">\n <button mat-icon-button (click)=\"useCurrentLocation()\" [disabled]=\"isReadonlyOrDisabled\">\n <mat-icon>my_location</mat-icon>\n </button>\n <mat-form-field class=\"dbx-mapbox-latlng-field-input-field\">\n <mat-label>Coordinates</mat-label>\n <input type=\"text\" matInput [placeholder]=\"placeholder\" [formControl]=\"formControl\" />\n </mat-form-field>\n </div>\n </div>\n `,\n providers: [DbxMapboxMapStore],\n styleUrls: ['./latlng.field.component.scss']\n})\nexport class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {\n private _latLngStringFunction!: LatLngStringFunction;\n\n readonly compactClass$ = mapCompactModeObs(this.compact?.mode$, {\n compact: 'dbx-texteditor-field-compact'\n });\n\n private _sub = new SubscriptionObject();\n private _zoom = new BehaviorSubject<number>(12);\n\n private _formControlObs = new BehaviorSubject<Maybe<AbstractControl>>(undefined);\n readonly formControl$ = this._formControlObs.pipe(filterMaybe());\n\n readonly value$ = this.formControl$.pipe(\n switchMap((control) => control.valueChanges.pipe(startWith(control.value))),\n shareReplay(1)\n );\n\n readonly latLng$: Observable<LatLngPoint> = this.value$.pipe(\n filterMaybe(),\n map((x) => latLngPoint(x)),\n filter((x) => x.lat !== 0 && x.lng !== 0),\n shareReplay(1)\n );\n\n readonly center$ = this.latLng$;\n readonly zoom$ = this._zoom.asObservable();\n\n constructor(@Optional() readonly compact: CompactContextStore, private readonly geolocation$: GeolocationService, readonly dbxMapboxMapStore: DbxMapboxMapStore) {\n super();\n }\n\n get zoom(): number {\n return Math.min(this.field.props.zoom || 12, 18);\n }\n\n get formGroupName(): string {\n return this.field.key as string;\n }\n\n get formGroup(): FormGroup {\n return this.form as FormGroup;\n }\n\n get label(): Maybe<string> {\n return this.field.props?.label;\n }\n\n get description(): Maybe<string> {\n return this.props.description;\n }\n\n get isReadonlyOrDisabled() {\n return this.props.readonly || this.disabled;\n }\n\n ngOnInit(): void {\n this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);\n this._formControlObs.next(this.formControl);\n this._zoom.next(this.zoom);\n\n this.dbxMapboxMapStore.setCenter(this.center$);\n this.dbxMapboxMapStore.setZoom(this.zoom$);\n\n if (this.props.readonly) {\n this.formControl.disable();\n }\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this._formControlObs.complete();\n this._zoom.complete();\n this._sub.destroy();\n }\n\n useCurrentLocation() {\n this._sub.subscription = this.geolocation$.pipe(first()).subscribe((position) => {\n if (position) {\n const { latitude: lat, longitude: lng } = position.coords;\n this.setValue({ lat, lng });\n }\n });\n }\n\n onDragEnd(marker: Marker) {\n this.setValue(marker.getLngLat());\n }\n\n setValue(latLng?: Maybe<LatLngPoint>) {\n this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DbxFormMapboxLatLngFieldComponent } from './latlng.field.component';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { DbxTextModule } from '@dereekb/dbx-web';\nimport { NgxMapboxGLModule } from 'ngx-mapbox-gl';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { DbxMapboxModule } from '@dereekb/dbx-web/mapbox';\n\n@NgModule({\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n DbxTextModule,\n DbxMapboxModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n FormlyModule.forChild({\n types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]\n }),\n NgxMapboxGLModule\n ],\n declarations: [DbxFormMapboxLatLngFieldComponent]\n})\nexport class DbxFormMapboxLatLngModule {}\n","import { NgModule } from '@angular/core';\nimport { DbxFormMapboxLatLngModule } from './field/latlng/latlng.module';\n\n@NgModule({\n exports: [DbxFormMapboxLatLngModule]\n})\nexport class DbxFormMapboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport *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EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;2FAExB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,yBAAyB,CAAC;iBACrC,CAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -8,18 +8,20 @@ import { FieldType } from '@ngx-formly/material';
|
|
|
8
8
|
import { BehaviorSubject, switchMap, startWith, shareReplay, map, filter, first } from 'rxjs';
|
|
9
9
|
import { SubscriptionObject, filterMaybe } from '@dereekb/rxjs';
|
|
10
10
|
import * as i2 from '@ng-web-apis/geolocation';
|
|
11
|
-
import * as i3 from '@
|
|
11
|
+
import * as i3 from '@dereekb/dbx-web/mapbox';
|
|
12
|
+
import { DbxMapboxMapStore, DbxMapboxModule } from '@dereekb/dbx-web/mapbox';
|
|
13
|
+
import * as i4 from '@angular/common';
|
|
12
14
|
import { CommonModule } from '@angular/common';
|
|
13
|
-
import * as
|
|
15
|
+
import * as i5 from '@angular/material/icon';
|
|
14
16
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
-
import * as
|
|
17
|
+
import * as i6 from '@angular/material/button';
|
|
16
18
|
import { MatButtonModule } from '@angular/material/button';
|
|
17
|
-
import * as
|
|
19
|
+
import * as i7 from '@angular/forms';
|
|
18
20
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
19
|
-
import * as
|
|
20
|
-
import * as
|
|
21
|
+
import * as i8 from '@angular/material/form-field';
|
|
22
|
+
import * as i9 from '@angular/material/input';
|
|
21
23
|
import { MatInputModule } from '@angular/material/input';
|
|
22
|
-
import * as
|
|
24
|
+
import * as i10 from 'ngx-mapbox-gl';
|
|
23
25
|
import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
|
|
24
26
|
import * as i1$1 from '@ngx-formly/core';
|
|
25
27
|
import { FormlyModule } from '@ngx-formly/core';
|
|
@@ -49,15 +51,16 @@ function mapboxLatLngField(config = {}) {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
52
|
-
constructor(compact, geolocation
|
|
54
|
+
constructor(compact, geolocation$, dbxMapboxMapStore) {
|
|
53
55
|
super();
|
|
54
56
|
this.compact = compact;
|
|
55
57
|
this.geolocation$ = geolocation$;
|
|
58
|
+
this.dbxMapboxMapStore = dbxMapboxMapStore;
|
|
56
59
|
this.compactClass$ = mapCompactModeObs(this.compact?.mode$, {
|
|
57
60
|
compact: 'dbx-texteditor-field-compact'
|
|
58
61
|
});
|
|
59
62
|
this._sub = new SubscriptionObject();
|
|
60
|
-
this._zoom = new BehaviorSubject(
|
|
63
|
+
this._zoom = new BehaviorSubject(12);
|
|
61
64
|
this._formControlObs = new BehaviorSubject(undefined);
|
|
62
65
|
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
63
66
|
this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
|
|
@@ -66,7 +69,7 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
66
69
|
this.zoom$ = this._zoom.asObservable();
|
|
67
70
|
}
|
|
68
71
|
get zoom() {
|
|
69
|
-
return
|
|
72
|
+
return Math.min(this.field.props.zoom || 12, 18);
|
|
70
73
|
}
|
|
71
74
|
get formGroupName() {
|
|
72
75
|
return this.field.key;
|
|
@@ -87,6 +90,8 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
87
90
|
this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);
|
|
88
91
|
this._formControlObs.next(this.formControl);
|
|
89
92
|
this._zoom.next(this.zoom);
|
|
93
|
+
this.dbxMapboxMapStore.setCenter(this.center$);
|
|
94
|
+
this.dbxMapboxMapStore.setZoom(this.zoom$);
|
|
90
95
|
if (this.props.readonly) {
|
|
91
96
|
this.formControl.disable();
|
|
92
97
|
}
|
|
@@ -112,11 +117,11 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
112
117
|
this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);
|
|
113
118
|
}
|
|
114
119
|
}
|
|
115
|
-
DbxFormMapboxLatLngFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: [{ token: i1.CompactContextStore, optional: true }, { token: i2.GeolocationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
116
|
-
DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxFormMapboxLatLngFieldComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
|
|
120
|
+
DbxFormMapboxLatLngFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: [{ token: i1.CompactContextStore, optional: true }, { token: i2.GeolocationService }, { token: i3.DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Component });
|
|
121
|
+
DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxFormMapboxLatLngFieldComponent, selector: "ng-component", providers: [DbxMapboxMapStore], usesInheritance: true, ngImport: i0, template: `
|
|
117
122
|
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
118
123
|
<div class="dbx-mapbox-latlng-field-map">
|
|
119
|
-
<mgl-map
|
|
124
|
+
<mgl-map dbxMapboxMap>
|
|
120
125
|
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
121
126
|
</mgl-map>
|
|
122
127
|
</div>
|
|
@@ -130,13 +135,13 @@ DbxFormMapboxLatLngFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion
|
|
|
130
135
|
</mat-form-field>
|
|
131
136
|
</div>
|
|
132
137
|
</div>
|
|
133
|
-
`, isInline: true, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"], dependencies: [{ kind: "directive", type:
|
|
138
|
+
`, isInline: true, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i7.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "customMapboxApiUrl", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "minZoom", "maxZoom", "minPitch", "maxPitch", "scrollZoom", "dragRotate", "touchPitch", "touchZoomRotate", "doubleClickZoom", "keyboard", "dragPan", "boxZoom", "style", "center", "maxBounds", "zoom", "bearing", "pitch", "fitBoundsOptions", "renderWorldCopies", "projection", "movingMethod", "movingOptions", "fitBounds", "fitScreenCoordinates", "centerWithPanTo", "panToOptions", "cursorStyle"], outputs: ["mapResize", "mapRemove", "mapMouseDown", "mapMouseUp", "mapMouseMove", "mapClick", "mapDblClick", "mapMouseOver", "mapMouseOut", "mapContextMenu", "mapTouchStart", "mapTouchEnd", "mapTouchMove", "mapTouchCancel", "mapWheel", "moveStart", "move", "moveEnd", "mapDragStart", "mapDrag", "mapDragEnd", "zoomStart", "zoomEvt", "zoomEnd", "rotateStart", "rotate", "rotateEnd", "pitchStart", "pitchEvt", "pitchEnd", "boxZoomStart", "boxZoomEnd", "boxZoomCancel", "webGlContextLost", "webGlContextRestored", "mapLoad", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing", "resize", "remove", "mouseDown", "mouseUp", "mouseMove", "click", "dblClick", "mouseOver", "mouseOut", "contextMenu", "touchStart", "touchEnd", "touchMove", "touchCancel", "wheel", "dragStart", "drag", "dragEnd", "load", "error"] }, { kind: "component", type: i10.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
|
|
134
139
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, decorators: [{
|
|
135
140
|
type: Component,
|
|
136
141
|
args: [{ template: `
|
|
137
142
|
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
138
143
|
<div class="dbx-mapbox-latlng-field-map">
|
|
139
|
-
<mgl-map
|
|
144
|
+
<mgl-map dbxMapboxMap>
|
|
140
145
|
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
141
146
|
</mgl-map>
|
|
142
147
|
</div>
|
|
@@ -150,10 +155,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
150
155
|
</mat-form-field>
|
|
151
156
|
</div>
|
|
152
157
|
</div>
|
|
153
|
-
`, styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"] }]
|
|
158
|
+
`, providers: [DbxMapboxMapStore], styles: [".dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map{height:220px;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input{display:flex;align-items:center}.dbx-mapbox-latlng-field .dbx-mapbox-latlng-field-input .dbx-mapbox-latlng-field-input-field{width:calc(100% - 40px)}\n"] }]
|
|
154
159
|
}], ctorParameters: function () { return [{ type: i1.CompactContextStore, decorators: [{
|
|
155
160
|
type: Optional
|
|
156
|
-
}] }, { type: i2.GeolocationService }]; } });
|
|
161
|
+
}] }, { type: i2.GeolocationService }, { type: i3.DbxMapboxMapStore }]; } });
|
|
157
162
|
|
|
158
163
|
class DbxFormMapboxLatLngModule {
|
|
159
164
|
}
|
|
@@ -162,6 +167,7 @@ DbxFormMapboxLatLngModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0
|
|
|
162
167
|
MatIconModule,
|
|
163
168
|
MatButtonModule,
|
|
164
169
|
DbxTextModule,
|
|
170
|
+
DbxMapboxModule,
|
|
165
171
|
FormsModule,
|
|
166
172
|
ReactiveFormsModule,
|
|
167
173
|
MatInputModule, i1$1.FormlyModule, NgxMapboxGLModule] });
|
|
@@ -169,6 +175,7 @@ DbxFormMapboxLatLngModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
|
|
|
169
175
|
MatIconModule,
|
|
170
176
|
MatButtonModule,
|
|
171
177
|
DbxTextModule,
|
|
178
|
+
DbxMapboxModule,
|
|
172
179
|
FormsModule,
|
|
173
180
|
ReactiveFormsModule,
|
|
174
181
|
MatInputModule,
|
|
@@ -184,6 +191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
|
|
|
184
191
|
MatIconModule,
|
|
185
192
|
MatButtonModule,
|
|
186
193
|
DbxTextModule,
|
|
194
|
+
DbxMapboxModule,
|
|
187
195
|
FormsModule,
|
|
188
196
|
ReactiveFormsModule,
|
|
189
197
|
MatInputModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dereekb-dbx-form-mapbox.mjs","sources":["../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.module.ts","../../../../../packages/dbx-form/mapbox/src/lib/mapbox.module.ts","../../../../../packages/dbx-form/mapbox/src/dereekb-dbx-form-mapbox.ts"],"sourcesContent":["import { DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DescriptionFieldConfig, FieldConfig, formlyField, LabeledFieldConfig, propsForFieldConfig, styleWrapper, validatorsForFieldConfig } from '@dereekb/dbx-form';\nimport { LAT_LNG_PATTERN } from '@dereekb/util';\nimport { FormlyFieldConfig } from '@ngx-formly/core';\n\nexport interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig> {}\n\nexport function mapboxLatLngField(config: MapboxLatLngFieldConfig = {}): FormlyFieldConfig {\n const { key = 'latLng' } = config;\n const fieldConfig: FormlyFieldConfig = {\n ...formlyField({\n key,\n type: 'mapbox-latlng-picker',\n ...propsForFieldConfig(config, {\n label: config.label ?? 'Location Picker',\n placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,\n pattern: LAT_LNG_PATTERN,\n autocomplete: false\n })\n }),\n ...validatorsForFieldConfig({\n messages: {\n pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE\n }\n })\n };\n\n return styleWrapper(fieldConfig, {\n classGetter: 'dbx-mat-form-field-disable-underline'\n });\n}\n","import { AbstractControl, FormControl, FormGroup } from '@angular/forms';\nimport { CompactContextStore, mapCompactModeObs } from '@dereekb/dbx-web';\nimport { Component, OnDestroy, OnInit, Optional } from '@angular/core';\nimport { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';\nimport { FieldType } from '@ngx-formly/material';\nimport { Editor, Validators } from 'ngx-editor';\nimport { first, BehaviorSubject, debounceTime, distinctUntilChanged, filter, shareReplay, startWith, switchMap, map, Observable, combineLatest, of } from 'rxjs';\nimport { filterMaybe, SubscriptionObject } from '@dereekb/rxjs';\nimport { Maybe, latLngString, LatLngString, LatLngPoint, LatLngPointFunctionConfig, latLngPoint, LatLngStringFunction, latLngStringFunction } from '@dereekb/util';\nimport { isSameMinute } from 'date-fns';\nimport { GeolocationService } from '@ng-web-apis/geolocation';\nimport { Marker } from 'mapbox-gl';\n\nexport interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {\n zoom?: number;\n latLngConfig?: LatLngPointFunctionConfig;\n}\n\n@Component({\n template: `\n <div class=\"dbx-mapbox-latlng-field\" [ngClass]=\"(compactClass$ | async) ?? ''\" [formGroup]=\"formGroup\">\n <div class=\"dbx-mapbox-latlng-field-map\">\n <mgl-map [style]=\"'mapbox://styles/mapbox/streets-v9'\" [zoom]=\"(zoom$ | async) || [8]\" [center]=\"(center$ | async) || [0, 0]\">\n <mgl-marker [lngLat]=\"(latLng$ | async) || [0, 0]\" [draggable]=\"!isReadonlyOrDisabled\" (markerDragEnd)=\"onDragEnd($event)\"></mgl-marker>\n </mgl-map>\n </div>\n <div class=\"dbx-mapbox-latlng-field-input\">\n <button mat-icon-button (click)=\"useCurrentLocation()\" [disabled]=\"isReadonlyOrDisabled\">\n <mat-icon>my_location</mat-icon>\n </button>\n <mat-form-field class=\"dbx-mapbox-latlng-field-input-field\">\n <mat-label>Coordinates</mat-label>\n <input type=\"text\" matInput [placeholder]=\"placeholder\" [formControl]=\"formControl\" />\n </mat-form-field>\n </div>\n </div>\n `,\n styleUrls: ['./latlng.field.component.scss']\n})\nexport class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {\n private _latLngStringFunction!: LatLngStringFunction;\n\n readonly compactClass$ = mapCompactModeObs(this.compact?.mode$, {\n compact: 'dbx-texteditor-field-compact'\n });\n\n private _sub = new SubscriptionObject();\n private _zoom = new BehaviorSubject<[number]>([12]);\n\n private _formControlObs = new BehaviorSubject<Maybe<AbstractControl>>(undefined);\n readonly formControl$ = this._formControlObs.pipe(filterMaybe());\n\n readonly value$ = this.formControl$.pipe(\n switchMap((control) => control.valueChanges.pipe(startWith(control.value))),\n shareReplay(1)\n );\n\n readonly latLng$: Observable<LatLngPoint> = this.value$.pipe(\n filterMaybe(),\n map((x) => latLngPoint(x)),\n filter((x) => x.lat !== 0 && x.lng !== 0),\n shareReplay(1)\n );\n\n readonly center$ = this.latLng$;\n readonly zoom$ = this._zoom.asObservable();\n\n constructor(@Optional() readonly compact: CompactContextStore, private readonly geolocation$: GeolocationService) {\n super();\n }\n\n get zoom(): [number] {\n return [Math.min(this.field.props.zoom || 12, 18)];\n }\n\n get formGroupName(): string {\n return this.field.key as string;\n }\n\n get formGroup(): FormGroup {\n return this.form as FormGroup;\n }\n\n get label(): Maybe<string> {\n return this.field.props?.label;\n }\n\n get description(): Maybe<string> {\n return this.props.description;\n }\n\n get isReadonlyOrDisabled() {\n return this.props.readonly || this.disabled;\n }\n\n ngOnInit(): void {\n this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);\n this._formControlObs.next(this.formControl);\n this._zoom.next(this.zoom);\n\n if (this.props.readonly) {\n this.formControl.disable();\n }\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this._formControlObs.complete();\n this._zoom.complete();\n this._sub.destroy();\n }\n\n useCurrentLocation() {\n this._sub.subscription = this.geolocation$.pipe(first()).subscribe((position) => {\n if (position) {\n const { latitude: lat, longitude: lng } = position.coords;\n this.setValue({ lat, lng });\n }\n });\n }\n\n onDragEnd(marker: Marker) {\n this.setValue(marker.getLngLat());\n }\n\n setValue(latLng?: Maybe<LatLngPoint>) {\n this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DbxFormMapboxLatLngFieldComponent } from './latlng.field.component';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { DbxTextModule } from '@dereekb/dbx-web';\nimport { NgxMapboxGLModule } from 'ngx-mapbox-gl';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\n\n@NgModule({\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n DbxTextModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n FormlyModule.forChild({\n types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]\n }),\n NgxMapboxGLModule\n ],\n declarations: [DbxFormMapboxLatLngFieldComponent]\n})\nexport class DbxFormMapboxLatLngModule {}\n","import { NgModule } from '@angular/core';\nimport { DbxFormMapboxLatLngModule } from './field/latlng/latlng.module';\n\n@NgModule({\n exports: [DbxFormMapboxLatLngModule]\n})\nexport class DbxFormMapboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMgB,SAAA,iB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AiC,CAAC;AAClD,iBAAA,CAAA;;;MCpBY,mBAAmB,CAAA;;gHAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAnB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;AAExB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;2FAExB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,yBAAyB,CAAC;AACrC,iBAAA,CAAA;;;ACLD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"dereekb-dbx-form-mapbox.mjs","sources":["../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts","../../../../../packages/dbx-form/mapbox/src/lib/field/latlng/latlng.module.ts","../../../../../packages/dbx-form/mapbox/src/lib/mapbox.module.ts","../../../../../packages/dbx-form/mapbox/src/dereekb-dbx-form-mapbox.ts"],"sourcesContent":["import { DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, DescriptionFieldConfig, FieldConfig, formlyField, LabeledFieldConfig, propsForFieldConfig, styleWrapper, validatorsForFieldConfig } from '@dereekb/dbx-form';\nimport { LAT_LNG_PATTERN } from '@dereekb/util';\nimport { FormlyFieldConfig } from '@ngx-formly/core';\n\nexport interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig> {}\n\nexport function mapboxLatLngField(config: MapboxLatLngFieldConfig = {}): FormlyFieldConfig {\n const { key = 'latLng' } = config;\n const fieldConfig: FormlyFieldConfig = {\n ...formlyField({\n key,\n type: 'mapbox-latlng-picker',\n ...propsForFieldConfig(config, {\n label: config.label ?? 'Location Picker',\n placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,\n pattern: LAT_LNG_PATTERN,\n autocomplete: false\n })\n }),\n ...validatorsForFieldConfig({\n messages: {\n pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE\n }\n })\n };\n\n return styleWrapper(fieldConfig, {\n classGetter: 'dbx-mat-form-field-disable-underline'\n });\n}\n","import { AbstractControl, FormControl, FormGroup } from '@angular/forms';\nimport { CompactContextStore, mapCompactModeObs } from '@dereekb/dbx-web';\nimport { Component, OnDestroy, OnInit, Optional } from '@angular/core';\nimport { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';\nimport { FieldType } from '@ngx-formly/material';\nimport { Editor, Validators } from 'ngx-editor';\nimport { first, BehaviorSubject, debounceTime, distinctUntilChanged, filter, shareReplay, startWith, switchMap, map, Observable, combineLatest, of } from 'rxjs';\nimport { filterMaybe, SubscriptionObject } from '@dereekb/rxjs';\nimport { Maybe, latLngString, LatLngString, LatLngPoint, LatLngPointFunctionConfig, latLngPoint, LatLngStringFunction, latLngStringFunction } from '@dereekb/util';\nimport { isSameMinute } from 'date-fns';\nimport { GeolocationService } from '@ng-web-apis/geolocation';\nimport { Marker } from 'mapbox-gl';\nimport { DbxMapboxMapStore } from '@dereekb/dbx-web/mapbox';\n\nexport interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {\n zoom?: number;\n latLngConfig?: LatLngPointFunctionConfig;\n}\n\n@Component({\n template: `\n <div class=\"dbx-mapbox-latlng-field\" [ngClass]=\"(compactClass$ | async) ?? ''\" [formGroup]=\"formGroup\">\n <div class=\"dbx-mapbox-latlng-field-map\">\n <mgl-map dbxMapboxMap>\n <mgl-marker [lngLat]=\"(latLng$ | async) || [0, 0]\" [draggable]=\"!isReadonlyOrDisabled\" (markerDragEnd)=\"onDragEnd($event)\"></mgl-marker>\n </mgl-map>\n </div>\n <div class=\"dbx-mapbox-latlng-field-input\">\n <button mat-icon-button (click)=\"useCurrentLocation()\" [disabled]=\"isReadonlyOrDisabled\">\n <mat-icon>my_location</mat-icon>\n </button>\n <mat-form-field class=\"dbx-mapbox-latlng-field-input-field\">\n <mat-label>Coordinates</mat-label>\n <input type=\"text\" matInput [placeholder]=\"placeholder\" [formControl]=\"formControl\" />\n </mat-form-field>\n </div>\n </div>\n `,\n providers: [DbxMapboxMapStore],\n styleUrls: ['./latlng.field.component.scss']\n})\nexport class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {\n private _latLngStringFunction!: LatLngStringFunction;\n\n readonly compactClass$ = mapCompactModeObs(this.compact?.mode$, {\n compact: 'dbx-texteditor-field-compact'\n });\n\n private _sub = new SubscriptionObject();\n private _zoom = new BehaviorSubject<number>(12);\n\n private _formControlObs = new BehaviorSubject<Maybe<AbstractControl>>(undefined);\n readonly formControl$ = this._formControlObs.pipe(filterMaybe());\n\n readonly value$ = this.formControl$.pipe(\n switchMap((control) => control.valueChanges.pipe(startWith(control.value))),\n shareReplay(1)\n );\n\n readonly latLng$: Observable<LatLngPoint> = this.value$.pipe(\n filterMaybe(),\n map((x) => latLngPoint(x)),\n filter((x) => x.lat !== 0 && x.lng !== 0),\n shareReplay(1)\n );\n\n readonly center$ = this.latLng$;\n readonly zoom$ = this._zoom.asObservable();\n\n constructor(@Optional() readonly compact: CompactContextStore, private readonly geolocation$: GeolocationService, readonly dbxMapboxMapStore: DbxMapboxMapStore) {\n super();\n }\n\n get zoom(): number {\n return Math.min(this.field.props.zoom || 12, 18);\n }\n\n get formGroupName(): string {\n return this.field.key as string;\n }\n\n get formGroup(): FormGroup {\n return this.form as FormGroup;\n }\n\n get label(): Maybe<string> {\n return this.field.props?.label;\n }\n\n get description(): Maybe<string> {\n return this.props.description;\n }\n\n get isReadonlyOrDisabled() {\n return this.props.readonly || this.disabled;\n }\n\n ngOnInit(): void {\n this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);\n this._formControlObs.next(this.formControl);\n this._zoom.next(this.zoom);\n\n this.dbxMapboxMapStore.setCenter(this.center$);\n this.dbxMapboxMapStore.setZoom(this.zoom$);\n\n if (this.props.readonly) {\n this.formControl.disable();\n }\n }\n\n override ngOnDestroy(): void {\n super.ngOnDestroy();\n this._formControlObs.complete();\n this._zoom.complete();\n this._sub.destroy();\n }\n\n useCurrentLocation() {\n this._sub.subscription = this.geolocation$.pipe(first()).subscribe((position) => {\n if (position) {\n const { latitude: lat, longitude: lng } = position.coords;\n this.setValue({ lat, lng });\n }\n });\n }\n\n onDragEnd(marker: Marker) {\n this.setValue(marker.getLngLat());\n }\n\n setValue(latLng?: Maybe<LatLngPoint>) {\n this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DbxFormMapboxLatLngFieldComponent } from './latlng.field.component';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { DbxTextModule } from '@dereekb/dbx-web';\nimport { NgxMapboxGLModule } from 'ngx-mapbox-gl';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { DbxMapboxModule } from '@dereekb/dbx-web/mapbox';\n\n@NgModule({\n imports: [\n CommonModule,\n MatIconModule,\n MatButtonModule,\n DbxTextModule,\n DbxMapboxModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n FormlyModule.forChild({\n types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]\n }),\n NgxMapboxGLModule\n ],\n declarations: [DbxFormMapboxLatLngFieldComponent]\n})\nexport class DbxFormMapboxLatLngModule {}\n","import { NgModule } from '@angular/core';\nimport { DbxFormMapboxLatLngModule } from './field/latlng/latlng.module';\n\n@NgModule({\n exports: [DbxFormMapboxLatLngModule]\n})\nexport class DbxFormMapboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMgB,SAAA,iBAAiB,CAAC,MAAA,GAAkC,EAAE,EAAA;AACpE,IAAA,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;AAClC,IAAA,MAAM,WAAW,GAAsB;AACrC,QAAA,GAAG,WAAW,CAAC;YACb,GAAG;AACH,YAAA,IAAI,EAAE,sBAAsB;YAC5B,GAAG,mBAAmB,CAAC,MAAM,EAAE;AAC7B,gBAAA,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,iBAAiB;AACxC,gBAAA,WAAW,EAAE,sCAAsC;AACnD,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,YAAY,EAAE,KAAK;aACpB,CAAC;SACH,CAAC;AACF,QAAA,GAAG,wBAAwB,CAAC;AAC1B,YAAA,QAAQ,EAAE;AACR,gBAAA,OAAO,EAAE,0CAA0C;AACpD,aAAA;SACF,CAAC;KACH,CAAC;IAEF,OAAO,YAAY,CAAC,WAAW,EAAE;AAC/B,QAAA,WAAW,EAAE,sCAAsC;AACpD,KAAA,CAAC,CAAC;AACL;;ACYM,MAAO,iCAA6H,SAAQ,SAA6B,CAAA;AA4B7K,IAAA,WAAA,CAAiC,OAA4B,EAAmB,YAAgC,EAAW,iBAAoC,EAAA;AAC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AAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;AAExB,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAFpB,yBAAyB,CAAA,EAAA,CAAA,CAAA;2FAExB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAH/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,yBAAyB,CAAC;AACrC,iBAAA,CAAA;;;ACLD;;AAEG;;;;"}
|
|
@@ -7,6 +7,7 @@ import { Observable } from 'rxjs';
|
|
|
7
7
|
import { Maybe, LatLngPoint, LatLngPointFunctionConfig } from '@dereekb/util';
|
|
8
8
|
import { GeolocationService } from '@ng-web-apis/geolocation';
|
|
9
9
|
import { Marker } from 'mapbox-gl';
|
|
10
|
+
import { DbxMapboxMapStore } from '@dereekb/dbx-web/mapbox';
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
11
12
|
export interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {
|
|
12
13
|
zoom?: number;
|
|
@@ -15,6 +16,7 @@ export interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps
|
|
|
15
16
|
export declare class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {
|
|
16
17
|
readonly compact: CompactContextStore;
|
|
17
18
|
private readonly geolocation$;
|
|
19
|
+
readonly dbxMapboxMapStore: DbxMapboxMapStore;
|
|
18
20
|
private _latLngStringFunction;
|
|
19
21
|
readonly compactClass$: Observable<Maybe<string>>;
|
|
20
22
|
private _sub;
|
|
@@ -24,9 +26,9 @@ export declare class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLa
|
|
|
24
26
|
readonly value$: Observable<any>;
|
|
25
27
|
readonly latLng$: Observable<LatLngPoint>;
|
|
26
28
|
readonly center$: Observable<LatLngPoint>;
|
|
27
|
-
readonly zoom$: Observable<
|
|
28
|
-
constructor(compact: CompactContextStore, geolocation$: GeolocationService);
|
|
29
|
-
get zoom():
|
|
29
|
+
readonly zoom$: Observable<number>;
|
|
30
|
+
constructor(compact: CompactContextStore, geolocation$: GeolocationService, dbxMapboxMapStore: DbxMapboxMapStore);
|
|
31
|
+
get zoom(): number;
|
|
30
32
|
get formGroupName(): string;
|
|
31
33
|
get formGroup(): FormGroup;
|
|
32
34
|
get label(): Maybe<string>;
|
|
@@ -37,6 +39,6 @@ export declare class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLa
|
|
|
37
39
|
useCurrentLocation(): void;
|
|
38
40
|
onDragEnd(marker: Marker): void;
|
|
39
41
|
setValue(latLng?: Maybe<LatLngPoint>): void;
|
|
40
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormMapboxLatLngFieldComponent<any>, [{ optional: true; }, null]>;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormMapboxLatLngFieldComponent<any>, [{ optional: true; }, null, null]>;
|
|
41
43
|
static ɵcmp: i0.ɵɵComponentDeclaration<DbxFormMapboxLatLngFieldComponent<any>, "ng-component", never, {}, {}, never, never, false>;
|
|
42
44
|
}
|
|
@@ -4,12 +4,13 @@ import * as i2 from "@angular/common";
|
|
|
4
4
|
import * as i3 from "@angular/material/icon";
|
|
5
5
|
import * as i4 from "@angular/material/button";
|
|
6
6
|
import * as i5 from "@dereekb/dbx-web";
|
|
7
|
-
import * as i6 from "@
|
|
8
|
-
import * as i7 from "@angular/
|
|
9
|
-
import * as i8 from "@
|
|
10
|
-
import * as i9 from "ngx-
|
|
7
|
+
import * as i6 from "@dereekb/dbx-web/mapbox";
|
|
8
|
+
import * as i7 from "@angular/forms";
|
|
9
|
+
import * as i8 from "@angular/material/input";
|
|
10
|
+
import * as i9 from "@ngx-formly/core";
|
|
11
|
+
import * as i10 from "ngx-mapbox-gl";
|
|
11
12
|
export declare class DbxFormMapboxLatLngModule {
|
|
12
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormMapboxLatLngModule, never>;
|
|
13
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormMapboxLatLngModule, [typeof i1.DbxFormMapboxLatLngFieldComponent], [typeof i2.CommonModule, typeof i3.MatIconModule, typeof i4.MatButtonModule, typeof i5.DbxTextModule, typeof i6.FormsModule, typeof
|
|
14
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormMapboxLatLngModule, [typeof i1.DbxFormMapboxLatLngFieldComponent], [typeof i2.CommonModule, typeof i3.MatIconModule, typeof i4.MatButtonModule, typeof i5.DbxTextModule, typeof i6.DbxMapboxModule, typeof i7.FormsModule, typeof i7.ReactiveFormsModule, typeof i8.MatInputModule, typeof i9.FormlyModule, typeof i10.NgxMapboxGLModule], never>;
|
|
14
15
|
static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormMapboxLatLngModule>;
|
|
15
16
|
}
|
package/mapbox/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-form/mapbox",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^14.1.0",
|
|
6
6
|
"@angular/core": "^14.1.0",
|
|
7
7
|
"@angular/forms": "^14.0.0",
|
|
8
|
-
"@dereekb/dbx-web": "9.3.
|
|
8
|
+
"@dereekb/dbx-web": "9.3.3",
|
|
9
9
|
"@ngx-formly/core": "6.0.0-rc.2",
|
|
10
10
|
"@ngx-formly/material": "6.0.0-rc.2",
|
|
11
11
|
"ngx-editor": "^15.0.0",
|
|
12
12
|
"@ng-web-apis/geolocation": "^2.0.0",
|
|
13
13
|
"mapbox-gl": "^2.9.2",
|
|
14
|
-
"@dereekb/dbx-
|
|
15
|
-
"
|
|
14
|
+
"@dereekb/dbx-web/mapbox": "9.3.3",
|
|
15
|
+
"@dereekb/dbx-form": "9.3.3"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"tslib": "^2.3.0"
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-form",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^14.0.0",
|
|
6
6
|
"@angular/core": "^14.0.0",
|
|
7
7
|
"lodash.clonedeep": "^4.5.0",
|
|
8
|
-
"@dereekb/dbx-core": "9.3.
|
|
8
|
+
"@dereekb/dbx-core": "9.3.3",
|
|
9
9
|
"@angular/material": "^14.0.0",
|
|
10
|
-
"@dereekb/dbx-web": "9.3.
|
|
10
|
+
"@dereekb/dbx-web": "9.3.3",
|
|
11
11
|
"@angular/forms": "^14.0.0",
|
|
12
12
|
"@ngx-formly/core": "6.0.0-rc.2",
|
|
13
13
|
"@ngx-formly/material": "6.0.0-rc.2",
|