@dereekb/dbx-form 9.1.2 → 9.3.1
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/lib/formly/field/selection/searchable/searchable.text.field.component.mjs +1 -1
- package/esm2020/lib/formly/field/value/date/datetime.field.mjs +6 -6
- package/esm2020/lib/formly/field/value/text/text.additional.field.mjs +22 -1
- package/esm2020/lib/formly/field/wrapper/style.wrapper.component.mjs +18 -7
- package/esm2020/lib/formly/template/index.mjs +2 -1
- package/esm2020/lib/formly/template/timezone.mjs +38 -0
- package/esm2020/mapbox/dereekb-dbx-form-mapbox.mjs +5 -0
- package/esm2020/mapbox/index.mjs +3 -0
- package/esm2020/mapbox/lib/field/index.mjs +2 -0
- package/esm2020/mapbox/lib/field/latlng/index.mjs +4 -0
- package/esm2020/mapbox/lib/field/latlng/latlng.field.component.mjs +124 -0
- package/esm2020/mapbox/lib/field/latlng/latlng.field.mjs +26 -0
- package/esm2020/mapbox/lib/field/latlng/latlng.module.mjs +53 -0
- package/esm2020/mapbox/lib/mapbox.module.mjs +15 -0
- package/fesm2015/dereekb-dbx-form-mapbox.mjs +214 -0
- package/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -0
- package/fesm2015/dereekb-dbx-form.mjs +69 -14
- package/fesm2015/dereekb-dbx-form.mjs.map +1 -1
- package/fesm2020/dereekb-dbx-form-mapbox.mjs +216 -0
- package/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -0
- package/fesm2020/dereekb-dbx-form.mjs +78 -14
- package/fesm2020/dereekb-dbx-form.mjs.map +1 -1
- package/lib/formly/field/value/date/_date.scss +0 -10
- package/lib/formly/field/value/date/datetime.field.d.ts +1 -1
- package/lib/formly/field/value/text/text.additional.field.d.ts +3 -0
- package/lib/formly/field/wrapper/_wrapper.scss +10 -0
- package/lib/formly/field/wrapper/style.wrapper.component.d.ts +10 -3
- package/lib/formly/template/index.d.ts +1 -0
- package/lib/formly/template/timezone.d.ts +20 -0
- package/mapbox/README.md +6 -0
- package/mapbox/esm2020/dereekb-dbx-form-mapbox.mjs +5 -0
- package/mapbox/esm2020/index.mjs +3 -0
- package/mapbox/esm2020/lib/field/index.mjs +2 -0
- package/mapbox/esm2020/lib/field/latlng/index.mjs +4 -0
- package/mapbox/esm2020/lib/field/latlng/latlng.field.component.mjs +124 -0
- package/mapbox/esm2020/lib/field/latlng/latlng.field.mjs +26 -0
- package/mapbox/esm2020/lib/field/latlng/latlng.module.mjs +53 -0
- package/mapbox/esm2020/lib/mapbox.module.mjs +15 -0
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs +214 -0
- package/mapbox/fesm2015/dereekb-dbx-form-mapbox.mjs.map +1 -0
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs +216 -0
- package/mapbox/fesm2020/dereekb-dbx-form-mapbox.mjs.map +1 -0
- package/mapbox/index.d.ts +2 -0
- package/mapbox/lib/field/index.d.ts +1 -0
- package/mapbox/lib/field/latlng/index.d.ts +3 -0
- package/mapbox/lib/field/latlng/latlng.field.component.d.ts +42 -0
- package/mapbox/lib/field/latlng/latlng.field.d.ts +5 -0
- package/mapbox/lib/field/latlng/latlng.module.d.ts +15 -0
- package/mapbox/lib/mapbox.module.d.ts +7 -0
- package/mapbox/package.json +40 -0
- package/package.json +12 -4
|
@@ -0,0 +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,YAAY,CAAC,WAAW,EAAE;AAC/B,QAAA,WAAW,EAAE,sCAAsC;AACpD,KAAA,CAAC,CAAC;AACL;;ACUM,MAAO,iCAA6H,SAAQ,SAA6B,CAAA;IA4B7K,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yB,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;;;;"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { formlyField, propsForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER, validatorsForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, styleWrapper } from '@dereekb/dbx-form';
|
|
2
|
+
import { LAT_LNG_PATTERN, latLngPoint, latLngStringFunction } from '@dereekb/util';
|
|
3
|
+
import * as i1 from '@dereekb/dbx-web';
|
|
4
|
+
import { mapCompactModeObs, DbxTextModule } from '@dereekb/dbx-web';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { Component, Optional, NgModule } from '@angular/core';
|
|
7
|
+
import { FieldType } from '@ngx-formly/material';
|
|
8
|
+
import { BehaviorSubject, switchMap, startWith, shareReplay, map, filter, first } from 'rxjs';
|
|
9
|
+
import { SubscriptionObject, filterMaybe } from '@dereekb/rxjs';
|
|
10
|
+
import * as i2 from '@ng-web-apis/geolocation';
|
|
11
|
+
import * as i3 from '@angular/common';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import * as i4 from '@angular/material/icon';
|
|
14
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
+
import * as i5 from '@angular/material/button';
|
|
16
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
17
|
+
import * as i6 from '@angular/forms';
|
|
18
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
19
|
+
import * as i7 from '@angular/material/form-field';
|
|
20
|
+
import * as i8 from '@angular/material/input';
|
|
21
|
+
import { MatInputModule } from '@angular/material/input';
|
|
22
|
+
import * as i9 from 'ngx-mapbox-gl';
|
|
23
|
+
import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
|
|
24
|
+
import * as i1$1 from '@ngx-formly/core';
|
|
25
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
26
|
+
|
|
27
|
+
function mapboxLatLngField(config = {}) {
|
|
28
|
+
const { key = 'latLng' } = config;
|
|
29
|
+
const fieldConfig = {
|
|
30
|
+
...formlyField({
|
|
31
|
+
key,
|
|
32
|
+
type: 'mapbox-latlng-picker',
|
|
33
|
+
...propsForFieldConfig(config, {
|
|
34
|
+
label: config.label ?? 'Location Picker',
|
|
35
|
+
placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,
|
|
36
|
+
pattern: LAT_LNG_PATTERN,
|
|
37
|
+
autocomplete: false
|
|
38
|
+
})
|
|
39
|
+
}),
|
|
40
|
+
...validatorsForFieldConfig({
|
|
41
|
+
messages: {
|
|
42
|
+
pattern: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
return styleWrapper(fieldConfig, {
|
|
47
|
+
classGetter: 'dbx-mat-form-field-disable-underline'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
52
|
+
constructor(compact, geolocation$) {
|
|
53
|
+
super();
|
|
54
|
+
this.compact = compact;
|
|
55
|
+
this.geolocation$ = geolocation$;
|
|
56
|
+
this.compactClass$ = mapCompactModeObs(this.compact?.mode$, {
|
|
57
|
+
compact: 'dbx-texteditor-field-compact'
|
|
58
|
+
});
|
|
59
|
+
this._sub = new SubscriptionObject();
|
|
60
|
+
this._zoom = new BehaviorSubject([12]);
|
|
61
|
+
this._formControlObs = new BehaviorSubject(undefined);
|
|
62
|
+
this.formControl$ = this._formControlObs.pipe(filterMaybe());
|
|
63
|
+
this.value$ = this.formControl$.pipe(switchMap((control) => control.valueChanges.pipe(startWith(control.value))), shareReplay(1));
|
|
64
|
+
this.latLng$ = this.value$.pipe(filterMaybe(), map((x) => latLngPoint(x)), filter((x) => x.lat !== 0 && x.lng !== 0), shareReplay(1));
|
|
65
|
+
this.center$ = this.latLng$;
|
|
66
|
+
this.zoom$ = this._zoom.asObservable();
|
|
67
|
+
}
|
|
68
|
+
get zoom() {
|
|
69
|
+
return [Math.min(this.field.props.zoom || 12, 18)];
|
|
70
|
+
}
|
|
71
|
+
get formGroupName() {
|
|
72
|
+
return this.field.key;
|
|
73
|
+
}
|
|
74
|
+
get formGroup() {
|
|
75
|
+
return this.form;
|
|
76
|
+
}
|
|
77
|
+
get label() {
|
|
78
|
+
return this.field.props?.label;
|
|
79
|
+
}
|
|
80
|
+
get description() {
|
|
81
|
+
return this.props.description;
|
|
82
|
+
}
|
|
83
|
+
get isReadonlyOrDisabled() {
|
|
84
|
+
return this.props.readonly || this.disabled;
|
|
85
|
+
}
|
|
86
|
+
ngOnInit() {
|
|
87
|
+
this._latLngStringFunction = latLngStringFunction(this.field.props.latLngConfig);
|
|
88
|
+
this._formControlObs.next(this.formControl);
|
|
89
|
+
this._zoom.next(this.zoom);
|
|
90
|
+
if (this.props.readonly) {
|
|
91
|
+
this.formControl.disable();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
ngOnDestroy() {
|
|
95
|
+
super.ngOnDestroy();
|
|
96
|
+
this._formControlObs.complete();
|
|
97
|
+
this._zoom.complete();
|
|
98
|
+
this._sub.destroy();
|
|
99
|
+
}
|
|
100
|
+
useCurrentLocation() {
|
|
101
|
+
this._sub.subscription = this.geolocation$.pipe(first()).subscribe((position) => {
|
|
102
|
+
if (position) {
|
|
103
|
+
const { latitude: lat, longitude: lng } = position.coords;
|
|
104
|
+
this.setValue({ lat, lng });
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
onDragEnd(marker) {
|
|
109
|
+
this.setValue(marker.getLngLat());
|
|
110
|
+
}
|
|
111
|
+
setValue(latLng) {
|
|
112
|
+
this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
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: `
|
|
117
|
+
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
118
|
+
<div class="dbx-mapbox-latlng-field-map">
|
|
119
|
+
<mgl-map [style]="'mapbox://styles/mapbox/streets-v9'" [zoom]="(zoom$ | async) || [8]" [center]="(center$ | async) || [0, 0]">
|
|
120
|
+
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
121
|
+
</mgl-map>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="dbx-mapbox-latlng-field-input">
|
|
124
|
+
<button mat-icon-button (click)="useCurrentLocation()" [disabled]="isReadonlyOrDisabled">
|
|
125
|
+
<mat-icon>my_location</mat-icon>
|
|
126
|
+
</button>
|
|
127
|
+
<mat-form-field class="dbx-mapbox-latlng-field-input-field">
|
|
128
|
+
<mat-label>Coordinates</mat-label>
|
|
129
|
+
<input type="text" matInput [placeholder]="placeholder" [formControl]="formControl" />
|
|
130
|
+
</mat-form-field>
|
|
131
|
+
</div>
|
|
132
|
+
</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: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.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: i6.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: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i6.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i6.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i7.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8.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: i9.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: i9.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: i3.AsyncPipe, name: "async" }] });
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, decorators: [{
|
|
135
|
+
type: Component,
|
|
136
|
+
args: [{ template: `
|
|
137
|
+
<div class="dbx-mapbox-latlng-field" [ngClass]="(compactClass$ | async) ?? ''" [formGroup]="formGroup">
|
|
138
|
+
<div class="dbx-mapbox-latlng-field-map">
|
|
139
|
+
<mgl-map [style]="'mapbox://styles/mapbox/streets-v9'" [zoom]="(zoom$ | async) || [8]" [center]="(center$ | async) || [0, 0]">
|
|
140
|
+
<mgl-marker [lngLat]="(latLng$ | async) || [0, 0]" [draggable]="!isReadonlyOrDisabled" (markerDragEnd)="onDragEnd($event)"></mgl-marker>
|
|
141
|
+
</mgl-map>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="dbx-mapbox-latlng-field-input">
|
|
144
|
+
<button mat-icon-button (click)="useCurrentLocation()" [disabled]="isReadonlyOrDisabled">
|
|
145
|
+
<mat-icon>my_location</mat-icon>
|
|
146
|
+
</button>
|
|
147
|
+
<mat-form-field class="dbx-mapbox-latlng-field-input-field">
|
|
148
|
+
<mat-label>Coordinates</mat-label>
|
|
149
|
+
<input type="text" matInput [placeholder]="placeholder" [formControl]="formControl" />
|
|
150
|
+
</mat-form-field>
|
|
151
|
+
</div>
|
|
152
|
+
</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"] }]
|
|
154
|
+
}], ctorParameters: function () { return [{ type: i1.CompactContextStore, decorators: [{
|
|
155
|
+
type: Optional
|
|
156
|
+
}] }, { type: i2.GeolocationService }]; } });
|
|
157
|
+
|
|
158
|
+
class DbxFormMapboxLatLngModule {
|
|
159
|
+
}
|
|
160
|
+
DbxFormMapboxLatLngModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
161
|
+
DbxFormMapboxLatLngModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngModule, declarations: [DbxFormMapboxLatLngFieldComponent], imports: [CommonModule,
|
|
162
|
+
MatIconModule,
|
|
163
|
+
MatButtonModule,
|
|
164
|
+
DbxTextModule,
|
|
165
|
+
FormsModule,
|
|
166
|
+
ReactiveFormsModule,
|
|
167
|
+
MatInputModule, i1$1.FormlyModule, NgxMapboxGLModule] });
|
|
168
|
+
DbxFormMapboxLatLngModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngModule, imports: [CommonModule,
|
|
169
|
+
MatIconModule,
|
|
170
|
+
MatButtonModule,
|
|
171
|
+
DbxTextModule,
|
|
172
|
+
FormsModule,
|
|
173
|
+
ReactiveFormsModule,
|
|
174
|
+
MatInputModule,
|
|
175
|
+
FormlyModule.forChild({
|
|
176
|
+
types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]
|
|
177
|
+
}),
|
|
178
|
+
NgxMapboxGLModule] });
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxLatLngModule, decorators: [{
|
|
180
|
+
type: NgModule,
|
|
181
|
+
args: [{
|
|
182
|
+
imports: [
|
|
183
|
+
CommonModule,
|
|
184
|
+
MatIconModule,
|
|
185
|
+
MatButtonModule,
|
|
186
|
+
DbxTextModule,
|
|
187
|
+
FormsModule,
|
|
188
|
+
ReactiveFormsModule,
|
|
189
|
+
MatInputModule,
|
|
190
|
+
FormlyModule.forChild({
|
|
191
|
+
types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]
|
|
192
|
+
}),
|
|
193
|
+
NgxMapboxGLModule
|
|
194
|
+
],
|
|
195
|
+
declarations: [DbxFormMapboxLatLngFieldComponent]
|
|
196
|
+
}]
|
|
197
|
+
}] });
|
|
198
|
+
|
|
199
|
+
class DbxFormMapboxModule {
|
|
200
|
+
}
|
|
201
|
+
DbxFormMapboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
202
|
+
DbxFormMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxModule, exports: [DbxFormMapboxLatLngModule] });
|
|
203
|
+
DbxFormMapboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxModule, imports: [DbxFormMapboxLatLngModule] });
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxFormMapboxModule, decorators: [{
|
|
205
|
+
type: NgModule,
|
|
206
|
+
args: [{
|
|
207
|
+
exports: [DbxFormMapboxLatLngModule]
|
|
208
|
+
}]
|
|
209
|
+
}] });
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Generated bundle index. Do not edit.
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
export { DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngModule, DbxFormMapboxModule, mapboxLatLngField };
|
|
216
|
+
//# sourceMappingURL=dereekb-dbx-form-mapbox.mjs.map
|
|
@@ -0,0 +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,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;A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AAA,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;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './latlng';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AbstractControl, FormGroup } from '@angular/forms';
|
|
2
|
+
import { CompactContextStore } from '@dereekb/dbx-web';
|
|
3
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
4
|
+
import { FieldTypeConfig, FormlyFieldProps } from '@ngx-formly/core';
|
|
5
|
+
import { FieldType } from '@ngx-formly/material';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { Maybe, LatLngPoint, LatLngPointFunctionConfig } from '@dereekb/util';
|
|
8
|
+
import { GeolocationService } from '@ng-web-apis/geolocation';
|
|
9
|
+
import { Marker } from 'mapbox-gl';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
export interface DbxFormMapboxLatLngComponentFieldProps extends FormlyFieldProps {
|
|
12
|
+
zoom?: number;
|
|
13
|
+
latLngConfig?: LatLngPointFunctionConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComponentFieldProps = DbxFormMapboxLatLngComponentFieldProps> extends FieldType<FieldTypeConfig<T>> implements OnInit, OnDestroy {
|
|
16
|
+
readonly compact: CompactContextStore;
|
|
17
|
+
private readonly geolocation$;
|
|
18
|
+
private _latLngStringFunction;
|
|
19
|
+
readonly compactClass$: Observable<Maybe<string>>;
|
|
20
|
+
private _sub;
|
|
21
|
+
private _zoom;
|
|
22
|
+
private _formControlObs;
|
|
23
|
+
readonly formControl$: Observable<AbstractControl<any, any>>;
|
|
24
|
+
readonly value$: Observable<any>;
|
|
25
|
+
readonly latLng$: Observable<LatLngPoint>;
|
|
26
|
+
readonly center$: Observable<LatLngPoint>;
|
|
27
|
+
readonly zoom$: Observable<[number]>;
|
|
28
|
+
constructor(compact: CompactContextStore, geolocation$: GeolocationService);
|
|
29
|
+
get zoom(): [number];
|
|
30
|
+
get formGroupName(): string;
|
|
31
|
+
get formGroup(): FormGroup;
|
|
32
|
+
get label(): Maybe<string>;
|
|
33
|
+
get description(): Maybe<string>;
|
|
34
|
+
get isReadonlyOrDisabled(): boolean;
|
|
35
|
+
ngOnInit(): void;
|
|
36
|
+
ngOnDestroy(): void;
|
|
37
|
+
useCurrentLocation(): void;
|
|
38
|
+
onDragEnd(marker: Marker): void;
|
|
39
|
+
setValue(latLng?: Maybe<LatLngPoint>): void;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormMapboxLatLngFieldComponent<any>, [{ optional: true; }, null]>;
|
|
41
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DbxFormMapboxLatLngFieldComponent<any>, "ng-component", never, {}, {}, never, never, false>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DescriptionFieldConfig, FieldConfig, LabeledFieldConfig } from '@dereekb/dbx-form';
|
|
2
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
3
|
+
export interface MapboxLatLngFieldConfig extends Omit<LabeledFieldConfig, 'key'>, DescriptionFieldConfig, Partial<FieldConfig> {
|
|
4
|
+
}
|
|
5
|
+
export declare function mapboxLatLngField(config?: MapboxLatLngFieldConfig): FormlyFieldConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./latlng.field.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/material/icon";
|
|
5
|
+
import * as i4 from "@angular/material/button";
|
|
6
|
+
import * as i5 from "@dereekb/dbx-web";
|
|
7
|
+
import * as i6 from "@angular/forms";
|
|
8
|
+
import * as i7 from "@angular/material/input";
|
|
9
|
+
import * as i8 from "@ngx-formly/core";
|
|
10
|
+
import * as i9 from "ngx-mapbox-gl";
|
|
11
|
+
export declare class DbxFormMapboxLatLngModule {
|
|
12
|
+
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 i6.ReactiveFormsModule, typeof i7.MatInputModule, typeof i8.FormlyModule, typeof i9.NgxMapboxGLModule], never>;
|
|
14
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormMapboxLatLngModule>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./field/latlng/latlng.module";
|
|
3
|
+
export declare class DbxFormMapboxModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DbxFormMapboxModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DbxFormMapboxModule, never, never, [typeof i1.DbxFormMapboxLatLngModule]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DbxFormMapboxModule>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dereekb/dbx-form/mapbox",
|
|
3
|
+
"version": "9.3.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^14.1.0",
|
|
6
|
+
"@angular/core": "^14.1.0",
|
|
7
|
+
"@angular/forms": "^14.0.0",
|
|
8
|
+
"@dereekb/dbx-web": "9.3.1",
|
|
9
|
+
"@ngx-formly/core": "6.0.0-rc.2",
|
|
10
|
+
"@ngx-formly/material": "6.0.0-rc.2",
|
|
11
|
+
"ngx-editor": "^15.0.0",
|
|
12
|
+
"@ng-web-apis/geolocation": "^2.0.0",
|
|
13
|
+
"mapbox-gl": "^2.9.2",
|
|
14
|
+
"@dereekb/dbx-form": "9.3.1",
|
|
15
|
+
"ngx-mapbox-gl": "^9.1.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"tslib": "^2.3.0"
|
|
19
|
+
},
|
|
20
|
+
"module": "fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
21
|
+
"es2020": "fesm2020/dereekb-dbx-form-mapbox.mjs",
|
|
22
|
+
"esm2020": "esm2020/dereekb-dbx-form-mapbox.mjs",
|
|
23
|
+
"fesm2020": "fesm2020/dereekb-dbx-form-mapbox.mjs",
|
|
24
|
+
"fesm2015": "fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
25
|
+
"typings": "index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
"./package.json": {
|
|
28
|
+
"default": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./index.d.ts",
|
|
32
|
+
"esm2020": "./esm2020/dereekb-dbx-form-mapbox.mjs",
|
|
33
|
+
"es2020": "./fesm2020/dereekb-dbx-form-mapbox.mjs",
|
|
34
|
+
"es2015": "./fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
35
|
+
"node": "./fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
36
|
+
"default": "./fesm2020/dereekb-dbx-form-mapbox.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": false
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/dbx-form",
|
|
3
|
-
"version": "9.1
|
|
3
|
+
"version": "9.3.1",
|
|
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.1
|
|
8
|
+
"@dereekb/dbx-core": "9.3.1",
|
|
9
9
|
"@angular/material": "^14.0.0",
|
|
10
|
-
"@dereekb/dbx-web": "9.1
|
|
10
|
+
"@dereekb/dbx-web": "9.3.1",
|
|
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",
|
|
14
14
|
"change-case": "^4.1.2",
|
|
15
|
-
"ngx-editor": "^
|
|
15
|
+
"ngx-editor": "^15.0.0",
|
|
16
16
|
"ngx-mat-intl-tel-input": "^5.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
"node": "./fesm2015/dereekb-dbx-form.mjs",
|
|
29
29
|
"default": "./fesm2020/dereekb-dbx-form.mjs"
|
|
30
30
|
},
|
|
31
|
+
"./mapbox": {
|
|
32
|
+
"types": "./mapbox/index.d.ts",
|
|
33
|
+
"esm2020": "./esm2020/mapbox/dereekb-dbx-form-mapbox.mjs",
|
|
34
|
+
"es2020": "./fesm2020/dereekb-dbx-form-mapbox.mjs",
|
|
35
|
+
"es2015": "./fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
36
|
+
"node": "./fesm2015/dereekb-dbx-form-mapbox.mjs",
|
|
37
|
+
"default": "./fesm2020/dereekb-dbx-form-mapbox.mjs"
|
|
38
|
+
},
|
|
31
39
|
"./package.json": {
|
|
32
40
|
"default": "./package.json"
|
|
33
41
|
}
|