@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.
@@ -1,35 +1,7 @@
1
1
  import i18n from "i18next";
2
2
  export declare const DEFAULT_LANGUAGE = "en";
3
3
  export declare const resources: {
4
- readonly en: {
5
- readonly legend: {
6
- strokeWidth: string;
7
- strokeColor: string;
8
- symbolSize: string;
9
- symbolColor: string;
10
- hide: string;
11
- show: string;
12
- other: string;
13
- andBefore: string;
14
- andLess: string;
15
- after: string;
16
- more: string;
17
- };
18
- };
19
- readonly ru: {
20
- readonly legend: {
21
- strokeWidth: string;
22
- strokeColor: string;
23
- symbolSize: string;
24
- symbolColor: string;
25
- hide: string;
26
- show: string;
27
- other: string;
28
- andBefore: string;
29
- andLess: string;
30
- after: string;
31
- more: string;
32
- };
33
- };
4
+ readonly en: {};
5
+ readonly ru: {};
34
6
  };
35
7
  export { i18n };
@@ -18,7 +18,6 @@ var color = require('@evergis/color');
18
18
  var condition = require('@evergis/condition');
19
19
  var i18n = _interopDefault(require('i18next'));
20
20
  var reactI18next = require('react-i18next');
21
- var LanguageDetector = _interopDefault(require('i18next-browser-languagedetector'));
22
21
  var ImageFill = require('@evergis/sgis/es/symbols/polygon/ImageFill');
23
22
  var Simple = require('@evergis/sgis/es/symbols/polygon/Simple');
24
23
  var PolylineSymbol = require('@evergis/sgis/es/symbols/PolylineSymbol');
@@ -942,66 +941,12 @@ const unClassify = symbol => Object.entries(symbol).reduce((flatSymbol, _ref) =>
942
941
  });
943
942
  }, {});
944
943
 
945
- var strokeWidth = "Stroke width";
946
- var strokeColor = "Stroke color";
947
- var symbolSize = "Symbol size";
948
- var symbolColor = "Symbol color";
949
- var hide = "Hide";
950
- var show = "Show";
951
- var other = "Other";
952
- var andBefore = "and before";
953
- var andLess = "and less";
954
- var after = "after";
955
- var more = "more";
956
- var legend_en = {
957
- strokeWidth: strokeWidth,
958
- strokeColor: strokeColor,
959
- symbolSize: symbolSize,
960
- symbolColor: symbolColor,
961
- hide: hide,
962
- show: show,
963
- other: other,
964
- andBefore: andBefore,
965
- andLess: andLess,
966
- after: after,
967
- more: more
968
- };
969
-
970
- var strokeWidth$1 = "Толщина обводки";
971
- var strokeColor$1 = "Цвет обводки";
972
- var symbolSize$1 = "Размер знака";
973
- var symbolColor$1 = "Цвет символа";
974
- var hide$1 = "Свернуть";
975
- var show$1 = "Развернуть";
976
- var other$1 = "Другое";
977
- var andBefore$1 = "и до";
978
- var andLess$1 = "и менее";
979
- var after$1 = "после";
980
- var more$1 = "более";
981
- var legend_ru = {
982
- strokeWidth: strokeWidth$1,
983
- strokeColor: strokeColor$1,
984
- symbolSize: symbolSize$1,
985
- symbolColor: symbolColor$1,
986
- hide: hide$1,
987
- show: show$1,
988
- other: other$1,
989
- andBefore: andBefore$1,
990
- andLess: andLess$1,
991
- after: after$1,
992
- more: more$1
993
- };
994
-
995
944
  const DEFAULT_LANGUAGE = "en";
996
945
  const resources = {
997
- en: {
998
- legend: legend_en
999
- },
1000
- ru: {
1001
- legend: legend_ru
1002
- }
946
+ en: {},
947
+ ru: {}
1003
948
  };
