@theseam/ui-common 0.3.6 → 0.3.7

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 (25) hide show
  1. package/breadcrumbs/_breadcrumbs-theme.scss +3 -3
  2. package/breadcrumbs/breadcrumbs/breadcrumbs.component.scss +10 -10
  3. package/bundles/theseam-ui-common-google-maps.umd.js +39 -7
  4. package/bundles/theseam-ui-common-google-maps.umd.js.map +1 -1
  5. package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
  6. package/esm2015/google-maps/google-maps-feature-helpers.js +12 -3
  7. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.js +2 -2
  8. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.js +1 -1
  9. package/esm2015/google-maps/google-maps.service.js +15 -5
  10. package/esm2015/utils/geo-json/coerce-feature-collection.js +1 -1
  11. package/esm2015/utils/geo-json/geo-json-to-area.js +1 -1
  12. package/esm2015/utils/geo-json/is-feature-collection.validator.js +1 -1
  13. package/esm2015/utils/geo-json/is-only-geometry-types.js +1 -1
  14. package/esm2015/utils/geo-json/is-only-geometry-types.validator.js +1 -1
  15. package/esm2015/utils/geo-json/merge-polygons.js +1 -1
  16. package/esm2015/utils/geo-json/no-inner-rings.validator.js +1 -1
  17. package/esm2015/utils/geo-json/no-kinks.validator.js +1 -1
  18. package/esm2015/utils/geo-json/split-multi-polygons.js +1 -1
  19. package/fesm2015/theseam-ui-common-google-maps.js +26 -7
  20. package/fesm2015/theseam-ui-common-google-maps.js.map +1 -1
  21. package/fesm2015/theseam-ui-common-utils.js.map +1 -1
  22. package/framework/top-bar/_top-bar-theme.scss +5 -5
  23. package/google-maps/google-maps-feature-helpers.d.ts +1 -0
  24. package/google-maps/theseam-ui-common-google-maps.metadata.json +1 -1
  25. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- @import './styles/utilities';
2
-
3
- @import './breadcrumbs/breadcrumbs.component.scss';
1
+ @import './styles/utilities';
2
+
3
+ @import './breadcrumbs/breadcrumbs.component.scss';
@@ -1,10 +1,10 @@
1
- @import '../styles/utilities';
2
-
3
- seam-breadcrumbs {
4
- li {
5
- color: $breadcrumb-color;
6
- a {
7
- color: inherit;
8
- }
9
- }
10
- }
1
+ @import '../styles/utilities';
2
+
3
+ seam-breadcrumbs {
4
+ li {
5
+ color: $breadcrumb-color;
6
+ a {
7
+ color: inherit;
8
+ }
9
+ }
10
+ }
@@ -420,6 +420,27 @@
420
420
  }
421
421
  coordinates.push(coordinates[0]);
422
422
  }
