@theseam/ui-common 0.4.14 → 0.4.17

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.
Files changed (35) hide show
  1. package/esm2020/google-maps/google-maps/google-maps.component.mjs +20 -9
  2. package/esm2020/google-maps/google-maps-api-loader/lazy-google-maps-api-loader.mjs +2 -1
  3. package/esm2020/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.mjs +3 -3
  4. package/esm2020/google-maps/google-maps.service.mjs +6 -3
  5. package/esm2020/services/preferences/preferences-accessor.mjs +1 -1
  6. package/esm2020/services/preferences/preferences-manager.service.mjs +1 -1
  7. package/esm2020/services/preferences/preferences-record.mjs +1 -1
  8. package/esm2020/services/preferences/preferences.models.mjs +1 -1
  9. package/esm2020/story-helpers/story-preferences-accessor.service.mjs +1 -1
  10. package/esm2020/utils/geo-json/coerce-feature-collection.mjs +1 -1
  11. package/esm2020/utils/geo-json/is-feature-collection.validator.mjs +1 -1
  12. package/esm2020/utils/geo-json/is-only-geometry-types.mjs +1 -1
  13. package/esm2020/utils/geo-json/merge-polygons.mjs +1 -1
  14. package/esm2020/utils/geo-json/no-inner-rings.validator.mjs +1 -1
  15. package/esm2020/utils/geo-json/split-multi-polygons.mjs +1 -1
  16. package/esm2020/widget/preferences/widget-preferences.models.mjs +1 -1
  17. package/esm2020/widget/preferences/widget-preferences.service.mjs +1 -1
  18. package/esm2020/widget/preferences/widget-preferences.token.mjs +1 -1
  19. package/esm2020/widget/widget.models.mjs +1 -1
  20. package/fesm2015/theseam-ui-common-google-maps.mjs +28 -12
  21. package/fesm2015/theseam-ui-common-google-maps.mjs.map +1 -1
  22. package/fesm2015/theseam-ui-common-services.mjs.map +1 -1
  23. package/fesm2015/theseam-ui-common-story-helpers.mjs.map +1 -1
  24. package/fesm2015/theseam-ui-common-utils.mjs.map +1 -1
  25. package/fesm2015/theseam-ui-common-widget.mjs.map +1 -1
  26. package/fesm2020/theseam-ui-common-google-maps.mjs +27 -12
  27. package/fesm2020/theseam-ui-common-google-maps.mjs.map +1 -1
  28. package/fesm2020/theseam-ui-common-services.mjs.map +1 -1
  29. package/fesm2020/theseam-ui-common-story-helpers.mjs.map +1 -1
  30. package/fesm2020/theseam-ui-common-utils.mjs.map +1 -1
  31. package/fesm2020/theseam-ui-common-widget.mjs.map +1 -1
  32. package/google-maps/google-maps/google-maps.component.d.ts +4 -2
  33. package/google-maps/google-maps-api-loader/lazy-google-maps-api-loader.d.ts +1 -0
  34. package/google-maps/google-maps.service.d.ts +2 -0
  35. package/package.json +1 -1
@@ -486,6 +486,9 @@ class GoogleMapsService {
486
486
  setBaseLatLng(lat, lng) {
487
487
  this._baseLatLng = { lat, lng };
488
488
  }
489
+ setPadding(padding) {
490
+ this._padding = padding;
491
+ }
489
492
  // TODO: Refactor out of the service meant to just wrap the google maps api.
490
493
  setFeatureContextMenu(menu) {
491
494
  this.closeContextMenu();
@@ -597,7 +600,7 @@ class GoogleMapsService {
597
600
  this._assertInitialized();
598
601
  removeAllFeatures(this.googleMap.data);
599
602
  this.googleMap.data.addGeoJson(data);
600
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
603
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
601
604
  }
602
605
  // TODO: Refactor out of the service meant to just wrap the google maps api.
603
606
  reCenterOnFeatures() {
@@ -609,7 +612,7 @@ class GoogleMapsService {
609
612
  this.googleMap.panTo(this._baseLatLng);
610
613
  return;
611
614
  }
612
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
615
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
613
616
  // TODO: Fix to pan to center. Currently fitBounds results in the expected
614
617
  // result, but pantToBounds animates.
615
618
  // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))
@@ -1279,6 +1282,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1279
1282
  this.zoom = 14;
1280
1283
  this.longitude = -98.570209;
1281
1284
  this.latitude = 37.633814;
1285
+ this.padding = 0;
1282
1286
  this.mapReady = new EventEmitter();
1283
1287
  this._options = {
1284
1288
  mapTypeControl: true,
@@ -1314,6 +1318,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1314
1318
  }
1315
1319
  }));
