@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.
@@ -138,7 +138,7 @@ export interface AddFeatureContainerConfig extends Omit<ConfigContainerChild, "o
138
138
  export interface AddFeatureContainerProps extends Omit<ContainerProps, "elementConfig"> {
139
139
  elementConfig?: AddFeatureContainerConfig;
140
140
  }
141
- export type AttachmentContainerOptions = Pick<ConfigOptions, "expandable" | "expanded" | "viewMode" | "shownItems" | "otherItems" | "relatedDataSource" | "controls">;
141
+ export type AttachmentContainerOptions = Pick<ConfigOptions, "expandable" | "expanded" | "viewMode" | "shownItems" | "otherItems" | "relatedDataSource" | "controls" | "width" | "height">;
142
142
  export interface AttachmentContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
143
143
  templateName?: ContainerTemplate.Attachment;
144
144
  options?: AttachmentContainerOptions;
@@ -146,7 +146,7 @@ export interface AttachmentContainerConfig extends Omit<ConfigContainerChild, "o
146
146
  export interface AttachmentContainerProps extends Omit<ContainerProps, "elementConfig"> {
147
147
  elementConfig?: AttachmentContainerConfig;
148
148
  }
149
- export type CameraContainerOptions = Pick<ConfigOptions, "expandable" | "expanded">;
149
+ export type CameraContainerOptions = Pick<ConfigOptions, "expandable" | "expanded" | "width" | "height">;
150
150
  export interface CameraContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
151
151
  templateName?: ContainerTemplate.Camera;
152
152
  options?: CameraContainerOptions;
@@ -185,7 +185,7 @@ export interface ChartContainerConfig extends Omit<ConfigContainerChild, "option
185
185
  export interface ChartContainerProps extends Omit<ContainerProps, "elementConfig"> {
186
186
  elementConfig?: ChartContainerConfig;
187
187
  }
188
- export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded">;
188
+ export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded" | "width" | "height">;
189
189
  export interface ContainersGroupContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
190
190
  templateName?: ContainerTemplate.ContainersGroup;
191
191
  options?: ContainersGroupContainerOptions;
@@ -193,7 +193,7 @@ export interface ContainersGroupContainerConfig extends Omit<ConfigContainerChil
193
193
  export interface ContainersGroupContainerProps extends Omit<ContainerProps, "elementConfig"> {
194
194
  elementConfig?: ContainersGroupContainerConfig;
195
195
  }
196
- export type DataSourceContainerOptions = Pick<ConfigOptions, "column" | "relatedDataSource" | "expandable" | "expanded">;
196
+ export type DataSourceContainerOptions = Pick<ConfigOptions, "column" | "relatedDataSource" | "expandable" | "expanded" | "width" | "height">;
197
197
  export interface DataSourceContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
198
198
  templateName?: ContainerTemplate.DataSource;
199
199
  options?: DataSourceContainerOptions;
@@ -205,7 +205,7 @@ export type DataSourceInnerContainerOptions = Pick<ConfigOptions, "relatedDataSo
205
205
  export interface DataSourceInnerContainerConfig extends Omit<ConfigContainerChild, "options"> {
206
206
  options?: DataSourceInnerContainerOptions;
207
207
  }
208
- export type DataSourceProgressContainerOptions = Pick<ConfigOptions, "maxValue" | "showTotal" | "relatedDataSource" | "expandable" | "expanded" | "shownItems">;
208
+ export type DataSourceProgressContainerOptions = Pick<ConfigOptions, "maxValue" | "showTotal" | "relatedDataSource" | "expandable" | "expanded" | "shownItems" | "width" | "height">;
209
209
  export interface DataSourceProgressContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
210
210
  templateName?: ContainerTemplate.DataSourceProgress;
211
211
  options?: DataSourceProgressContainerOptions;
@@ -321,7 +321,7 @@ export interface ExportPdfContainerConfig extends Omit<ConfigContainerChild, "op
321
321
  export interface ExportPdfContainerProps extends Omit<ContainerProps, "elementConfig"> {
322
322
  elementConfig?: ExportPdfContainerConfig;
323
323
  }
324
- export type FiltersContainerOptions = Pick<ConfigOptions, "padding" | "bgColor" | "fontColor" | "fontSize" | "expandable" | "expanded">;
324
+ export type FiltersContainerOptions = Pick<ConfigOptions, "padding" | "bgColor" | "fontColor" | "fontSize" | "expandable" | "expanded" | "width" | "height">;
325
325
  export type FilterChildOptions = Pick<ConfigOptions, "filterName" | "label" | "placeholder" | "control" | "controls" | "relatedDataSource" | "minValue" | "maxValue">;