423
+ function polygonHasValidPathsLengths(polygon, minPointsInValidPath) {
424
+ var e_3, _a;
425
+ if (minPointsInValidPath === void 0) { minPointsInValidPath = 3; }
426
+ var paths = polygon.getPaths().getArray();
427
+ try {
428
+ for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
429
+ var path = paths_1_1.value;
430
+ if (path.getLength() < minPointsInValidPath) {
431
+ return false;
432
+ }
433
+ }
434
+ }
435
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
436
+ finally {
437
+ try {
438
+ if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);
439
+ }
440
+ finally { if (e_3) throw e_3.error; }
441
+ }
442
+ return true;
443
+ }
423
444
  function polygonCoordinates(polygon) {
424
445
  return polygon.getArray().map(function (linRing) {
425
446
  var coords = linRing.getArray().map(function (x) { return [x.lng(), x.lat()]; });
@@ -451,9 +472,9 @@
451
472
  return booleanContains__default["default"](polygonA, polygonB);
452
473
  }
453
474
  function createDataFeatureFromPolygon(polygon) {
454
- var arr = polygon.getPath().getArray();
475
+ var arr = polygon.getPaths().getArray().map(function (x) { return x.getArray(); });
455
476
  return new google.maps.Data.Feature({
456
- geometry: new google.maps.Data.Polygon([arr])
477
+ geometry: new google.maps.Data.Polygon(arr)
457
478
  });
458
479
  }
459
480
  function getBoundsWithAllFeatures(data) {
@@ -829,7 +850,7 @@
829
850
  };
830
851
  GoogleMapsService.prototype.setData = function (data) {
831
852
  return __awaiter(this, void 0, void 0, function () {
832
- return __generator(this, function (_b) {
853
+ return __generator(this, function (_c) {
833
854
  this._assertInitialized();
834
855
  removeAllFeatures(this.googleMap.data);
835
856
  this.googleMap.data.addGeoJson(data);
@@ -857,7 +878,7 @@
857
878
  this._allowDrawingHoleInPolygon = allow;
858
879
  };
859
880
  GoogleMapsService.prototype.setFileInputHandler = function (handler) {
860
- this._fileInputHandler;
881
+ this._fileInputHandler = handler;
861
882
  };
862
883
  GoogleMapsService.prototype.getFileInputHandler = function () {
863
884
  return this._fileInputHandler;
@@ -917,7 +938,7 @@
917
938
  });
918
939
  if (utils.notNullOrUndefined(this._drawingManager)) {
919
940
  google.maps.event.addListener(this._drawingManager, 'polygoncomplete', function (polygon) {
920
- var _a;
941
+ var _a, _b;
921
942
  // The DrawingManager doesn't seem to have a way to access the overlays,
922
943
  // so if the map is not set then it shouldn'y be considered a successful
923
944
  // completion. I am canceling the active drawing by disabling drawing
@@ -927,12 +948,22 @@
927
948
  return;
928
949
  }
929
950
  _this._assertInitialized();
951
+ // TODO: See if there is a way to prevent the polygon from completing
952
+ // without enough points. This is very low priority, because starting
953
+ // over after adding a single point isn't a major inconvenience.
954
+ if (!polygonHasValidPathsLengths(polygon)) {
955
+ // Remove the drawn polygon.
956
+ polygon.setMap(null);
957
+ // Stop drawing.
958
+ (_a = _this._drawingManager) === null || _a === void 0 ? void 0 : _a.setDrawingMode(null);
959
+ return;
960
+ }
930
961
  // Create a map feature of the drawn polygon.
931
962
  var feature = createDataFeatureFromPolygon(polygon);
932
963
  // Remove the drawn polygon.
933
964
  polygon.setMap(null);
934
965
  // Stop drawing.
935
- (_a = _this._drawingManager) === null || _a === void 0 ? void 0 : _a.setDrawingMode(null);
966
+ (_b = _this._drawingManager) === null || _b === void 0 ? void 0 : _b.setDrawingMode(null);
936
967
  // Check if the feature should be used as a cutout to an existing
937
968
  // feature or added as it's own feature.
938
969
  var exteriorPolygonFeature = _this._allowDrawingHoleInPolygon
@@ -1894,7 +1925,7 @@
1894
1925
  TheSeamGoogleMapsPlacesAutoCompleteComponent.decorators = [
1895
1926
  { type: core.Component, args: [{
1896
1927
  selector: 'seam-google-maps-places-autocomplete',
1897
- 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",
1928
+ 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",
1898
1929
  changeDetection: core.ChangeDetectionStrategy.OnPush,
1899
1930
  exportAs: 'seamGoogleMapsPlacesAutoComplete',
1900
1931
  styles: [":host{position:relative;width:100%}:host>input{padding-left:40px}:host .search-container--icon-wrapper{position:absolute;top:6px;left:10px;bottom:0px}:host .search-container--icon-wrapper ::ng-deep .svg-inline--fa{vertical-align:middle}\n"]
@@ -2186,6 +2217,7 @@
2186
2217
  exports.isFeatureSelected = isFeatureSelected;
2187
2218
  exports.multiPolygonCoordinates = multiPolygonCoordinates;
2188
2219
  exports.polygonCoordinates = polygonCoordinates;
2220
+ exports.polygonHasValidPathsLengths = polygonHasValidPathsLengths;
2189
2221
  exports.removeAllFeatures = removeAllFeatures;
2190
2222
  exports.setFeatureSelected = setFeatureSelected;
2191
2223
  exports.stripAppFeaturePropertiesFromJson = stripAppFeaturePropertiesFromJson;