@dereekb/dbx-form 13.7.0 → 13.8.0
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/fesm2022/dereekb-dbx-form-array.field.component-1wYSd4d3.mjs +169 -0
- package/fesm2022/dereekb-dbx-form-array.field.component-1wYSd4d3.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-calendar.mjs +433 -144
- package/fesm2022/dereekb-dbx-form-calendar.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-expand.field.component-Bp5_uO1A.mjs +56 -0
- package/fesm2022/dereekb-dbx-form-expand.field.component-Bp5_uO1A.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs +70 -0
- package/fesm2022/dereekb-dbx-form-formfield.field.component-BQyujXe3.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-info.field.component-B0cFprvc.mjs +50 -0
- package/fesm2022/dereekb-dbx-form-info.field.component-B0cFprvc.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs +35 -0
- package/fesm2022/dereekb-dbx-form-info.wrapper.field.component-Crm4wVr5.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-mapbox.mjs +629 -32
- package/fesm2022/dereekb-dbx-form-mapbox.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-quiz.mjs +46 -55
- package/fesm2022/dereekb-dbx-form-quiz.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-form-section.field.component-DliafLqL.mjs +63 -0
- package/fesm2022/dereekb-dbx-form-section.field.component-DliafLqL.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-style.field.component-C3ZNiotx.mjs +71 -0
- package/fesm2022/dereekb-dbx-form-style.field.component-C3ZNiotx.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-working.field.component-CO8vK2bH.mjs +53 -0
- package/fesm2022/dereekb-dbx-form-working.field.component-CO8vK2bH.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-working.wrapper.field.component-BtD7_5i5.mjs +54 -0
- package/fesm2022/dereekb-dbx-form-working.wrapper.field.component-BtD7_5i5.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs +87 -0
- package/fesm2022/dereekb-dbx-form-wrapper.content.component-Cy4ND_se.mjs.map +1 -0
- package/fesm2022/dereekb-dbx-form.mjs +11789 -4869
- package/fesm2022/dereekb-dbx-form.mjs.map +1 -1
- package/lib/forge/field/_field.scss +14 -0
- package/lib/forge/field/selection/_selection.scss +15 -0
- package/lib/forge/field/selection/pickable/_pickable.scss +11 -0
- package/lib/forge/field/selection/searchable/_searchable.scss +34 -0
- package/lib/forge/field/selection/sourceselect/_sourceselect.scss +46 -0
- package/lib/forge/field/wrapper/_wrapper.scss +62 -0
- package/lib/forge/style/_shared.scss +26 -0
- package/lib/form/_form.scss +95 -0
- package/lib/formly/field/texteditor/_texteditor.scss +8 -0
- package/lib/formly/field/value/array/_array.scss +6 -0
- package/lib/formly/field/value/phone/_phone.scss +4 -1
- package/lib/style/_all-core.scss +2 -0
- package/lib/style/_all-theme.scss +2 -0
- package/package.json +16 -14
- package/types/dereekb-dbx-form-calendar.d.ts +313 -96
- package/types/dereekb-dbx-form-mapbox.d.ts +297 -4
- package/types/dereekb-dbx-form.d.ts +8009 -2498
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { validatorsForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE, formlyField, propsAndConfigForFieldConfig, DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER } from '@dereekb/dbx-form';
|
|
2
|
-
import { LAT_LNG_PATTERN, isSameLatLngPoint, isDefaultLatLngPoint, isValidLatLngPoint, defaultLatLngPoint, latLngStringFunction, latLngPointFunction, latLngPoint } from '@dereekb/util';
|
|
2
|
+
import { LAT_LNG_PATTERN, isSameLatLngPoint, isDefaultLatLngPoint, isValidLatLngPoint, defaultLatLngPoint, latLngStringFunction, latLngPointFunction, filterFromPOJO, latLngPoint } from '@dereekb/util';
|
|
3
3
|
import * as i3 from '@angular/forms';
|
|
4
|
-
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
4
|
+
import { ReactiveFormsModule, FormControl, FormsModule } from '@angular/forms';
|
|
5
5
|
import { CompactContextStore, mapCompactModeObs } from '@dereekb/dbx-web';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { inject, ChangeDetectionStrategy, Component, Injector, NgModule } from '@angular/core';
|
|
7
|
+
import { inject, ChangeDetectionStrategy, Component, Injector, NgModule, input, computed, effect } from '@angular/core';
|
|
8
8
|
import { FieldType } from '@ngx-formly/material';
|
|
9
9
|
import { combineLatest, map, shareReplay, BehaviorSubject, of, switchMap, startWith, distinctUntilChanged, skipWhile, filter, skip, throttleTime, first } from 'rxjs';
|
|
10
10
|
import { SubscriptionObject, filterMaybe, asObservableFromGetter } from '@dereekb/rxjs';
|
|
11
11
|
import { WaGeolocationService } from '@ng-web-apis/geolocation';
|
|
12
12
|
import * as i3$1 from '@dereekb/dbx-web/mapbox';
|
|
13
13
|
import { DbxMapboxMarkerComponent, DbxMapboxInjectionStore, DbxMapboxMapStore, DbxMapboxModule, provideMapboxStoreIfParentIsUnavailable, DbxMapboxService, mapboxZoomLevel, MAPBOX_MIN_ZOOM_LEVEL, MAPBOX_MAX_ZOOM_LEVEL } from '@dereekb/dbx-web/mapbox';
|
|
14
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
14
|
+
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
15
15
|
import { NgClass } from '@angular/common';
|
|
16
16
|
import * as i4 from '@angular/material/button';
|
|
17
17
|
import { MatButtonModule } from '@angular/material/button';
|
|
@@ -25,10 +25,13 @@ import * as i2$1 from 'ngx-mapbox-gl';
|
|
|
25
25
|
import { MapComponent, MarkerComponent } from 'ngx-mapbox-gl';
|
|
26
26
|
import * as i1 from '@ngx-formly/core';
|
|
27
27
|
import { FormlyModule } from '@ngx-formly/core';
|
|
28
|
+
import { DEFAULT_PROPS, DEFAULT_VALIDATION_MESSAGES, provideDynamicForm } from '@ng-forge/dynamic-forms';
|
|
29
|
+
import { resolveValueFieldContext, buildValueFieldInputs } from '@ng-forge/dynamic-forms/integration';
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Creates a Formly field configuration for a Mapbox-powered latitude/longitude picker with optional map display.
|
|
31
33
|
*
|
|
34
|
+
* @deprecated Use forgeMapboxLatLngField() from the forge API instead.
|
|
32
35
|
* @param config - Optional field configuration overrides
|
|
33
36
|
* @returns A validated Formly field configuration for the Mapbox lat/lng picker
|
|
34
37
|
*/
|
|
@@ -68,20 +71,15 @@ function mapboxLatLngField(config = {}) {
|
|
|
68
71
|
class DbxFormMapboxLatLngFieldMarkerComponent {
|
|
69
72
|
fieldComponent = inject(DbxFormMapboxLatLngFieldComponent);
|
|
70
73
|
marker$ = combineLatest([this.fieldComponent.latLng$, this.fieldComponent.markerConfig$]).pipe(map(([latLng, markerConfig]) => {
|
|
71
|
-
|
|
72
|
-
return { latLng, ...markerConfig };
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
74
|
+
return markerConfig !== false ? { latLng, ...markerConfig } : undefined;
|
|
77
75
|
}), shareReplay(1));
|
|
78
76
|
markerSignal = toSignal(this.marker$);
|
|
79
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
80
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.
|
|
77
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngFieldMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
78
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: DbxFormMapboxLatLngFieldMarkerComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
81
79
|
<dbx-mapbox-marker [marker]="markerSignal()"></dbx-mapbox-marker>
|
|
82
80
|
`, isInline: true, dependencies: [{ kind: "component", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: ["marker"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
83
81
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngFieldMarkerComponent, decorators: [{
|
|
85
83
|
type: Component,
|
|
86
84
|
args: [{
|
|
87
85
|
template: `
|
|
@@ -103,6 +101,9 @@ const DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG = {
|
|
|
103
101
|
<mat-icon>my_location</mat-icon>
|
|
104
102
|
</button>
|
|
105
103
|
*/
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use DbxForgeMapboxLatLngFieldComponent instead.
|
|
106
|
+
*/
|
|
106
107
|
class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
107
108
|
_geolocationService = inject(WaGeolocationService);
|
|
108
109
|
compact = inject(CompactContextStore, { optional: true });
|
|
@@ -275,8 +276,8 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
275
276
|
this.formControl.markAsTouched();
|
|
276
277
|
this.formControl.markAsDirty();
|
|
277
278
|
}
|
|
278
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
279
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
279
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
280
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxFormMapboxLatLngFieldComponent, isStandalone: true, selector: "ng-component", providers: [provideMapboxStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
|
|
280
281
|
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()" [formGroup]="formGroup">
|
|
281
282
|
@if (showMap) {
|
|
282
283
|
<div class="dbx-mapbox-input-field-map">
|
|
@@ -302,7 +303,7 @@ class DbxFormMapboxLatLngFieldComponent extends FieldType {
|
|
|
302
303
|
</div>
|
|
303
304
|
`, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "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", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing"] }, { kind: "component", type: MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "zIndex", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: DbxMapboxModule }, { kind: "directive", type: i3$1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
304
305
|
}
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngFieldComponent, decorators: [{
|
|
306
307
|
type: Component,
|
|
307
308
|
args: [{ template: `
|
|
308
309
|
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()" [formGroup]="formGroup">
|
|
@@ -332,14 +333,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImpor
|
|
|
332
333
|
}] });
|
|
333
334
|
|
|
334
335
|
const importsAndExports$1 = [DbxFormMapboxLatLngFieldComponent];
|
|
336
|
+
/**
|
|
337
|
+
* @deprecated Use provideDbxForgeMapboxFieldDeclarations() instead.
|
|
338
|
+
*/
|
|
335
339
|
class DbxFormMapboxLatLngModule {
|
|
336
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
337
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.
|
|
338
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.
|
|
340
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
341
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngModule, imports: [DbxFormMapboxLatLngFieldComponent, i1.FormlyModule], exports: [DbxFormMapboxLatLngFieldComponent] });
|
|
342
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngModule, imports: [importsAndExports$1, FormlyModule.forChild({
|
|
339
343
|
types: [{ name: 'mapbox-latlng-picker', component: DbxFormMapboxLatLngFieldComponent, wrappers: ['style', 'form-field'] }]
|
|
340
344
|
})] });
|
|
341
345
|
}
|
|
342
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
346
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxLatLngModule, decorators: [{
|
|
343
347
|
type: NgModule,
|
|
344
348
|
args: [{
|
|
345
349
|
imports: [
|
|
@@ -352,9 +356,347 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImpor
|
|
|
352
356
|
}]
|
|
353
357
|
}] });
|
|
354
358
|
|
|
359
|
+
/**
|
|
360
|
+
* The custom forge field type name for the mapbox lat/lng field.
|
|
361
|
+
*/
|
|
362
|
+
const FORGE_MAPBOX_LATLNG_FIELD_TYPE = 'dbx-forge-mapbox-latlng';
|
|
363
|
+
/**
|
|
364
|
+
* Creates a forge field definition for a Mapbox-powered latitude/longitude picker.
|
|
365
|
+
*
|
|
366
|
+
* This is the forge equivalent of {@link mapboxLatLngField}.
|
|
367
|
+
*
|
|
368
|
+
* @param config - Optional field configuration overrides
|
|
369
|
+
* @returns A validated forge field definition for the Mapbox lat/lng picker
|
|
370
|
+
*/
|
|
371
|
+
function forgeMapboxLatLngField(config = {}) {
|
|
372
|
+
const { key = 'latLng', label, description, required, readonly: isReadonly, showMap, zoom, latLngConfig, recenterTime, showCenterButton, setCenterOnLocationSet, selectLocationOnMapDrag, selectLocationOnMapClick, markerConfig } = config;
|
|
373
|
+
const props = filterFromPOJO({
|
|
374
|
+
label: label ?? 'Location',
|
|
375
|
+
description,
|
|
376
|
+
placeholder: DEFAULT_LAT_LNG_TEXT_FIELD_PLACEHOLDER,
|
|
377
|
+
pattern: LAT_LNG_PATTERN,
|
|
378
|
+
patternMessage: DEFAULT_LAT_LNG_TEXT_FIELD_PATTERN_MESSAGE,
|
|
379
|
+
showMap,
|
|
380
|
+
zoom,
|
|
381
|
+
latLngConfig,
|
|
382
|
+
recenterTime,
|
|
383
|
+
selectLocationOnMapDrag,
|
|
384
|
+
selectLocationOnMapClick,
|
|
385
|
+
showCenterButton,
|
|
386
|
+
setCenterOnLocationSet,
|
|
387
|
+
markerConfig
|
|
388
|
+
});
|
|
389
|
+
return filterFromPOJO({
|
|
390
|
+
key,
|
|
391
|
+
type: FORGE_MAPBOX_LATLNG_FIELD_TYPE,
|
|
392
|
+
label: label ?? 'Location',
|
|
393
|
+
value: undefined,
|
|
394
|
+
required,
|
|
395
|
+
readonly: isReadonly,
|
|
396
|
+
props: Object.keys(props).length > 0 ? props : undefined
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
class DbxForgeMapboxLatLngFieldMarkerComponent {
|
|
401
|
+
fieldComponent = inject(DbxForgeMapboxLatLngFieldComponent);
|
|
402
|
+
marker$ = combineLatest([this.fieldComponent.latLng$, this.fieldComponent.markerConfig$]).pipe(map(([latLng, markerConfig]) => {
|
|
403
|
+
return markerConfig !== false ? { latLng, ...markerConfig } : undefined;
|
|
404
|
+
}), shareReplay(1));
|
|
405
|
+
markerSignal = toSignal(this.marker$);
|
|
406
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxLatLngFieldMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
407
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: DbxForgeMapboxLatLngFieldMarkerComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
408
|
+
<dbx-mapbox-marker [marker]="markerSignal()"></dbx-mapbox-marker>
|
|
409
|
+
`, isInline: true, dependencies: [{ kind: "component", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: ["marker"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
410
|
+
}
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxLatLngFieldMarkerComponent, decorators: [{
|
|
412
|
+
type: Component,
|
|
413
|
+
args: [{
|
|
414
|
+
template: `
|
|
415
|
+
<dbx-mapbox-marker [marker]="markerSignal()"></dbx-mapbox-marker>
|
|
416
|
+
`,
|
|
417
|
+
imports: [DbxMapboxMarkerComponent],
|
|
418
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
419
|
+
standalone: true
|
|
420
|
+
}]
|
|
421
|
+
}] });
|
|
422
|
+
|
|
423
|
+
const DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY = 'DbxForgeMapboxLatLngFieldComponent';
|
|
424
|
+
const DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_MARKER_CONFIG = {
|
|
425
|
+
icon: 'pin_drop'
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Forge custom field component for Mapbox latitude/longitude picking.
|
|
429
|
+
*
|
|
430
|
+
* This is the forge equivalent of {@link DbxFormMapboxLatLngFieldComponent}.
|
|
431
|
+
* It bridges ng-forge Signal Forms with the Mapbox map store.
|
|
432
|
+
*
|
|
433
|
+
* Registered as ng-forge type 'dbx-forge-mapbox-latlng'.
|
|
434
|
+
*/
|
|
435
|
+
class DbxForgeMapboxLatLngFieldComponent {
|
|
436
|
+
_geolocationService = inject(WaGeolocationService);
|
|
437
|
+
compact = inject(CompactContextStore, { optional: true });
|
|
438
|
+
dbxMapboxInjectionStore = inject(DbxMapboxInjectionStore, { optional: true });
|
|
439
|
+
dbxMapboxMapStore = inject(DbxMapboxMapStore);
|
|
440
|
+
// Standard ng-forge value field inputs
|
|
441
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
442
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
443
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
444
|
+
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
445
|
+
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
446
|
+
tabIndex = input(...(ngDevMode ? [undefined, { debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
447
|
+
props = input(...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
448
|
+
meta = input(...(ngDevMode ? [undefined, { debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
449
|
+
validationMessages = input(...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : /* istanbul ignore next */ []));
|
|
450
|
+
defaultValidationMessages = input(...(ngDevMode ? [undefined, { debugName: "defaultValidationMessages" }] : /* istanbul ignore next */ []));
|
|
451
|
+
// Internal text form control for the coordinate input
|
|
452
|
+
textCtrl = new FormControl('');
|
|
453
|
+
// Subscription management
|
|
454
|
+
_sub = new SubscriptionObject();
|
|
455
|
+
_geoSub = new SubscriptionObject();
|
|
456
|
+
_centerSub = new SubscriptionObject();
|
|
457
|
+
_flyToCenterSub = new SubscriptionObject();
|
|
458
|
+
_clickSub = new SubscriptionObject();
|
|
459
|
+
_zoom = new BehaviorSubject(12);
|
|
460
|
+
_markerConfig = new BehaviorSubject(of(DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_MARKER_CONFIG));
|
|
461
|
+
_latLngStringFunction;
|
|
462
|
+
_latLngPointFunction;
|
|
463
|
+
compactClass$ = mapCompactModeObs(this.compact?.mode$, {
|
|
464
|
+
compact: 'dbx-mapbox-input-field-compact'
|
|
465
|
+
}).pipe(filterMaybe());
|
|
466
|
+
_useCurrentLocationDisabled = new BehaviorSubject(false);
|
|
467
|
+
useCurrentLocationDisabled$ = this._useCurrentLocationDisabled.asObservable();
|
|
468
|
+
// Field value signal (double-call pattern)
|
|
469
|
+
fieldValue = computed(() => {
|
|
470
|
+
const state = this.field()?.();
|
|
471
|
+
return state?.value?.();
|
|
472
|
+
}, ...(ngDevMode ? [{ debugName: "fieldValue" }] : /* istanbul ignore next */ []));
|
|
473
|
+
isDisabled = computed(() => {
|
|
474
|
+
const state = this.field()?.();
|
|
475
|
+
return state?.disabled?.() ?? false;
|
|
476
|
+
}, ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
477
|
+
isReadonlyOrDisabledSignal = computed(() => this.props()?.readonly || this.isDisabled(), ...(ngDevMode ? [{ debugName: "isReadonlyOrDisabledSignal" }] : /* istanbul ignore next */ []));
|
|
478
|
+
// Computed props from field definition
|
|
479
|
+
showMapSignal = computed(() => this.props()?.showMap ?? true, ...(ngDevMode ? [{ debugName: "showMapSignal" }] : /* istanbul ignore next */ []));
|
|
480
|
+
selectLocationOnMapDragSignal = computed(() => this.props()?.selectLocationOnMapDrag ?? true, ...(ngDevMode ? [{ debugName: "selectLocationOnMapDragSignal" }] : /* istanbul ignore next */ []));
|
|
481
|
+
selectLocationOnMapClickSignal = computed(() => this.props()?.selectLocationOnMapClick ?? false, ...(ngDevMode ? [{ debugName: "selectLocationOnMapClickSignal" }] : /* istanbul ignore next */ []));
|
|
482
|
+
setCenterOnLocationSetSignal = computed(() => this.props()?.setCenterOnLocationSet ?? true, ...(ngDevMode ? [{ debugName: "setCenterOnLocationSetSignal" }] : /* istanbul ignore next */ []));
|
|
483
|
+
showCenterButtonSignal = computed(() => !this.selectLocationOnMapDragSignal() && this.props()?.showCenterButton !== false, ...(ngDevMode ? [{ debugName: "showCenterButtonSignal" }] : /* istanbul ignore next */ []));
|
|
484
|
+
recenterTimeSignal = computed(() => this.props()?.recenterTime || 10 * 1000, ...(ngDevMode ? [{ debugName: "recenterTimeSignal" }] : /* istanbul ignore next */ []));
|
|
485
|
+
placeholderTextSignal = computed(() => this.props()?.placeholder, ...(ngDevMode ? [{ debugName: "placeholderTextSignal" }] : /* istanbul ignore next */ []));
|
|
486
|
+
// Observables for map store sync
|
|
487
|
+
fieldValue$ = toObservable(this.fieldValue);
|
|
488
|
+
latLng$ = this.fieldValue$.pipe(filterMaybe(), map((x) => this._latLngPointFunction?.(x) ?? defaultLatLngPoint()), distinctUntilChanged(isSameLatLngPoint), shareReplay(1));
|
|
489
|
+
nonZeroLatLng$ = this.latLng$.pipe(skipWhile(isDefaultLatLngPoint), filter(isValidLatLngPoint));
|
|
490
|
+
zoom$ = this._zoom.asObservable();
|
|
491
|
+
markerConfig$ = this._markerConfig.asObservable().pipe(switchMap((x) => x), shareReplay(1));
|
|
492
|
+
useCurrentLocationDisabledSignal = toSignal(this._useCurrentLocationDisabled, { initialValue: false });
|
|
493
|
+
compactClassSignal = toSignal(this.compactClass$, { initialValue: '' });
|
|
494
|
+
latLngSignal = toSignal(this.latLng$, { initialValue: defaultLatLngPoint() });
|
|
495
|
+
_syncing = false;
|
|
496
|
+
_setFieldValue(value) {
|
|
497
|
+
const state = this.field()?.();
|
|
498
|
+
if (state?.value?.set) {
|
|
499
|
+
state.value.set(value);
|
|
500
|
+
state.markAsTouched?.();
|
|
501
|
+
state.markAsDirty?.();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
constructor() {
|
|
505
|
+
// Initialize on first props emission
|
|
506
|
+
effect(() => {
|
|
507
|
+
const p = this.props();
|
|
508
|
+
if (!p) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const latLngPointConfig = { ...p.latLngConfig, wrap: p.latLngConfig?.wrap || false, validate: p.latLngConfig?.validate || false, precisionRounding: p.latLngConfig?.precisionRounding ?? 'round' };
|
|
512
|
+
this._latLngStringFunction = latLngStringFunction(latLngPointConfig);
|
|
513
|
+
this._latLngPointFunction = latLngPointFunction(latLngPointConfig);
|
|
514
|
+
const zoom = Math.min(p.zoom || 12, 18);
|
|
515
|
+
this._zoom.next(zoom);
|
|
516
|
+
if (p.setCenterOnLocationSet !== false) {
|
|
517
|
+
this._centerSub.subscription = this.dbxMapboxMapStore.setCenter(this.nonZeroLatLng$);
|
|
518
|
+
}
|
|
519
|
+
if (p.showMap ?? true) {
|
|
520
|
+
this.dbxMapboxMapStore.setZoom(this.zoom$);
|
|
521
|
+
const recenterTime = p.recenterTime || 10 * 1000;
|
|
522
|
+
if (recenterTime > 0) {
|
|
523
|
+
this._flyToCenterSub.subscription = this.dbxMapboxMapStore.center$.pipe(skip(1), throttleTime(recenterTime, undefined, { leading: false, trailing: true })).subscribe(() => {
|
|
524
|
+
this.flyToMarker();
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
if (p.selectLocationOnMapDrag ?? true) {
|
|
530
|
+
this._sub.subscription = this.dbxMapboxMapStore.center$.subscribe((center) => {
|
|
531
|
+
this.dbxMapboxMapStore.centerGivenMargin$.pipe(first()).subscribe(() => {
|
|
532
|
+
if (!this.isReadonlyOrDisabledSignal()) {
|
|
533
|
+
this.setValue(center);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
if (p.selectLocationOnMapClick) {
|
|
539
|
+
this._clickSub.subscription = this.dbxMapboxMapStore.clickEvent$.subscribe((x) => {
|
|
540
|
+
if (x?.type === 'click') {
|
|
541
|
+
this.setValue(x.lngLat);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (p.readonly) {
|
|
547
|
+
this.textCtrl.disable();
|
|
548
|
+
}
|
|
549
|
+
// Add the marker to the injection store for display
|
|
550
|
+
if (this.dbxMapboxInjectionStore) {
|
|
551
|
+
if (p.markerConfig != null) {
|
|
552
|
+
this._markerConfig.next(p.markerConfig === false ? of(false) : asObservableFromGetter(p.markerConfig, this));
|
|
553
|
+
}
|
|
554
|
+
this.dbxMapboxInjectionStore.addInjectionConfig({
|
|
555
|
+
key: p.mapInjectionKey || DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY,
|
|
556
|
+
injectionConfig: {
|
|
557
|
+
componentClass: DbxForgeMapboxLatLngFieldMarkerComponent,
|
|
558
|
+
providers: [{ provide: DbxForgeMapboxLatLngFieldComponent, useValue: this }]
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
// Sync field value → text control (inbound)
|
|
564
|
+
effect(() => {
|
|
565
|
+
const value = this.fieldValue();
|
|
566
|
+
if (!this._syncing) {
|
|
567
|
+
this._syncing = true;
|
|
568
|
+
this.textCtrl.setValue(value ?? '', { emitEvent: false });
|
|
569
|
+
this._syncing = false;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
// Sync text control → field value (outbound)
|
|
573
|
+
this.textCtrl.valueChanges.subscribe((textValue) => {
|
|
574
|
+
if (!this._syncing) {
|
|
575
|
+
this._syncing = true;
|
|
576
|
+
this._setFieldValue(textValue || null);
|
|
577
|
+
this._syncing = false;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
ngOnDestroy() {
|
|
582
|
+
this._zoom.complete();
|
|
583
|
+
this._markerConfig.complete();
|
|
584
|
+
this._useCurrentLocationDisabled.complete();
|
|
585
|
+
this._sub.destroy();
|
|
586
|
+
this._geoSub.destroy();
|
|
587
|
+
this._centerSub.destroy();
|
|
588
|
+
this._flyToCenterSub.destroy();
|
|
589
|
+
this._clickSub.destroy();
|
|
590
|
+
}
|
|
591
|
+
flyToMarker() {
|
|
592
|
+
this.dbxMapboxMapStore.easeTo(this.nonZeroLatLng$.pipe(first(), map((x) => ({ center: x }))));
|
|
593
|
+
}
|
|
594
|
+
useCurrentLocation() {
|
|
595
|
+
this._geoSub.subscription = this._geolocationService.pipe(first()).subscribe({
|
|
596
|
+
next: (position) => {
|
|
597
|
+
if (position) {
|
|
598
|
+
const { latitude: lat, longitude: lng } = position.coords;
|
|
599
|
+
this.setValue({ lat, lng });
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
error: () => {
|
|
603
|
+
this._useCurrentLocationDisabled.next(true);
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
onMarkerDragEnd(marker) {
|
|
608
|
+
this.setValue(marker.getLngLat());
|
|
609
|
+
}
|
|
610
|
+
setValue(latLng) {
|
|
611
|
+
const stringValue = latLng ? this._latLngStringFunction(latLng) : null;
|
|
612
|
+
this._syncing = true;
|
|
613
|
+
this.textCtrl.setValue(stringValue, { emitEvent: false });
|
|
614
|
+
this._setFieldValue(stringValue);
|
|
615
|
+
this._syncing = false;
|
|
616
|
+
}
|
|
617
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxLatLngFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
618
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxForgeMapboxLatLngFieldComponent, isStandalone: true, selector: "dbx-forge-mapbox-latlng-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideMapboxStoreIfParentIsUnavailable()], ngImport: i0, template: `
|
|
619
|
+
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()">
|
|
620
|
+
@if (showMapSignal()) {
|
|
621
|
+
<div class="dbx-mapbox-input-field-map">
|
|
622
|
+
<mgl-map dbxMapboxMap>
|
|
623
|
+
<mgl-marker [lngLat]="latLngSignal()" [draggable]="!isReadonlyOrDisabledSignal()" (markerDragEnd)="onMarkerDragEnd($event)"></mgl-marker>
|
|
624
|
+
</mgl-map>
|
|
625
|
+
</div>
|
|
626
|
+
}
|
|
627
|
+
<div class="dbx-mapbox-input-field-input">
|
|
628
|
+
@if (showCenterButtonSignal()) {
|
|
629
|
+
<button mat-icon-button (click)="flyToMarker()">
|
|
630
|
+
<mat-icon>my_location</mat-icon>
|
|
631
|
+
</button>
|
|
632
|
+
}
|
|
633
|
+
<mat-form-field class="dbx-mapbox-input-field-input-field">
|
|
634
|
+
<mat-label>Coordinates</mat-label>
|
|
635
|
+
<input type="text" matInput [placeholder]="placeholderTextSignal() ?? ''" [formControl]="textCtrl" />
|
|
636
|
+
@if (useCurrentLocationDisabledSignal()) {
|
|
637
|
+
<mat-hint class="dbx-hint dbx-warn">Could not access your current location.</mat-hint>
|
|
638
|
+
}
|
|
639
|
+
</mat-form-field>
|
|
640
|
+
</div>
|
|
641
|
+
</div>
|
|
642
|
+
`, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "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", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing"] }, { kind: "component", type: MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "zIndex", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: DbxMapboxModule }, { kind: "directive", type: i3$1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
643
|
+
}
|
|
644
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxLatLngFieldComponent, decorators: [{
|
|
645
|
+
type: Component,
|
|
646
|
+
args: [{ selector: 'dbx-forge-mapbox-latlng-field', template: `
|
|
647
|
+
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()">
|
|
648
|
+
@if (showMapSignal()) {
|
|
649
|
+
<div class="dbx-mapbox-input-field-map">
|
|
650
|
+
<mgl-map dbxMapboxMap>
|
|
651
|
+
<mgl-marker [lngLat]="latLngSignal()" [draggable]="!isReadonlyOrDisabledSignal()" (markerDragEnd)="onMarkerDragEnd($event)"></mgl-marker>
|
|
652
|
+
</mgl-map>
|
|
653
|
+
</div>
|
|
654
|
+
}
|
|
655
|
+
<div class="dbx-mapbox-input-field-input">
|
|
656
|
+
@if (showCenterButtonSignal()) {
|
|
657
|
+
<button mat-icon-button (click)="flyToMarker()">
|
|
658
|
+
<mat-icon>my_location</mat-icon>
|
|
659
|
+
</button>
|
|
660
|
+
}
|
|
661
|
+
<mat-form-field class="dbx-mapbox-input-field-input-field">
|
|
662
|
+
<mat-label>Coordinates</mat-label>
|
|
663
|
+
<input type="text" matInput [placeholder]="placeholderTextSignal() ?? ''" [formControl]="textCtrl" />
|
|
664
|
+
@if (useCurrentLocationDisabledSignal()) {
|
|
665
|
+
<mat-hint class="dbx-hint dbx-warn">Could not access your current location.</mat-hint>
|
|
666
|
+
}
|
|
667
|
+
</mat-form-field>
|
|
668
|
+
</div>
|
|
669
|
+
</div>
|
|
670
|
+
`, providers: [provideMapboxStoreIfParentIsUnavailable()], imports: [NgClass, MapComponent, MarkerComponent, ReactiveFormsModule, MatIconModule, DbxMapboxModule, MatButtonModule, MatFormFieldModule, MatInputModule], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"] }]
|
|
671
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }] } });
|
|
672
|
+
/**
|
|
673
|
+
* Custom mapper for the forge mapbox lat/lng field.
|
|
674
|
+
*
|
|
675
|
+
* @param fieldDef - Field definition configuration
|
|
676
|
+
* @param fieldDef.key - Form model key for the field
|
|
677
|
+
* @returns Signal containing a Record of input names to values for ngComponentOutlet
|
|
678
|
+
*/
|
|
679
|
+
function mapboxLatLngFieldMapper(fieldDef) {
|
|
680
|
+
const ctx = resolveValueFieldContext();
|
|
681
|
+
const defaultProps = inject(DEFAULT_PROPS);
|
|
682
|
+
const defaultValidationMessages = inject(DEFAULT_VALIDATION_MESSAGES);
|
|
683
|
+
return computed(() => {
|
|
684
|
+
return buildValueFieldInputs(fieldDef, ctx, defaultProps?.(), defaultValidationMessages?.());
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
var latlng_forge_field_component = /*#__PURE__*/Object.freeze({
|
|
689
|
+
__proto__: null,
|
|
690
|
+
DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY: DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY,
|
|
691
|
+
DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_MARKER_CONFIG: DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_MARKER_CONFIG,
|
|
692
|
+
DbxForgeMapboxLatLngFieldComponent: DbxForgeMapboxLatLngFieldComponent,
|
|
693
|
+
mapboxLatLngFieldMapper: mapboxLatLngFieldMapper
|
|
694
|
+
});
|
|
695
|
+
|
|
355
696
|
/**
|
|
356
697
|
* Creates a Formly field configuration for a Mapbox-powered zoom level picker with optional map preview.
|
|
357
698
|
*
|
|
699
|
+
* @deprecated Use forgeMapboxZoomField() from the forge API instead.
|
|
358
700
|
* @param config - Optional field configuration overrides
|
|
359
701
|
* @returns A validated Formly field configuration for the Mapbox zoom picker
|
|
360
702
|
*/
|
|
@@ -380,6 +722,9 @@ function mapboxZoomField(config = {}) {
|
|
|
380
722
|
return fieldConfig;
|
|
381
723
|
}
|
|
382
724
|
|
|
725
|
+
/**
|
|
726
|
+
* @deprecated Use DbxForgeMapboxZoomFieldComponent instead.
|
|
727
|
+
*/
|
|
383
728
|
class DbxFormMapboxZoomFieldComponent extends FieldType {
|
|
384
729
|
compact = inject(CompactContextStore, { optional: true });
|
|
385
730
|
dbxMapboxService = inject(DbxMapboxService);
|
|
@@ -472,8 +817,8 @@ class DbxFormMapboxZoomFieldComponent extends FieldType {
|
|
|
472
817
|
this.formControl.markAsTouched();
|
|
473
818
|
this.formControl.markAsDirty();
|
|
474
819
|
}
|
|
475
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
476
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
820
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
821
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxFormMapboxZoomFieldComponent, isStandalone: true, selector: "ng-component", providers: [provideMapboxStoreIfParentIsUnavailable()], usesInheritance: true, ngImport: i0, template: `
|
|
477
822
|
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()" [formGroup]="formGroup">
|
|
478
823
|
@if (showMap) {
|
|
479
824
|
<div class="dbx-mapbox-input-field-map">
|
|
@@ -489,7 +834,7 @@ class DbxFormMapboxZoomFieldComponent extends FieldType {
|
|
|
489
834
|
</div>
|
|
490
835
|
`, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DbxMapboxModule }, { kind: "directive", type: i3$1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "component", type: i2$1.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "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", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.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: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
491
836
|
}
|
|
492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
837
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomFieldComponent, decorators: [{
|
|
493
838
|
type: Component,
|
|
494
839
|
args: [{ template: `
|
|
495
840
|
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()" [formGroup]="formGroup">
|
|
@@ -509,14 +854,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImpor
|
|
|
509
854
|
}] });
|
|
510
855
|
|
|
511
856
|
const importsAndExports = [DbxFormMapboxZoomFieldComponent];
|
|
857
|
+
/**
|
|
858
|
+
* @deprecated Use provideDbxForgeMapboxFieldDeclarations() instead.
|
|
859
|
+
*/
|
|
512
860
|
class DbxFormMapboxZoomModule {
|
|
513
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
514
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.
|
|
515
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.
|
|
861
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
862
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomModule, imports: [DbxFormMapboxZoomFieldComponent, i1.FormlyModule], exports: [DbxFormMapboxZoomFieldComponent] });
|
|
863
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomModule, imports: [importsAndExports, FormlyModule.forChild({
|
|
516
864
|
types: [{ name: 'mapbox-zoom-picker', component: DbxFormMapboxZoomFieldComponent, wrappers: ['style', 'form-field'] }]
|
|
517
865
|
})] });
|
|
518
866
|
}
|
|
519
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxZoomModule, decorators: [{
|
|
520
868
|
type: NgModule,
|
|
521
869
|
args: [{
|
|
522
870
|
imports: [
|
|
@@ -529,21 +877,270 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImpor
|
|
|
529
877
|
}]
|
|
530
878
|
}] });
|
|
531
879
|
|
|
880
|
+
/**
|
|
881
|
+
* The custom forge field type name for the mapbox zoom field.
|
|
882
|
+
*/
|
|
883
|
+
const FORGE_MAPBOX_ZOOM_FIELD_TYPE = 'dbx-forge-mapbox-zoom';
|
|
884
|
+
/**
|
|
885
|
+
* Creates a forge field definition for a Mapbox-powered zoom level picker.
|
|
886
|
+
*
|
|
887
|
+
* This is the forge equivalent of {@link mapboxZoomField}.
|
|
888
|
+
*
|
|
889
|
+
* @param config - Optional field configuration overrides
|
|
890
|
+
* @returns A validated forge field definition for the Mapbox zoom picker
|
|
891
|
+
*/
|
|
892
|
+
function forgeMapboxZoomField(config = {}) {
|
|
893
|
+
const { key = 'zoom', label, description, required, readonly: isReadonly, showMap, center, minZoom, maxZoom, zoomStep } = config;
|
|
894
|
+
const props = filterFromPOJO({
|
|
895
|
+
label: label ?? 'Zoom',
|
|
896
|
+
description,
|
|
897
|
+
showMap,
|
|
898
|
+
center,
|
|
899
|
+
minZoom,
|
|
900
|
+
maxZoom,
|
|
901
|
+
zoomStep
|
|
902
|
+
});
|
|
903
|
+
return filterFromPOJO({
|
|
904
|
+
key,
|
|
905
|
+
type: FORGE_MAPBOX_ZOOM_FIELD_TYPE,
|
|
906
|
+
label: label ?? 'Zoom',
|
|
907
|
+
value: undefined,
|
|
908
|
+
required,
|
|
909
|
+
readonly: isReadonly,
|
|
910
|
+
props: Object.keys(props).length > 0 ? props : undefined
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Forge custom field component for Mapbox zoom level picking.
|
|
916
|
+
*
|
|
917
|
+
* This is the forge equivalent of {@link DbxFormMapboxZoomFieldComponent}.
|
|
918
|
+
* It bridges ng-forge Signal Forms with the Mapbox map store.
|
|
919
|
+
*
|
|
920
|
+
* Registered as ng-forge type 'dbx-forge-mapbox-zoom'.
|
|
921
|
+
*/
|
|
922
|
+
class DbxForgeMapboxZoomFieldComponent {
|
|
923
|
+
compact = inject(CompactContextStore, { optional: true });
|
|
924
|
+
dbxMapboxService = inject(DbxMapboxService);
|
|
925
|
+
dbxMapboxMapStore = inject(DbxMapboxMapStore);
|
|
926
|
+
// Standard ng-forge value field inputs
|
|
927
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
928
|
+
key = input.required(...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
929
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
930
|
+
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
931
|
+
className = input('', ...(ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []));
|
|
932
|
+
tabIndex = input(...(ngDevMode ? [undefined, { debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
933
|
+
props = input(...(ngDevMode ? [undefined, { debugName: "props" }] : /* istanbul ignore next */ []));
|
|
934
|
+
meta = input(...(ngDevMode ? [undefined, { debugName: "meta" }] : /* istanbul ignore next */ []));
|
|
935
|
+
validationMessages = input(...(ngDevMode ? [undefined, { debugName: "validationMessages" }] : /* istanbul ignore next */ []));
|
|
936
|
+
defaultValidationMessages = input(...(ngDevMode ? [undefined, { debugName: "defaultValidationMessages" }] : /* istanbul ignore next */ []));
|
|
937
|
+
// Internal number form control for the zoom input
|
|
938
|
+
numberCtrl = new FormControl(null);
|
|
939
|
+
placeholderText = '';
|
|
940
|
+
_undoZoomLimit = false;
|
|
941
|
+
compactClass$ = mapCompactModeObs(this.compact?.mode$, {
|
|
942
|
+
compact: 'dbx-mapbox-input-field-compact'
|
|
943
|
+
}).pipe(filterMaybe());
|
|
944
|
+
compactClassSignal = toSignal(this.compactClass$, { initialValue: '' });
|
|
945
|
+
// Subscription management
|
|
946
|
+
_sub = new SubscriptionObject();
|
|
947
|
+
_center = new BehaviorSubject(undefined);
|
|
948
|
+
// Field value signal (double-call pattern)
|
|
949
|
+
fieldValue = computed(() => {
|
|
950
|
+
const state = this.field()?.();
|
|
951
|
+
return state?.value?.();
|
|
952
|
+
}, ...(ngDevMode ? [{ debugName: "fieldValue" }] : /* istanbul ignore next */ []));
|
|
953
|
+
isDisabled = computed(() => {
|
|
954
|
+
const state = this.field()?.();
|
|
955
|
+
return state?.disabled?.() ?? false;
|
|
956
|
+
}, ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
957
|
+
isReadonlyOrDisabledSignal = computed(() => this.props()?.readonly || this.isDisabled(), ...(ngDevMode ? [{ debugName: "isReadonlyOrDisabledSignal" }] : /* istanbul ignore next */ []));
|
|
958
|
+
// Computed props
|
|
959
|
+
showMapSignal = computed(() => this.props()?.showMap ?? true, ...(ngDevMode ? [{ debugName: "showMapSignal" }] : /* istanbul ignore next */ []));
|
|
960
|
+
lockMapToZoomLevelsSignal = computed(() => this.props()?.lockMapToZoomLevels ?? false, ...(ngDevMode ? [{ debugName: "lockMapToZoomLevelsSignal" }] : /* istanbul ignore next */ []));
|
|
961
|
+
minZoomSignal = computed(() => mapboxZoomLevel(this.props()?.minZoom || MAPBOX_MIN_ZOOM_LEVEL), ...(ngDevMode ? [{ debugName: "minZoomSignal" }] : /* istanbul ignore next */ []));
|
|
962
|
+
maxZoomSignal = computed(() => mapboxZoomLevel(this.props()?.maxZoom || MAPBOX_MAX_ZOOM_LEVEL), ...(ngDevMode ? [{ debugName: "maxZoomSignal" }] : /* istanbul ignore next */ []));
|
|
963
|
+
zoomStepSignal = computed(() => mapboxZoomLevel(this.props()?.zoomStep || 1), ...(ngDevMode ? [{ debugName: "zoomStepSignal" }] : /* istanbul ignore next */ []));
|
|
964
|
+
fieldValue$ = toObservable(this.fieldValue);
|
|
965
|
+
zoom$ = this.fieldValue$.pipe(filterMaybe(), shareReplay(1));
|
|
966
|
+
center$ = this._center.pipe(filterMaybe());
|
|
967
|
+
_syncing = false;
|
|
968
|
+
_setFieldValue(value) {
|
|
969
|
+
const state = this.field()?.();
|
|
970
|
+
if (state?.value?.set) {
|
|
971
|
+
state.value.set(value);
|
|
972
|
+
state.markAsTouched?.();
|
|
973
|
+
state.markAsDirty?.();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
constructor() {
|
|
977
|
+
// Initialize on first props emission
|
|
978
|
+
effect(() => {
|
|
979
|
+
const p = this.props();
|
|
980
|
+
if (!p) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
const center = p.center || latLngPoint(this.dbxMapboxService.defaultCenter);
|
|
984
|
+
this._center.next(center);
|
|
985
|
+
this.dbxMapboxMapStore.setZoom(this.zoom$);
|
|
986
|
+
if (p.showMap ?? true) {
|
|
987
|
+
this.dbxMapboxMapStore.setCenter(this.center$);
|
|
988
|
+
}
|
|
989
|
+
if (p?.readonly) {
|
|
990
|
+
this.numberCtrl.disable();
|
|
991
|
+
if (p.showMap ?? true) {
|
|
992
|
+
this.dbxMapboxMapStore.setZoomDisabled();
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
else if (p.lockMapToZoomLevels) {
|
|
996
|
+
const min = mapboxZoomLevel(p.minZoom || MAPBOX_MIN_ZOOM_LEVEL);
|
|
997
|
+
const max = mapboxZoomLevel(p.maxZoom || MAPBOX_MAX_ZOOM_LEVEL);
|
|
998
|
+
this.dbxMapboxMapStore.setZoomRange({ min, max });
|
|
999
|
+
this._undoZoomLimit = !(p.showMap ?? true);
|
|
1000
|
+
}
|
|
1001
|
+
this._sub.subscription = this.dbxMapboxMapStore.zoom$.subscribe((zoom) => {
|
|
1002
|
+
if (!this.isReadonlyOrDisabledSignal()) {
|
|
1003
|
+
this.setZoomValue(zoom);
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
});
|
|
1007
|
+
// Sync field value → number control (inbound)
|
|
1008
|
+
effect(() => {
|
|
1009
|
+
const value = this.fieldValue();
|
|
1010
|
+
if (!this._syncing) {
|
|
1011
|
+
this._syncing = true;
|
|
1012
|
+
this.numberCtrl.setValue(value ?? null, { emitEvent: false });
|
|
1013
|
+
this._syncing = false;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
// Sync number control → field value (outbound)
|
|
1017
|
+
this.numberCtrl.valueChanges.subscribe((numValue) => {
|
|
1018
|
+
if (!this._syncing) {
|
|
1019
|
+
this._syncing = true;
|
|
1020
|
+
this._setFieldValue(numValue ?? null);
|
|
1021
|
+
this._syncing = false;
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
ngOnDestroy() {
|
|
1026
|
+
this._center.complete();
|
|
1027
|
+
this._sub.destroy();
|
|
1028
|
+
if (!this._undoZoomLimit) {
|
|
1029
|
+
this.dbxMapboxMapStore.setZoomRange({});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
setZoomValue(zoom) {
|
|
1033
|
+
this._syncing = true;
|
|
1034
|
+
this.numberCtrl.setValue(zoom ?? null, { emitEvent: false });
|
|
1035
|
+
this._setFieldValue(zoom ?? null);
|
|
1036
|
+
this._syncing = false;
|
|
1037
|
+
}
|
|
1038
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxZoomFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1039
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: DbxForgeMapboxZoomFieldComponent, isStandalone: true, selector: "dbx-forge-mapbox-zoom-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, props: { classPropertyName: "props", publicName: "props", isSignal: true, isRequired: false, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, validationMessages: { classPropertyName: "validationMessages", publicName: "validationMessages", isSignal: true, isRequired: false, transformFunction: null }, defaultValidationMessages: { classPropertyName: "defaultValidationMessages", publicName: "defaultValidationMessages", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideMapboxStoreIfParentIsUnavailable()], ngImport: i0, template: `
|
|
1040
|
+
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()">
|
|
1041
|
+
@if (showMapSignal()) {
|
|
1042
|
+
<div class="dbx-mapbox-input-field-map">
|
|
1043
|
+
<mgl-map dbxMapboxMap></mgl-map>
|
|
1044
|
+
</div>
|
|
1045
|
+
}
|
|
1046
|
+
<div class="dbx-mapbox-input-field-input">
|
|
1047
|
+
<mat-form-field class="dbx-mapbox-input-field-input-field">
|
|
1048
|
+
<mat-label>Zoom Level</mat-label>
|
|
1049
|
+
<input type="number" matInput [min]="minZoomSignal()" [max]="maxZoomSignal()" [step]="zoomStepSignal()" [placeholder]="placeholderText" [formControl]="numberCtrl" />
|
|
1050
|
+
</mat-form-field>
|
|
1051
|
+
</div>
|
|
1052
|
+
</div>
|
|
1053
|
+
`, isInline: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DbxMapboxModule }, { kind: "directive", type: i3$1.DbxMapboxMapDirective, selector: "[dbxMapboxMap]" }, { kind: "component", type: i2$1.MapComponent, selector: "mgl-map", inputs: ["accessToken", "collectResourceTiming", "crossSourceCollisions", "fadeDuration", "hash", "refreshExpiredTiles", "failIfMajorPerformanceCaveat", "bearingSnap", "interactive", "pitchWithRotate", "clickTolerance", "attributionControl", "logoPosition", "maxTileCacheSize", "localIdeographFontFamily", "preserveDrawingBuffer", "trackResize", "transformRequest", "bounds", "antialias", "locale", "cooperativeGestures", "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", "mapCreate", "idle", "render", "mapError", "data", "styleData", "sourceData", "dataLoading", "styleDataLoading", "sourceDataLoading", "styleImageMissing"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.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: i3.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i3.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1054
|
+
}
|
|
1055
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxForgeMapboxZoomFieldComponent, decorators: [{
|
|
1056
|
+
type: Component,
|
|
1057
|
+
args: [{ selector: 'dbx-forge-mapbox-zoom-field', template: `
|
|
1058
|
+
<div class="dbx-mapbox-input-field" [ngClass]="compactClassSignal()">
|
|
1059
|
+
@if (showMapSignal()) {
|
|
1060
|
+
<div class="dbx-mapbox-input-field-map">
|
|
1061
|
+
<mgl-map dbxMapboxMap></mgl-map>
|
|
1062
|
+
</div>
|
|
1063
|
+
}
|
|
1064
|
+
<div class="dbx-mapbox-input-field-input">
|
|
1065
|
+
<mat-form-field class="dbx-mapbox-input-field-input-field">
|
|
1066
|
+
<mat-label>Zoom Level</mat-label>
|
|
1067
|
+
<input type="number" matInput [min]="minZoomSignal()" [max]="maxZoomSignal()" [step]="zoomStepSignal()" [placeholder]="placeholderText" [formControl]="numberCtrl" />
|
|
1068
|
+
</mat-form-field>
|
|
1069
|
+
</div>
|
|
1070
|
+
</div>
|
|
1071
|
+
`, providers: [provideMapboxStoreIfParentIsUnavailable()], imports: [NgClass, DbxMapboxModule, ReactiveFormsModule, MatFormFieldModule, MatInputModule], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, styles: [".dbx-mapbox-input-field .dbx-mapbox-input-field-map{height:220px;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-map mgl-map{height:100%;width:100%}.dbx-mapbox-input-field .dbx-mapbox-input-field-input{display:flex;align-items:center}.dbx-mapbox-input-field .dbx-mapbox-input-field-input .dbx-mapbox-input-field-input-field{width:calc(100% - 40px)}.dbx-mapbox-input-field-compact .dbx-latlng-field-input{min-height:120px;height:300px;max-height:calc(var(--vh100) * .5)}\n"] }]
|
|
1072
|
+
}], ctorParameters: () => [], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], className: [{ type: i0.Input, args: [{ isSignal: true, alias: "className", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], props: [{ type: i0.Input, args: [{ isSignal: true, alias: "props", required: false }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], validationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "validationMessages", required: false }] }], defaultValidationMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultValidationMessages", required: false }] }] } });
|
|
1073
|
+
/**
|
|
1074
|
+
* Custom mapper for the forge mapbox zoom field.
|
|
1075
|
+
*
|
|
1076
|
+
* @param fieldDef - Field definition configuration
|
|
1077
|
+
* @param fieldDef.key - Form model key for the field
|
|
1078
|
+
* @returns Signal containing a Record of input names to values for ngComponentOutlet
|
|
1079
|
+
*/
|
|
1080
|
+
function mapboxZoomFieldMapper(fieldDef) {
|
|
1081
|
+
const ctx = resolveValueFieldContext();
|
|
1082
|
+
const defaultProps = inject(DEFAULT_PROPS);
|
|
1083
|
+
const defaultValidationMessages = inject(DEFAULT_VALIDATION_MESSAGES);
|
|
1084
|
+
return computed(() => {
|
|
1085
|
+
return buildValueFieldInputs(fieldDef, ctx, defaultProps?.(), defaultValidationMessages?.());
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
var zoom_forge_field_component = /*#__PURE__*/Object.freeze({
|
|
1090
|
+
__proto__: null,
|
|
1091
|
+
DbxForgeMapboxZoomFieldComponent: DbxForgeMapboxZoomFieldComponent,
|
|
1092
|
+
mapboxZoomFieldMapper: mapboxZoomFieldMapper
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* @deprecated Use provideDbxForgeMapboxFieldDeclarations() instead.
|
|
1097
|
+
*/
|
|
532
1098
|
class DbxFormMapboxModule {
|
|
533
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
534
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.
|
|
535
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.
|
|
1099
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1100
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxModule, exports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule] });
|
|
1101
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxModule, imports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule] });
|
|
536
1102
|
}
|
|
537
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
1103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: DbxFormMapboxModule, decorators: [{
|
|
538
1104
|
type: NgModule,
|
|
539
1105
|
args: [{
|
|
540
1106
|
exports: [DbxFormMapboxLatLngModule, DbxFormMapboxZoomModule]
|
|
541
1107
|
}]
|
|
542
1108
|
}] });
|
|
543
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* Forge mapbox lat/lng field type definition.
|
|
1112
|
+
*/
|
|
1113
|
+
const DbxForgeMapboxLatLngFieldType = {
|
|
1114
|
+
name: FORGE_MAPBOX_LATLNG_FIELD_TYPE,
|
|
1115
|
+
loadComponent: () => Promise.resolve().then(function () { return latlng_forge_field_component; }).then((m) => m.DbxForgeMapboxLatLngFieldComponent),
|
|
1116
|
+
mapper: mapboxLatLngFieldMapper
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* Forge mapbox zoom field type definition.
|
|
1120
|
+
*/
|
|
1121
|
+
const DbxForgeMapboxZoomFieldType = {
|
|
1122
|
+
name: FORGE_MAPBOX_ZOOM_FIELD_TYPE,
|
|
1123
|
+
loadComponent: () => Promise.resolve().then(function () { return zoom_forge_field_component; }).then((m) => m.DbxForgeMapboxZoomFieldComponent),
|
|
1124
|
+
mapper: mapboxZoomFieldMapper
|
|
1125
|
+
};
|
|
1126
|
+
/**
|
|
1127
|
+
* All custom dbx-form/mapbox forge field type definitions.
|
|
1128
|
+
*/
|
|
1129
|
+
const DBX_FORGE_MAPBOX_FIELD_TYPES = [DbxForgeMapboxLatLngFieldType, DbxForgeMapboxZoomFieldType];
|
|
1130
|
+
/**
|
|
1131
|
+
* Registers ng-forge dynamic form field declarations for the mapbox package.
|
|
1132
|
+
*
|
|
1133
|
+
* Add this to your app's providers alongside provideDbxForgeFormFieldDeclarations().
|
|
1134
|
+
*
|
|
1135
|
+
* @returns An array of providers that register the mapbox forge field types with ng-forge
|
|
1136
|
+
*/
|
|
1137
|
+
function provideDbxForgeMapboxFieldDeclarations() {
|
|
1138
|
+
return provideDynamicForm(...DBX_FORGE_MAPBOX_FIELD_TYPES);
|
|
1139
|
+
}
|
|
1140
|
+
|
|
544
1141
|
/**
|
|
545
1142
|
* Generated bundle index. Do not edit.
|
|
546
1143
|
*/
|
|
547
1144
|
|
|
548
|
-
export { DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY, DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG, DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngFieldMarkerComponent, DbxFormMapboxLatLngModule, DbxFormMapboxModule, DbxFormMapboxZoomFieldComponent, DbxFormMapboxZoomModule, mapboxLatLngField, mapboxZoomField };
|
|
1145
|
+
export { DBX_FORGE_MAPBOX_FIELD_TYPES, DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY, DEFAULT_DBX_FORGE_MAPBOX_LAT_LNG_MARKER_CONFIG, DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_FIELD_INJECTION_KEY, DEFAULT_DBX_FORM_MAPBOX_LAT_LNG_MARKER_CONFIG, DbxForgeMapboxLatLngFieldComponent, DbxForgeMapboxLatLngFieldMarkerComponent, DbxForgeMapboxZoomFieldComponent, DbxFormMapboxLatLngFieldComponent, DbxFormMapboxLatLngFieldMarkerComponent, DbxFormMapboxLatLngModule, DbxFormMapboxModule, DbxFormMapboxZoomFieldComponent, DbxFormMapboxZoomModule, FORGE_MAPBOX_LATLNG_FIELD_TYPE, FORGE_MAPBOX_ZOOM_FIELD_TYPE, forgeMapboxLatLngField, forgeMapboxZoomField, mapboxLatLngField, mapboxLatLngFieldMapper, mapboxZoomField, mapboxZoomFieldMapper, provideDbxForgeMapboxFieldDeclarations };
|
|
549
1146
|
//# sourceMappingURL=dereekb-dbx-form-mapbox.mjs.map
|