@evergis/react 4.0.92 → 4.0.94

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
@@ -4,8 +4,7 @@ import { createContext, memo, useRef, useState, useCallback, useEffect, useConte
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, STORAGE_TOKEN_KEY, parseJwt, STORAGE_REFRESH_TOKEN_KEY, RemoteTaskStatus, LayerServiceType, OgcGeometryType, StringSubType, AttributeConfigurationType } from '@evergis/api';
7
- import Gradient from 'javascript-color-gradient';
8
- import { Color as Color$1 } from '@evergis/color';
7
+ import { Color as Color$1, ColorScale } from '@evergis/color';
9
8
  import { isValid, format, parseJSON, parseISO, toDate } from 'date-fns';
10
9
  import { isNil, isEmpty, isEqual, uniqueId, unescape } from 'lodash';
11
10
  import { ru, enUS } from 'date-fns/locale';
@@ -3562,13 +3561,26 @@ const GRADIENT_COLORS = [
3562
3561
  "#A1E062",
3563
3562
  "#51D8A5",
3564
3563
  ];
3565
- const getGradientColors = (colorsCount) => {
3566
- return new Gradient()
3567
- .setColorGradient(...GRADIENT_COLORS)
3568
- .setMidpoint(colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount + 10)
3569
- .getColors()
3570
- .slice(0, colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount);
3564
+ const HEX_RRGGBB_LENGTH = 7;
3565
+ /**
3566
+ * Растягивает палитру на нужное количество цветов: опорные цвета равномерно
3567
+ * раскладываются по шкале, недостающие интерполируются между ними.
3568
+ * @param colors - опорные цвета палитры в hex
3569
+ * @param count - требуемое количество цветов
3570
+ * @returns массив ровно из count цветов
3571
+ */
3572
+ const stretchPalette = (colors, count) => {
3573
+ if (!colors?.length || count <= 0)
3574
+ return [];
3575
+ if (colors.length === 1)
3576
+ return Array.from({ length: count }, () => colors[0]);
3577
+ const scale = new ColorScale(colors.map((color, index) => [index / (colors.length - 1), color]));
3578
+ return Array.from({ length: count }, (_, index) => {
3579
+ const color = scale.getColor(count === 1 ? 0 : index / (count - 1));
3580
+ return color ? new Color$1(color).toString("hex").slice(0, HEX_RRGGBB_LENGTH) : colors[colors.length - 1];
3581
+ });
3571
3582
  };
3583
+ const getGradientColors = (colorsCount) => stretchPalette(GRADIENT_COLORS, colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount);
3572
3584
  /**
3573
3585
  * Converts HSL hue value to RGB
3574
3586
  * @param p - lower bound
@@ -6405,11 +6417,11 @@ const getChartMarkers = (items, markers, dataSources) => {
6405
6417
 
6406
6418
  const ContainersGroupContainer = memo(({ elementConfig, type, renderElement }) => {
6407
6419
  const { expandedContainers } = useWidgetContext(type);
6408
- const { id, children, options } = elementConfig || {};
6409
- const { column, expandable, expanded } = options || {};
6420
+ const { id, style, children, options } = elementConfig || {};
6421
+ const { column, expandable, expanded, width, height } = options || {};
6410
6422
  const isColumn = column === undefined || column;
6411
6423
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
6412
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(Container, { id: id, isColumn: isColumn, children: jsx(ContainerChildren, { type: type, items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
6424
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(Container, { id: id, isColumn: isColumn, style: getWrapperSizeStyle(style, width, height), children: jsx(ContainerChildren, { type: type, items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
6413
6425
  });
6414
6426
 
6415
6427
  const ChartLegendContainer = styled(Flex) `
@@ -6590,7 +6602,8 @@ const useRenderContainer = ({ elementConfig, type, renderElement, renderBody, })
6590
6602
  };
6591
6603
 
6592
6604
  const OneColumnContainer = memo(({ type, elementConfig, renderElement }) => {
6593
- const renderBody = useCallback(({ id, value, style, hasUnits, render }) => (jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxs(ContainerValue, { children: [value, hasUnits && (jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), []);
6605
+ const { width, height } = elementConfig?.options || {};
6606
+ const renderBody = useCallback(({ id, value, style, hasUnits, render }) => (jsxs(Container, { id: id, isColumn: true, style: getWrapperSizeStyle({ ...BASE_CONTAINER_STYLE, ...style }, width, height), children: [jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxs(ContainerValue, { children: [value, hasUnits && (jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), [width, height]);
6594
6607
  const { renderContainer, attributesToRender } = useRenderContainer({
6595
6608
  type,
6596
6609
  elementConfig,
@@ -6601,7 +6614,8 @@ const OneColumnContainer = memo(({ type, elementConfig, renderElement }) => {
6601
6614
  });
6602
6615
 
6603
6616
  const TwoColumnContainer = memo(({ elementConfig, type, renderElement }) => {
6604
- const renderBody = useCallback(({ id, value, style, hasIcon, hasUnits, render }) => (jsxs(TwoColumnContainerWrapper, { id: id, style: style, children: [jsxs(ContainerAlias, { children: [hasIcon && (jsx(ContainerAliasIcon, { children: render({ id: "icon" }) })), render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxs(ContainerValue, { big: true, children: [value, hasUnits && (jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), []);
6617
+ const { width, height } = elementConfig?.options || {};
6618
+ const renderBody = useCallback(({ id, value, style, hasIcon, hasUnits, render }) => (jsxs(TwoColumnContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: [jsxs(ContainerAlias, { children: [hasIcon && (jsx(ContainerAliasIcon, { children: render({ id: "icon" }) })), render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxs(ContainerValue, { big: true, children: [value, hasUnits && (jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), [width, height]);
6605
6619
  const { renderContainer, attributesToRender } = useRenderContainer({
6606
6620
  type,
6607
6621
  elementConfig,
@@ -6787,7 +6801,7 @@ const DataSourceProgressContainer = memo(({ config, elementConfig, type, innerCo
6787
6801
  });
6788
6802
  const { attributes } = layerInfo?.configuration?.attributesConfiguration || {};
6789
6803
  const { id, options, children, style } = elementConfig || {};
6790
- const { maxValue, showTotal, relatedDataSource, expandable, expanded } = options || {};
6804
+ const { maxValue, showTotal, relatedDataSource, expandable, expanded, width, height } = options || {};
6791
6805
  const valueElement = children?.find(item => item.id === "value");
6792
6806
  const unitsElement = children?.find(item => item.id === "units");
6793
6807
  const { sliceItems, checkIsSliced, showMore, onShowMore } = useShownOtherItems(options);
@@ -6820,7 +6834,7 @@ const DataSourceProgressContainer = memo(({ config, elementConfig, type, innerCo
6820
6834
  return jsx(DataSourceError, { name: elementConfig.templateName });
6821
6835
  }
6822
6836
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
6823
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
6837
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxs(DataSourceProgressContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
6824
6838
  ns: "dashboard",
6825
6839
  defaultValue: "Показать все",
6826
6840
  }) })), showTotal && (jsxs(Fragment$1, { children: [jsx(Divider, {}), jsxs(ProgressTotal, { children: [jsx(ProgressTotalTitle, { children: t("total", { ns: "dashboard", defaultValue: "Итого" }) }), jsxs(ProgressValue, { children: [totalValue, jsx(ProgressUnits, { children: totalUnits })] })] })] }))] })) : (jsx(ContainerLoading, {})), jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type })] }));
@@ -7047,7 +7061,7 @@ const FiltersContainer = memo(({ elementConfig, config, type, renderElement }) =
7047
7061
  const { currentPage } = useWidgetPage(type);
7048
7062
  const { filters: configFilters } = currentPage;
7049
7063
  const { id, style, options } = elementConfig || {};
7050
- const { padding, bgColor, fontColor, fontSize, expandable, expanded } = options || {};
7064
+ const { padding, bgColor, fontColor, fontSize, expandable, expanded, width, height } = options || {};
7051
7065
  const isLoading = useMemo(() => checkIsLoading(dataSources, config, configFilters), [configFilters, config, dataSources]);
7052
7066
  const filterItems = useMemo(() => elementConfig?.children?.filter(child => child.options?.filterName), [elementConfig?.children]);
7053
7067
  const renderFilter = useCallback((filter, index) => {
@@ -7056,7 +7070,7 @@ const FiltersContainer = memo(({ elementConfig, config, type, renderElement }) =
7056
7070
  }, [config, type]);
7057
7071
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7058
7072
  const selectedItems = useMemo(() => getFilterSelectedItems(filterItems, filters, configFilters), [configFilters, filters, filterItems]);
7059
- return (jsxs(Fragment$1, { children: [jsx(Flex, { mb: !isVisible && selectedItems.length ? "2rem" : 0, children: jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }) }), isLoading && jsx(ContainerLoading, {}), !isLoading && isVisible && (jsx(FiltersContainerWrapper, { id: id, style: style, "$padding": padding, "$bgColor": bgColor, "$fontSize": fontSize, "$fontColor": fontColor, children: filterItems?.map(renderFilter) })), jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type, filter: filterItems[0]?.options?.filterName })] }));
7073
+ return (jsxs(Fragment$1, { children: [jsx(Flex, { mb: !isVisible && selectedItems.length ? "2rem" : 0, children: jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }) }), isLoading && jsx(ContainerLoading, {}), !isLoading && isVisible && (jsx(FiltersContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), "$padding": padding, "$bgColor": bgColor, "$fontSize": fontSize, "$fontColor": fontColor, children: filterItems?.map(renderFilter) })), jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type, filter: filterItems[0]?.options?.filterName })] }));
7060
7074
  });
7061
7075
 
7062
7076
  const DefaultAttributesContainer = memo(({ type, renderElement }) => {
@@ -7237,7 +7251,7 @@ const IconContainer = memo(({ elementConfig, renderElement }) => {
7237
7251
  const DataSourceContainer = memo(({ config, elementConfig, type, innerComponent, renderElement }) => {
7238
7252
  const { dataSources, expandedContainers } = useWidgetContext(type);
7239
7253
  const { id, style, options } = elementConfig || {};
7240
- const { column = true, relatedDataSource, expandable, expanded } = options || {};
7254
+ const { column = true, relatedDataSource, expandable, expanded, width, height } = options || {};
7241
7255
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7242
7256
  const dataSource = useMemo(() => dataSources?.find(({ name }) => name === relatedDataSource), [dataSources, relatedDataSource]);
7243
7257
  if (!relatedDataSource)
@@ -7246,7 +7260,7 @@ const DataSourceContainer = memo(({ config, elementConfig, type, innerComponent,
7246
7260
  return jsx(DataSourceError, { name: elementConfig.templateName });
7247
7261
  }
7248
7262
  const isLoading = !dataSource?.features;
7249
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsx(Container, { id: id, isColumn: column, style: { height: isLoading ? "3rem" : "auto", ...style }, children: dataSource.features?.map((feature, index) => (jsx(DataSourceInnerContainer, { index: index, type: type, config: config, feature: feature, elementConfig: elementConfig, innerComponent: innerComponent }, index))) })) : (jsx(ContainerLoading, {}))] }));
7263
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsx(Container, { id: id, isColumn: column, style: getWrapperSizeStyle({ height: isLoading ? "3rem" : "auto", ...style }, width, height), children: dataSource.features?.map((feature, index) => (jsx(DataSourceInnerContainer, { index: index, type: type, config: config, feature: feature, elementConfig: elementConfig, innerComponent: innerComponent }, index))) })) : (jsx(ContainerLoading, {}))] }));
7250
7264
  });
7251
7265
 
7252
7266
  const SvgContainerColorMixin = css `
@@ -7385,7 +7399,7 @@ const SlideshowContainer = memo(({ config, elementConfig, type }) => {
7385
7399
  dataSources,
7386
7400
  });
7387
7401
  const { id, style, options } = elementConfig || {};
7388
- const { expandable, expanded } = options || {};
7402
+ const { expandable, expanded, width, height } = options || {};
7389
7403
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7390
7404
  const render = useMemo(() => getRenderElement({
7391
7405
  config,
@@ -7409,7 +7423,7 @@ const SlideshowContainer = memo(({ config, elementConfig, type }) => {
7409
7423
  pageIndex,
7410
7424
  type,
7411
7425
  ]);
7412
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: render }), isVisible && (jsxs(Container, { style: style, children: [jsx(ContainerAlias, { hasBottomMargin: true, children: render({ id: "alias" }) }), jsx(ContainerValue, { children: render({
7426
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: render }), isVisible && (jsxs(Container, { style: getWrapperSizeStyle(style, width, height), children: [jsx(ContainerAlias, { hasBottomMargin: true, children: render({ id: "alias" }) }), jsx(ContainerValue, { children: render({
7413
7427
  id: "slideshow",
7414
7428
  wrap: false,
7415
7429
  }) })] }))] }));
@@ -7418,9 +7432,9 @@ const SlideshowContainer = memo(({ config, elementConfig, type }) => {
7418
7432
  const CameraContainer = memo(({ elementConfig, type, renderElement }) => {
7419
7433
  const { expandedContainers } = useWidgetContext(type);
7420
7434
  const { id, options, style } = elementConfig || {};
7421
- const { expandable, expanded } = options || {};
7435
+ const { expandable, expanded, width, height } = options || {};
7422
7436
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7423
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxs(Container, { id: id, style: style, children: [jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { children: renderElement({ id: "value", wrap: false }) })] }))] }));
7437
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxs(Container, { id: id, style: getWrapperSizeStyle(style, width, height), children: [jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsx(ContainerValue, { children: renderElement({ id: "value", wrap: false }) })] }))] }));
7424
7438
  });
7425
7439
 
7426
7440
  const TabAnchor = styled.div `
@@ -7684,7 +7698,7 @@ const LayersContainer = memo(({ type, elementConfig, renderElement }) => {
7684
7698
  const { expandedContainers } = useWidgetContext(type);
7685
7699
  const { currentPage } = useWidgetPage(type);
7686
7700
  const { id, options, style } = elementConfig || {};
7687
- const { layerNames, expandable, expanded } = options || {};
7701
+ const { layerNames, expandable, expanded, width, height } = options || {};
7688
7702
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7689
7703
  const layers = useMemo(() => {
7690
7704
  if (!currentPage?.layers)
@@ -7693,7 +7707,7 @@ const LayersContainer = memo(({ type, elementConfig, renderElement }) => {
7693
7707
  return currentPage.layers;
7694
7708
  return currentPage.layers.filter(({ name }) => layerNames.includes(name));
7695
7709
  }, [currentPage?.layers, layerNames]);
7696
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(LayersContainerWrapper, { id: id, style: style, children: jsx(LayerTree, { layers: layers, onlyMainTools: true }) }))] }));
7710
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(LayersContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: jsx(LayerTree, { layers: layers, onlyMainTools: true }) }))] }));
7697
7711
  });
7698
7712
 
7699
7713
  const ExportPdfContainer = memo(({ type, elementConfig }) => {
@@ -7707,9 +7721,9 @@ const ExportPdfContainer = memo(({ type, elementConfig }) => {
7707
7721
  const UploadContainer = memo(({ type, elementConfig, renderElement }) => {
7708
7722
  const { expandedContainers } = useWidgetContext(type);
7709
7723
  const { id, options } = elementConfig || {};
7710
- const { expandable, expanded } = options || {};
7724
+ const { expandable, expanded, width, height } = options || {};
7711
7725
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7712
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && renderElement({ id: "uploader", wrap: false })] }));
7726
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(Flex, { column: true, style: getWrapperSizeStyle({ width: "100%" }, width, height), children: renderElement({ id: "uploader", wrap: false }) }))] }));
7713
7727
  });
7714
7728
 
7715
7729
  const StatusBadge = styled(Chip) `
@@ -7924,7 +7938,7 @@ const TaskContainer = memo(({ type, elementConfig, renderElement }) => {
7924
7938
  const { currentPage } = useWidgetPage(type);
7925
7939
  const { taskId, runTask, stopTask, status, openLog, loading, isLogDialogOpen, closeLog, log, lastMessage, result, } = usePythonTask();
7926
7940
  const { options } = elementConfig || {};
7927
- const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, } = options || {};
7941
+ const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, width, height, } = options || {};
7928
7942
  const { setNotificationDismissed } = useTaskNotifications({
7929
7943
  enabled: !!useNotifications,
7930
7944
  suppressed: isLogDialogOpen,
@@ -7964,7 +7978,7 @@ const TaskContainer = memo(({ type, elementConfig, renderElement }) => {
7964
7978
  return runTask({ resourceId, parameters: newParams, script, fileName, methodName });
7965
7979
  }));
7966
7980
  }, [attributes, currentPage.filters, dataSources, ewktGeometry, layerInfo, projectDataSources, relatedResources, runTask, selectedFilters, stopTask, taskId]);
7967
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxs(Flex, { justifyContent: center ? "center" : "flex-start", children: [jsx(StatusWaitingButton, { title: title || t("run", { ns: "dashboard", defaultValue: "Запуск" }), icon: icon, status: status, statusColors: statusColors, isWaiting: loading || !!taskId, isDisabled: !relatedResources?.length, onClick: onClick }), !!(log || taskId) && (jsxs(Fragment$1, { children: [jsx(IconButton, { kind: "info", onClick: openLog }), jsx(LogDialog, { logs: log, status: status, statusColors: statusColors, isOpen: isLogDialogOpen, onClose: onCloseLog, onMinimize: useNotifications ? onMinimizeLog : undefined })] }))] })] }));
7981
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxs(Flex, { justifyContent: center ? "center" : "flex-start", style: getWrapperSizeStyle(undefined, width, height), children: [jsx(StatusWaitingButton, { title: title || t("run", { ns: "dashboard", defaultValue: "Запуск" }), icon: icon, status: status, statusColors: statusColors, isWaiting: loading || !!taskId, isDisabled: !relatedResources?.length, onClick: onClick }), !!(log || taskId) && (jsxs(Fragment$1, { children: [jsx(IconButton, { kind: "info", onClick: openLog }), jsx(LogDialog, { logs: log, status: status, statusColors: statusColors, isOpen: isLogDialogOpen, onClose: onCloseLog, onMinimize: useNotifications ? onMinimizeLog : undefined })] }))] })] }));
7968
7982
  });
7969
7983
 
7970
7984
  const EditContainer = ({ type, elementConfig, renderElement }) => {
@@ -8705,7 +8719,7 @@ const AttachmentContainer = memo(({ type, elementConfig, renderElement }) => {
8705
8719
  const { expandedContainers } = useWidgetContext(type);
8706
8720
  const { items, visibleItems, viewMode, setViewMode, showMore, setShowMore, hasMore, hiddenCount } = useAttachmentContainer({ type, elementConfig });
8707
8721
  const { id, style, options } = elementConfig || {};
8708
- const { expandable, expanded } = options || {};
8722
+ const { expandable, expanded, width, height } = options || {};
8709
8723
  const [previewIndex, setPreviewIndex] = useState(null);
8710
8724
  const previewImages = useAttachmentPreviewImages({ items, active: previewIndex !== null });
8711
8725
  const handlePreview = useCallback((link) => {
@@ -8716,7 +8730,7 @@ const AttachmentContainer = memo(({ type, elementConfig, renderElement }) => {
8716
8730
  const handleClosePreview = useCallback(() => setPreviewIndex(null), []);
8717
8731
  const handleShowMore = useCallback(() => setShowMore(true), [setShowMore]);
8718
8732
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
8719
- return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(Container, { id: id, style: { ...BASE_CONTAINER_STYLE, ...style }, children: jsxs(Flex, { column: true, children: [jsx(AttachmentsHeader, { alias: renderElement?.({ id: "alias" }), count: items.length, viewMode: viewMode, onChangeViewMode: setViewMode }), jsx(AttachmentsContent, { children: viewMode === "grid" ? (jsx(AttachmentsGrid, { items: visibleItems, isEdit: false, onPreview: handlePreview })) : (jsx(AttachmentsList, { items: visibleItems, isEdit: false, onPreview: handlePreview })) }), hasMore && !showMore && (jsx(ShowMoreButton, { hiddenCount: hiddenCount, onClick: handleShowMore })), previewIndex !== null && (jsx(Preview, { images: previewImages, initialIndex: previewIndex, isOpen: previewIndex !== null, onClose: handleClosePreview, errorTitleText: t("attachments.resourceUnavailable", {
8733
+ return (jsxs(Fragment$1, { children: [jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsx(Container, { id: id, style: getWrapperSizeStyle({ ...BASE_CONTAINER_STYLE, ...style }, width, height), children: jsxs(Flex, { column: true, children: [jsx(AttachmentsHeader, { alias: renderElement?.({ id: "alias" }), count: items.length, viewMode: viewMode, onChangeViewMode: setViewMode }), jsx(AttachmentsContent, { children: viewMode === "grid" ? (jsx(AttachmentsGrid, { items: visibleItems, isEdit: false, onPreview: handlePreview })) : (jsx(AttachmentsList, { items: visibleItems, isEdit: false, onPreview: handlePreview })) }), hasMore && !showMore && (jsx(ShowMoreButton, { hiddenCount: hiddenCount, onClick: handleShowMore })), previewIndex !== null && (jsx(Preview, { images: previewImages, initialIndex: previewIndex, isOpen: previewIndex !== null, onClose: handleClosePreview, errorTitleText: t("attachments.resourceUnavailable", {
8720
8734
  ns: "common",
8721
8735
  defaultValue: "Ресурс недоступен",
8722
8736
  }) }, previewIndex))] }) }))] }));
@@ -10266,7 +10280,7 @@ const getDashboardHeader = (templateName) => {
10266
10280
  };
10267
10281
 
10268
10282
  const getDataFromAttributes = (t, config, attributes) => {
10269
- const colors = config?.options?.colors || FEATURE_CARD_DEFAULT_COLORS;
10283
+ const colors = stretchPalette(config?.options?.colors || FEATURE_CARD_DEFAULT_COLORS, config?.children?.length || 0);
10270
10284
  const data = config?.children?.map(({ attributeName }, index) => {
10271
10285
  const attribute = attributes?.find(item => item.attributeName === attributeName);
10272
10286
  return {
@@ -10318,12 +10332,8 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
10318
10332
  if (isOtherSliced) {
10319
10333
  data = data.slice(0, config?.options?.otherItems);
10320
10334
  }
10321
- const gradientColors = colors?.length === 1 ? [colors[0], colors[0]] : colors;
10322
- const gradientArray = relatedConfig.chartAxis && colors?.length < data.length
10323
- ? new Gradient()
10324
- .setColorGradient(...gradientColors)
10325
- .setMidpoint(data.length)
10326
- .getColors()
10335
+ const gradientArray = relatedConfig.chartAxis
10336
+ ? stretchPalette(colors, data.length)
10327
10337
  : colors;
10328
10338
  const filter = getConfigFilter(relatedConfig?.filterName, filters);
10329
10339
  const result = data.reduce((acc, feature, index) => {
@@ -12045,6 +12055,18 @@ const getThemeByName = (themeName) => {
12045
12055
  return themeName === ThemeName.Dark ? darkTheme : defaultTheme;
12046
12056
  };
12047
12057
 
12058
+ /**
12059
+ * Мержит `width`/`height` из options контейнера в inline-style его корневой обёртки.
12060
+ *
12061
+ * Значения размера из options имеют приоритет над одноимёнными полями `style`.
12062
+ * Поле добавляется только когда задано — иначе `style` остаётся нетронутым.
12063
+ */
12064
+ const getWrapperSizeStyle = (style, width, height) => ({
12065
+ ...style,
12066
+ ...(width != null && { width }),
12067
+ ...(height != null && { height }),
12068
+ });
12069
+
12048
12070
  const getDisplayTemplateNameFromAttribute = (attribute) => {
12049
12071
  if (attribute?.subType === StringSubType.Attachments) {
12050
12072
  return ContainerTemplate.Attachment;
@@ -14415,5 +14437,5 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
14415
14437
  }, children: children }), upperSiblings] }));
