@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
@@ -478,6 +478,9 @@ class GoogleMapsService {
478
478
  setBaseLatLng(lat, lng) {
479
479
  this._baseLatLng = { lat, lng };
480
480
  }
481
+ setPadding(padding) {
482
+ this._padding = padding;
483
+ }
481
484
  // TODO: Refactor out of the service meant to just wrap the google maps api.
482
485
  setFeatureContextMenu(menu) {
483
486
  this.closeContextMenu();
@@ -593,7 +596,7 @@ class GoogleMapsService {
593
596
  this._assertInitialized();
594
597
  removeAllFeatures(this.googleMap.data);
595
598
  this.googleMap.data.addGeoJson(data);
596
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
599
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
597
600
  });
598
601
  }
599
602
  // TODO: Refactor out of the service meant to just wrap the google maps api.
@@ -606,7 +609,7 @@ class GoogleMapsService {
606
609
  this.googleMap.panTo(this._baseLatLng);
607
610
  return;
608
611
  }
609
- this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data));
612
+ this.googleMap.fitBounds(getBoundsWithAllFeatures(this.googleMap.data), this._padding);
610
613
  // TODO: Fix to pan to center. Currently fitBounds results in the expected
611
614
  // result, but pantToBounds animates.
612
615
  // this.googleMap.panToBounds(getBoundsWithAllFeatures(this.googleMap.data))
@@ -1288,6 +1291,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1288
1291
  this.zoom = 14;
1289
1292
  this.longitude = -98.570209;
1290
1293
  this.latitude = 37.633814;
1294
+ this.padding = 0;
1291
1295
  this.mapReady = new EventEmitter();
1292
1296
  this._options = {
1293
1297
  mapTypeControl: true,
@@ -1323,6 +1327,7 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1323
1327
  }
1324
1328
  }));
1325
1329
  this._googleMaps.setBaseLatLng(this.latitude, this.longitude);
1330
+ this._googleMaps.setPadding(this.padding);
1326
1331
  this._gmApiLoaded = this._googleMapsApiLoader.load().pipe(map(() => true), catchError(() => of(false)));
1327
1332
  }
1328
1333
  ngOnInit() {
@@ -1378,6 +1383,9 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1378
1383
  if (Object.prototype.hasOwnProperty.call(changes, 'editingEnabled')) {
1379
1384
  this._googleMaps.setEditingEnabled(this.editingEnabled);
1380
1385
  }
1386
+ if (Object.prototype.hasOwnProperty.call(changes, 'padding')) {
1387
+ this._googleMaps.setPadding(this.padding);
1388
+ }
1381
1389
  }
1382
1390
  writeValue(value) {
1383
1391
  this.value = value;
@@ -1411,20 +1419,25 @@ class TheSeamGoogleMapsComponent extends _TheSeamGoogleMapsMixinBase {
1411
1419
  var _a;
1412
1420
  this._googleMaps.setMap(theMap);
1413
1421
  this._googleMaps.setData(this._mapValueManager.value);
1414
- // NOTE: AgmMap has a race condition problem that causes the input latitude,
1415
- // longitude, and zoom to get ignored, before googlemaps emits
1416
- // 'center_changed'. This should avoid the issue, until we stop using AgmMap
1417
- // or upgrade to a more recent version that may not have the issue anymore.
1418
- // TODO: Check if the switch to '@angular/google-maps' fixed this problem.
1419
- this._googleMaps.reCenterOnFeatures();
1420
- (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.setZoom(this.zoom);
1422
+ // NOTE: The input zoom level was getting reset after this function ran,
1423
+ // so putting in this idle listener to wait until the map is fully rendered
1424
+ // to set the zoom.
1425
+ // Calling reCenterOnFeatures() after setZoom() ensures that maps with pre-drawn shapes
1426
+ // will display correctly
1427
+ this.idleListener = (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.addListener('idle', () => {
1428
+ var _a, _b;
1429
+ (_a = this._googleMaps.googleMap) === null || _a === void 0 ? void 0 : _a.setZoom(this.zoom);
1430
+ this._googleMaps.reCenterOnFeatures();
1431
+ this.mapReady.emit(this._googleMaps.googleMap);
1432
+ (_b = this.idleListener) === null || _b === void 0 ? void 0 : _b.remove();
1433
+ });
1421
1434
  }
1422
1435
  _onClickDeleteFeature() {
1423
1436
  this._googleMaps.deleteSelection();
1424
1437
  }
1425
1438
  }
1426
1439
  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 });
1427
- 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: [
1440
+ 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: [
1428
1441
  MapValueManagerService,
1429
1442
  GoogleMapsService,
1430
1443
  { provide: MAP_CONTROLS_SERVICE, useClass: GoogleMapsControlsService },
@@ -1517,6 +1530,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1517
1530
  type: Input
1518
1531
  }], latitude: [{
1519
1532
  type: Input
1533
+ }], padding: [{
1534
+ type: Input
1520
1535
  }], mapReady: [{
1521
1536
  type: Output
1522
1537
  }], featureContextMenu: [{
@@ -1839,13 +1854,13 @@ class TheSeamGoogleMapsPlacesAutoCompleteComponent {
1839
1854
  }
1840
1855
  }
1841
1856
  TheSeamGoogleMapsPlacesAutoCompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsPlacesAutoCompleteComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1842
- 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 });
1857
+ 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 });
1843
1858
  __decorate([
1844
1859
  InputBoolean()
1845
1860
  ], TheSeamGoogleMapsPlacesAutoCompleteComponent.prototype, "disabled", void 0);
1846
1861
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamGoogleMapsPlacesAutoCompleteComponent, decorators: [{
1847
1862
  type: Component,
1848
- 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"] }]
1863
+ 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"] }]
1849
1864
  }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { label: [{
1850
1865
  type: Input
1851
1866
  }], icon: [{
@@ -2001,6 +2016,7 @@ class TheSeamLazyMapsApiLoader extends TheSeamGoogleMapsApiLoader {
2001
2016
  libraries: this._config.libraries,
2002
2017
  region: this._config.region,
2003
2018
  language: this._config.language || (this._localeId !== 'en-US' ? this._localeId : null),
2019
+ loading: this._config.loading || 'async'
2004
2020
  };
2005
2021
  const params = Object.keys(queryParams)
2006
2022
  // Remove undefined or null params.