1004
- i18n.use(LanguageDetector).use(reactI18next.initReactI18next).init({
949
+ i18n.use(reactI18next.initReactI18next).init({
1005
950
  fallbackLng: DEFAULT_LANGUAGE,
1006
951
  ns: Object.keys(resources[DEFAULT_LANGUAGE]),
1007
952
  interpolation: {
@@ -1023,17 +968,17 @@ const printRangeClass = (value, index) => {
1023
968
 
1024
969
  if (from === null) {
1025
970
  return to + " " + (isDate ? i18n.t("andBefore", {
1026
- ns: "legend"
971
+ ns: "style"
1027
972
  }) : i18n.t("andLess", {
1028
- ns: "legend"
973
+ ns: "style"
1029
974
  }));
1030
975
  }
1031
976
 
1032
977
  if (to === null) {
1033
978
  return (isDate ? i18n.t("after", {
1034
- ns: "legend"
979
+ ns: "style"
1035
980
  }) : i18n.t("more", {
1036
- ns: "legend"
981
+ ns: "style"
1037
982
  })) + " " + from;
1038
983
  }
1039
984
 
@@ -2646,13 +2591,13 @@ const formatRangeClassValue = (value, formatValue, index) => {
2646
2591
 
2647
2592
  if (from === null) {
2648
2593
  return "" + formattedTo + (!isDate ? " " + i18n.t("andLess", {
2649
- ns: "legend"
2594
+ ns: "style"
2650
2595
  }) : '');
2651
2596
  }
2652
2597
 
2653
2598
  if (to === null) {
2654
2599
  return "" + (!isDate ? i18n.t("more", {
2655
- ns: "legend"
2600
+ ns: "style"
2656
2601
  }) + " " : '') + formattedFrom;
2657
2602
  }
2658
2603
 
@@ -3046,6 +2991,8 @@ const classifyParamsReduce = (symbol, classifyParams, index) => {
3046
2991
  const getClassified = layerInfo => {
3047
2992
  var _layerInfo$style2, _layerInfo$style2$chi, _layerInfo$style4, _layerInfo$style5;
3048
2993
 
2994
+ if (!layerInfo) return undefined;
2995
+
3049
2996
  if ((_layerInfo$style2 = layerInfo.style) != null && (_layerInfo$style2$chi = _layerInfo$style2.children) != null && _layerInfo$style2$chi.length) {
3050
2997
  var _layerInfo$style3;
3051
2998
 
@@ -6501,7 +6448,7 @@ const getLegendText = _ref => {
6501
6448
 
6502
6449
  if (!title) {
6503
6450
  return React__default.createElement(ItemText, null, i18n.t("other", {
6504
- ns: "legend"
6451
+ ns: "style"
6505
6452
  }));
6506
6453
  }
6507
6454
 
@@ -6533,7 +6480,7 @@ const LegendChildren = _ref => {
6533
6480
  clearHiddenLegends,
6534
6481
  formatValue
6535
6482
  } = _ref;
6536
- if (!((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6483
+ if (!(layerInfo != null && (_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length)) return null;
6537
6484
  const attributes = getLayerAttributes(layerInfo.layerDefinition);
6538
6485
  return React__default.createElement(MapLegendContainer, null, layerInfo.style.children.map((paramValue, index) => {
6539
6486
  var _getConditionAttribut;
@@ -6570,7 +6517,7 @@ const LegendParameterDescription = _ref => {
6570
6517
  } = _ref;
6571
6518
  const {
6572
6519
  t
6573
- } = reactI18next.useTranslation("legend");
6520
+ } = reactI18next.useTranslation("style");
6574
6521
  const isSize = isParameterType("size", parameter);
6575
6522
  const isStrokeWidth = isParameterType(["strokeWidth", "stroke.width"], parameter);
6576
6523
  const isStrokeColor = isParameterType(["strokeColor", "stroke.color"], parameter);
@@ -6604,7 +6551,7 @@ const MinimizedLegend = _ref => {
6604
6551
  } = _ref;
6605
6552
  const {
6606
6553
  t
6607
- } = reactI18next.useTranslation("legend");
6554
+ } = reactI18next.useTranslation("style");
6608
6555
  const currentValues = [...values];
6609
6556
  const other = currentValues.pop();
6610
6557
  const isSize = isParameterType("size", parameter);
@@ -6742,7 +6689,7 @@ const LegendSection = _ref => {
6742
6689
  } = _ref;
6743
6690
  const {
6744
6691
  t
6745
- } = reactI18next.useTranslation("legend");
6692
+ } = reactI18next.useTranslation("style");
6746
6693
  const [isExpanded, toggleExpanded] = useToggle();
6747
6694
  const [maxRef, maxNode] = useNode();
6748
6695
  const [minRef, minNode] = useNode();
@@ -6798,6 +6745,8 @@ const Legend = /*#__PURE__*/React.memo(_ref => {
6798
6745
  } = _ref,
6799
6746
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
6800
6747
 
6748
+ if (!layerInfo) return null;
6749
+
6801
6750
  if ((_layerInfo$style = layerInfo.style) != null && (_layerInfo$style$chil = _layerInfo$style.children) != null && _layerInfo$style$chil.length) {
6802
6751
  return React__default.createElement(LegendChildren, {
6803
6752
  layerInfo: layerInfo,