@theseam/ui-common 0.3.5 → 0.3.8

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 (37) 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-dynamic.umd.js +1 -1
  4. package/bundles/theseam-ui-common-dynamic.umd.js.map +1 -1
  5. package/bundles/theseam-ui-common-google-maps.umd.js +39 -7
  6. package/bundles/theseam-ui-common-google-maps.umd.js.map +1 -1
  7. package/bundles/theseam-ui-common-utils.umd.js +83 -5
  8. package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
  9. package/esm2015/dynamic/evaluators/jexl-evaluator/jexl-evaluator.js +2 -2
  10. package/esm2015/google-maps/google-maps-feature-helpers.js +12 -3
  11. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.component.js +2 -2
  12. package/esm2015/google-maps/google-maps-places-autocomplete/google-maps-places-autocomplete.directive.js +1 -1
  13. package/esm2015/google-maps/google-maps.service.js +15 -5
  14. package/esm2015/utils/geo-json/coerce-feature-collection.js +1 -1
  15. package/esm2015/utils/geo-json/geo-json-to-area.js +1 -1
  16. package/esm2015/utils/geo-json/is-feature-collection.validator.js +1 -1
  17. package/esm2015/utils/geo-json/is-only-geometry-types.js +1 -1
  18. package/esm2015/utils/geo-json/is-only-geometry-types.validator.js +1 -1
  19. package/esm2015/utils/geo-json/merge-polygons.js +1 -1
  20. package/esm2015/utils/geo-json/min-max-points.validator.js +56 -0
  21. package/esm2015/utils/geo-json/no-inner-rings.validator.js +1 -1
  22. package/esm2015/utils/geo-json/no-kinks.validator.js +2 -2
  23. package/esm2015/utils/geo-json/split-multi-polygons.js +1 -1
  24. package/esm2015/utils/public-api.js +2 -1
  25. package/fesm2015/theseam-ui-common-dynamic.js +1 -1
  26. package/fesm2015/theseam-ui-common-dynamic.js.map +1 -1
  27. package/fesm2015/theseam-ui-common-google-maps.js +26 -7
  28. package/fesm2015/theseam-ui-common-google-maps.js.map +1 -1
  29. package/fesm2015/theseam-ui-common-utils.js +59 -6
  30. package/fesm2015/theseam-ui-common-utils.js.map +1 -1
  31. package/framework/top-bar/_top-bar-theme.scss +5 -5
  32. package/google-maps/google-maps-feature-helpers.d.ts +1 -0
  33. package/google-maps/theseam-ui-common-google-maps.metadata.json +1 -1
  34. package/package.json +1 -1
  35. package/utils/geo-json/min-max-points.validator.d.ts +3 -0
  36. package/utils/public-api.d.ts +1 -0
  37. package/utils/theseam-ui-common-utils.metadata.json +1 -1
@@ -810,6 +810,86 @@
810
810
  }
811
811
  }
812
812
 