326
326
  export interface FilterChild extends Omit<ConfigContainerChild, "options" | "type"> {
327
327
  /** {@link FilterType} оставляем строкой, чтобы не плодить два почти одинаковых union-а в `type`. */
@@ -352,7 +352,7 @@ export interface ImageContainerConfig extends Omit<ConfigContainerChild, "option
352
352
  export interface ImageContainerProps extends Omit<ContainerProps, "elementConfig"> {
353
353
  elementConfig?: ImageContainerConfig;
354
354
  }
355
- export type LayersContainerOptions = Pick<ConfigOptions, "layerNames" | "expandable" | "expanded">;
355
+ export type LayersContainerOptions = Pick<ConfigOptions, "layerNames" | "expandable" | "expanded" | "width" | "height">;
356
356
  export interface LayersContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
357
357
  templateName?: ContainerTemplate.Layers;
358
358
  options?: LayersContainerOptions;
@@ -360,7 +360,7 @@ export interface LayersContainerConfig extends Omit<ConfigContainerChild, "optio
360
360
  export interface LayersContainerProps extends Omit<ContainerProps, "elementConfig"> {
361
361
  elementConfig?: LayersContainerConfig;
362
362
  }
363
- export type OneColumnContainerOptions = Pick<ConfigOptions, "attributes" | "useProjectHiddenAttributes" | "hideEmpty" | "innerTemplateStyle">;
363
+ export type OneColumnContainerOptions = Pick<ConfigOptions, "attributes" | "useProjectHiddenAttributes" | "hideEmpty" | "innerTemplateStyle" | "width" | "height">;
364
364
  export interface OneColumnContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
365
365
  templateName?: ContainerTemplate.OneColumn;
366
366
  options?: OneColumnContainerOptions;
@@ -395,7 +395,7 @@ export interface RoundedBackgroundContainerConfig extends Omit<ConfigContainerCh
395
395
  export interface RoundedBackgroundContainerProps extends Omit<ContainerProps, "elementConfig"> {
396
396
  elementConfig?: RoundedBackgroundContainerConfig;
397
397
  }
398
- export type SlideshowContainerOptions = Pick<ConfigOptions, "expandable" | "expanded">;
398
+ export type SlideshowContainerOptions = Pick<ConfigOptions, "expandable" | "expanded" | "width" | "height">;
399
399
  export interface SlideshowContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
400
400
  templateName?: ContainerTemplate.Slideshow;
401
401
  options?: SlideshowContainerOptions;
@@ -416,7 +416,7 @@ export interface TabsContainerConfig extends Omit<ConfigContainerChild, "options
416
416
  export interface TabsContainerProps extends Omit<ContainerProps, "elementConfig"> {
417
417
  elementConfig?: TabsContainerConfig;
418
418
  }
419
- export type TaskContainerOptions = Pick<ConfigOptions, "title" | "relatedResources" | "center" | "icon" | "statusColors" | "responseFilters" | "useNotifications">;
419
+ export type TaskContainerOptions = Pick<ConfigOptions, "title" | "relatedResources" | "center" | "icon" | "statusColors" | "responseFilters" | "useNotifications" | "width" | "height">;
420
420
  export interface TaskContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
421
421
  templateName?: ContainerTemplate.Task;
422
422
  options?: TaskContainerOptions;
@@ -432,7 +432,7 @@ export interface TitleContainerConfig extends Omit<ConfigContainerChild, "option
432
432
  export interface TitleContainerProps extends Omit<ContainerProps, "elementConfig"> {
433
433
  elementConfig?: TitleContainerConfig;
434
434
  }
435
- export type TwoColumnContainerOptions = Pick<ConfigOptions, "attributes" | "useProjectHiddenAttributes" | "hideEmpty" | "innerTemplateStyle">;
435
+ export type TwoColumnContainerOptions = Pick<ConfigOptions, "attributes" | "useProjectHiddenAttributes" | "hideEmpty" | "innerTemplateStyle" | "width" | "height">;
436
436
  export interface TwoColumnContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
437
437
  templateName?: ContainerTemplate.TwoColumn;
438
438
  options?: TwoColumnContainerOptions;
@@ -440,7 +440,7 @@ export interface TwoColumnContainerConfig extends Omit<ConfigContainerChild, "op
440
440
  export interface TwoColumnContainerProps extends Omit<ContainerProps, "elementConfig"> {
441
441
  elementConfig?: TwoColumnContainerConfig;
442
442
  }
443
- export type UploadContainerOptions = Pick<ConfigOptions, "expandable" | "expanded">;
443
+ export type UploadContainerOptions = Pick<ConfigOptions, "expandable" | "expanded" | "width" | "height">;
444
444
  export interface UploadContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
445
445
  templateName?: ContainerTemplate.Upload;
446
446
  options?: UploadContainerOptions;
@@ -0,0 +1,8 @@
1
+ import { CSSProperties } from 'react';
2
+ /**
3
+ * Мержит `width`/`height` из options контейнера в inline-style его корневой обёртки.
4
+ *
5
+ * Значения размера из options имеют приоритет над одноимёнными полями `style`.
6
+ * Поле добавляется только когда задано — иначе `style` остаётся нетронутым.
7
+ */
8
+ export declare const getWrapperSizeStyle: (style?: CSSProperties, width?: number, height?: number) => CSSProperties;
@@ -45,6 +45,7 @@ export * from './getSlideshowImages';
45
45
  export * from './getSvgUrl';
46
46
  export * from './getTemplateNameFromAttribute';
47
47
  export * from './getThemeByName';
48
+ export * from './getWrapperSizeStyle';
48
49
  export * from './getDisplayTemplateNameFromAttribute';
49
50
  export * from './getTotalFromAttributes';
50
51
  export * from './getTotalFromRelatedFeatures';
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ var React = require('react');
6
6
  var styled = require('styled-components');
7
7
  var charts = require('@evergis/charts');
8
8
  var api = require('@evergis/api');
9
- var Gradient = require('javascript-color-gradient');
10
9
  var color$1 = require('@evergis/color');
11
10
  var dateFns = require('date-fns');
12
11
  var lodash = require('lodash');
@@ -3564,13 +3563,26 @@ const GRADIENT_COLORS = [
3564
3563
  "#A1E062",
3565
3564
  "#51D8A5",
3566
3565
  ];
3567
- const getGradientColors = (colorsCount) => {
3568
- return new Gradient()
3569
- .setColorGradient(...GRADIENT_COLORS)
3570
- .setMidpoint(colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount + 10)
3571
- .getColors()
3572
- .slice(0, colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount);
3566
+ const HEX_RRGGBB_LENGTH = 7;
3567
+ /**
3568
+ * Растягивает палитру на нужное количество цветов: опорные цвета равномерно
3569
+ * раскладываются по шкале, недостающие интерполируются между ними.
3570
+ * @param colors - опорные цвета палитры в hex
3571
+ * @param count - требуемое количество цветов
3572
+ * @returns массив ровно из count цветов
3573
+ */
3574
+ const stretchPalette = (colors, count) => {
3575
+ if (!colors?.length || count <= 0)
3576
+ return [];
3577
+ if (colors.length === 1)
3578
+ return Array.from({ length: count }, () => colors[0]);
3579
+ const scale = new color$1.ColorScale(colors.map((color, index) => [index / (colors.length - 1), color]));
3580
+ return Array.from({ length: count }, (_, index) => {
3581
+ const color = scale.getColor(count === 1 ? 0 : index / (count - 1));
3582
+ return color ? new color$1.Color(color).toString("hex").slice(0, HEX_RRGGBB_LENGTH) : colors[colors.length - 1];
3583
+ });
3573
3584
  };
3585
+ const getGradientColors = (colorsCount) => stretchPalette(GRADIENT_COLORS, colorsCount === undefined || colorsCount < GRADIENT_COLORS.length ? GRADIENT_COLORS.length : colorsCount);
3574
3586
  /**
3575
3587
  * Converts HSL hue value to RGB
3576
3588
  * @param p - lower bound
@@ -6407,11 +6419,11 @@ const getChartMarkers = (items, markers, dataSources) => {
6407
6419
 
6408
6420
  const ContainersGroupContainer = React.memo(({ elementConfig, type, renderElement }) => {
6409
6421
  const { expandedContainers } = useWidgetContext(type);
6410
- const { id, children, options } = elementConfig || {};
6411
- const { column, expandable, expanded } = options || {};
6422
+ const { id, style, children, options } = elementConfig || {};
6423
+ const { column, expandable, expanded, width, height } = options || {};
6412
6424
  const isColumn = column === undefined || column;
6413
6425
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
6414
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, isColumn: isColumn, children: jsxRuntime.jsx(ContainerChildren, { type: type, items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
6426
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, isColumn: isColumn, style: getWrapperSizeStyle(style, width, height), children: jsxRuntime.jsx(ContainerChildren, { type: type, items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
6415
6427
  });
6416
6428
 
6417
6429
  const ChartLegendContainer = styled(uilibGl.Flex) `
@@ -6592,7 +6604,8 @@ const useRenderContainer = ({ elementConfig, type, renderElement, renderBody, })
6592
6604
  };
6593
6605
 
6594
6606
  const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) => {
6595
- const renderBody = React.useCallback(({ id, value, style, hasUnits, render }) => (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), []);
6607
+ const { width, height } = elementConfig?.options || {};
6608
+ const renderBody = React.useCallback(({ id, value, style, hasUnits, render }) => (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: getWrapperSizeStyle({ ...BASE_CONTAINER_STYLE, ...style }, width, height), children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), [width, height]);
6596
6609
  const { renderContainer, attributesToRender } = useRenderContainer({
6597
6610
  type,
6598
6611
  elementConfig,
@@ -6603,7 +6616,8 @@ const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) =
6603
6616
  });
6604
6617
 
6605
6618
  const TwoColumnContainer = React.memo(({ elementConfig, type, renderElement }) => {
6606
- const renderBody = React.useCallback(({ id, value, style, hasIcon, hasUnits, render }) => (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style: style, children: [jsxRuntime.jsxs(ContainerAlias, { children: [hasIcon && (jsxRuntime.jsx(ContainerAliasIcon, { children: render({ id: "icon" }) })), render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { big: true, children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), []);
6619
+ const { width, height } = elementConfig?.options || {};
6620
+ const renderBody = React.useCallback(({ id, value, style, hasIcon, hasUnits, render }) => (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: [jsxRuntime.jsxs(ContainerAlias, { children: [hasIcon && (jsxRuntime.jsx(ContainerAliasIcon, { children: render({ id: "icon" }) })), render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { big: true, children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] })), [width, height]);
6607
6621
  const { renderContainer, attributesToRender } = useRenderContainer({
6608
6622
  type,
6609
6623
  elementConfig,
@@ -6789,7 +6803,7 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
6789
6803
  });
6790
6804
  const { attributes } = layerInfo?.configuration?.attributesConfiguration || {};
6791
6805
  const { id, options, children, style } = elementConfig || {};
6792
- const { maxValue, showTotal, relatedDataSource, expandable, expanded } = options || {};
6806
+ const { maxValue, showTotal, relatedDataSource, expandable, expanded, width, height } = options || {};
6793
6807
  const valueElement = children?.find(item => item.id === "value");
6794
6808
  const unitsElement = children?.find(item => item.id === "units");
6795
6809
  const { sliceItems, checkIsSliced, showMore, onShowMore } = useShownOtherItems(options);
@@ -6822,7 +6836,7 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
6822
6836
  return jsxRuntime.jsx(DataSourceError, { name: elementConfig.templateName });
6823
6837
  }
6824
6838
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
6825
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsxs(DataSourceProgressContainerWrapper, { id: id, style: style, children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsxRuntime.jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
6839
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsxs(DataSourceProgressContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: [sliceItems(dataSource?.features)?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { type: type, index: index, feature: feature, config: config, elementConfig: elementConfig, maxValue: currentMaxValue, innerComponent: innerComponent }, index))), checkIsSliced(dataSource?.features) && (jsxRuntime.jsx(ContainerToggler, { toggled: showMore, onClick: onShowMore, children: showMore ? t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) : t("showAll", {
6826
6840
  ns: "dashboard",
6827
6841
  defaultValue: "Показать все",
6828
6842
  }) })), showTotal && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.Divider, {}), jsxRuntime.jsxs(ProgressTotal, { children: [jsxRuntime.jsx(ProgressTotalTitle, { children: t("total", { ns: "dashboard", defaultValue: "Итого" }) }), jsxRuntime.jsxs(ProgressValue, { children: [totalValue, jsxRuntime.jsx(ProgressUnits, { children: totalUnits })] })] })] }))] })) : (jsxRuntime.jsx(ContainerLoading, {})), jsxRuntime.jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type })] }));
@@ -7049,7 +7063,7 @@ const FiltersContainer = React.memo(({ elementConfig, config, type, renderElemen
7049
7063
  const { currentPage } = useWidgetPage(type);
7050
7064
  const { filters: configFilters } = currentPage;
7051
7065
  const { id, style, options } = elementConfig || {};
7052
- const { padding, bgColor, fontColor, fontSize, expandable, expanded } = options || {};
7066
+ const { padding, bgColor, fontColor, fontSize, expandable, expanded, width, height } = options || {};
7053
7067
  const isLoading = React.useMemo(() => checkIsLoading(dataSources, config, configFilters), [configFilters, config, dataSources]);
7054
7068
  const filterItems = React.useMemo(() => elementConfig?.children?.filter(child => child.options?.filterName), [elementConfig?.children]);
7055
7069
  const renderFilter = React.useCallback((filter, index) => {
@@ -7058,7 +7072,7 @@ const FiltersContainer = React.memo(({ elementConfig, config, type, renderElemen
7058
7072
  }, [config, type]);
7059
7073
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7060
7074
  const selectedItems = React.useMemo(() => getFilterSelectedItems(filterItems, filters, configFilters), [configFilters, filters, filterItems]);
7061
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.Flex, { mb: !isVisible && selectedItems.length ? "2rem" : 0, children: jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }) }), isLoading && jsxRuntime.jsx(ContainerLoading, {}), !isLoading && isVisible && (jsxRuntime.jsx(FiltersContainerWrapper, { id: id, style: style, "$padding": padding, "$bgColor": bgColor, "$fontSize": fontSize, "$fontColor": fontColor, children: filterItems?.map(renderFilter) })), jsxRuntime.jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type, filter: filterItems[0]?.options?.filterName })] }));
7075
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.Flex, { mb: !isVisible && selectedItems.length ? "2rem" : 0, children: jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }) }), isLoading && jsxRuntime.jsx(ContainerLoading, {}), !isLoading && isVisible && (jsxRuntime.jsx(FiltersContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), "$padding": padding, "$bgColor": bgColor, "$fontSize": fontSize, "$fontColor": fontColor, children: filterItems?.map(renderFilter) })), jsxRuntime.jsx(HiddenTitleItems, { elementConfig: elementConfig, config: config, type: type, filter: filterItems[0]?.options?.filterName })] }));
7062
7076
  });
7063
7077
 
7064
7078
  const DefaultAttributesContainer = React.memo(({ type, renderElement }) => {
@@ -7239,7 +7253,7 @@ const IconContainer = React.memo(({ elementConfig, renderElement }) => {
7239
7253
  const DataSourceContainer = React.memo(({ config, elementConfig, type, innerComponent, renderElement }) => {
7240
7254
  const { dataSources, expandedContainers } = useWidgetContext(type);
7241
7255
  const { id, style, options } = elementConfig || {};
7242
- const { column = true, relatedDataSource, expandable, expanded } = options || {};
7256
+ const { column = true, relatedDataSource, expandable, expanded, width, height } = options || {};
7243
7257
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7244
7258
  const dataSource = React.useMemo(() => dataSources?.find(({ name }) => name === relatedDataSource), [dataSources, relatedDataSource]);
7245
7259
  if (!relatedDataSource)
@@ -7248,7 +7262,7 @@ const DataSourceContainer = React.memo(({ config, elementConfig, type, innerComp
7248
7262
  return jsxRuntime.jsx(DataSourceError, { name: elementConfig.templateName });
7249
7263
  }
7250
7264
  const isLoading = !dataSource?.features;
7251
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsx(Container, { id: id, isColumn: column, style: { height: isLoading ? "3rem" : "auto", ...style }, children: dataSource.features?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { index: index, type: type, config: config, feature: feature, elementConfig: elementConfig, innerComponent: innerComponent }, index))) })) : (jsxRuntime.jsx(ContainerLoading, {}))] }));
7265
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), !isVisible ? null : dataSource ? (jsxRuntime.jsx(Container, { id: id, isColumn: column, style: getWrapperSizeStyle({ height: isLoading ? "3rem" : "auto", ...style }, width, height), children: dataSource.features?.map((feature, index) => (jsxRuntime.jsx(DataSourceInnerContainer, { index: index, type: type, config: config, feature: feature, elementConfig: elementConfig, innerComponent: innerComponent }, index))) })) : (jsxRuntime.jsx(ContainerLoading, {}))] }));
7252
7266
  });
7253
7267
 
7254
7268
  const SvgContainerColorMixin = styled.css `
@@ -7387,7 +7401,7 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
7387
7401
  dataSources,
7388
7402
  });
7389
7403
  const { id, style, options } = elementConfig || {};
7390
- const { expandable, expanded } = options || {};
7404
+ const { expandable, expanded, width, height } = options || {};
7391
7405
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7392
7406
  const render = React.useMemo(() => getRenderElement({
7393
7407
  config,
@@ -7411,7 +7425,7 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
7411
7425
  pageIndex,
7412
7426
  type,
7413
7427
  ]);
7414
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: render }), isVisible && (jsxRuntime.jsxs(Container, { style: style, children: [jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: render({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { children: render({
7428
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: render }), isVisible && (jsxRuntime.jsxs(Container, { style: getWrapperSizeStyle(style, width, height), children: [jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: render({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { children: render({
7415
7429
  id: "slideshow",
7416
7430
  wrap: false,
7417
7431
  }) })] }))] }));
@@ -7420,9 +7434,9 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
7420
7434
  const CameraContainer = React.memo(({ elementConfig, type, renderElement }) => {
7421
7435
  const { expandedContainers } = useWidgetContext(type);
7422
7436
  const { id, options, style } = elementConfig || {};
7423
- const { expandable, expanded } = options || {};
7437
+ const { expandable, expanded, width, height } = options || {};
7424
7438
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7425
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsxs(Container, { id: id, style: style, children: [jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { children: renderElement({ id: "value", wrap: false }) })] }))] }));
7439
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsxs(Container, { id: id, style: getWrapperSizeStyle(style, width, height), children: [jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { children: renderElement({ id: "value", wrap: false }) })] }))] }));
7426
7440
  });
7427
7441
 
7428
7442
  const TabAnchor = styled.div `
@@ -7686,7 +7700,7 @@ const LayersContainer = React.memo(({ type, elementConfig, renderElement }) => {
7686
7700
  const { expandedContainers } = useWidgetContext(type);
7687
7701
  const { currentPage } = useWidgetPage(type);
7688
7702
  const { id, options, style } = elementConfig || {};
7689
- const { layerNames, expandable, expanded } = options || {};
7703
+ const { layerNames, expandable, expanded, width, height } = options || {};
7690
7704
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7691
7705
  const layers = React.useMemo(() => {
7692
7706
  if (!currentPage?.layers)
@@ -7695,7 +7709,7 @@ const LayersContainer = React.memo(({ type, elementConfig, renderElement }) => {
7695
7709
  return currentPage.layers;
7696
7710
  return currentPage.layers.filter(({ name }) => layerNames.includes(name));
7697
7711
  }, [currentPage?.layers, layerNames]);
7698
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(LayersContainerWrapper, { id: id, style: style, children: jsxRuntime.jsx(LayerTree, { layers: layers, onlyMainTools: true }) }))] }));
7712
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(LayersContainerWrapper, { id: id, style: getWrapperSizeStyle(style, width, height), children: jsxRuntime.jsx(LayerTree, { layers: layers, onlyMainTools: true }) }))] }));
7699
7713
  });
7700
7714
 
7701
7715
  const ExportPdfContainer = React.memo(({ type, elementConfig }) => {
@@ -7709,9 +7723,9 @@ const ExportPdfContainer = React.memo(({ type, elementConfig }) => {
7709
7723
  const UploadContainer = React.memo(({ type, elementConfig, renderElement }) => {
7710
7724
  const { expandedContainers } = useWidgetContext(type);
7711
7725
  const { id, options } = elementConfig || {};
7712
- const { expandable, expanded } = options || {};
7726
+ const { expandable, expanded, width, height } = options || {};
7713
7727
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
7714
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && renderElement({ id: "uploader", wrap: false })] }));
7728
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(uilibGl.Flex, { column: true, style: getWrapperSizeStyle({ width: "100%" }, width, height), children: renderElement({ id: "uploader", wrap: false }) }))] }));
7715
7729
  });
7716
7730
 
7717
7731
  const StatusBadge = styled(uilibGl.Chip) `
@@ -7926,7 +7940,7 @@ const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
7926
7940
  const { currentPage } = useWidgetPage(type);
7927
7941
  const { taskId, runTask, stopTask, status, openLog, loading, isLogDialogOpen, closeLog, log, lastMessage, result, } = usePythonTask();
7928
7942
  const { options } = elementConfig || {};
7929
- const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, } = options || {};
7943
+ const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, width, height, } = options || {};
7930
7944
  const { setNotificationDismissed } = useTaskNotifications({
7931
7945
  enabled: !!useNotifications,
7932
7946
  suppressed: isLogDialogOpen,
@@ -7966,7 +7980,7 @@ const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
7966
7980
  return runTask({ resourceId, parameters: newParams, script, fileName, methodName });
7967
7981
  }));
7968
7982
  }, [attributes, currentPage.filters, dataSources, ewktGeometry, layerInfo, projectDataSources, relatedResources, runTask, selectedFilters, stopTask, taskId]);
7969
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: center ? "center" : "flex-start", children: [jsxRuntime.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) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.IconButton, { kind: "info", onClick: openLog }), jsxRuntime.jsx(LogDialog, { logs: log, status: status, statusColors: statusColors, isOpen: isLogDialogOpen, onClose: onCloseLog, onMinimize: useNotifications ? onMinimizeLog : undefined })] }))] })] }));
7983
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: center ? "center" : "flex-start", style: getWrapperSizeStyle(undefined, width, height), children: [jsxRuntime.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) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(uilibGl.IconButton, { kind: "info", onClick: openLog }), jsxRuntime.jsx(LogDialog, { logs: log, status: status, statusColors: statusColors, isOpen: isLogDialogOpen, onClose: onCloseLog, onMinimize: useNotifications ? onMinimizeLog : undefined })] }))] })] }));
7970
7984
  });
7971
7985
 
7972
7986
  const EditContainer = ({ type, elementConfig, renderElement }) => {
@@ -8707,7 +8721,7 @@ const AttachmentContainer = React.memo(({ type, elementConfig, renderElement })
8707
8721
  const { expandedContainers } = useWidgetContext(type);
8708
8722
  const { items, visibleItems, viewMode, setViewMode, showMore, setShowMore, hasMore, hiddenCount } = useAttachmentContainer({ type, elementConfig });
8709
8723
  const { id, style, options } = elementConfig || {};
8710
- const { expandable, expanded } = options || {};
8724
+ const { expandable, expanded, width, height } = options || {};
8711
8725
  const [previewIndex, setPreviewIndex] = React.useState(null);
8712
8726
  const previewImages = useAttachmentPreviewImages({ items, active: previewIndex !== null });
8713
8727
  const handlePreview = React.useCallback((link) => {
@@ -8718,7 +8732,7 @@ const AttachmentContainer = React.memo(({ type, elementConfig, renderElement })
8718
8732
  const handleClosePreview = React.useCallback(() => setPreviewIndex(null), []);
8719
8733
  const handleShowMore = React.useCallback(() => setShowMore(true), [setShowMore]);
8720
8734
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
8721
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, style: { ...BASE_CONTAINER_STYLE, ...style }, children: jsxRuntime.jsxs(uilibGl.Flex, { column: true, children: [jsxRuntime.jsx(AttachmentsHeader, { alias: renderElement?.({ id: "alias" }), count: items.length, viewMode: viewMode, onChangeViewMode: setViewMode }), jsxRuntime.jsx(AttachmentsContent, { children: viewMode === "grid" ? (jsxRuntime.jsx(AttachmentsGrid, { items: visibleItems, isEdit: false, onPreview: handlePreview })) : (jsxRuntime.jsx(AttachmentsList, { items: visibleItems, isEdit: false, onPreview: handlePreview })) }), hasMore && !showMore && (jsxRuntime.jsx(ShowMoreButton, { hiddenCount: hiddenCount, onClick: handleShowMore })), previewIndex !== null && (jsxRuntime.jsx(uilibGl.Preview, { images: previewImages, initialIndex: previewIndex, isOpen: previewIndex !== null, onClose: handleClosePreview, errorTitleText: t("attachments.resourceUnavailable", {
8735
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, style: getWrapperSizeStyle({ ...BASE_CONTAINER_STYLE, ...style }, width, height), children: jsxRuntime.jsxs(uilibGl.Flex, { column: true, children: [jsxRuntime.jsx(AttachmentsHeader, { alias: renderElement?.({ id: "alias" }), count: items.length, viewMode: viewMode, onChangeViewMode: setViewMode }), jsxRuntime.jsx(AttachmentsContent, { children: viewMode === "grid" ? (jsxRuntime.jsx(AttachmentsGrid, { items: visibleItems, isEdit: false, onPreview: handlePreview })) : (jsxRuntime.jsx(AttachmentsList, { items: visibleItems, isEdit: false, onPreview: handlePreview })) }), hasMore && !showMore && (jsxRuntime.jsx(ShowMoreButton, { hiddenCount: hiddenCount, onClick: handleShowMore })), previewIndex !== null && (jsxRuntime.jsx(uilibGl.Preview, { images: previewImages, initialIndex: previewIndex, isOpen: previewIndex !== null, onClose: handleClosePreview, errorTitleText: t("attachments.resourceUnavailable", {
8722
8736
  ns: "common",
8723
8737
  defaultValue: "Ресурс недоступен",
8724
8738
  }) }, previewIndex))] }) }))] }));
@@ -10268,7 +10282,7 @@ const getDashboardHeader = (templateName) => {
10268
10282
  };
10269
10283
 
10270
10284
  const getDataFromAttributes = (t, config, attributes) => {
10271
- const colors = config?.options?.colors || FEATURE_CARD_DEFAULT_COLORS;
10285
+ const colors = stretchPalette(config?.options?.colors || FEATURE_CARD_DEFAULT_COLORS, config?.children?.length || 0);
10272
10286
  const data = config?.children?.map(({ attributeName }, index) => {
10273
10287
  const attribute = attributes?.find(item => item.attributeName === attributeName);
10274
10288
  return {
@@ -10320,12 +10334,8 @@ const getDataFromRelatedFeatures = ({ t, config, filters, relatedConfig, dataSou
10320
10334
  if (isOtherSliced) {
10321
10335
  data = data.slice(0, config?.options?.otherItems);
10322
10336
  }
10323
- const gradientColors = colors?.length === 1 ? [colors[0], colors[0]] : colors;
10324
- const gradientArray = relatedConfig.chartAxis && colors?.length < data.length
10325
- ? new Gradient()
10326
- .setColorGradient(...gradientColors)
10327
- .setMidpoint(data.length)
10328
- .getColors()
10337
+ const gradientArray = relatedConfig.chartAxis
10338
+ ? stretchPalette(colors, data.length)
10329
10339
  : colors;
10330
10340
  const filter = getConfigFilter(relatedConfig?.filterName, filters);
10331
10341
  const result = data.reduce((acc, feature, index) => {
@@ -12047,6 +12057,18 @@ const getThemeByName = (themeName) => {
12047
12057
  return themeName === exports.ThemeName.Dark ? uilibGl.darkTheme : uilibGl.defaultTheme;
12048
12058
  };
12049
12059
 
12060
+ /**
12061
+ * Мержит `width`/`height` из options контейнера в inline-style его корневой обёртки.
12062
+ *
12063
+ * Значения размера из options имеют приоритет над одноимёнными полями `style`.
12064
+ * Поле добавляется только когда задано — иначе `style` остаётся нетронутым.
12065
+ */
12066
+ const getWrapperSizeStyle = (style, width, height) => ({
12067
+ ...style,
12068
+ ...(width != null && { width }),
12069
+ ...(height != null && { height }),
12070
+ });
12071
+
12050
12072
  const getDisplayTemplateNameFromAttribute = (attribute) => {
12051
12073
  if (attribute?.subType === api.StringSubType.Attachments) {
12052
12074
  return exports.ContainerTemplate.Attachment;
@@ -14661,6 +14683,7 @@ exports.getTemplateNameFromAttribute = getTemplateNameFromAttribute;
14661
14683
  exports.getThemeByName = getThemeByName;
14662
14684
  exports.getTotalFromAttributes = getTotalFromAttributes;
14663
14685
  exports.getTotalFromRelatedFeatures = getTotalFromRelatedFeatures;
14686
+ exports.getWrapperSizeStyle = getWrapperSizeStyle;
14664
14687
  exports.hexToRgba = hexToRgba;
14665
14688
  exports.isEmptyElementValue = isEmptyElementValue;
14666
14689
  exports.isEmptyValue = isEmptyValue;
@@ -14685,6 +14708,7 @@ exports.removeDataSource = removeDataSource;
14685
14708
  exports.rgbToHex = rgbToHex;
14686
14709
  exports.roundTotalSum = roundTotalSum;
14687
14710
  exports.sliceShownOtherItems = sliceShownOtherItems;
14711
+ exports.stretchPalette = stretchPalette;
14688
14712
  exports.timeOptions = timeOptions;
14689
14713
  exports.toRenderableValue = toRenderableValue;
14690
14714
  exports.tooltipNameFromAttributes = tooltipNameFromAttributes;