@evergis/react 3.1.41 → 3.1.42

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.
@@ -5,5 +5,6 @@ export declare const ChartLegend: FC<{
5
5
  chartElement?: ConfigContainerChild;
6
6
  type: WidgetType;
7
7
  twoColumns: boolean;
8
+ fontSize: string | number;
8
9
  loading: boolean;
9
10
  }>;
@@ -10,5 +10,6 @@ export declare const ChartLegendColor: import('styled-components').StyledCompone
10
10
  color: string;
11
11
  }, never>;
12
12
  export declare const ChartLegendName: import('styled-components').StyledComponent<"div", any, {
13
+ $fontSize?: string | number;
13
14
  $fontColor?: string;
14
15
  }, never>;
@@ -1,4 +1,5 @@
1
1
  export declare const ElementValueWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
2
+ export declare const InnerContainerWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
2
3
  export declare const ContainerWrapper: any;
3
4
  export declare const DashboardChip: import('styled-components').StyledComponent<any, any, any, any>;
4
5
  export declare const DashboardPlaceholderWrap: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
@@ -50,6 +50,7 @@ export interface ConfigOptions {
50
50
  dotSnapping?: boolean;
51
51
  tagView?: boolean;
52
52
  simple?: boolean;
53
+ downloadById?: string;
53
54
  separator?: string;
54
55
  lineBreak?: string;
55
56
  image?: string;
package/dist/index.js CHANGED
@@ -4500,7 +4500,7 @@ const ChartLegendColor = styled.div `
4500
4500
  `;
4501
4501
  const ChartLegendName = styled.div `
4502
4502
  flex: 1;
4503
- font-size: 0.625rem;
4503
+ font-size: ${({ $fontSize }) => $fontSize || "0.625rem"};
4504
4504
  color: ${({ theme: { palette }, $fontColor }) => $fontColor || palette.textPrimary};
4505
4505
  `;
4506
4506
 
@@ -5103,6 +5103,9 @@ const LayerListContainer = styled(uilibGl.Flex) `
5103
5103
  const ElementValueWrapper = styled.div `
5104
5104
  transition: background-color ${uilibGl.transition.toggle};
5105
5105
  `;
5106
+ const InnerContainerWrapper$1 = styled.div `
5107
+ width: 100%;
5108
+ `;
5106
5109
  const ContainerWrapper = styled(uilibGl.Flex) `
5107
5110
  position: relative;
5108
5111
  min-height: 1rem;
@@ -6197,6 +6200,17 @@ const ContainerIconTitle = styled(uilibGl.Flex) `
6197
6200
  ${uilibGl.LegendToggler} {
6198
6201
  margin-left: 0.25rem;
6199
6202
  }
6203
+
6204
+ span[kind="download"] {
6205
+ opacity: 0;
6206
+ transition: opacity ${uilibGl.transition.hover};
6207
+ }
6208
+
6209
+ :hover {
6210
+ span[kind="download"] {
6211
+ opacity: 1;
6212
+ }
6213
+ }
6200
6214
  `;
6201
6215
  const ContainerTitle = styled(uilibGl.Flex) `
6202
6216
  align-items: center;
@@ -6232,8 +6246,9 @@ const TitleContainer = React.memo(({ containerId, templateName, layerNames, font
6232
6246
  const [layersVisibility, toggleVisibility] = useToggle(true);
6233
6247
  const { palette } = styled.useTheme();
6234
6248
  const { style, options } = elementConfig || {};
6235
- const { simple } = options || {};
6249
+ const { simple, downloadById } = options || {};
6236
6250
  const isLayers = templateName === exports.ContainerTemplate.Layers;
6251
+ const { onExport } = useExportPdf(downloadById);
6237
6252
  const onClick = React.useCallback(() => {
6238
6253
  if (!expandable)
6239
6254
  return;
@@ -6248,7 +6263,7 @@ const TitleContainer = React.memo(({ containerId, templateName, layerNames, font
6248
6263
  const renderVisibility = React.useMemo(() => isLayers && (jsxRuntime.jsx(uilibGl.FlexSpan, { mr: "-1rem", children: jsxRuntime.jsx(uilibGl.IconToggle, { kind: layersVisibility ? "password_show" : "password_hide", className: "feature-visible", isSelected: layersVisibility, onClick: onToggleVisibility }) })), [isLayers, layersVisibility, onToggleVisibility]);
6249
6264
  const renderToggler = React.useMemo(() => !!containerId &&
6250
6265
  expandable && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(uilibGl.LegendToggler, { color: palette.icon, toggled: expandedContainers?.[containerId] !== undefined ? expandedContainers[containerId] : expanded, onClick: onClick }) })), [containerId, expandable, expanded, expandedContainers, onClick, palette.icon]);
6251
- return (jsxRuntime.jsx(Container, { isTitle: isVisible, style: style, children: jsxRuntime.jsxs(ContainerTitle, { simple: simple, children: [jsxRuntime.jsxs(ContainerIconTitle, { fontColor: fontColor, children: [renderElement({ id: "titleIcon", wrap: false }), renderElement({ id: "title" }), isLayers && renderToggler] }), !isLayers && renderToggler, renderVisibility] }) }));
6266
+ return (jsxRuntime.jsx(Container, { isTitle: isVisible, style: style, children: jsxRuntime.jsxs(ContainerTitle, { simple: simple, children: [jsxRuntime.jsxs(ContainerIconTitle, { fontColor: fontColor, children: [renderElement({ id: "titleIcon", wrap: false }), renderElement({ id: "title" }), !!downloadById && (jsxRuntime.jsx(uilibGl.IconButton, { kind: "download", onClick: onExport })), isLayers && renderToggler] }), !isLayers && renderToggler, renderVisibility] }) }));
6252
6267
  });
6253
6268
 
6254
6269
  const ContainerDivider = styled(uilibGl.Divider) `
@@ -7437,7 +7452,7 @@ const ElementImage = React.memo(({ type, elementConfig }) => {
7437
7452
  const ElementLegend = React.memo(({ type, element, elementConfig, expandedContainers }) => {
7438
7453
  const { attributes, dataSources } = useWidgetContext(type);
7439
7454
  const { options } = elementConfig || {};
7440
- const { twoColumns, chartId, relatedDataSources } = options || {};
7455
+ const { twoColumns, chartId, relatedDataSources, fontSize } = options || {};
7441
7456
  const chartElement = React.useMemo(() => findAnd.returnFound(element?.children, { id: chartId }), [chartId, element?.children]);
7442
7457
  const { data, loading } = useChartData({
7443
7458
  element: chartElement,
@@ -7464,7 +7479,7 @@ const ElementLegend = React.memo(({ type, element, elementConfig, expandedContai
7464
7479
  return { ...item, name: attribute?.alias || item.name };
7465
7480
  });
7466
7481
  }, [attributes, axes, data, options.chartType, relatedDataSources, dataSources]);
7467
- return !chartElement?.options?.expanded || expandedContainers?.[chartElement.id] ? (jsxRuntime.jsx(ChartLegend, { data: legendData, loading: loading, chartElement: chartElement, twoColumns: twoColumns, type: type })) : null;
7482
+ return !chartElement?.options?.expanded || expandedContainers?.[chartElement.id] ? (jsxRuntime.jsx(ChartLegend, { data: legendData, loading: loading, chartElement: chartElement, twoColumns: twoColumns, fontSize: fontSize, type: type })) : null;
7468
7483
  });
7469
7484
 
7470
7485
  const ExternalLink = styled(uilibGl.IconButton).attrs(() => ({
@@ -9582,7 +9597,7 @@ const Chart = React.memo(({ config, element, elementConfig, type, renderElement
9582
9597
  return (jsxRuntime.jsx(ChartWrapper, { width: width, height: isStackBar ? "auto" : isPieChart ? width : height, column: column, loading: loading, children: renderChart }));
9583
9598
  });
9584
9599
 
9585
- const ChartLegend = ({ data, chartElement, type, twoColumns, loading }) => {
9600
+ const ChartLegend = ({ data, chartElement, fontSize, type, twoColumns, loading }) => {
9586
9601
  const { t } = useGlobalContext();
9587
9602
  const { sliceItems, showMore, onShowMore } = useShownOtherItems(chartElement?.options);
9588
9603
  const axes = React.useMemo(() => getChartAxes(chartElement), [chartElement]);
@@ -9591,7 +9606,7 @@ const ChartLegend = ({ data, chartElement, type, twoColumns, loading }) => {
9591
9606
  const showMoreBtn = !!shownItems && data.length > shownItems;
9592
9607
  if (!loading && !data?.length && !!hideEmpty)
9593
9608
  return null;
9594
- 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", defaultValue: "Другое" }) }))] }));
9609
+ 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, { "$fontSize": fontSize, "$fontColor": fontColor, children: name })] }, index))) }), showMoreBtn && (jsxRuntime.jsx(uilibGl.LegendToggler, { onClick: onShowMore, toggled: showMore, children: t("other", { ns: "dashboard", defaultValue: "Другое" }) }))] }));
9595
9610
  };
