@evergis/react 3.1.93 → 3.1.95
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import { IconButton, Flex, transition, Chip, Icon, Description, FlexSpan, IconToggle, Popup, Menu, DraggableTree, shadows, Divider, LegendToggler, Tooltip as Tooltip$1, DropdownField, MultiSelectContainer, IconButtonButton, FlatButton, DraggableTreeContainer, Dialog, DialogTitle, ThemeProvider, darkTheme, DialogContent, CircularProgress, LinearProgress, H2, defaultTheme, Preview, Dropdown, Blank, Popover, UploaderItemArea, UploaderTitleWrapper, Uploader, NumberRangeSlider, useAsyncAutocomplete, AutoComplete, Checkbox, RangeNumberInput, dateFormat } from '@evergis/uilib-gl';
|
|
3
|
-
import { createContext, memo, useRef, useState,
|
|
3
|
+
import { createContext, memo, useRef, useState, useCallback, useEffect, useContext, useMemo, Fragment } from 'react';
|
|
4
4
|
import styled, { createGlobalStyle, css, useTheme } from 'styled-components';
|
|
5
5
|
import { lineChartClassNames, BarChart as BarChart$1, barChartClassNames, LineChart, PieChart } from '@evergis/charts';
|
|
6
6
|
import { AttributeType, generateId, GeometryType, RemoteTaskStatus } from '@evergis/api';
|
|
@@ -3935,6 +3935,15 @@ const ServerNotificationsContext = createContext({});
|
|
|
3935
3935
|
const useServerNotifications = (url, initialized) => {
|
|
3936
3936
|
const hubConnection = useRef(null);
|
|
3937
3937
|
const [connection, setConnection] = useState(null);
|
|
3938
|
+
const subscribeNotifications = useCallback(() => {
|
|
3939
|
+
if (!connection || connection.state !== "Connected") {
|
|
3940
|
+
return;
|
|
3941
|
+
}
|
|
3942
|
+
connection
|
|
3943
|
+
.invoke("SubscribeNotifications", [])
|
|
3944
|
+
.then(() => console.info("Подписка `SubscribeNotifications` оформлена"))
|
|
3945
|
+
.catch(err => console.info("Ошибка подписки `SubscribeNotifications`:", err));
|
|
3946
|
+
}, [connection]);
|
|
3938
3947
|
useEffect(() => {
|
|
3939
3948
|
if (!initialized) {
|
|
3940
3949
|
return;
|
|
@@ -3943,6 +3952,7 @@ const useServerNotifications = (url, initialized) => {
|
|
|
3943
3952
|
.withUrl(`${url}?clientId=${generateId()}`, {
|
|
3944
3953
|
withCredentials: true,
|
|
3945
3954
|
})
|
|
3955
|
+
.withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 3000 })
|
|
3946
3956
|
.configureLogging(LogLevel.Information)
|
|
3947
3957
|
.build();
|
|
3948
3958
|
hubConnection.current
|
|
@@ -3955,10 +3965,9 @@ const useServerNotifications = (url, initialized) => {
|
|
|
3955
3965
|
if (!connection || connection.state !== "Connected") {
|
|
3956
3966
|
return;
|
|
3957
3967
|
}
|
|
3958
|
-
connection
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
.catch(err => console.info("Ошибка подписки `SubscribeNotifications`:", err));
|
|
3968
|
+
connection.onreconnecting(() => console.info("Переподключение к серверным нотификациям"));
|
|
3969
|
+
connection.onreconnected(subscribeNotifications);
|
|
3970
|
+
subscribeNotifications();
|
|
3962
3971
|
}, [connection]);
|
|
3963
3972
|
return connection;
|
|
3964
3973
|
};
|
|
@@ -4640,6 +4649,7 @@ const LayerGroupMain = styled(Flex) `
|
|
|
4640
4649
|
|
|
4641
4650
|
const customModes = MapboxDraw.modes;
|
|
4642
4651
|
const StaticMode = {};
|
|
4652
|
+
const InvisibleMode = {};
|
|
4643
4653
|
StaticMode.onSetup = function () {
|
|
4644
4654
|
this.setActionableState(undefined);
|
|
4645
4655
|
return {};
|
|
@@ -4647,7 +4657,13 @@ StaticMode.onSetup = function () {
|
|
|
4647
4657
|
StaticMode.toDisplayFeatures = function (state, geojson, display) {
|
|
4648
4658
|
display(geojson);
|
|
4649
4659
|
};
|
|
4660
|
+
InvisibleMode.onSetup = function () {
|
|
4661
|
+
this.setActionableState(undefined);
|
|
4662
|
+
return {};
|
|
4663
|
+
};
|
|
4664
|
+
InvisibleMode.toDisplayFeatures = function () { };
|
|
4650
4665
|
customModes.static = StaticMode;
|
|
4666
|
+
customModes.invisible = InvisibleMode;
|
|
4651
4667
|
|
|
4652
4668
|
const customStyles = [
|
|
4653
4669
|
{
|
|
@@ -9865,8 +9881,6 @@ const useDashboardHeader = () => {
|
|
|
9865
9881
|
};
|
|
9866
9882
|
|
|
9867
9883
|
const useDataSources = ({ type: widgetType, config, attributes, filters, layerParams, eqlParameters, }) => {
|
|
9868
|
-
// const { map } = useMapContext();
|
|
9869
|
-
// const sr = useProjectSrid();
|
|
9870
9884
|
const { ewktGeometry, api } = useGlobalContext();
|
|
9871
9885
|
const { dataSources } = useWidgetContext(widgetType);
|
|
9872
9886
|
const { filters: configFilters, dataSources: configDataSources } = config || {};
|