@evergis/react 3.1.15 → 3.1.16
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/Dashboard/components/Chart/styled.d.ts +16 -0
- package/dist/components/Dashboard/containers/RoundedBackgroundContainer/styled.d.ts +2 -0
- package/dist/components/Dashboard/types.d.ts +2 -0
- package/dist/index.js +171 -47
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +181 -57
- package/dist/react.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/react.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
-
import { IconButton, Flex, transition, Chip, Icon, Description, FlexSpan, IconToggle, Popup, Menu, DraggableTree, shadows, Divider, LegendToggler, Tooltip, DropdownField, MultiSelectContainer, IconButtonButton, FlatButton, DraggableTreeContainer, LinearProgress, H2, ThemeProvider, defaultTheme, Preview, Blank, Popover, darkTheme, NumberRangeSlider, useAsyncAutocomplete, AutoComplete, Dropdown, Checkbox, CircularProgress, RangeNumberInput, dateFormat } from '@evergis/uilib-gl';
|
|
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, LinearProgress, H2, ThemeProvider, defaultTheme, Preview, Blank, Popover, darkTheme, NumberRangeSlider, useAsyncAutocomplete, AutoComplete, Dropdown, Checkbox, CircularProgress, RangeNumberInput, dateFormat } from '@evergis/uilib-gl';
|
|
3
3
|
import { createContext, memo, useRef, useState, useEffect, useCallback, useContext, useMemo, Fragment } from 'react';
|
|
4
|
-
import styled, { css, useTheme } from 'styled-components';
|
|
4
|
+
import styled, { createGlobalStyle, css, useTheme } from 'styled-components';
|
|
5
5
|
import { lineChartClassNames, barChartClassNames, BarChart as BarChart$1, LineChart, PieChart } from '@evergis/charts';
|
|
6
6
|
import { AttributeType, GeometryType } from '@evergis/api';
|
|
7
7
|
import Gradient from 'javascript-color-gradient';
|
|
@@ -35,14 +35,18 @@ const ChartTooltipTable = styled.table `
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
const ChartTooltip = styled(Flex) `
|
|
38
|
-
flex-direction: row;
|
|
39
|
-
align-items: center;
|
|
40
38
|
flex-wrap: nowrap;
|
|
39
|
+
background: rgb(48, 69, 79);
|
|
40
|
+
border-radius: 0.25rem;
|
|
41
|
+
color: white;
|
|
41
42
|
|
|
42
43
|
:not(:last-child) {
|
|
43
44
|
margin-bottom: 0.25rem;
|
|
44
45
|
}
|
|
45
46
|
`;
|
|
47
|
+
const ChartTooltipLabel = styled.div `
|
|
48
|
+
margin-right: 0.25rem;
|
|
49
|
+
`;
|
|
46
50
|
const ChartTooltipColor = styled.div `
|
|
47
51
|
width: 0.625rem;
|
|
48
52
|
height: 0.625rem;
|
|
@@ -88,6 +92,107 @@ const ChartWrapperContainer = styled.div `
|
|
|
88
92
|
position: relative;
|
|
89
93
|
width: 100%;
|
|
90
94
|
`;
|
|
95
|
+
const Tooltip = styled.div `
|
|
96
|
+
position: relative;
|
|
97
|
+
border-radius: 0.25rem;
|
|
98
|
+
background-color: rgba(28, 33, 48);
|
|
99
|
+
padding: 0.5rem;
|
|
100
|
+
box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.15);
|
|
101
|
+
font-size: 0.75rem;
|
|
102
|
+
transform: ${({ transform }) => transform};
|
|
103
|
+
color: white;
|
|
104
|
+
|
|
105
|
+
:before {
|
|
106
|
+
position: absolute;
|
|
107
|
+
display: block;
|
|
108
|
+
content: "";
|
|
109
|
+
width: 0;
|
|
110
|
+
height: 0;
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
const LineChartTooltipStyles = createGlobalStyle `
|
|
114
|
+
.dashboardLineChartTooltip.${lineChartClassNames.lineChartMouseLabel} {
|
|
115
|
+
.${lineChartClassNames.lineChartLabelFlex} {
|
|
116
|
+
justify-content: center;
|
|
117
|
+
align-items: flex-end;
|
|
118
|
+
|
|
119
|
+
${Tooltip} {
|
|
120
|
+
margin: 0 0 12px 0;
|
|
121
|
+
|
|
122
|
+
:before {
|
|
123
|
+
top: auto;
|
|
124
|
+
bottom: 0;
|
|
125
|
+
left: 50%;
|
|
126
|
+
transform: translate(-50%, 100%);
|
|
127
|
+
border-left: 4px solid transparent;
|
|
128
|
+
border-right: 4px solid transparent;
|
|
129
|
+
border-top: 4px solid rgba(28, 33, 48, 0.9);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.${lineChartClassNames.lineChartYScaleGlobal}, .${lineChartClassNames.lineChartXScaleGlobal} {
|
|
136
|
+
.domain {
|
|
137
|
+
visibility: hidden;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.tick {
|
|
141
|
+
text {
|
|
142
|
+
fill: ${({ theme: { palette } }) => palette.textDisabled};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
line {
|
|
146
|
+
visibility: hidden;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.${lineChartClassNames.lineChartXScaleGlobal} {
|
|
152
|
+
.tick {
|
|
153
|
+
:first-of-type {
|
|
154
|
+
text {
|
|
155
|
+
text-anchor: start;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:last-of-type {
|
|
160
|
+
text {
|
|
161
|
+
text-anchor: end;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.${lineChartClassNames.lineChartLine} {
|
|
168
|
+
stroke-width: 2px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.${lineChartClassNames.lineChartLabel} {
|
|
172
|
+
color: ${({ theme: { palette } }) => palette.textPrimary};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.${lineChartClassNames.lineChartMouseCircle} {
|
|
176
|
+
stroke: #ffffff;
|
|
177
|
+
stroke-width: 2px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.${lineChartClassNames.lineChartGridLineX} {
|
|
181
|
+
stroke: ${({ theme: { palette } }) => palette.element};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
text {
|
|
185
|
+
fill: ${({ theme: { palette } }) => palette.textDisabled};
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
const BarChartStyles = createGlobalStyle `
|
|
189
|
+
.dashboardBarChart {
|
|
190
|
+
.domain,
|
|
191
|
+
line {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
91
196
|
|
|
92
197
|
function range(start, stop, step) {
|
|
93
198
|
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
|
@@ -5618,7 +5723,7 @@ const ProgressContainer = memo(({ type, elementConfig, feature, maxValue, index,
|
|
|
5618
5723
|
const color = useMemo(() => colorAttribute
|
|
5619
5724
|
? attributes?.find(({ name }) => name === colorAttribute)?.value
|
|
5620
5725
|
: colors?.[index] || bgColor, [attributes, bgColor, colorAttribute, colors, index]);
|
|
5621
|
-
return (jsx(Tooltip, { content: renderTooltip, placement: "top", arrow: true, children: ref => (jsxs(ProgressContainerWrapper, { ref: ref, style: innerTemplateStyle || style, children: [renderIcon && jsx(ProgressIcon, { children: renderIcon }), jsxs(ProgressContent, { children: [!hideTitle && (jsxs(ProgressAlias, { children: [jsx("div", { children: renderAlias }), jsxs(ProgressValue, { children: [renderValue, unitsElement && jsx(ProgressUnits, { children: renderElement({ id: "units" }) })] })] })), jsxs(ProgressBarContainer, { innerValue: innerValue, children: [jsx(ProgressBarWrapper, { children: jsx(ProgressBar, { "$width": width, "$color": color }) }), !!(hideTitle || innerValue) && jsx(ProgressInnerValue, { children: renderValue })] })] })] })) }));
|
|
5726
|
+
return (jsx(Tooltip$1, { content: renderTooltip, placement: "top", arrow: true, children: ref => (jsxs(ProgressContainerWrapper, { ref: ref, style: innerTemplateStyle || style, children: [renderIcon && jsx(ProgressIcon, { children: renderIcon }), jsxs(ProgressContent, { children: [!hideTitle && (jsxs(ProgressAlias, { children: [jsx("div", { children: renderAlias }), jsxs(ProgressValue, { children: [renderValue, unitsElement && jsx(ProgressUnits, { children: renderElement({ id: "units" }) })] })] })), jsxs(ProgressBarContainer, { innerValue: innerValue, children: [jsx(ProgressBarWrapper, { children: jsx(ProgressBar, { "$width": width, "$color": color }) }), !!(hideTitle || innerValue) && jsx(ProgressInnerValue, { children: renderValue })] })] })] })) }));
|
|
5622
5727
|
});
|
|
5623
5728
|
|
|
5624
5729
|
const RANGE_MIN_VALUE = 0;
|
|
@@ -5714,7 +5819,6 @@ const AnyChartWrapper = styled.div `
|
|
|
5714
5819
|
`;
|
|
5715
5820
|
const BarChartWrapper = styled(AnyChartWrapper) `
|
|
5716
5821
|
width: 100%;
|
|
5717
|
-
max-width: ${MAX_CHART_WIDTH}px;
|
|
5718
5822
|
margin: 0 auto ${BAR_CHART_FOOTER_MARGIN}px;
|
|
5719
5823
|
|
|
5720
5824
|
:hover {
|
|
@@ -5844,7 +5948,7 @@ const PagesContainer = memo(({ type }) => {
|
|
|
5844
5948
|
const { pageIndex, currentPage } = useWidgetPage(type);
|
|
5845
5949
|
const { selectedTabId, setSelectedTabId, expandedContainers, attributes } = useWidgetContext(type);
|
|
5846
5950
|
const { options } = config || {};
|
|
5847
|
-
const { column } = options || {};
|
|
5951
|
+
const { column, width } = options || {};
|
|
5848
5952
|
const isColumn = column === undefined || column;
|
|
5849
5953
|
const filteredChildren = useMemo(() => !selectedTabId
|
|
5850
5954
|
? currentPage.children
|
|
@@ -5869,7 +5973,7 @@ const PagesContainer = memo(({ type }) => {
|
|
|
5869
5973
|
setSelectedTabId,
|
|
5870
5974
|
type,
|
|
5871
5975
|
]);
|
|
5872
|
-
return (jsxs(
|
|
5976
|
+
return (jsxs("div", { style: { width }, children: [jsx(ExpandableTitle, { elementConfig: config, type: type, renderElement: renderElement }), jsx(Container, { isColumn: isColumn, isMain: true, children: jsx(ContainerChildren, { items: filteredChildren, isMain: true, renderElement: renderElement }) })] }));
|
|
5873
5977
|
});
|
|
5874
5978
|
|
|
5875
5979
|
const TwoColumnsInnerContainer = memo(({ renderElement }) => {
|
|
@@ -6268,6 +6372,7 @@ const TabsContainer = memo(({ elementConfig, type }) => {
|
|
|
6268
6372
|
return (jsx(SwiperContainer, { style: style, children: jsx(Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id, value, options: tabOptions }) => (jsxs(SwiperSlide, { children: [jsxs(TabContainer, { href: `#${id}`, active: selectedTabId === id, column: column, bgColor: bgColor, noBg: noBg, radius: radius, onlyIcon: onlyIcon, hasIcon: !!tabOptions?.icon, onClick: () => onClick(id), children: [renderIcon(tabOptions?.icon, selectedTabId === id), !onlyIcon && (jsx(TabValue, { children: jsx(TextTrim, { maxLength: maxLength, children: value }) }))] }), jsx(TabAnchor, { id: id })] }, id))) }) }));
|
|
6269
6373
|
});
|
|
6270
6374
|
|
|
6375
|
+
const ContainerIconValue = styled(Flex) ``;
|
|
6271
6376
|
const RoundedBackgroundContainerWrapper = styled(Flex) `
|
|
6272
6377
|
position: relative;
|
|
6273
6378
|
flex-direction: ${({ $bigIcon }) => ($bigIcon ? "row" : "column")};
|
|
@@ -6285,13 +6390,10 @@ const RoundedBackgroundContainerWrapper = styled(Flex) `
|
|
|
6285
6390
|
css `
|
|
6286
6391
|
align-items: center;
|
|
6287
6392
|
|
|
6288
|
-
* {
|
|
6393
|
+
> * {
|
|
6289
6394
|
display: flex;
|
|
6290
6395
|
justify-content: center;
|
|
6291
6396
|
text-align: center;
|
|
6292
|
-
}
|
|
6293
|
-
|
|
6294
|
-
> * {
|
|
6295
6397
|
width: 100%;
|
|
6296
6398
|
}
|
|
6297
6399
|
`};
|
|
@@ -6324,8 +6426,32 @@ const RoundedBackgroundContainerWrapper = styled(Flex) `
|
|
|
6324
6426
|
}
|
|
6325
6427
|
`};
|
|
6326
6428
|
|
|
6429
|
+
${ContainerIconValue} {
|
|
6430
|
+
align-items: center;
|
|
6431
|
+
flex-direction: column;
|
|
6432
|
+
|
|
6433
|
+
${({ $big }) => $big &&
|
|
6434
|
+
css `
|
|
6435
|
+
flex-direction: row;
|
|
6436
|
+
margin-bottom: 0.5rem;
|
|
6437
|
+
|
|
6438
|
+
> * {
|
|
6439
|
+
text-align: left;
|
|
6440
|
+
}
|
|
6441
|
+
|
|
6442
|
+
span[kind] {
|
|
6443
|
+
margin-right: 0.5rem;
|
|
6444
|
+
}
|
|
6445
|
+
|
|
6446
|
+
${ContainerValue} {
|
|
6447
|
+
width: auto;
|
|
6448
|
+
}
|
|
6449
|
+
`};
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6327
6452
|
${ContainerValue} {
|
|
6328
6453
|
flex-direction: ${({ $inlineUnits }) => ($inlineUnits ? "row" : "column")};
|
|
6454
|
+
justify-content: ${({ $big }) => ($big ? "flex-start" : "flex-end")};
|
|
6329
6455
|
align-items: ${({ $inlineUnits }) => ($inlineUnits ? "center" : "flex-start")};
|
|
6330
6456
|
line-height: 1;
|
|
6331
6457
|
}
|
|
@@ -6349,15 +6475,17 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
|
|
|
6349
6475
|
feature
|
|
6350
6476
|
});
|
|
6351
6477
|
const { options, style, children } = elementConfig || {};
|
|
6352
|
-
const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, bigIcon, hideEmpty, colorAttribute } = options || {};
|
|
6478
|
+
const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
|
|
6353
6479
|
const aliasElement = children?.find(({ id }) => id === "alias");
|
|
6354
6480
|
const unitsElement = children?.find(({ id }) => id === "units");
|
|
6355
6481
|
const valueElement = children?.find(({ id }) => id === "value");
|
|
6356
6482
|
const value = renderElement({ id: "value" });
|
|
6357
6483
|
const color = useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
|
|
6484
|
+
const renderAlias = useMemo(() => (jsx(ContainerAlias, { style: aliasElement?.style, children: jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
|
|
6485
|
+
const renderValue = useMemo(() => (jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
|
|
6358
6486
|
if (!value && hideEmpty)
|
|
6359
6487
|
return null;
|
|
6360
|
-
return (jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$
|
|
6488
|
+
return (jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxs(ContainerIconValue, { children: [renderElement({ id: "icon", wrap: false }), big ? renderAlias : renderValue] }), big ? renderValue : renderAlias] }));
|
|
6361
6489
|
});
|
|
6362
6490
|
|
|
6363
6491
|
const AddFeatureContainer = memo(({ elementConfig }) => {
|
|
@@ -6543,7 +6671,7 @@ var EditGeometryType;
|
|
|
6543
6671
|
const DashboardDefaultHeader = memo(() => {
|
|
6544
6672
|
const { components: { ProjectCatalogMenu, ProjectPanelMenu, ProjectPagesMenu }, } = useWidgetContext();
|
|
6545
6673
|
const { pageId, image, icon, tooltip, themeName } = useDashboardHeader();
|
|
6546
|
-
return (jsxs(DefaultHeaderContainer, { image: image, isDark: themeName === ThemeName.Dark, children: [!pageId && jsx(LinearProgress, {}), jsxs(Flex, { column: true, gap: "1rem", children: [jsx(FlexSpan, { children: jsxs(TopContainer, { children: [jsx(LogoContainer, { children: icon }), jsxs(TopContainerButtons, { children: [jsx(ProjectCatalogMenu, {}), jsx(ProjectPanelMenu, {})] })] }) }), jsx(FlexSpan, { children: jsx(Flex, { column: true, gap: "0.25rem", children: jsx(FlexSpan, { children: jsxs(Flex, { alignItems: "center", children: [jsx(FlexSpan, { flexGrow: 1, children: jsx(Tooltip, { arrow: true, content: tooltip, children: ref => (jsx(PageTitle, { ref: ref, children: jsx(ProjectPagesMenu, {}) })) }) }), jsx(FlexSpan, { children: jsx(Pagination, {}) })] }) }) }) })] })] }));
|
|
6674
|
+
return (jsxs(DefaultHeaderContainer, { image: image, isDark: themeName === ThemeName.Dark, children: [!pageId && jsx(LinearProgress, {}), jsxs(Flex, { column: true, gap: "1rem", children: [jsx(FlexSpan, { children: jsxs(TopContainer, { children: [jsx(LogoContainer, { children: icon }), jsxs(TopContainerButtons, { children: [jsx(ProjectCatalogMenu, {}), jsx(ProjectPanelMenu, {})] })] }) }), jsx(FlexSpan, { children: jsx(Flex, { column: true, gap: "0.25rem", children: jsx(FlexSpan, { children: jsxs(Flex, { alignItems: "center", children: [jsx(FlexSpan, { flexGrow: 1, children: jsx(Tooltip$1, { arrow: true, content: tooltip, children: ref => (jsx(PageTitle, { ref: ref, children: jsx(ProjectPagesMenu, {}) })) }) }), jsx(FlexSpan, { children: jsx(Pagination, {}) })] }) }) }) })] })] }));
|
|
6547
6675
|
});
|
|
6548
6676
|
|
|
6549
6677
|
const HeaderFrontView = styled(Flex) `
|
|
@@ -6645,7 +6773,7 @@ const HeaderTitle = ({ noFeature }) => {
|
|
|
6645
6773
|
})) ||
|
|
6646
6774
|
feature?.id);
|
|
6647
6775
|
}, [attributes, feature, layerDefinition]);
|
|
6648
|
-
return (jsxs(HeaderTitleContainer, { children: [noFeature ? (jsx(FeatureTitleContainer, { children: t("noObjectFound", { ns: "dashboard" }) })) : (jsx(FeatureTitleContainer, { clickable: true, children: jsx(Tooltip, { arrow: true, placement: "top", content: t("zoomToFeature", { ns: "dashboard" }), delay: [600, 0], children: ref => (jsx(FlexSpan, { ref: ref, onClick: () => zoomToFeatures([feature]), children: resultTitle })) }) })), jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
6776
|
+
return (jsxs(HeaderTitleContainer, { children: [noFeature ? (jsx(FeatureTitleContainer, { children: t("noObjectFound", { ns: "dashboard" }) })) : (jsx(FeatureTitleContainer, { clickable: true, children: jsx(Tooltip$1, { arrow: true, placement: "top", content: t("zoomToFeature", { ns: "dashboard" }), delay: [600, 0], children: ref => (jsx(FlexSpan, { ref: ref, onClick: () => zoomToFeatures([feature]), children: resultTitle })) }) })), jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
6649
6777
|
};
|
|
6650
6778
|
|
|
6651
6779
|
const LayerIconContainer = styled.div `
|
|
@@ -7394,7 +7522,7 @@ const ElementTooltip = memo(({ type, elementConfig }) => {
|
|
|
7394
7522
|
const { icon } = options || {};
|
|
7395
7523
|
const attribute = getAttributeByName(attributeName, attributes);
|
|
7396
7524
|
const text = (attribute?.value || elementConfig?.value);
|
|
7397
|
-
return text ? (jsx(Tooltip, { placement: "top", arrow: true, content: text, children: ref => jsx(TooltipIcon, { kind: icon || "question", ref: ref }) })) : null;
|
|
7525
|
+
return text ? (jsx(Tooltip$1, { placement: "top", arrow: true, content: text, children: ref => jsx(TooltipIcon, { kind: icon || "question", ref: ref }) })) : null;
|
|
7398
7526
|
});
|
|
7399
7527
|
|
|
7400
7528
|
const SlideshowHeaderWrapper = styled.div `
|
|
@@ -8406,7 +8534,7 @@ const pieChartTooltipFromAttributes = (t, data, attributes) => {
|
|
|
8406
8534
|
const pieChartTooltipFromRelatedFeatures = (t, data, relatedAttributes, layerInfo) => {
|
|
8407
8535
|
if (!data?.length)
|
|
8408
8536
|
return "";
|
|
8409
|
-
return (jsx(ThemeProvider, { children: jsxs(ChartTooltip, { children: [jsx(ChartTooltipColor, { "$color": data[0].color }), jsxs("div", { children: [data[0].name, " \u00A0 ", formatChartRelatedValue(t, data[0].value, layerInfo, relatedAttributes)] })] }) }));
|
|
8537
|
+
return (jsx(ThemeProvider, { children: jsxs(ChartTooltip, { alignItems: "center", children: [jsx(ChartTooltipColor, { "$color": data[0].color }), jsxs("div", { children: [data[0].name, " \u00A0 ", formatChartRelatedValue(t, data[0].value, layerInfo, relatedAttributes)] })] }) }));
|
|
8410
8538
|
};
|
|
8411
8539
|
|
|
8412
8540
|
const removeDataSource = (dashboardConfiguration, name, pageIndex) => {
|
|
@@ -8988,12 +9116,12 @@ const StackBar = ({ data, filterName, type, alias, options, renderElement, rende
|
|
|
8988
9116
|
const units = attribute?.stringFormat?.unitsLabel;
|
|
8989
9117
|
const total = useMemo(() => items?.reduce((result, { value }) => result + Number(value), 0) || 0, [items]);
|
|
8990
9118
|
const getWidth = useCallback(value => ((Number(value) / total) * 100).toFixed(2), [total]);
|
|
8991
|
-
const renderGroupTooltip = useMemo(() => (jsx(ThemeProvider, { children: jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: items?.map(({ name, value, color }, index) => (jsxs("tr", { children: [jsx("td", { children: jsxs(ChartTooltip, { children: [jsx(ChartTooltipColor, { "$color": color }), jsx(ChartTooltipName, { children: name })] }) }), jsx("td", { children: value })] }, index))) }) })), [items]);
|
|
9119
|
+
const renderGroupTooltip = useMemo(() => (jsx(ThemeProvider, { children: jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: items?.map(({ name, value, color }, index) => (jsxs("tr", { children: [jsx("td", { children: jsxs(ChartTooltip, { alignItems: "center", children: [jsx(ChartTooltipColor, { "$color": color }), jsx(ChartTooltipName, { children: name })] }) }), jsx("td", { children: value })] }, index))) }) })), [items]);
|
|
8992
9120
|
const renderItem = useCallback(({ name, value, color }, ref) => (jsx(StackBarSection, { ref: ref, "$width": getWidth(value), "$height": height, "$color": color, cornerRadius: cornerRadius, hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: filterName ? () => onFilter(name) : undefined })), [cornerRadius, filterName, getWidth, hasAnyFilter, height, isFiltered, onFilter]);
|
|
8993
|
-
const renderItems = useMemo(() => (jsx(Fragment$1, { children: items?.map((item, index) => (jsx(Fragment, { children: groupTooltip ? (renderItem(item)) : (jsx(ThemeProvider, { children: jsx(Tooltip, { placement: "top", arrow: true, content: renderTooltip([item]), children: ref => renderItem(item, ref) }) })) }, index))) })), [groupTooltip, items, renderItem, renderTooltip]);
|
|
9121
|
+
const renderItems = useMemo(() => (jsx(Fragment$1, { children: items?.map((item, index) => (jsx(Fragment, { children: groupTooltip ? (renderItem(item)) : (jsx(ThemeProvider, { children: jsx(Tooltip$1, { placement: "top", arrow: true, content: renderTooltip([item]), children: ref => renderItem(item, ref) }) })) }, index))) })), [groupTooltip, items, renderItem, renderTooltip]);
|
|
8994
9122
|
if (!total || !attribute)
|
|
8995
9123
|
return null;
|
|
8996
|
-
return (jsxs(Fragment$1, { children: [(alias || showTotal) && (jsxs(StackBarHeader, { children: [jsx(StackBarAlias, { children: renderElement({ id: "alias" }) }), showTotal && (jsxs(StackBarTotal, { children: [jsx(StackBarValue, { children: formatAttributeValue({ t, type: attribute.type, value: total, stringFormat: attribute.stringFormat, noUnits: true }) }), !!units && jsx(StackBarUnits, { children: units })] }))] })), groupTooltip ? (jsx(Tooltip, { placement: "top", arrow: true, content: renderGroupTooltip, children: ref => jsx(StackBarContainer, { ref: ref, children: renderItems }) })) : (jsx(StackBarContainer, { children: renderItems }))] }));
|
|
9124
|
+
return (jsxs(Fragment$1, { children: [(alias || showTotal) && (jsxs(StackBarHeader, { children: [jsx(StackBarAlias, { children: renderElement({ id: "alias" }) }), showTotal && (jsxs(StackBarTotal, { children: [jsx(StackBarValue, { children: formatAttributeValue({ t, type: attribute.type, value: total, stringFormat: attribute.stringFormat, noUnits: true }) }), !!units && jsx(StackBarUnits, { children: units })] }))] })), groupTooltip ? (jsx(Tooltip$1, { placement: "top", arrow: true, content: renderGroupTooltip, children: ref => jsx(StackBarContainer, { ref: ref, children: renderItems }) })) : (jsx(StackBarContainer, { children: renderItems }))] }));
|
|
8997
9125
|
};
|
|
8998
9126
|
|
|
8999
9127
|
const Chart = memo(({ config, element, elementConfig, type, renderElement }) => {
|
|
@@ -9021,16 +9149,11 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
9021
9149
|
const isRelated = !!relatedAttributes?.length;
|
|
9022
9150
|
const { data, loading } = useChartData({ element, type });
|
|
9023
9151
|
const totalWidthFromBarWidth = (data[0]?.items?.length || 0) * (barWidth + padding);
|
|
9024
|
-
const width = options?.width
|
|
9025
|
-
|
|
9026
|
-
? MAX_CHART_WIDTH
|
|
9027
|
-
: options.width
|
|
9028
|
-
: isStackBar
|
|
9152
|
+
const width = options?.width ? options.width :
|
|
9153
|
+
isStackBar
|
|
9029
9154
|
? "100%"
|
|
9030
9155
|
: isBarChart
|
|
9031
|
-
? totalWidthFromBarWidth
|
|
9032
|
-
? MAX_CHART_WIDTH
|
|
9033
|
-
: totalWidthFromBarWidth
|
|
9156
|
+
? totalWidthFromBarWidth || MAX_CHART_WIDTH
|
|
9034
9157
|
: DEFAULT_CHART_WIDTH;
|
|
9035
9158
|
const [customize] = useChartChange({
|
|
9036
9159
|
dataSources: config.dataSources,
|
|
@@ -9059,13 +9182,13 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
9059
9182
|
return result?.filter((name, index) => result.indexOf(name) === index);
|
|
9060
9183
|
}, [data, isLineChart]);
|
|
9061
9184
|
const renderLineChartTooltip = useCallback((items, { indexX }) => {
|
|
9062
|
-
return (
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9185
|
+
return (jsxs(Tooltip, { children: [jsx(ChartTooltipLabel, { children: labels[indexX] }), items
|
|
9186
|
+
.filter(({ value }) => !isEmptyValue(value))
|
|
9187
|
+
?.map(({ layerName, attributeName, value, stroke }, index) => {
|
|
9188
|
+
const layerInfo = layerInfos?.find(({ name }) => name === layerName);
|
|
9189
|
+
const attribute = layerInfo?.layerDefinition.attributes[attributeName];
|
|
9190
|
+
return (jsxs(ChartTooltipRow, { children: [jsx(ChartLegendColor$1, { "$color": stroke }), jsx(ChartLegendValue, { children: attribute ? formatAttributeValue({ t, type: attribute.type, value, stringFormat: attribute.stringFormat }) : value })] }, index));
|
|
9191
|
+
})] }));
|
|
9069
9192
|
}, [labels, layerInfos]);
|
|
9070
9193
|
const markers = useMemo(() => getChartMarkers(data[0]?.items, configMarkers), [data, configMarkers]);
|
|
9071
9194
|
const formatTooltipName = useCallback((name) => (isRelated ? name : tooltipNameFromAttributes(name, formattedAttributes)), [formattedAttributes, isRelated]);
|
|
@@ -9089,16 +9212,16 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
9089
9212
|
.flat()
|
|
9090
9213
|
.map(({ values }) => values)
|
|
9091
9214
|
.flat();
|
|
9092
|
-
return (
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9215
|
+
return (jsxs(AnyChartWrapper, { height: height, children: [jsx(LineChartTooltipStyles, {}), jsx(LineChart, { data: lineChartData, labels: labels, width: +width, height: height, xAxisPadding: 15, yAxisPadding: 0, min: Math.min(...chartValues), customYAxisSelection: yAxis => {
|
|
9216
|
+
if (isHidedY) {
|
|
9217
|
+
yAxis.remove();
|
|
9218
|
+
}
|
|
9219
|
+
}, customYAxis: yAxis => yAxis.ticks(4), renderTooltip: renderLineChartTooltip, customize: customize, dynamicTooltipEnable: true, stackedTooltip: true, tooltipClassName: "dashboardLineChartTooltip", drawGridX: !isHidedY, margin: {
|
|
9220
|
+
top: 0,
|
|
9221
|
+
right: 0,
|
|
9222
|
+
bottom: 0,
|
|
9223
|
+
left: 0
|
|
9224
|
+
} })] }));
|
|
9102
9225
|
}
|
|
9103
9226
|
if (isStackBar) {
|
|
9104
9227
|
return (jsx(AnyChartWrapper, { height: height, children: jsx(StackBar, { data: data, filterName: filterName, type: type, alias: elementConfig?.children?.find(child => child.id === "alias"), options: options, renderTooltip: renderPieChartTooltip, renderElement: renderElement }) }));
|
|
@@ -9111,16 +9234,17 @@ const Chart = memo(({ config, element, elementConfig, type, renderElement }) =>
|
|
|
9111
9234
|
color: formatFilterColor(item.name, item.color, defaultColor)
|
|
9112
9235
|
})) || []), width: +width, height: +width, padAngle: angle, outerRadius: radius, cornerRadius: cornerRadius, renderTooltip: renderPieChartTooltip, withTooltip: true, onClick: filterName ? item => onFilter(item.name) : undefined, children: showTotal && jsx(PieChartCenter, { children: totalWord || roundTotalSum(+totalSum) }) }) }));
|
|
9113
9236
|
}
|
|
9237
|
+
const markersMargin = options?.showMarkers ? 10 : 0;
|
|
9114
9238
|
const margin = {
|
|
9115
|
-
top:
|
|
9116
|
-
right:
|
|
9117
|
-
bottom: markers?.length ? 20 :
|
|
9118
|
-
left:
|
|
9239
|
+
top: markersMargin,
|
|
9240
|
+
right: markersMargin,
|
|
9241
|
+
bottom: markers?.length ? 20 : markersMargin,
|
|
9242
|
+
left: markersMargin
|
|
9119
9243
|
};
|
|
9120
|
-
return (jsx(BarChartWrapper, { height: height + margin.bottom, children:
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9244
|
+
return (jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxs(BarChartContainer, { children: [jsx(BarChartStyles, {}), jsx(BarChart$1, { data: getDataFromFilterItems(data[0]?.items), colors: getColorsFromFilterItems(data[0]?.items, defaultColor, formatFilterColor), minValue: getMinValueFromFilterItems(data[0]?.items), markers: markers, width: +width, height: height, barWidth: barWidth, barPadding: padding, className: "dashboardBarChart", customXAxis: axis => axis.remove(), customYAxis: axis => !options?.showMarkers && axis.remove(), customBars: ({ bars }) => {
|
|
9245
|
+
bars.attr("rx", radius);
|
|
9246
|
+
bars.attr("ry", radius);
|
|
9247
|
+
}, margin: margin, xAxisPadding: 0, yAxisPadding: 0, formatTooltipValue: formatTooltipValue, formatTooltipName: formatTooltipName, hideTooltipGroupName: true, dynamicTooltipEnable: true, isBarTooltip: true, onBarClick: filterName ? item => onFilter(item.name) : undefined })] }) }));
|
|
9124
9248
|
}, [
|
|
9125
9249
|
element,
|
|
9126
9250
|
isLineChart,
|
|
@@ -9169,7 +9293,7 @@ const ChartLegend = ({ data, chartElement, type, twoColumns, loading }) => {
|
|
|
9169
9293
|
const showMoreBtn = !!shownItems && data.length > shownItems;
|
|
9170
9294
|
if (!loading && !data?.length && !!hideEmpty)
|
|
9171
9295
|
return null;
|
|
9172
|
-
return (jsxs(Flex, { opacity: loading ? FILTERED_VALUE_OPACITY / 100 : 1, children: [jsx(ChartLegendContainer, { twoColumns: twoColumns, children: sliceItems(data)?.map(({ name, color }, index) => (jsxs(ChartLegendItem, { hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: axes?.[0]?.filterName ? () => onFilter(name) : undefined, children: [jsx(ChartLegendColor, { color: color }), jsx(ChartLegendName, { "$fontColor": fontColor, children: name })] }, index))) }), showMoreBtn && (jsx(LegendToggler, { onClick: onShowMore, toggled: showMore, children: t("other", { ns: "dashboard" }) }))] }));
|
|
9296
|
+
return (jsxs(Flex, { flexDirection: "column", opacity: loading ? FILTERED_VALUE_OPACITY / 100 : 1, children: [jsx(ChartLegendContainer, { twoColumns: twoColumns, children: sliceItems(data)?.map(({ name, color }, index) => (jsxs(ChartLegendItem, { hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: axes?.[0]?.filterName ? () => onFilter(name) : undefined, children: [jsx(ChartLegendColor, { color: color }), jsx(ChartLegendName, { "$fontColor": fontColor, children: name })] }, index))) }), showMoreBtn && (jsx(LegendToggler, { onClick: onShowMore, toggled: showMore, children: t("other", { ns: "dashboard" }) }))] }));
|
|
9173
9297
|
};
|
|
9174
9298
|
|
|
9175
9299
|
const ContainerChildren = memo(({ items, isColumn, isMain, renderElement }) => {
|
|
@@ -9273,7 +9397,7 @@ const FeatureCardTitle = ({ title, description }) => {
|
|
|
9273
9397
|
})) ||
|
|
9274
9398
|
feature?.id);
|
|
9275
9399
|
}, [attributes, feature?.id, layerDefinition, title, titleAttribute]);
|
|
9276
|
-
return (jsxs(HeaderTitleContainer, { children: [jsx(FeatureTitleContainer, { clickable: true, children: jsx(Tooltip, { arrow: true, placement: "top", content: t("zoomToFeature", { ns: "dashboard" }), delay: [600, 0], children: ref => (jsx(FlexSpan, { ref: ref, onClick: () => zoomToFeatures([feature]), children: resultTitle })) }) }), jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
9400
|
+
return (jsxs(HeaderTitleContainer, { children: [jsx(FeatureTitleContainer, { clickable: true, children: jsx(Tooltip$1, { arrow: true, placement: "top", content: t("zoomToFeature", { ns: "dashboard" }), delay: [600, 0], children: ref => (jsx(FlexSpan, { ref: ref, onClick: () => zoomToFeatures([feature]), children: resultTitle })) }) }), jsx(LayerDescription, { title: resultDescription, children: resultDescription })] }));
|
|
9277
9401
|
};
|
|
9278
9402
|
|
|
9279
9403
|
const HiddenFilters = styled(Flex) `
|
|
@@ -9447,7 +9571,7 @@ const TextTrim = memo(({ maxLength, expandable, lineBreak, children }) => {
|
|
|
9447
9571
|
if (expandable) {
|
|
9448
9572
|
return (jsxs(Fragment$1, { children: [formatValue(expanded ? text : substring), jsx(LegendToggler, { toggled: expanded, onClick: toggleExpanded, children: expanded ? t("hide", { ns: "dashboard" }) : t("more", { ns: "dashboard" }) })] }));
|
|
9449
9573
|
}
|
|
9450
|
-
return (jsx(Tooltip, { placement: "top", arrow: true, content: text, children: ref => jsx("div", { ref: ref, children: formatValue(substring) }) }));
|
|
9574
|
+
return (jsx(Tooltip$1, { placement: "top", arrow: true, content: text, children: ref => jsx("div", { ref: ref, children: formatValue(substring) }) }));
|
|
9451
9575
|
});
|
|
9452
9576
|
|
|
9453
9577
|
const DEFAULT_COLOR = "#00ffff";
|