1316
1320
  this._googleMaps.setBaseLatLng(this.latitude, this.longitude);
1321
+ this._googleMaps.setPadding(this.padding);
1317
1322
  this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(map(() => true), catchError(() => of(false)));
1318
1323
  }
1319
1324
  ngOnInit() {
@@ -1372,6 +1377,9 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1372
1377
  if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {
1373
1378
  this._googleMaps.setEditingEnabled(this.editingEnabled);
1374
1379
  }
1380
+ if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {
1381
+ this._googleMaps.setPadding(this.padding);
1382
+ }
1375
1383
  }
1376
1384
  writeValue(value) {
1377
1385
  this.value = value;
@@ -1404,20 +1412,24 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1404
1412
  _onMapReady(theMap) {
1405
1413
  this._googleMaps.setMap(theMap);
1406
1414
  this._googleMaps.setData(this._mapValueManager.value);
1407
- // NOTE: AgmMap has a race condition problem that causes the input latitude,
1408
- // longitude, and zoom to get ignored, before googlemaps emits
1409
- // 'center_changed'. This should avoid the issue, until we stop using AgmMap
1410
- // or upgrade to a more recent version that may not have the issue anymore.
1411
- // TODO: Check if the switch to '@angular/google-maps' fixed this problem.
1412
- this._googleMaps.reCenterOnFeatures();
1413
- this._googleMaps.googleMap?.setZoom(this.zoom);
1415
+ // NOTE: The input zoom level was getting reset after this function ran,
1416
+ // so putting in this idle listener to wait until the map is fully rendered
1417
+ // to set the zoom.
1418
+ // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes
1419
+ // will display correctly
1420
+ this.idleListener = this._googleMaps.googleMap?.addListener('idle', () => {
1421
+ this._googleMaps.googleMap?.setZoom(this.zoom);
1422
+ this._googleMaps.reCenterOnFeatures();
1423
+ this.mapReady.emit(this._googleMaps.googleMap);
1424
+ this.idleListener?.remove();
1425
+ });
1414
1426
  }
1415
1427
  _onClickDeleteFeature() {
1416
1428
  this._googleMaps.deleteSelection();
1417
1429
  }
1418
1430
  }
1419
1431
  TheSeamGoogleMapsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsComponent, deps: [{ token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: GoogleMapsService }, { token: MapValueManagerService }, { token: TheSeamGoogleMapsApiLoader }], target: i0.ɵɵFactoryTarget.Component });