9596
9611
 
9597
9612
  const ContainerChildren = React.memo(({ items, isColumn, isMain, renderElement }) => {
@@ -9603,7 +9618,7 @@ const ContainerChildren = React.memo(({ items, isColumn, isMain, renderElement }
9603
9618
  index,
9604
9619
  wrap: isColumn || isMain,
9605
9620
  });
9606
- return isMain ? (jsxRuntime.jsx(ContainerWrapper, { "data-id": item.id, "data-templatename": item.templateName, children: jsxRuntime.jsx(DashboardWrapper, { children: render }) }, index)) : (jsxRuntime.jsx(React.Fragment, { children: render }, index));
9621
+ return isMain ? (jsxRuntime.jsx(ContainerWrapper, { id: item.id, "data-templatename": item.templateName, children: jsxRuntime.jsx(DashboardWrapper, { children: render }) }, index)) : (jsxRuntime.jsx(InnerContainerWrapper$1, { id: item.id, children: render }, index));
9607
9622
  }) }));
9608
9623
  });
9609
9624
 
@@ -10185,6 +10200,7 @@ exports.HeaderTitleContainer = HeaderTitleContainer;
10185
10200
  exports.HiddenTitleItems = HiddenTitleItems;
10186
10201
  exports.IconContainer = IconContainer;
10187
10202
  exports.ImageContainer = ImageContainer;
10203
+ exports.InnerContainerWrapper = InnerContainerWrapper$1;
10188
10204
  exports.LEFT_PANEL_HEADER_HEIGHT = LEFT_PANEL_HEADER_HEIGHT;
10189
10205
  exports.Layer = Layer;
10190
10206
  exports.LayerDescription = LayerDescription;