@evergis/react 2.0.138 → 2.0.139
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/components/MapLegend/MinimizedLegend.d.ts +3 -0
- package/dist/components/MapLegend/styled.d.ts +6 -4
- package/dist/components/MapLegend/types.d.ts +7 -0
- package/dist/contexts/LegendContext.d.ts +1 -1
- package/dist/core/feature/getFeatureSymbol.d.ts +1 -1
- package/dist/core/style/EvergisStyle.d.ts +1 -1
- package/dist/hooks/useLegend/useLegendValueSymbol.d.ts +1 -1
- package/dist/hooks/useLegend/useMapLegend.d.ts +2 -2
- package/dist/react.cjs.development.js +72 -25
- package/dist/react.cjs.development.js.map +1 -1
- package/dist/react.cjs.production.min.js +1 -1
- package/dist/react.cjs.production.min.js.map +1 -1
- package/dist/react.esm.js +73 -26
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/react.esm.js
CHANGED
|
@@ -42,7 +42,7 @@ import { GridClusterProvider } from '@evergis/sgis/es/layers/clusterProviders/Gr
|
|
|
42
42
|
import { PointEditor } from '@evergis/sgis/es/controls/PointEditor';
|
|
43
43
|
import { debounce } from '@evergis/sgis/es/utils/utils';
|
|
44
44
|
import styled, { css } from 'styled-components';
|
|
45
|
-
import { Icon, useToggle } from '@evergis/ui';
|
|
45
|
+
import { Icon, isNumeric, useToggle } from '@evergis/ui';
|
|
46
46
|
import punycode from 'punycode';
|
|
47
47
|
import { TileLayer as TileLayer$1 } from '@evergis/sgis/es/layers/TileLayer';
|
|
48
48
|
|
|
@@ -3449,10 +3449,9 @@ const useMapLegend = (layer, config) => {
|
|
|
3449
3449
|
return null;
|
|
3450
3450
|
}
|
|
3451
3451
|
|
|
3452
|
-
const firstLegend = legend.items[0];
|
|
3453
3452
|
return {
|
|
3454
3453
|
symbol: legend.symbol,
|
|
3455
|
-
|
|
3454
|
+
items: legend.items
|
|
3456
3455
|
};
|
|
3457
3456
|
};
|
|
3458
3457
|
|
|
@@ -4726,7 +4725,7 @@ const LegendContainer = /*#__PURE__*/styled.div(_templateObject$2 || (_templateO
|
|
|
4726
4725
|
const LegendSectionContainer = /*#__PURE__*/styled.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
|
|
4727
4726
|
const LegendSymbolTitle = /*#__PURE__*/styled.p(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])));
|
|
4728
4727
|
const LegendValueContainer = /*#__PURE__*/styled.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
|
|
4729
|
-
const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight:
|
|
4728
|
+
const LegendSectionHeader = /*#__PURE__*/styled.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4730
4729
|
|
|
4731
4730
|
const LegendSection = _ref => {
|
|
4732
4731
|
let {
|
|
@@ -4991,23 +4990,43 @@ const Fullscreen = () => {
|
|
|
4991
4990
|
}));
|
|
4992
4991
|
};
|
|
4993
4992
|
|
|
4994
|
-
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
|
|
4993
|
+
var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12$1, _templateObject13$1;
|
|
4995
4994
|
const MapLegendControl = /*#__PURE__*/styled(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
|
|
4996
4995
|
const MapLegendContainer = /*#__PURE__*/styled.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
|
|
4997
4996
|
const MapLegendHeader = /*#__PURE__*/styled(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
|
|
4998
|
-
const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight:
|
|
4999
|
-
const
|
|
5000
|
-
const MapLegendItem = /*#__PURE__*/styled.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background-color: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n"])), _ref => {
|
|
4997
|
+
const MapLegendValueDescr = /*#__PURE__*/styled.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1rem;\n"])));
|
|
4998
|
+
const MapLegendItem = /*#__PURE__*/styled.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: 1;\n height: 1rem;\n background: ", ";\n border: 1px rgba(48, 69, 79, 0.1) solid;\n margin-right: -1px;\n \n ", "\n"])), _ref => {
|
|
5001
4999
|
let {
|
|
5002
5000
|
value
|
|
5003
5001
|
} = _ref;
|
|
5004
|
-
return value;
|
|
5002
|
+
return typeof value === "number" ? "none" : value;
|
|
5003
|
+
}, _ref2 => {
|
|
5004
|
+
let {
|
|
5005
|
+
value
|
|
5006
|
+
} = _ref2;
|
|
5007
|
+
return !!value && typeof value === "number" && SizeLegendMixin(value);
|
|
5008
|
+
});
|
|
5009
|
+
const MapLegendOther = /*#__PURE__*/styled(MapLegendItem)(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n flex: none;\n width: 1rem;\n margin-left: 0.25rem;\n border-radius: 0.125rem;\n"])));
|
|
5010
|
+
const SizeOverlayLegendMixin = /*#__PURE__*/css(_templateObject7$2 || (_templateObject7$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 2rem;\n height: 2rem;\n \n ", ", ", " {\n flex: none;\n position: absolute;\n top: 0;\n left: 50%;\n width: inherit;\n height: inherit;\n margin-left: -1rem;\n \n :after {\n top: 0;\n margin-top: 0;\n }\n }\n"])), MapLegendItem, MapLegendOther);
|
|
5011
|
+
const MapLegendItems = /*#__PURE__*/styled.div(_templateObject8$2 || (_templateObject8$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n width: 100%;\n border-radius: 0.125rem;\n\n ", ";\n"])), _ref3 => {
|
|
5012
|
+
let {
|
|
5013
|
+
overlay
|
|
5014
|
+
} = _ref3;
|
|
5015
|
+
return overlay && SizeOverlayLegendMixin;
|
|
5005
5016
|
});
|
|
5006
|
-
|
|
5007
|
-
const
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5017
|
+
|
|
5018
|
+
const SizeLegendMixin = function SizeLegendMixin(value) {
|
|
5019
|
+
if (value === void 0) {
|
|
5020
|
+
value = 0;
|
|
5021
|
+
}
|
|
5022
|
+
|
|
5023
|
+
return css(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteralLoose(["\n position: relative;\n height: 2rem;\n background: none;\n border: none;\n margin-right: 0;\n \n :after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n border: 1px rgba(48, 69, 79, 0.28) solid;\n border-radius: 50%;\n margin: -", "px 0 0 -", "px;\n width: ", "px;\n height: ", "px;\n }\n"])), value / 2, value / 2, value, value);
|
|
5024
|
+
};
|
|
5025
|
+
|
|
5026
|
+
const MapLegendValues = /*#__PURE__*/styled.div(_templateObject10$1 || (_templateObject10$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n font-size: 0.75rem;\n color: rgba(48, 69, 79, 0.65);\n"])));
|
|
5027
|
+
const MapLegendValuesRange = /*#__PURE__*/styled.div(_templateObject11$1 || (_templateObject11$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
5028
|
+
const MapLegendValuesOther = /*#__PURE__*/styled(MapLegendOther)(_templateObject12$1 || (_templateObject12$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 0;\n text-align: center;\n overflow: visible;\n"])));
|
|
5029
|
+
const MapLegendExpandButton = /*#__PURE__*/styled.div(_templateObject13$1 || (_templateObject13$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n margin: 0.1rem 0 0.5rem;\n font-size: 0.625rem;\n color: #1FB3AA;\n"])));
|
|
5011
5030
|
|
|
5012
5031
|
const getValueFromLegendTitle = (title, minOrMax) => {
|
|
5013
5032
|
var _title$split;
|
|
@@ -5017,11 +5036,33 @@ const getValueFromLegendTitle = (title, minOrMax) => {
|
|
|
5017
5036
|
return minOrMax === "min" ? result == null ? void 0 : result[0] : result == null ? void 0 : result[1];
|
|
5018
5037
|
}
|
|
5019
5038
|
|
|
5020
|
-
return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split
|
|
5039
|
+
return (title == null ? void 0 : (_title$split = title.split(" ")) == null ? void 0 : _title$split.find(isNumeric)) || "";
|
|
5040
|
+
};
|
|
5041
|
+
|
|
5042
|
+
const MinimizedLegend = _ref => {
|
|
5043
|
+
var _currentValues$, _currentValues;
|
|
5044
|
+
|
|
5045
|
+
let {
|
|
5046
|
+
values,
|
|
5047
|
+
title,
|
|
5048
|
+
overlay
|
|
5049
|
+
} = _ref;
|
|
5050
|
+
const currentValues = [...values];
|
|
5051
|
+
const other = currentValues.pop();
|
|
5052
|
+
return React.createElement(React.Fragment, null, !!title && React.createElement(MapLegendValueDescr, null, title), React.createElement(MapLegendItems, {
|
|
5053
|
+
overlay: overlay
|
|
5054
|
+
}, currentValues.map(value => React.createElement(MapLegendItem, {
|
|
5055
|
+
key: value.title,
|
|
5056
|
+
title: value.title,
|
|
5057
|
+
value: value.parameterValue
|
|
5058
|
+
})), React.createElement(MapLegendOther, {
|
|
5059
|
+
title: "\u0414\u0440\u0443\u0433\u043E\u0435",
|
|
5060
|
+
value: other == null ? void 0 : other.parameterValue
|
|
5061
|
+
})), typeof (other == null ? void 0 : other.parameterValue) === "string" && React.createElement(MapLegendValues, null, React.createElement(MapLegendValuesRange, null, React.createElement("div", null, getValueFromLegendTitle((_currentValues$ = currentValues[0]) == null ? void 0 : _currentValues$.title, "max")), React.createElement("div", null, getValueFromLegendTitle((_currentValues = currentValues[currentValues.length - 1]) == null ? void 0 : _currentValues.title, "min"))), React.createElement(MapLegendValuesOther, null, "-")));
|
|
5021
5062
|
};
|
|
5022
5063
|
|
|
5023
5064
|
const MapLegend = _ref => {
|
|
5024
|
-
var
|
|
5065
|
+
var _items$0$parameter;
|
|
5025
5066
|
|
|
5026
5067
|
let {
|
|
5027
5068
|
layer,
|
|
@@ -5037,23 +5078,29 @@ const MapLegend = _ref => {
|
|
|
5037
5078
|
|
|
5038
5079
|
const {
|
|
5039
5080
|
symbol,
|
|
5040
|
-
|
|
5081
|
+
items
|
|
5041
5082
|
} = legend;
|
|
5083
|
+
const isValidClassify = !((_items$0$parameter = items[0].parameter) != null && _items$0$parameter.includes("labelSymbol"));
|
|
5042
5084
|
return React.createElement(LegendProvider, {
|
|
5043
5085
|
symbol: symbol
|
|
5044
5086
|
}, React.createElement(MapLegendControl, {
|
|
5045
5087
|
className: className
|
|
5046
|
-
}, React.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), React.createElement(MapLegendContainer, null, isExpanded ? React.createElement(Legend, {
|
|
5088
|
+
}, React.createElement(MapLegendHeader, null, layer == null ? void 0 : layer.alias), isValidClassify && React.createElement(MapLegendContainer, null, isExpanded ? React.createElement(Legend, {
|
|
5047
5089
|
layer: layer,
|
|
5048
5090
|
config: config
|
|
5049
|
-
}) : React.createElement(React.Fragment, null,
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5091
|
+
}) : React.createElement(React.Fragment, null, items.map(item => {
|
|
5092
|
+
var _symbol$fill, _item$parameter, _symbol$fill2;
|
|
5093
|
+
|
|
5094
|
+
return React.createElement(React.Fragment, null, React.createElement(MinimizedLegend, {
|
|
5095
|
+
values: item.values,
|
|
5096
|
+
defaultValue: (_symbol$fill = symbol.fill) == null ? void 0 : _symbol$fill.color,
|
|
5097
|
+
title: item.title !== (layer == null ? void 0 : layer.alias) ? item.title : ""
|
|
5098
|
+
}), ((_item$parameter = item.parameter) == null ? void 0 : _item$parameter.includes("size")) && React.createElement(MinimizedLegend, {
|
|
5099
|
+
values: item.values,
|
|
5100
|
+
defaultValue: (_symbol$fill2 = symbol.fill) == null ? void 0 : _symbol$fill2.color,
|
|
5101
|
+
overlay: true
|
|
5102
|
+
}));
|
|
5103
|
+
})), React.createElement(MapLegendExpandButton, {
|
|
5057
5104
|
onClick: toggleExpanded
|
|
5058
5105
|
}, isExpanded ? "Свернуть" : "Развернуть"))));
|
|
5059
5106
|
};
|