@evergis/react 4.0.91 → 4.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Dashboard/componentTypes.d.ts +12 -12
- package/dist/components/Dashboard/utils/getWrapperSizeStyle.d.ts +8 -0
- package/dist/components/Dashboard/utils/index.d.ts +1 -0
- package/dist/index.js +38 -23
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +38 -24
- package/dist/react.esm.js.map +1 -1
- package/package.json +5 -5
|
@@ -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
|
@@ -6407,11 +6407,11 @@ const getChartMarkers = (items, markers, dataSources) => {
|
|
|
6407
6407
|
|
|
6408
6408
|
const ContainersGroupContainer = React.memo(({ elementConfig, type, renderElement }) => {
|
|
6409
6409
|
const { expandedContainers } = useWidgetContext(type);
|
|
6410
|
-
const { id, children, options } = elementConfig || {};
|
|
6411
|
-
const { column, expandable, expanded } = options || {};
|
|
6410
|
+
const { id, style, children, options } = elementConfig || {};
|
|
6411
|
+
const { column, expandable, expanded, width, height } = options || {};
|
|
6412
6412
|
const isColumn = column === undefined || column;
|
|
6413
6413
|
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 }) }))] }));
|
|
6414
|
+
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
6415
|
});
|
|
6416
6416
|
|
|
6417
6417
|
const ChartLegendContainer = styled(uilibGl.Flex) `
|
|
@@ -6592,7 +6592,8 @@ const useRenderContainer = ({ elementConfig, type, renderElement, renderBody, })
|
|
|
6592
6592
|
};
|
|
6593
6593
|
|
|
6594
6594
|
const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
6595
|
-
const
|
|
6595
|
+
const { width, height } = elementConfig?.options || {};
|
|
6596
|
+
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
6597
|
const { renderContainer, attributesToRender } = useRenderContainer({
|
|
6597
6598
|
type,
|
|
6598
6599
|
elementConfig,
|
|
@@ -6603,7 +6604,8 @@ const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) =
|
|
|
6603
6604
|
});
|
|
6604
6605
|
|
|
6605
6606
|
const TwoColumnContainer = React.memo(({ elementConfig, type, renderElement }) => {
|
|
6606
|
-
const
|
|
6607
|
+
const { width, height } = elementConfig?.options || {};
|
|
6608
|
+
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
6609
|
const { renderContainer, attributesToRender } = useRenderContainer({
|
|
6608
6610
|
type,
|
|
6609
6611
|
elementConfig,
|
|
@@ -6789,7 +6791,7 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
|
|
|
6789
6791
|
});
|
|
6790
6792
|
const { attributes } = layerInfo?.configuration?.attributesConfiguration || {};
|
|
6791
6793
|
const { id, options, children, style } = elementConfig || {};
|
|
6792
|
-
const { maxValue, showTotal, relatedDataSource, expandable, expanded } = options || {};
|
|
6794
|
+
const { maxValue, showTotal, relatedDataSource, expandable, expanded, width, height } = options || {};
|
|
6793
6795
|
const valueElement = children?.find(item => item.id === "value");
|
|
6794
6796
|
const unitsElement = children?.find(item => item.id === "units");
|
|
6795
6797
|
const { sliceItems, checkIsSliced, showMore, onShowMore } = useShownOtherItems(options);
|
|
@@ -6822,7 +6824,7 @@ const DataSourceProgressContainer = React.memo(({ config, elementConfig, type, i
|
|
|
6822
6824
|
return jsxRuntime.jsx(DataSourceError, { name: elementConfig.templateName });
|
|
6823
6825
|
}
|
|
6824
6826
|
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", {
|
|
6827
|
+
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
6828
|
ns: "dashboard",
|
|
6827
6829
|
defaultValue: "Показать все",
|
|
6828
6830
|
}) })), 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 +7051,7 @@ const FiltersContainer = React.memo(({ elementConfig, config, type, renderElemen
|
|
|
7049
7051
|
const { currentPage } = useWidgetPage(type);
|
|
7050
7052
|
const { filters: configFilters } = currentPage;
|
|
7051
7053
|
const { id, style, options } = elementConfig || {};
|
|
7052
|
-
const { padding, bgColor, fontColor, fontSize, expandable, expanded } = options || {};
|
|
7054
|
+
const { padding, bgColor, fontColor, fontSize, expandable, expanded, width, height } = options || {};
|
|
7053
7055
|
const isLoading = React.useMemo(() => checkIsLoading(dataSources, config, configFilters), [configFilters, config, dataSources]);
|
|
7054
7056
|
const filterItems = React.useMemo(() => elementConfig?.children?.filter(child => child.options?.filterName), [elementConfig?.children]);
|
|
7055
7057
|
const renderFilter = React.useCallback((filter, index) => {
|
|
@@ -7058,7 +7060,7 @@ const FiltersContainer = React.memo(({ elementConfig, config, type, renderElemen
|
|
|
7058
7060
|
}, [config, type]);
|
|
7059
7061
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
7060
7062
|
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 })] }));
|
|
7063
|
+
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
7064
|
});
|
|
7063
7065
|
|
|
7064
7066
|
const DefaultAttributesContainer = React.memo(({ type, renderElement }) => {
|
|
@@ -7239,7 +7241,7 @@ const IconContainer = React.memo(({ elementConfig, renderElement }) => {
|
|
|
7239
7241
|
const DataSourceContainer = React.memo(({ config, elementConfig, type, innerComponent, renderElement }) => {
|
|
7240
7242
|
const { dataSources, expandedContainers } = useWidgetContext(type);
|
|
7241
7243
|
const { id, style, options } = elementConfig || {};
|
|
7242
|
-
const { column = true, relatedDataSource, expandable, expanded } = options || {};
|
|
7244
|
+
const { column = true, relatedDataSource, expandable, expanded, width, height } = options || {};
|
|
7243
7245
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
7244
7246
|
const dataSource = React.useMemo(() => dataSources?.find(({ name }) => name === relatedDataSource), [dataSources, relatedDataSource]);
|
|
7245
7247
|
if (!relatedDataSource)
|
|
@@ -7248,7 +7250,7 @@ const DataSourceContainer = React.memo(({ config, elementConfig, type, innerComp
|
|
|
7248
7250
|
return jsxRuntime.jsx(DataSourceError, { name: elementConfig.templateName });
|
|
7249
7251
|
}
|
|
7250
7252
|
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, {}))] }));
|
|
7253
|
+
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
7254
|
});
|
|
7253
7255
|
|
|
7254
7256
|
const SvgContainerColorMixin = styled.css `
|
|
@@ -7387,7 +7389,7 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
|
|
|
7387
7389
|
dataSources,
|
|
7388
7390
|
});
|
|
7389
7391
|
const { id, style, options } = elementConfig || {};
|
|
7390
|
-
const { expandable, expanded } = options || {};
|
|
7392
|
+
const { expandable, expanded, width, height } = options || {};
|
|
7391
7393
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
7392
7394
|
const render = React.useMemo(() => getRenderElement({
|
|
7393
7395
|
config,
|
|
@@ -7411,7 +7413,7 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
|
|
|
7411
7413
|
pageIndex,
|
|
7412
7414
|
type,
|
|
7413
7415
|
]);
|
|
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({
|
|
7416
|
+
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
7417
|
id: "slideshow",
|
|
7416
7418
|
wrap: false,
|
|
7417
7419
|
}) })] }))] }));
|
|
@@ -7420,9 +7422,9 @@ const SlideshowContainer = React.memo(({ config, elementConfig, type }) => {
|
|
|
7420
7422
|
const CameraContainer = React.memo(({ elementConfig, type, renderElement }) => {
|
|
7421
7423
|
const { expandedContainers } = useWidgetContext(type);
|
|
7422
7424
|
const { id, options, style } = elementConfig || {};
|
|
7423
|
-
const { expandable, expanded } = options || {};
|
|
7425
|
+
const { expandable, expanded, width, height } = options || {};
|
|
7424
7426
|
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 }) })] }))] }));
|
|
7427
|
+
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
7428
|
});
|
|
7427
7429
|
|
|
7428
7430
|
const TabAnchor = styled.div `
|
|
@@ -7686,7 +7688,7 @@ const LayersContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
7686
7688
|
const { expandedContainers } = useWidgetContext(type);
|
|
7687
7689
|
const { currentPage } = useWidgetPage(type);
|
|
7688
7690
|
const { id, options, style } = elementConfig || {};
|
|
7689
|
-
const { layerNames, expandable, expanded } = options || {};
|
|
7691
|
+
const { layerNames, expandable, expanded, width, height } = options || {};
|
|
7690
7692
|
const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
|
|
7691
7693
|
const layers = React.useMemo(() => {
|
|
7692
7694
|
if (!currentPage?.layers)
|
|
@@ -7695,7 +7697,7 @@ const LayersContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
7695
7697
|
return currentPage.layers;
|
|
7696
7698
|
return currentPage.layers.filter(({ name }) => layerNames.includes(name));
|
|
7697
7699
|
}, [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 }) }))] }));
|
|
7700
|
+
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
7701
|
});
|
|
7700
7702
|
|
|
7701
7703
|
const ExportPdfContainer = React.memo(({ type, elementConfig }) => {
|
|
@@ -7709,9 +7711,9 @@ const ExportPdfContainer = React.memo(({ type, elementConfig }) => {
|
|
|
7709
7711
|
const UploadContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
7710
7712
|
const { expandedContainers } = useWidgetContext(type);
|
|
7711
7713
|
const { id, options } = elementConfig || {};
|
|
7712
|
-
const { expandable, expanded } = options || {};
|
|
7714
|
+
const { expandable, expanded, width, height } = options || {};
|
|
7713
7715
|
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 })] }));
|
|
7716
|
+
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
7717
|
});
|
|
7716
7718
|
|
|
7717
7719
|
const StatusBadge = styled(uilibGl.Chip) `
|
|
@@ -7926,7 +7928,7 @@ const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
7926
7928
|
const { currentPage } = useWidgetPage(type);
|
|
7927
7929
|
const { taskId, runTask, stopTask, status, openLog, loading, isLogDialogOpen, closeLog, log, lastMessage, result, } = usePythonTask();
|
|
7928
7930
|
const { options } = elementConfig || {};
|
|
7929
|
-
const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, } = options || {};
|
|
7931
|
+
const { title, relatedResources, center, icon, statusColors, responseFilters, useNotifications, width, height, } = options || {};
|
|
7930
7932
|
const { setNotificationDismissed } = useTaskNotifications({
|
|
7931
7933
|
enabled: !!useNotifications,
|
|
7932
7934
|
suppressed: isLogDialogOpen,
|
|
@@ -7966,7 +7968,7 @@ const TaskContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
|
7966
7968
|
return runTask({ resourceId, parameters: newParams, script, fileName, methodName });
|
|
7967
7969
|
}));
|
|
7968
7970
|
}, [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 })] }))] })] }));
|
|
7971
|
+
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
7972
|
});
|
|
7971
7973
|
|
|
7972
7974
|
const EditContainer = ({ type, elementConfig, renderElement }) => {
|
|
@@ -8707,7 +8709,7 @@ const AttachmentContainer = React.memo(({ type, elementConfig, renderElement })
|
|
|
8707
8709
|
const { expandedContainers } = useWidgetContext(type);
|
|
8708
8710
|
const { items, visibleItems, viewMode, setViewMode, showMore, setShowMore, hasMore, hiddenCount } = useAttachmentContainer({ type, elementConfig });
|
|
8709
8711
|
const { id, style, options } = elementConfig || {};
|
|
8710
|
-
const { expandable, expanded } = options || {};
|
|
8712
|
+
const { expandable, expanded, width, height } = options || {};
|
|
8711
8713
|
const [previewIndex, setPreviewIndex] = React.useState(null);
|
|
8712
8714
|
const previewImages = useAttachmentPreviewImages({ items, active: previewIndex !== null });
|
|
8713
8715
|
const handlePreview = React.useCallback((link) => {
|
|
@@ -8718,7 +8720,7 @@ const AttachmentContainer = React.memo(({ type, elementConfig, renderElement })
|
|
|
8718
8720
|
const handleClosePreview = React.useCallback(() => setPreviewIndex(null), []);
|
|
8719
8721
|
const handleShowMore = React.useCallback(() => setShowMore(true), [setShowMore]);
|
|
8720
8722
|
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", {
|
|
8723
|
+
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
8724
|
ns: "common",
|
|
8723
8725
|
defaultValue: "Ресурс недоступен",
|
|
8724
8726
|
}) }, previewIndex))] }) }))] }));
|
|
@@ -12047,6 +12049,18 @@ const getThemeByName = (themeName) => {
|
|
|
12047
12049
|
return themeName === exports.ThemeName.Dark ? uilibGl.darkTheme : uilibGl.defaultTheme;
|
|
12048
12050
|
};
|
|
12049
12051
|
|
|
12052
|
+
/**
|
|
12053
|
+
* Мержит `width`/`height` из options контейнера в inline-style его корневой обёртки.
|
|
12054
|
+
*
|
|
12055
|
+
* Значения размера из options имеют приоритет над одноимёнными полями `style`.
|
|
12056
|
+
* Поле добавляется только когда задано — иначе `style` остаётся нетронутым.
|
|
12057
|
+
*/
|
|
12058
|
+
const getWrapperSizeStyle = (style, width, height) => ({
|
|
12059
|
+
...style,
|
|
12060
|
+
...(width != null && { width }),
|
|
12061
|
+
...(height != null && { height }),
|
|
12062
|
+
});
|
|
12063
|
+
|
|
12050
12064
|
const getDisplayTemplateNameFromAttribute = (attribute) => {
|
|
12051
12065
|
if (attribute?.subType === api.StringSubType.Attachments) {
|
|
12052
12066
|
return exports.ContainerTemplate.Attachment;
|
|
@@ -14661,6 +14675,7 @@ exports.getTemplateNameFromAttribute = getTemplateNameFromAttribute;
|
|
|
14661
14675
|
exports.getThemeByName = getThemeByName;
|
|
14662
14676
|
exports.getTotalFromAttributes = getTotalFromAttributes;
|
|
14663
14677
|
exports.getTotalFromRelatedFeatures = getTotalFromRelatedFeatures;
|
|
14678
|
+
exports.getWrapperSizeStyle = getWrapperSizeStyle;
|
|
14664
14679
|
exports.hexToRgba = hexToRgba;
|
|
14665
14680
|
exports.isEmptyElementValue = isEmptyElementValue;
|
|
14666
14681
|
exports.isEmptyValue = isEmptyValue;
|