@evergis/react 2.0.227 → 2.0.228

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/react.esm.js CHANGED
@@ -11,7 +11,6 @@ import { Color } from '@evergis/color';
11
11
  import { ConditionInterpreter, TokenType, ConditionEvaluator, Char } from '@evergis/condition';
12
12
  import i18n from 'i18next';
13
13
  import { initReactI18next, useTranslation } from 'react-i18next';
14
- import LanguageDetector from 'i18next-browser-languagedetector';
15
14
  import { ImageFill } from '@evergis/sgis/es/symbols/polygon/ImageFill';
16
15
  import { PolygonSymbol } from '@evergis/sgis/es/symbols/polygon/Simple';
17
16
  import { PolylineSymbol } from '@evergis/sgis/es/symbols/PolylineSymbol';
@@ -934,66 +933,12 @@ const unClassify = symbol => Object.entries(symbol).reduce((flatSymbol, _ref) =>
934
933
  });
935
934
  }, {});
936
935
 
937
- var strokeWidth = "Stroke width";
938
- var strokeColor = "Stroke color";
939
- var symbolSize = "Symbol size";
940
- var symbolColor = "Symbol color";
941
- var hide = "Hide";
942
- var show = "Show";
943
- var other = "Other";
944
- var andBefore = "and before";
945
- var andLess = "and less";
946
- var after = "after";
947
- var more = "more";
948
- var legend_en = {
949
- strokeWidth: strokeWidth,
950
- strokeColor: strokeColor,
951
- symbolSize: symbolSize,
952
- symbolColor: symbolColor,
953
- hide: hide,
954
- show: show,
955
- other: other,
956
- andBefore: andBefore,
957
- andLess: andLess,
958
- after: after,
959
- more: more
960
- };
961
-
962
- var strokeWidth$1 = "Толщина обводки";
963
- var strokeColor$1 = "Цвет обводки";
964
- var symbolSize$1 = "Размер знака";
965
- var symbolColor$1 = "Цвет символа";
966
- var hide$1 = "Свернуть";
967
- var show$1 = "Развернуть";
968
- var other$1 = "Другое";
969
- var andBefore$1 = "и до";
970
- var andLess$1 = "и менее";
971
- var after$1 = "после";
972
- var more$1 = "более";
973
- var legend_ru = {
974
- strokeWidth: strokeWidth$1,
975
- strokeColor: strokeColor$1,
976
- symbolSize: symbolSize$1,
977
- symbolColor: symbolColor$1,
978
- hide: hide$1,
979
- show: show$1,
980
- other: other$1,
981
- andBefore: andBefore$1,
982
- andLess: andLess$1,
983
- after: after$1,
984
- more: more$1
985
- };
986
-
987
936
  const DEFAULT_LANGUAGE = "en";
988
937
  const resources = {
989
- en: {
990
- legend: legend_en
991
- },
992
- ru: {
993
- legend: legend_ru
994
- }
938
+ en: {},
939
+ ru: {}
995
940
  };
996
- i18n.use(LanguageDetector).use(initReactI18next).init({
941
+ i18n.use(initReactI18next).init({
997
942
  fallbackLng: DEFAULT_LANGUAGE,
998
943
  ns: Object.keys(resources[DEFAULT_LANGUAGE]),
999
944
  interpolation: {
@@ -1015,17 +960,17 @@ const printRangeClass = (value, index) => {
1015
960
 
1016
961
  if (from === null) {
1017
962
  return to + " " + (isDate ? i18n.t("andBefore", {
1018
- ns: "legend"
963
+ ns: "style"
1019
964
  }) : i18n.t("andLess", {
1020
- ns: "legend"
965
+ ns: "style"
1021
966
  }));
1022
967
  }
1023
968
 
1024
969
  if (to === null) {
1025
970
  return (isDate ? i18n.t("after", {
1026
- ns: "legend"
971
+ ns: "style"
1027
972
  }) : i18n.t("more", {
1028
- ns: "legend"
973
+ ns: "style"
1029
974
  })) + " " + from;
1030
975
  }
1031
976
 
@@ -2647,13 +2592,13 @@ const formatRangeClassValue = (value, formatValue, index) => {
2647
2592
 
2648
2593
  if (from === null) {
2649
2594
  return "" + formattedTo + (!isDate ? " " + i18n.t("andLess", {
2650
- ns: "legend"
2595
+ ns: "style"
2651
2596
  }) : '');
2652
2597
  }
2653
2598
 
2654
2599
  if (to === null) {
2655
2600
  return "" + (!isDate ? i18n.t("more", {
2656
- ns: "legend"
2601
+ ns: "style"
2657
2602
  }) + " " : '') + formattedFrom;
2658
2603
  }
2659
2604
 
@@ -3047,6 +2992,8 @@ const classifyParamsReduce = (symbol, classifyParams, index) => {
3047
2992
  const getClassified = layerInfo => {
3048
2993
  var _layerInfo$style2, _layerInfo$style2$chi, _layerInfo$style4, _layerInfo$style5;
3049
2994
 
2995
+ if (!layerInfo) return undefined;
2996
+
3050
2997
  if ((_layerInfo$style2 = layerInfo.style) != null && (_layerInfo$style2$chi = _layerInfo$style2.children) != null && _layerInfo$style2$chi.length) {
3051
2998
  var _layerInfo$style3;
3052
2999
 
@@ -6504,7 +6451,7 @@ const getLegendText = _ref => {
6504
6451
 
6505
6452
  if (!title) {
6506
6453
  return React.createElement(ItemText, null, i18n.t("other", {
6507
- ns: "legend"
6454
+ ns: "style"
6508
6455
  }));
6509
6456
  }
6510
6457
 
@@ -6536,7 +6483,7 @@ const LegendChildren = _ref => {
6536
6483
  clearHiddenLegends,
6537
6484
  formatValue
6538
6485
  } = _ref;
6539
- if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6486
+ if (!(layerInfo != null && (_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6540
6487
  const attributes = getLayerAttributes(layerInfo.layerDefinition);
6541
6488
  return React.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
6542
6489
  var _getConditionAttribut;
@@ -6573,7 +6520,7 @@ const LegendParameterDescription = _ref => {
6573
6520
  } = _ref;
6574
6521
  const {
6575
6522
  t
6576
- } = useTranslation("legend");
6523
+ } = useTranslation("style");
6577
6524
  const isSize = isParameterType("size", parameter);
6578
6525
  const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6579
6526
  const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
@@ -6607,7 +6554,7 @@ const MinimizedLegend = _ref => {
6607
6554
  } = _ref;
6608
6555
  const {
6609
6556
  t
6610
- } = useTranslation("legend");
6557
+ } = useTranslation("style");
6611
6558
  const currentValues = [...values];
6612
6559
  const other = currentValues.pop();
6613
6560
  const isSize = isParameterType("size", parameter);
@@ -6745,7 +6692,7 @@ const LegendSection = _ref => {
6745
6692
  } = _ref;
6746
6693
  const {
6747
6694
  t
6748
- } = useTranslation("legend");
6695
+ } = useTranslation("style");
6749
6696
  const [isExpanded, toggleExpanded] = useToggle();
6750
6697
  const [maxRef, maxNode] = useNode();
6751
6698
  const [minRef, minNode] = useNode();
@@ -6801,6 +6748,8 @@ const Legend = /*#__PURE__*/memo(_ref => {
6801
6748
  } = _ref,
6802
6749
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6803
6750
 
6751
+ if (!layerInfo) return null;
6752
+
6804
6753
  if ((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length) {
6805
6754
  return React.createElement(LegendChildren, {
6806
6755
  layerInfo: layerInfo,