@evergis/react 3.1.126-alpha.0 → 3.1.126-alpha.1

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/dist/index.js CHANGED
@@ -3622,8 +3622,9 @@ exports.DateFormat = void 0;
3622
3622
  })(exports.DateFormat || (exports.DateFormat = {}));
3623
3623
  const stringDateParsers = [dateFns.parseJSON, dateFns.parseISO, rawDate => new Date(rawDate)];
3624
3624
  const getDate = (rawDate) => {
3625
- if (!rawDate)
3625
+ if (!rawDate) {
3626
3626
  return null;
3627
+ }
3627
3628
  if (typeof rawDate === "string") {
3628
3629
  for (const parser of stringDateParsers) {
3629
3630
  const date = parser(rawDate);
@@ -3641,7 +3642,7 @@ const formatDate$1 = (date, { dateFormat = exports.DateFormat.ClientDefaultForma
3641
3642
  if (dateFns.isValid(dateValue)) {
3642
3643
  return dateFns.format(dateValue, dateFormat);
3643
3644
  }
3644
- return defaultValue.toString();
3645
+ return `${defaultValue}`;
3645
3646
  };
3646
3647
 
3647
3648
  const debounce = (callback, delay) => {
@@ -3657,13 +3658,6 @@ const debounce = (callback, delay) => {
3657
3658
  };
3658
3659
 
3659
3660
  const TIME_ZONE_FORMAT = ' "GMT"z'; // eslint-disable-line
3660
- const numberFormatTypes = [
3661
- api.AttributeType.Int32,
3662
- api.AttributeType.Int64,
3663
- api.AttributeType.Double,
3664
- api.AttributeType.MultiPolygon,
3665
- api.AttributeType.Polyline,
3666
- ];
3667
3661
  exports.ScalingFactor = void 0;
3668
3662
  (function (ScalingFactor) {
3669
3663
  ScalingFactor[ScalingFactor["Default"] = 1] = "Default";
@@ -3818,8 +3812,9 @@ const formatNumberValue = (stringFormat, value, type, noUnits = false) => {
3818
3812
  };
3819
3813
  const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false }) => {
3820
3814
  if (type === api.AttributeType.Point) {
3821
- if (!stringFormat?.format || !value)
3815
+ if (!stringFormat?.format || !value) {
3822
3816
  return null;
3817
+ }
3823
3818
  const { coordinates } = value;
3824
3819
  return formatPointValue({ t, stringFormat, value: coordinates });
3825
3820
  }
@@ -3828,9 +3823,20 @@ const formatAttributeValue = ({ t, type, value, stringFormat, noUnits = false })
3828
3823
  return null;
3829
3824
  return formatDateValue(stringFormat, value);
3830
3825
  }
3831
- if (numberFormatTypes.includes(type) && !isNaN(value)) {
3832
- if (!stringFormat)
3826
+ if ([
3827
+ api.AttributeType.Int32,
3828
+ api.AttributeType.Int64,
3829
+ api.AttributeType.Double,
3830
+ api.AttributeType.Polygon,
3831
+ api.AttributeType.LineString,
3832
+ api.AttributeType.MultiPoint,
3833
+ api.AttributeType.MultiPolygon,
3834
+ api.AttributeType.MultiLineString,
3835
+ ].includes(type) &&
3836
+ !isNaN(value)) {
3837
+ if (!stringFormat) {
3833
3838
  return value.toString();
3839
+ }
3834
3840
  return formatNumberValue(stringFormat, value, type, noUnits);
3835
3841
  }
3836
3842
  if (type === api.AttributeType.Json) {
@@ -3896,6 +3902,10 @@ const isLayerService = (value) => isObject(value) && "name" in value;
3896
3902
 
3897
3903
  const isNumeric = (number) => !isNaN(parseFloat(number)) && isFinite(number);
3898
3904
 
3905
+ const metersPerPixel = (zoom, lat) => {
3906
+ return (156543.03 * Math.cos(lat * (Math.PI / 180))) / 2 ** zoom;
3907
+ };
3908
+
3899
3909
  const DashboardContext = React.createContext({});
3900
3910
  const DashboardProvider = React.memo(({ children, ...props }) => {
3901
3911
  return jsxRuntime.jsx(DashboardContext.Provider, { value: props, children: children });
@@ -4420,7 +4430,8 @@ const getLayerDefinition = (layer) => {
4420
4430
  return {
4421
4431
  ...emptyLayerDefinition,
4422
4432
  ...(layer.layerDefinition || {}),
4423
- attributes: layer.layerDefinition.attributes || emptyLayerDefinition.attributes,
4433
+ attributes: layer.layerDefinition.attributes ||
4434
+ emptyLayerDefinition.attributes,
4424
4435
  };
4425
4436
  };
4426
4437
 
@@ -12027,6 +12038,7 @@ exports.isNumeric = isNumeric;
12027
12038
  exports.isObject = isObject;
12028
12039
  exports.isProxyService = isProxyService;
12029
12040
  exports.isVisibleContainer = isVisibleContainer;
12041
+ exports.metersPerPixel = metersPerPixel;
12030
12042
  exports.numberOptions = numberOptions;
12031
12043
  exports.parseClientStyle = parseClientStyle;
12032
12044
  exports.parseIconNames = parseIconNames;