14416
14438
  };
14417
14439
 
14418
- export { ALIGNMENTS, AddFeatureButton, AddFeatureContainer, AlertIconContainer, AttachmentContainer, AttributeGalleryContainer, AttributeLabel, BASE_CONTAINER_STYLE, BaseMapTheme, CHART_TYPES, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardBackgroundHeader, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFontColorMixin, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerIconContainer, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, POLL_SUBTASK_INTERVAL_MS, POLL_SUBTASK_TIMEOUT_MS, PROVIDER_PREFIX, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, ProviderPrefix, RoundedBackgroundContainer, SAVE_HOOK_RESULT_DURATION, SERVER_NOTIFICATION_EVENT, STACK_BAR_TOTAL_HEIGHT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer, TopContainer, TopContainerButtons, TwoColumnContainer, UploadContainer, VIEW_MODES, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyTreeFilterToCondition, applyVarsToCondition, asAttributeName, asChartId, asContainerId, asDataSourceName, asFilterName, asLayerName, asModalId, asResourceId, asTabId, checkEqualOrIncludes, checkIsLoading, createConfigLayer, createConfigPage, createNewPageId, createSaveNotificationId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, geometryToEwkt, getActualExtrusionHeight, getAttributeByName, getAttributeValue, getAttributesConfiguration, getChartAxes, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getDisplayTemplateNameFromAttribute, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerInfo, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getProxyService, getRelatedAttribute, getRenderElement, getResourceUrl, getRootElementId, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTemplateNameFromAttribute, getThemeByName, getTotalFromAttributes, getTotalFromRelatedFeatures, hexToRgba, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isHookActive, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isTreeFilterValue, isVisibleContainer, metersPerPixel, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, toRenderableValue, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, updateDataSource, useAfterSave, useAppHeight, useAttachmentItems, useAttachmentPreviewImages, useAutoCompleteControl, useBeforeSave, useChartChange, useChartData, useContainerAttributes, useCurrentPageLayers, useCustomFeatureSelect, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useEditGroupAttributes, useExpandableContainers, useExportPdf, useFeatureSaveHooks, useFetchImageWithAuth, useFetchWithAuth, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerHiddenAttributes, useLayerParams, useMapContext, useMapDraw, useMapImages, useMaxZoomTo, useProjectDashboardInit, usePythonSandbox, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRemoteTask, useRenderElement, useSavePrototypeBuilder, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useVisibleProjectItems, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
14440
+ export { ALIGNMENTS, AddFeatureButton, AddFeatureContainer, AlertIconContainer, AttachmentContainer, AttributeGalleryContainer, AttributeLabel, BASE_CONTAINER_STYLE, BaseMapTheme, CHART_TYPES, CONFIG_PAGES_ID, CONFIG_PAGE_ID, CameraContainer, Chart, ChartContainer, ChartLegend, ChartLoading, Container, ContainerChildren, ContainerLoading, ContainerTemplate, ContainerWrapper, ContainersGroupContainer, DEFAULT_ATTRIBUTE_NAME, DEFAULT_BARCHART_RADIUS, DEFAULT_BASE_MAP, DEFAULT_CHART_ANGLE, DEFAULT_CHART_HEIGHT, DEFAULT_CHART_WIDTH, DEFAULT_CIRCLE_PAINT, DEFAULT_DASHBOARD_CONFIG, DEFAULT_DATA_SOURCE_LIMIT, DEFAULT_DROPDOWN_WIDTH, DEFAULT_FILL_EXTRUSION_PAINT, DEFAULT_FILL_PAINT, DEFAULT_FILTER_PADDING, DEFAULT_ID_ATTRIBUTE_NAME, DEFAULT_LAT, DEFAULT_LINE_PAINT, DEFAULT_LNG, DEFAULT_PAGES_CONFIG, DEFAULT_PIECHART_RADIUS, DEFAULT_ZOOM, Dashboard, DashboardCheckbox, DashboardChip, DashboardContent, DashboardContext, DashboardDefaultHeader, DashboardHeader, DashboardLoading, DashboardPlaceholder, DashboardPlaceholderWrap, DashboardProvider, DashboardWrapper, DataSourceContainer, DataSourceError, DataSourceErrorContainer, DataSourceInnerContainer, DataSourceProgressContainer, DateFormat, DefaultAttributesContainer, DefaultHeaderContainer, DefaultHeaderWrapper, DividerContainer, EditGeometryType, ElementButton, ElementCamera, ElementChart, ElementChips, ElementControl, ElementIcon, ElementImage, ElementLegend, ElementLink, ElementMarkdown, ElementSlideshow, ElementSvg, ElementTooltip, ElementValueWrapper, ExpandableTitle, FEATURE_CARD_DEFAULT_COLORS, FEATURE_CARD_OTHER_COLOR, FILTERED_VALUE_OPACITY, FILTER_PREFIX, FeatureCardBackgroundHeader, FeatureCardButtons, FeatureCardContext, FeatureCardDefaultHeader, FeatureCardHeader, FeatureCardProvider, FeatureCardSlideshowHeader, FeatureCardTitle, FeatureControls, FeatureTitleContainer, FiltersContainer, GEOMETRY_ATTRIBUTE, GlobalContext, GlobalProvider, Header, HeaderContainer, HeaderFontColorMixin, HeaderFrontView, HeaderTemplate, HeaderTitleContainer, HiddenTitleItems, IconContainer, ImageContainer, LEFT_PANEL_HEADER_HEIGHT, Layer, LayerDescription, LayerGroup, LayerGroupList, LayerIcon, LayerIconContainer, LayerListContainer, LayerTree, LayersContainer, LayersListWrapper, LinearProgressContainer, LogTerminal, LogoContainer, MAX_CHART_WIDTH, Map$1 as Map, MapContext, MapProvider, NO_CONTENT_VALUE, NUMERIC_ATTRIBUTE_TYPES, NoLiveSnapshotContainer, OneColumnContainer, POLL_SUBTASK_INTERVAL_MS, POLL_SUBTASK_TIMEOUT_MS, PROVIDER_PREFIX, PageNavigator, PageTitle, PageTitleContainer, PagesContainer, Pagination, PresentationHeader, PresentationHeaderButtons, PresentationHeaderTools, PresentationPanelContainer, PresentationPanelWrapper, PresentationWrapper, ProgressContainer, ProviderPrefix, RoundedBackgroundContainer, SAVE_HOOK_RESULT_DURATION, SERVER_NOTIFICATION_EVENT, STACK_BAR_TOTAL_HEIGHT, ScalingFactor, ServerNotificationsContext, ServerNotificationsProvider, SlideshowContainer, SmallPreviewContainer$1 as SmallPreviewContainer, SmallPreviewControl, SmallPreviewCounter, SmallPreviewImages, SmallPreviewLeft, SmallPreviewRight, StackBar, SvgImage, TIME_ZONE_FORMAT, TabsContainer, TextTrim, ThemeName, TitleContainer, TopContainer, TopContainerButtons, TwoColumnContainer, UploadContainer, VIEW_MODES, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyTreeFilterToCondition, applyVarsToCondition, asAttributeName, asChartId, asContainerId, asDataSourceName, asFilterName, asLayerName, asModalId, asResourceId, asTabId, checkEqualOrIncludes, checkIsLoading, createConfigLayer, createConfigPage, createNewPageId, createSaveNotificationId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, geometryToEwkt, getActualExtrusionHeight, getAttributeByName, getAttributeValue, getAttributesConfiguration, getChartAxes, getChartFilterName, getChartMarkers, getConfigFilter, getContainerComponent, getDashboardHeader, getDataFromAttributes, getDataFromRelatedFeatures, getDataSource, getDataSourceFilterValue, getDate, getDefaultConfig, getDisplayTemplateNameFromAttribute, getElementValue, getFeatureAttributes, getFeatureCardHeader, getFilterComponent, getFilterSelectedItems, getFilterValue, getFormattedAttributes, getGradientColors, getLayerInfo, getLayerInfoFromDataSources, getPagesFromConfig, getPagesFromProjectInfo, getProxyService, getRelatedAttribute, getRenderElement, getResourceUrl, getRootElementId, getSelectedFilterValue, getSlideshowImages, getSvgUrl, getTemplateNameFromAttribute, getThemeByName, getTotalFromAttributes, getTotalFromRelatedFeatures, getWrapperSizeStyle, hexToRgba, isEmptyElementValue, isEmptyValue, isHiddenEmptyValue, isHookActive, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isTreeFilterValue, isVisibleContainer, metersPerPixel, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, stretchPalette, timeOptions, toRenderableValue, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, updateDataSource, useAfterSave, useAppHeight, useAttachmentItems, useAttachmentPreviewImages, useAutoCompleteControl, useBeforeSave, useChartChange, useChartData, useContainerAttributes, useCurrentPageLayers, useCustomFeatureSelect, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useEditGroupAttributes, useExpandableContainers, useExportPdf, useFeatureSaveHooks, useFetchImageWithAuth, useFetchWithAuth, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerHiddenAttributes, useLayerParams, useMapContext, useMapDraw, useMapImages, useMaxZoomTo, useProjectDashboardInit, usePythonSandbox, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRemoteTask, useRenderElement, useSavePrototypeBuilder, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useVisibleProjectItems, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
14419
14441
  //# sourceMappingURL=react.esm.js.map