@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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
1
2
|
export declare const ChartTooltipTable: import('styled-components').StyledComponent<"table", any, {}, never>;
|
|
2
3
|
export declare const ChartTooltip: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
4
|
+
export declare const ChartTooltipLabel: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
5
|
export declare const ChartTooltipColor: import('styled-components').StyledComponent<"div", any, {
|
|
4
6
|
$color: string;
|
|
5
7
|
}, never>;
|
|
@@ -13,3 +15,17 @@ export declare const PieChartCenter: import('styled-components').StyledComponent
|
|
|
13
15
|
export declare const ChartWrapperContainer: import('styled-components').StyledComponent<"div", any, {
|
|
14
16
|
column: boolean;
|
|
15
17
|
}, never>;
|
|
18
|
+
export declare const Tooltip: import('styled-components').StyledComponent<"div", any, {
|
|
19
|
+
transform?: CSSProperties["transform"];
|
|
20
|
+
}, never>;
|
|
21
|
+
export declare const LineChartTooltipStyles: import('styled-components').GlobalStyleComponent<{
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
[x: number]: any;
|
|
24
|
+
[x: symbol]: any;
|
|
25
|
+
} & {
|
|
26
|
+
theme?: any;
|
|
27
|
+
} & {
|
|
28
|
+
as?: string | import('react').ComponentType<any>;
|
|
29
|
+
forwardedAs?: string | import('react').ComponentType<any>;
|
|
30
|
+
}, import('styled-components').DefaultTheme>;
|
|
31
|
+
export declare const BarChartStyles: import('styled-components').GlobalStyleComponent<{}, import('styled-components').DefaultTheme>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export declare const ContainerIconValue: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
1
2
|
export declare const RoundedBackgroundContainerWrapper: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
|
|
2
3
|
$center?: boolean;
|
|
3
4
|
$color?: string;
|
|
4
5
|
$inlineUnits?: boolean;
|
|
6
|
+
$big?: boolean;
|
|
5
7
|
$bigIcon?: boolean;
|
|
6
8
|
}, never>;
|
|
@@ -43,6 +43,7 @@ export interface ConfigOptions {
|
|
|
43
43
|
srid?: string;
|
|
44
44
|
title?: string;
|
|
45
45
|
label?: string;
|
|
46
|
+
showMarkers?: boolean;
|
|
46
47
|
withPadding?: boolean;
|
|
47
48
|
withDivider?: boolean;
|
|
48
49
|
tagView?: boolean;
|
|
@@ -98,6 +99,7 @@ export interface ConfigOptions {
|
|
|
98
99
|
wrap?: boolean;
|
|
99
100
|
icon?: string;
|
|
100
101
|
iconUrl?: string;
|
|
102
|
+
big?: boolean;
|
|
101
103
|
bigIcon?: boolean;
|
|
102
104
|
onlyIcon?: boolean;
|
|
103
105
|
hideEmpty?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -37,14 +37,18 @@ const ChartTooltipTable = styled.table `
|
|
|
37
37
|
}
|
|
38
38
|
`;
|
|
39
39
|
const ChartTooltip = styled(uilibGl.Flex) `
|
|
40
|
-
flex-direction: row;
|
|
41
|
-
align-items: center;
|
|
42
40
|
flex-wrap: nowrap;
|
|
41
|
+
background: rgb(48, 69, 79);
|
|
42
|
+
border-radius: 0.25rem;
|
|
43
|
+
color: white;
|
|
43
44
|
|
|
44
45
|
:not(:last-child) {
|
|
45
46
|
margin-bottom: 0.25rem;
|
|
46
47
|
}
|
|
47
48
|
`;
|
|
49
|
+
const ChartTooltipLabel = styled.div `
|
|
50
|
+
margin-right: 0.25rem;
|
|
51
|
+
`;
|
|
48
52
|
const ChartTooltipColor = styled.div `
|
|
49
53
|
width: 0.625rem;
|
|
50
54
|
height: 0.625rem;
|
|
@@ -90,6 +94,107 @@ const ChartWrapperContainer = styled.div `
|
|
|
90
94
|
position: relative;
|
|
91
95
|
width: 100%;
|
|
92
96
|
`;
|
|
97
|
+
const Tooltip = styled.div `
|
|
98
|
+
position: relative;
|
|
99
|
+
border-radius: 0.25rem;
|
|
100
|
+
background-color: rgba(28, 33, 48);
|
|
101
|
+
padding: 0.5rem;
|
|
102
|
+
box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.15);
|
|
103
|
+
font-size: 0.75rem;
|
|
104
|
+
transform: ${({ transform }) => transform};
|
|
105
|
+
color: white;
|
|
106
|
+
|
|
107
|
+
:before {
|
|
108
|
+
position: absolute;
|
|
109
|
+
display: block;
|
|
110
|
+
content: "";
|
|
111
|
+
width: 0;
|
|
112
|
+
height: 0;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
const LineChartTooltipStyles = styled.createGlobalStyle `
|
|
116
|
+
.dashboardLineChartTooltip.${charts.lineChartClassNames.lineChartMouseLabel} {
|
|
117
|
+
.${charts.lineChartClassNames.lineChartLabelFlex} {
|
|
118
|
+
justify-content: center;
|
|
119
|
+
align-items: flex-end;
|
|
120
|
+
|
|
121
|
+
${Tooltip} {
|
|
122
|
+
margin: 0 0 12px 0;
|
|
123
|
+
|
|
124
|
+
:before {
|
|
125
|
+
top: auto;
|
|
126
|
+
bottom: 0;
|
|
127
|
+
left: 50%;
|
|
128
|
+
transform: translate(-50%, 100%);
|
|
129
|
+
border-left: 4px solid transparent;
|
|
130
|
+
border-right: 4px solid transparent;
|
|
131
|
+
border-top: 4px solid rgba(28, 33, 48, 0.9);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.${charts.lineChartClassNames.lineChartYScaleGlobal}, .${charts.lineChartClassNames.lineChartXScaleGlobal} {
|
|
138
|
+
.domain {
|
|
139
|
+
visibility: hidden;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.tick {
|
|
143
|
+
text {
|
|
144
|
+
fill: ${({ theme: { palette } }) => palette.textDisabled};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
line {
|
|
148
|
+
visibility: hidden;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.${charts.lineChartClassNames.lineChartXScaleGlobal} {
|
|
154
|
+
.tick {
|
|
155
|
+
:first-of-type {
|
|
156
|
+
text {
|
|
157
|
+
text-anchor: start;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:last-of-type {
|
|
162
|
+
text {
|
|
163
|
+
text-anchor: end;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.${charts.lineChartClassNames.lineChartLine} {
|
|
170
|
+
stroke-width: 2px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.${charts.lineChartClassNames.lineChartLabel} {
|
|
174
|
+
color: ${({ theme: { palette } }) => palette.textPrimary};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.${charts.lineChartClassNames.lineChartMouseCircle} {
|
|
178
|
+
stroke: #ffffff;
|
|
179
|
+
stroke-width: 2px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.${charts.lineChartClassNames.lineChartGridLineX} {
|
|
183
|
+
stroke: ${({ theme: { palette } }) => palette.element};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
text {
|
|
187
|
+
fill: ${({ theme: { palette } }) => palette.textDisabled};
|
|
188
|
+
}
|
|
189
|
+
`;
|
|
190
|
+
const BarChartStyles = styled.createGlobalStyle `
|
|
191
|
+
.dashboardBarChart {
|
|
192
|
+
.domain,
|
|
193
|
+
line {
|
|
194
|
+
display: none;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
`;
|
|
93
198
|
|
|
94
199
|
function range(start, stop, step) {
|
|
95
200
|
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
|
@@ -5716,7 +5821,6 @@ const AnyChartWrapper = styled.div `
|
|
|
5716
5821
|
`;
|
|
5717
5822
|
const BarChartWrapper = styled(AnyChartWrapper) `
|
|
5718
5823
|
width: 100%;
|
|
5719
|
-
max-width: ${MAX_CHART_WIDTH}px;
|
|
5720
5824
|
margin: 0 auto ${BAR_CHART_FOOTER_MARGIN}px;
|
|
5721
5825
|
|
|
5722
5826
|
:hover {
|
|
@@ -5846,7 +5950,7 @@ const PagesContainer = React.memo(({ type }) => {
|
|
|
5846
5950
|
const { pageIndex, currentPage } = useWidgetPage(type);
|
|
5847
5951
|
const { selectedTabId, setSelectedTabId, expandedContainers, attributes } = useWidgetContext(type);
|
|
5848
5952
|
const { options } = config || {};
|
|
5849
|
-
const { column } = options || {};
|
|
5953
|
+
const { column, width } = options || {};
|
|
5850
5954
|
const isColumn = column === undefined || column;
|
|
5851
5955
|
const filteredChildren = React.useMemo(() => !selectedTabId
|
|
5852
5956
|
? currentPage.children
|
|
@@ -5871,7 +5975,7 @@ const PagesContainer = React.memo(({ type }) => {
|
|
|
5871
5975
|
setSelectedTabId,
|
|
5872
5976
|
type,
|
|
5873
5977
|
]);
|
|
5874
|
-
return (jsxRuntime.jsxs(
|
|
5978
|
+
return (jsxRuntime.jsxs("div", { style: { width }, children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: config, type: type, renderElement: renderElement }), jsxRuntime.jsx(Container, { isColumn: isColumn, isMain: true, children: jsxRuntime.jsx(ContainerChildren, { items: filteredChildren, isMain: true, renderElement: renderElement }) })] }));
|
|
5875
5979
|
});
|
|
5876
5980
|
|
|
5877
5981
|
const TwoColumnsInnerContainer = React.memo(({ renderElement }) => {
|
|
@@ -6270,6 +6374,7 @@ const TabsContainer = React.memo(({ elementConfig, type }) => {
|
|
|
6270
6374
|
return (jsxRuntime.jsx(SwiperContainer, { style: style, children: jsxRuntime.jsx(react.Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id, value, options: tabOptions }) => (jsxRuntime.jsxs(react.SwiperSlide, { children: [jsxRuntime.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 && (jsxRuntime.jsx(TabValue, { children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength, children: value }) }))] }), jsxRuntime.jsx(TabAnchor, { id: id })] }, id))) }) }));
|
|
6271
6375
|
});
|
|
6272
6376
|
|
|
6377
|
+
const ContainerIconValue = styled(uilibGl.Flex) ``;
|
|
6273
6378
|
const RoundedBackgroundContainerWrapper = styled(uilibGl.Flex) `
|
|
6274
6379
|
position: relative;
|
|
6275
6380
|
flex-direction: ${({ $bigIcon }) => ($bigIcon ? "row" : "column")};
|
|
@@ -6287,13 +6392,10 @@ const RoundedBackgroundContainerWrapper = styled(uilibGl.Flex) `
|
|
|
6287
6392
|
styled.css `
|
|
6288
6393
|
align-items: center;
|
|
6289
6394
|
|
|
6290
|
-
* {
|
|
6395
|
+
> * {
|
|
6291
6396
|
display: flex;
|
|
6292
6397
|
justify-content: center;
|
|
6293
6398
|
text-align: center;
|
|
6294
|
-
}
|
|
6295
|
-
|
|
6296
|
-
> * {
|
|
6297
6399
|
width: 100%;
|
|
6298
6400
|
}
|
|
6299
6401
|
`};
|
|
@@ -6326,8 +6428,32 @@ const RoundedBackgroundContainerWrapper = styled(uilibGl.Flex) `
|
|
|
6326
6428
|
}
|
|
6327
6429
|
`};
|
|
6328
6430
|
|
|
6431
|
+
${ContainerIconValue} {
|
|
6432
|
+
align-items: center;
|
|
6433
|
+
flex-direction: column;
|
|
6434
|
+
|
|
6435
|
+
${({ $big }) => $big &&
|
|
6436
|
+
styled.css `
|
|
6437
|
+
flex-direction: row;
|
|
6438
|
+
margin-bottom: 0.5rem;
|
|
6439
|
+
|
|
6440
|
+
> * {
|
|
6441
|
+
text-align: left;
|
|
6442
|
+
}
|
|
6443
|
+
|
|
6444
|
+
span[kind] {
|
|
6445
|
+
margin-right: 0.5rem;
|
|
6446
|
+
}
|
|
6447
|
+
|
|
6448
|
+
${ContainerValue} {
|
|
6449
|
+
width: auto;
|
|
6450
|
+
}
|
|
6451
|
+
`};
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6329
6454
|
${ContainerValue} {
|
|
6330
6455
|
flex-direction: ${({ $inlineUnits }) => ($inlineUnits ? "row" : "column")};
|
|
6456
|
+
justify-content: ${({ $big }) => ($big ? "flex-start" : "flex-end")};
|
|
6331
6457
|
align-items: ${({ $inlineUnits }) => ($inlineUnits ? "center" : "flex-start")};
|
|
6332
6458
|
line-height: 1;
|
|
6333
6459
|
}
|
|
@@ -6351,15 +6477,17 @@ const RoundedBackgroundContainer = React.memo(({ type, elementConfig, feature, r
|
|
|
6351
6477
|
feature
|
|
6352
6478
|
});
|
|
6353
6479
|
const { options, style, children } = elementConfig || {};
|
|
6354
|
-
const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, bigIcon, hideEmpty, colorAttribute } = options || {};
|
|
6480
|
+
const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
|
|
6355
6481
|
const aliasElement = children?.find(({ id }) => id === "alias");
|
|
6356
6482
|
const unitsElement = children?.find(({ id }) => id === "units");
|
|
6357
6483
|
const valueElement = children?.find(({ id }) => id === "value");
|
|
6358
6484
|
const value = renderElement({ id: "value" });
|
|
6359
6485
|
const color = React.useMemo(() => attributes?.find(({ name }) => name === colorAttribute)?.value || fontColor, [attributes, colorAttribute, fontColor]);
|
|
6486
|
+
const renderAlias = React.useMemo(() => (jsxRuntime.jsx(ContainerAlias, { style: aliasElement?.style, children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
|
|
6487
|
+
const renderValue = React.useMemo(() => (jsxRuntime.jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsxRuntime.jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
|
|
6360
6488
|
if (!value && hideEmpty)
|
|
6361
6489
|
return null;
|
|
6362
|
-
return (jsxRuntime.jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$
|
|
6490
|
+
return (jsxRuntime.jsxs(RoundedBackgroundContainerWrapper, { style: innerTemplateStyle || style, "$center": center, "$color": color, "$inlineUnits": inlineUnits, "$big": big, "$bigIcon": bigIcon, children: [jsxRuntime.jsxs(ContainerIconValue, { children: [renderElement({ id: "icon", wrap: false }), big ? renderAlias : renderValue] }), big ? renderValue : renderAlias] }));
|
|
6363
6491
|
});
|
|
6364
6492
|
|
|
6365
6493
|
const AddFeatureContainer = React.memo(({ elementConfig }) => {
|
|
@@ -8408,7 +8536,7 @@ const pieChartTooltipFromAttributes = (t, data, attributes) => {
|
|
|
8408
8536
|
const pieChartTooltipFromRelatedFeatures = (t, data, relatedAttributes, layerInfo) => {
|
|
8409
8537
|
if (!data?.length)
|
|
8410
8538
|
return "";
|
|
8411
|
-
return (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsxs(ChartTooltip, { children: [jsxRuntime.jsx(ChartTooltipColor, { "$color": data[0].color }), jsxRuntime.jsxs("div", { children: [data[0].name, " \u00A0 ", formatChartRelatedValue(t, data[0].value, layerInfo, relatedAttributes)] })] }) }));
|
|
8539
|
+
return (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsxs(ChartTooltip, { alignItems: "center", children: [jsxRuntime.jsx(ChartTooltipColor, { "$color": data[0].color }), jsxRuntime.jsxs("div", { children: [data[0].name, " \u00A0 ", formatChartRelatedValue(t, data[0].value, layerInfo, relatedAttributes)] })] }) }));
|
|
8412
8540
|
};
|
|
8413
8541
|
|
|
8414
8542
|
const removeDataSource = (dashboardConfiguration, name, pageIndex) => {
|
|
@@ -8990,7 +9118,7 @@ const StackBar = ({ data, filterName, type, alias, options, renderElement, rende
|
|
|
8990
9118
|
const units = attribute?.stringFormat?.unitsLabel;
|
|
8991
9119
|
const total = React.useMemo(() => items?.reduce((result, { value }) => result + Number(value), 0) || 0, [items]);
|
|
8992
9120
|
const getWidth = React.useCallback(value => ((Number(value) / total) * 100).toFixed(2), [total]);
|
|
8993
|
-
const renderGroupTooltip = React.useMemo(() => (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: items?.map(({ name, value, color }, index) => (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { children: jsxRuntime.jsxs(ChartTooltip, { children: [jsxRuntime.jsx(ChartTooltipColor, { "$color": color }), jsxRuntime.jsx(ChartTooltipName, { children: name })] }) }), jsxRuntime.jsx("td", { children: value })] }, index))) }) })), [items]);
|
|
9121
|
+
const renderGroupTooltip = React.useMemo(() => (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(ChartTooltipTable, { cellPadding: 0, cellSpacing: 0, children: items?.map(({ name, value, color }, index) => (jsxRuntime.jsxs("tr", { children: [jsxRuntime.jsx("td", { children: jsxRuntime.jsxs(ChartTooltip, { alignItems: "center", children: [jsxRuntime.jsx(ChartTooltipColor, { "$color": color }), jsxRuntime.jsx(ChartTooltipName, { children: name })] }) }), jsxRuntime.jsx("td", { children: value })] }, index))) }) })), [items]);
|
|
8994
9122
|
const renderItem = React.useCallback(({ name, value, color }, ref) => (jsxRuntime.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]);
|
|
8995
9123
|
const renderItems = React.useMemo(() => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: items?.map((item, index) => (jsxRuntime.jsx(React.Fragment, { children: groupTooltip ? (renderItem(item)) : (jsxRuntime.jsx(uilibGl.ThemeProvider, { children: jsxRuntime.jsx(uilibGl.Tooltip, { placement: "top", arrow: true, content: renderTooltip([item]), children: ref => renderItem(item, ref) }) })) }, index))) })), [groupTooltip, items, renderItem, renderTooltip]);
|
|
8996
9124
|
if (!total || !attribute)
|
|
@@ -9023,16 +9151,11 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9023
9151
|
const isRelated = !!relatedAttributes?.length;
|
|
9024
9152
|
const { data, loading } = useChartData({ element, type });
|
|
9025
9153
|
const totalWidthFromBarWidth = (data[0]?.items?.length || 0) * (barWidth + padding);
|
|
9026
|
-
const width = options?.width
|
|
9027
|
-
|
|
9028
|
-
? MAX_CHART_WIDTH
|
|
9029
|
-
: options.width
|
|
9030
|
-
: isStackBar
|
|
9154
|
+
const width = options?.width ? options.width :
|
|
9155
|
+
isStackBar
|
|
9031
9156
|
? "100%"
|
|
9032
9157
|
: isBarChart
|
|
9033
|
-
? totalWidthFromBarWidth
|
|
9034
|
-
? MAX_CHART_WIDTH
|
|
9035
|
-
: totalWidthFromBarWidth
|
|
9158
|
+
? totalWidthFromBarWidth || MAX_CHART_WIDTH
|
|
9036
9159
|
: DEFAULT_CHART_WIDTH;
|
|
9037
9160
|
const [customize] = useChartChange({
|
|
9038
9161
|
dataSources: config.dataSources,
|
|
@@ -9061,13 +9184,13 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9061
9184
|
return result?.filter((name, index) => result.indexOf(name) === index);
|
|
9062
9185
|
}, [data, isLineChart]);
|
|
9063
9186
|
const renderLineChartTooltip = React.useCallback((items, { indexX }) => {
|
|
9064
|
-
return (jsxRuntime.
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9187
|
+
return (jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(ChartTooltipLabel, { children: labels[indexX] }), items
|
|
9188
|
+
.filter(({ value }) => !isEmptyValue(value))
|
|
9189
|
+
?.map(({ layerName, attributeName, value, stroke }, index) => {
|
|
9190
|
+
const layerInfo = layerInfos?.find(({ name }) => name === layerName);
|
|
9191
|
+
const attribute = layerInfo?.layerDefinition.attributes[attributeName];
|
|
9192
|
+
return (jsxRuntime.jsxs(ChartTooltipRow, { children: [jsxRuntime.jsx(ChartLegendColor$1, { "$color": stroke }), jsxRuntime.jsx(ChartLegendValue, { children: attribute ? formatAttributeValue({ t, type: attribute.type, value, stringFormat: attribute.stringFormat }) : value })] }, index));
|
|
9193
|
+
})] }));
|
|
9071
9194
|
}, [labels, layerInfos]);
|
|
9072
9195
|
const markers = React.useMemo(() => getChartMarkers(data[0]?.items, configMarkers), [data, configMarkers]);
|
|
9073
9196
|
const formatTooltipName = React.useCallback((name) => (isRelated ? name : tooltipNameFromAttributes(name, formattedAttributes)), [formattedAttributes, isRelated]);
|
|
@@ -9091,16 +9214,16 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9091
9214
|
.flat()
|
|
9092
9215
|
.map(({ values }) => values)
|
|
9093
9216
|
.flat();
|
|
9094
|
-
return (jsxRuntime.
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9217
|
+
return (jsxRuntime.jsxs(AnyChartWrapper, { height: height, children: [jsxRuntime.jsx(LineChartTooltipStyles, {}), jsxRuntime.jsx(charts.LineChart, { data: lineChartData, labels: labels, width: +width, height: height, xAxisPadding: 15, yAxisPadding: 0, min: Math.min(...chartValues), customYAxisSelection: yAxis => {
|
|
9218
|
+
if (isHidedY) {
|
|
9219
|
+
yAxis.remove();
|
|
9220
|
+
}
|
|
9221
|
+
}, customYAxis: yAxis => yAxis.ticks(4), renderTooltip: renderLineChartTooltip, customize: customize, dynamicTooltipEnable: true, stackedTooltip: true, tooltipClassName: "dashboardLineChartTooltip", drawGridX: !isHidedY, margin: {
|
|
9222
|
+
top: 0,
|
|
9223
|
+
right: 0,
|
|
9224
|
+
bottom: 0,
|
|
9225
|
+
left: 0
|
|
9226
|
+
} })] }));
|
|
9104
9227
|
}
|
|
9105
9228
|
if (isStackBar) {
|
|
9106
9229
|
return (jsxRuntime.jsx(AnyChartWrapper, { height: height, children: jsxRuntime.jsx(StackBar, { data: data, filterName: filterName, type: type, alias: elementConfig?.children?.find(child => child.id === "alias"), options: options, renderTooltip: renderPieChartTooltip, renderElement: renderElement }) }));
|
|
@@ -9113,16 +9236,17 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
|
|
|
9113
9236
|
color: formatFilterColor(item.name, item.color, defaultColor)
|
|
9114
9237
|
})) || []), width: +width, height: +width, padAngle: angle, outerRadius: radius, cornerRadius: cornerRadius, renderTooltip: renderPieChartTooltip, withTooltip: true, onClick: filterName ? item => onFilter(item.name) : undefined, children: showTotal && jsxRuntime.jsx(PieChartCenter, { children: totalWord || roundTotalSum(+totalSum) }) }) }));
|
|
9115
9238
|
}
|
|
9239
|
+
const markersMargin = options?.showMarkers ? 10 : 0;
|
|
9116
9240
|
const margin = {
|
|
9117
|
-
top:
|
|
9118
|
-
right:
|
|
9119
|
-
bottom: markers?.length ? 20 :
|
|
9120
|
-
left:
|
|
9241
|
+
top: markersMargin,
|
|
9242
|
+
right: markersMargin,
|
|
9243
|
+
bottom: markers?.length ? 20 : markersMargin,
|
|
9244
|
+
left: markersMargin
|
|
9121
9245
|
};
|
|
9122
|
-
return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9246
|
+
return (jsxRuntime.jsx(BarChartWrapper, { height: height + margin.bottom, children: jsxRuntime.jsxs(BarChartContainer, { children: [jsxRuntime.jsx(BarChartStyles, {}), jsxRuntime.jsx(charts.BarChart, { 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 }) => {
|
|
9247
|
+
bars.attr("rx", radius);
|
|
9248
|
+
bars.attr("ry", radius);
|
|
9249
|
+
}, margin: margin, xAxisPadding: 0, yAxisPadding: 0, formatTooltipValue: formatTooltipValue, formatTooltipName: formatTooltipName, hideTooltipGroupName: true, dynamicTooltipEnable: true, isBarTooltip: true, onBarClick: filterName ? item => onFilter(item.name) : undefined })] }) }));
|
|
9126
9250
|
}, [
|
|
9127
9251
|
element,
|
|
9128
9252
|
isLineChart,
|
|
@@ -9171,7 +9295,7 @@ const ChartLegend = ({ data, chartElement, type, twoColumns, loading }) => {
|
|
|
9171
9295
|
const showMoreBtn = !!shownItems && data.length > shownItems;
|
|
9172
9296
|
if (!loading && !data?.length && !!hideEmpty)
|
|
9173
9297
|
return null;
|
|
9174
|
-
return (jsxRuntime.jsxs(uilibGl.Flex, { opacity: loading ? FILTERED_VALUE_OPACITY / 100 : 1, children: [jsxRuntime.jsx(ChartLegendContainer, { twoColumns: twoColumns, children: sliceItems(data)?.map(({ name, color }, index) => (jsxRuntime.jsxs(ChartLegendItem, { hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: axes?.[0]?.filterName ? () => onFilter(name) : undefined, children: [jsxRuntime.jsx(ChartLegendColor, { color: color }), jsxRuntime.jsx(ChartLegendName, { "$fontColor": fontColor, children: name })] }, index))) }), showMoreBtn && (jsxRuntime.jsx(uilibGl.LegendToggler, { onClick: onShowMore, toggled: showMore, children: t("other", { ns: "dashboard" }) }))] }));
|
|
9298
|
+
return (jsxRuntime.jsxs(uilibGl.Flex, { flexDirection: "column", opacity: loading ? FILTERED_VALUE_OPACITY / 100 : 1, children: [jsxRuntime.jsx(ChartLegendContainer, { twoColumns: twoColumns, children: sliceItems(data)?.map(({ name, color }, index) => (jsxRuntime.jsxs(ChartLegendItem, { hasAnyFilter: hasAnyFilter, isFiltered: isFiltered(name), onClick: axes?.[0]?.filterName ? () => onFilter(name) : undefined, children: [jsxRuntime.jsx(ChartLegendColor, { color: color }), jsxRuntime.jsx(ChartLegendName, { "$fontColor": fontColor, children: name })] }, index))) }), showMoreBtn && (jsxRuntime.jsx(uilibGl.LegendToggler, { onClick: onShowMore, toggled: showMore, children: t("other", { ns: "dashboard" }) }))] }));
|
|
9175
9299
|
};
|
|
9176
9300
|
|
|
9177
9301
|
const ContainerChildren = React.memo(({ items, isColumn, isMain, renderElement }) => {
|