813
+ function notNullOrUndefined(value) {
814
+ return value !== null && value !== undefined;
815
+ }
816
+
817
+ var MIN_MAX_POINTS_VALIDATOR_NAME = 'min-max-points';
818
+ function minMaxPointsValidator(min, max) {
819
+ if (min === void 0) { min = 3; }
820
+ return function (control) {
821
+ var _a;
822
+ // Don't need to validate if there isn't a value. Use `Validators.required` for that.
823
+ if (isEmptyInputValue(control.value)) {
824
+ return null; // don't validate empty values to allow optional controls
825
+ }
826
+ var value = coerceFeatureCollection(control.value);
827
+ if (value === null) {
828
+ return null;
829
+ }
830
+ if (collectionViolatesMinMax(value, min, max)) {
831
+ var reason = notNullOrUndefined(max) ?
832
+ "A polygon must have between " + min + " and " + max + " points." :
833
+ "A polygon must have at least " + min + " points.";
834
+ return _a = {},
835
+ _a[MIN_MAX_POINTS_VALIDATOR_NAME] = {
836
+ reason: reason
837
+ },
838
+ _a;
839
+ }
840
+ return null;
841
+ };
842
+ }
843
+ /**
844
+ * Checks if a FeatureCollection contains any geometries with an incomplete polygon.
845
+ *
846
+ * NOTE: Does not consider GeometryCollection.
847
+ */
848
+ function collectionViolatesMinMax(featureCollection, min, max) {
849
+ var e_1, _a, e_2, _b;
850
+ try {
851
+ for (var _c = __values(featureCollection.features), _d = _c.next(); !_d.done; _d = _c.next()) {
852
+ var f = _d.value;
853
+ if (f.geometry.type === 'Polygon') {
854
+ if (polygonViolatesMinMax(f.geometry.coordinates[0].length, min, max)) {
855
+ return true;
856
+ }
857
+ }
858
+ else if (f.geometry.type === 'MultiPolygon') {
859
+ try {
860
+ for (var _e = (e_2 = void 0, __values(f.geometry.coordinates)), _f = _e.next(); !_f.done; _f = _e.next()) {
861
+ var coords = _f.value;
862
+ if (polygonViolatesMinMax(coords[0].length, min, max)) {
863
+ return true;
864
+ }
865
+ }
866
+ }
867
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
868
+ finally {
869
+ try {
870
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
871
+ }
872
+ finally { if (e_2) throw e_2.error; }
873
+ }
874
+ }
875
+ }
876
+ }
877
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
878
+ finally {
879
+ try {
880
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
881
+ }
882
+ finally { if (e_1) throw e_1.error; }
883
+ }
884
+ return false;
885
+ }
886
+ function polygonViolatesMinMax(coordinateLength, min, max) {
887
+ if (coordinateLength < min || (notNullOrUndefined(max) && max > min && coordinateLength > max)) {
888
+ return true;
889
+ }
890
+ return false;
891
+ }
892
+
813
893
  var NO_INNER_RINGS_VALIDATOR_NAME = 'no-inner-rings';
814
894
  /**
815
895
  * Validates that a FeatureCollection does not contain any Polygon with inner
@@ -931,7 +1011,7 @@
931
1011
  if (kinksFound.length > 0) {
932
1012
  return _b = {},
933
1013
  _b[NO_KINKS_VALIDATOR_NAME] = {
934
- reason: 'Paths should not intersect themself.',
1014
+ reason: 'Paths should not intersect themselves.',
935
1015
  featuresWithKink: kinksFound,
936
1016
  },
937
1017
  _b;
@@ -1359,10 +1439,6 @@
1359
1439
  });
1360
1440
  }
1361
1441
 
1362
- function notNullOrUndefined(value) {
1363
- return value !== null && value !== undefined;
1364
- }
1365
-
1366
1442
  function waitOnConditionAsync(condition, timeoutDuration, throwOnTimeout) {
1367
1443
  if (timeoutDuration === void 0) { timeoutDuration = -1; }
1368
1444
  if (throwOnTimeout === void 0) { throwOnTimeout = true; }
@@ -1738,6 +1814,7 @@
1738
1814
 
1739
1815
  exports.IS_FEATURE_COLLECTION_VALIDATOR_NAME = IS_FEATURE_COLLECTION_VALIDATOR_NAME;
1740
1816
  exports.IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME = IS_ONLY_GEOMETRY_TYPES_VALIDATOR_NAME;
1817
+ exports.MIN_MAX_POINTS_VALIDATOR_NAME = MIN_MAX_POINTS_VALIDATOR_NAME;
1741
1818
  exports.NO_INNER_RINGS_VALIDATOR_NAME = NO_INNER_RINGS_VALIDATOR_NAME;
1742
1819
  exports.NO_KINKS_VALIDATOR_NAME = NO_KINKS_VALIDATOR_NAME;
1743
1820
  exports.PollingTickerOptions = PollingTickerOptions;
@@ -1775,6 +1852,7 @@
1775
1852
  exports.loadStyleSheet = loadStyleSheet;
1776
1853
  exports.mapEach = mapEach;
1777
1854
  exports.mergePolygons = mergePolygons;
1855
+ exports.minMaxPointsValidator = minMaxPointsValidator;
1778
1856
  exports.noInnerRingsValidator = noInnerRingsValidator;
1779
1857
  exports.noKinksValidator = noKinksValidator;
1780
1858
  exports.notNullOrUndefined = notNullOrUndefined;