1420
- TheSeamGoogleMapsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsComponent, selector: "seam-google-maps", inputs: { disabled: "disabled", value: "value", tabIndex: "tabIndex", fileDropEnabled: "fileDropEnabled", fileUploadControlEnabled: "fileUploadControlEnabled", fullscreenControlEnabled: "fullscreenControlEnabled", reCenterControlEnabled: "reCenterControlEnabled", mapTypeControlEnabled: "mapTypeControlEnabled", streetViewControlEnabled: "streetViewControlEnabled", allowDrawingHoleInPolygon: "allowDrawingHoleInPolygon", editingEnabled: "editingEnabled", fileImportHandler: "fileImportHandler", zoom: "zoom", longitude: "longitude", latitude: "latitude" }, outputs: { mapReady: "mapReady" }, host: { properties: { "attr.disabled": "this._attrDisabled", "attr.tabindex": "this._attrTabIndex" } }, providers: [
1432
+ TheSeamGoogleMapsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsComponent, selector: "seam-google-maps", inputs: { disabled: "disabled", value: "value", tabIndex: "tabIndex", fileDropEnabled: "fileDropEnabled", fileUploadControlEnabled: "fileUploadControlEnabled", fullscreenControlEnabled: "fullscreenControlEnabled", reCenterControlEnabled: "reCenterControlEnabled", mapTypeControlEnabled: "mapTypeControlEnabled", streetViewControlEnabled: "streetViewControlEnabled", allowDrawingHoleInPolygon: "allowDrawingHoleInPolygon", editingEnabled: "editingEnabled", fileImportHandler: "fileImportHandler", zoom: "zoom", longitude: "longitude", latitude: "latitude", padding: "padding" }, outputs: { mapReady: "mapReady" }, host: { properties: { "attr.disabled": "this._attrDisabled", "attr.tabindex": "this._attrTabIndex" } }, providers: [
1421
1433
  MapValueManagerService,
1422
1434
  GoogleMapsService,
1423
1435
  { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },
@@ -1510,6 +1522,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1510
1522
  type: Input
1511
1523
  }], latitude: [{
1512
1524
  type: Input
1525
+ }], padding: [{
1526
+ type: Input
1513
1527
  }], mapReady: [{
1514
1528
  type: Output
1515
1529
  }], featureContextMenu: [{
@@ -1831,13 +1845,13 @@ class TheSeamGoogleMapsPlacesAutoCompleteComponent {
1831
1845
  }
1832
1846
  }
1833
1847
  TheSeamGoogleMapsPlacesAutoCompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsPlacesAutoCompleteComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1834
- TheSeamGoogleMapsPlacesAutoCompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsPlacesAutoCompleteComponent, selector: "seam-google-maps-places-autocomplete", inputs: { label: "label", icon: "icon", disabled: "disabled", placeholder: "placeholder", autocorrect: "autocorrect", autocapitalize: "autocapitalize", tabIndex: "tabIndex", options: "options" }, outputs: { placeChanged: "placeChanged" }, host: { listeners: { "click": "_onClick(event)", "focus": "_onFocus($event)" }, properties: { "attr.tabindex": "this._attrTabIndex" } }, viewQueries: [{ propertyName: "_inputDirective", first: true, predicate: ["inp"], descendants: true, read: InputDirective, static: true }, { propertyName: "__autocompleteDirective", first: true, predicate: TheSeamGoogleMapsPlacesAutocompleteDirective, descendants: true, static: true }], exportAs: ["seamGoogleMapsPlacesAutoComplete"], ngImport: i0, template: "<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\r\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\r\n</div>\r\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{ label || placeholder }}</label>\r\n<input #inp=\"seamInput\"\r\n seamInput\r\n seamGoogleMapsPlacesAutocomplete\r\n [disabled]=\"disabled\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.autocorrect]=\"autocorrect\"\r\n [attr.autocapitalize]=\"autocapitalize\"\r\n [options]=\"_options\"\r\n/>\r\n", styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }, { kind: "directive", type: i3.InputDirective, selector: "input[seamInput], textarea[seamInput], ng-select[seamInput], seam-checkbox[seamInput] [ngbRadioGroup], seam-tel-input[seamInput], quill-editor[seamInput], seam-google-maps[seamInput]", inputs: ["seamInputSize", "id", "type", "placeholder", "required", "disabled", "readonly"], exportAs: ["seamInput"] }, { kind: "directive", type: TheSeamGoogleMapsPlacesAutocompleteDirective, selector: "input[seamGoogleMapsPlacesAutocomplete]", inputs: ["options"], outputs: ["placeChanged"], exportAs: ["seamGoogleMapsPlacesAutocomplete"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1848
+ TheSeamGoogleMapsPlacesAutoCompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamGoogleMapsPlacesAutoCompleteComponent, selector: "seam-google-maps-places-autocomplete", inputs: { label: "label", icon: "icon", disabled: "disabled", placeholder: "placeholder", autocorrect: "autocorrect", autocapitalize: "autocapitalize", tabIndex: "tabIndex", options: "options" }, outputs: { placeChanged: "placeChanged" }, host: { listeners: { "click": "_onClick(event)", "focus": "_onFocus($event)" }, properties: { "attr.tabindex": "this._attrTabIndex" } }, viewQueries: [{ propertyName: "_inputDirective", first: true, predicate: ["inp"], descendants: true, read: InputDirective, static: true }, { propertyName: "__autocompleteDirective", first: true, predicate: TheSeamGoogleMapsPlacesAutocompleteDirective, descendants: true, static: true }], exportAs: ["seamGoogleMapsPlacesAutoComplete"], ngImport: i0, template: "<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\n</div>\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{ label || placeholder }}</label>\n<input #inp=\"seamInput\"\n seamInput\n seamGoogleMapsPlacesAutocomplete\n [disabled]=\"disabled\"\n [attr.placeholder]=\"placeholder\"\n [attr.autocorrect]=\"autocorrect\"\n [attr.autocapitalize]=\"autocapitalize\"\n [options]=\"_options\"\n/>\n", styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }, { kind: "directive", type: i3.InputDirective, selector: "input[seamInput], textarea[seamInput], ng-select[seamInput], seam-checkbox[seamInput] [ngbRadioGroup], seam-tel-input[seamInput], quill-editor[seamInput], seam-google-maps[seamInput]", inputs: ["seamInputSize", "id", "type", "placeholder", "required", "disabled", "readonly"], exportAs: ["seamInput"] }, { kind: "directive", type: TheSeamGoogleMapsPlacesAutocompleteDirective, selector: "input[seamGoogleMapsPlacesAutocomplete]", inputs: ["options"], outputs: ["placeChanged"], exportAs: ["seamGoogleMapsPlacesAutocomplete"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1835
1849
  __decorate([
1836
1850
  InputBoolean()
1837
1851
  ], TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "disabled", void 0);
1838
1852
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsPlacesAutoCompleteComponent, decorators: [{
1839
1853
  type: Component,
1840
- args: [{ selector: 'seam-google-maps-places-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'seamGoogleMapsPlacesAutoComplete', template: "<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\r\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\r\n</div>\r\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{ label || placeholder }}</label>\r\n<input #inp=\"seamInput\"\r\n seamInput\r\n seamGoogleMapsPlacesAutocomplete\r\n [disabled]=\"disabled\"\r\n [attr.placeholder]=\"placeholder\"\r\n [attr.autocorrect]=\"autocorrect\"\r\n [attr.autocapitalize]=\"autocapitalize\"\r\n [options]=\"_options\"\r\n/>\r\n", styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"] }]
1854
+ args: [{ selector: 'seam-google-maps-places-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'seamGoogleMapsPlacesAutoComplete', template: "<div *ngIf=\"icon\" class=\"search-container--icon-wrapper\">\n <seam-icon [icon]=\"icon\" class=\"text-muted\" size=\"lg\"></seam-icon>\n</div>\n<label *ngIf=\"label || placeholder\" [attr.for]=\"inp.id\" class=\"sr-only\">{{ label || placeholder }}</label>\n<input #inp=\"seamInput\"\n seamInput\n seamGoogleMapsPlacesAutocomplete\n [disabled]=\"disabled\"\n [attr.placeholder]=\"placeholder\"\n [attr.autocorrect]=\"autocorrect\"\n [attr.autocapitalize]=\"autocapitalize\"\n [options]=\"_options\"\n/>\n", styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"] }]
1841
1855
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { label: [{
1842
1856
  type: Input
1843
1857
  }], icon: [{
@@ -1993,6 +2007,7 @@ class TheSeamLazyMapsApiLoader extends TheSeamGoogleMapsApiLoader {
1993
2007
  libraries: this._config.libraries,
1994
2008
  region: this._config.region,
1995
2009
  language: this._config.language || (this._localeId !== 'en-US' ? this._localeId : null),
2010
+ loading: this._config.loading || 'async'
1996
2011
  };
1997
2012
  const params = Object.keys(queryParams)
1998
2013
  // Remove undefined or null params.