@evergis/react 4.0.59 → 4.0.62

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.
Files changed (63) hide show
  1. package/dist/components/Dashboard/branded.d.ts +52 -0
  2. package/dist/components/Dashboard/componentTypes.d.ts +571 -0
  3. package/dist/components/Dashboard/components/TextTrim/index.d.ts +2 -0
  4. package/dist/components/Dashboard/components/TextTrim/styled.d.ts +4 -0
  5. package/dist/components/Dashboard/containers/AddFeatureContainer/index.d.ts +2 -2
  6. package/dist/components/Dashboard/containers/AttachmentContainer/index.d.ts +2 -2
  7. package/dist/components/Dashboard/containers/CameraContainer/index.d.ts +2 -2
  8. package/dist/components/Dashboard/containers/ChartContainer/index.d.ts +2 -2
  9. package/dist/components/Dashboard/containers/ContainersGroupContainer/index.d.ts +2 -2
  10. package/dist/components/Dashboard/containers/DataSourceContainer/index.d.ts +2 -2
  11. package/dist/components/Dashboard/containers/DataSourceProgressContainer/index.d.ts +2 -2
  12. package/dist/components/Dashboard/containers/DefaultAttributesContainer/index.d.ts +2 -2
  13. package/dist/components/Dashboard/containers/DividerContainer/index.d.ts +2 -2
  14. package/dist/components/Dashboard/containers/EditContainer/components/EditAttachmentContainer.d.ts +2 -2
  15. package/dist/components/Dashboard/containers/EditContainer/components/EditBooleanContainer.d.ts +2 -2
  16. package/dist/components/Dashboard/containers/EditContainer/components/EditCheckboxContainer.d.ts +2 -2
  17. package/dist/components/Dashboard/containers/EditContainer/components/EditChipsContainer.d.ts +2 -2
  18. package/dist/components/Dashboard/containers/EditContainer/components/EditDateContainer.d.ts +2 -2
  19. package/dist/components/Dashboard/containers/EditContainer/components/EditDropdownContainer.d.ts +2 -2
  20. package/dist/components/Dashboard/containers/EditContainer/components/EditGroupContainer.d.ts +2 -2
  21. package/dist/components/Dashboard/containers/EditContainer/components/EditNumberContainer.d.ts +2 -2
  22. package/dist/components/Dashboard/containers/EditContainer/components/EditStringContainer.d.ts +2 -2
  23. package/dist/components/Dashboard/containers/EditContainer/index.d.ts +2 -2
  24. package/dist/components/Dashboard/containers/ExportPdfContainer/index.d.ts +2 -2
  25. package/dist/components/Dashboard/containers/FiltersContainer/index.d.ts +2 -2
  26. package/dist/components/Dashboard/containers/IconContainer/index.d.ts +2 -2
  27. package/dist/components/Dashboard/containers/ImageContainer/index.d.ts +2 -2
  28. package/dist/components/Dashboard/containers/LayersContainer/index.d.ts +2 -2
  29. package/dist/components/Dashboard/containers/OneColumnContainer/index.d.ts +2 -2
  30. package/dist/components/Dashboard/containers/PagesContainer/index.d.ts +2 -2
  31. package/dist/components/Dashboard/containers/SlideshowContainer/index.d.ts +2 -2
  32. package/dist/components/Dashboard/containers/TabsContainer/index.d.ts +2 -2
  33. package/dist/components/Dashboard/containers/TaskContainer/index.d.ts +2 -2
  34. package/dist/components/Dashboard/containers/TitleContainer/index.d.ts +2 -2
  35. package/dist/components/Dashboard/containers/TwoColumnContainer/index.d.ts +2 -2
  36. package/dist/components/Dashboard/containers/UploadContainer/index.d.ts +2 -2
  37. package/dist/components/Dashboard/containers/registry.d.ts +37 -34
  38. package/dist/components/Dashboard/elements/ElementButton/index.d.ts +2 -2
  39. package/dist/components/Dashboard/elements/ElementCamera/types.d.ts +2 -2
  40. package/dist/components/Dashboard/elements/ElementChart/index.d.ts +2 -2
  41. package/dist/components/Dashboard/elements/ElementChips/index.d.ts +2 -2
  42. package/dist/components/Dashboard/elements/ElementControl/index.d.ts +2 -2
  43. package/dist/components/Dashboard/elements/ElementIcon/index.d.ts +2 -2
  44. package/dist/components/Dashboard/elements/ElementImage/index.d.ts +2 -2
  45. package/dist/components/Dashboard/elements/ElementImage/useElementImage.d.ts +11 -0
  46. package/dist/components/Dashboard/elements/ElementLegend/index.d.ts +2 -4
  47. package/dist/components/Dashboard/elements/ElementLink/index.d.ts +2 -2
  48. package/dist/components/Dashboard/elements/ElementMarkdown/index.d.ts +2 -2
  49. package/dist/components/Dashboard/elements/ElementModal/index.d.ts +2 -2
  50. package/dist/components/Dashboard/elements/ElementSlideshow/types.d.ts +2 -2
  51. package/dist/components/Dashboard/elements/ElementSvg/index.d.ts +2 -6
  52. package/dist/components/Dashboard/elements/ElementTooltip/index.d.ts +2 -2
  53. package/dist/components/Dashboard/elements/ElementUploader/index.d.ts +2 -2
  54. package/dist/components/Dashboard/elements/registry.d.ts +12 -14
  55. package/dist/components/Dashboard/hooks/useWidgetConfig.d.ts +5 -1
  56. package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +12 -1
  57. package/dist/components/Dashboard/hooks/useWidgetPage.d.ts +4 -1
  58. package/dist/components/Dashboard/types.d.ts +198 -93
  59. package/dist/index.js +143 -57
  60. package/dist/index.js.map +1 -1
  61. package/dist/react.esm.js +132 -58
  62. package/dist/react.esm.js.map +1 -1
  63. package/package.json +3 -3
package/dist/react.esm.js CHANGED
@@ -3359,6 +3359,26 @@ Transform.prototype = {
3359
3359
 
3360
3360
  Transform.prototype;
3361
3361
 
3362
+ // ── Конструкторы (single-source casting) ─────────────────────────────────────
3363
+ const asContainerId = (value) => value;
3364
+ const asChartId = (value) => value;
3365
+ const asModalId = (value) => value;
3366
+ const asTabId = (value) => value;
3367
+ const asFilterName = (value) => value;
3368
+ const asLayerName = (value) => value;
3369
+ const asAttributeName = (value) => value;
3370
+ const asDataSourceName = (value) => value;
3371
+ const asResourceId = (value) => value;
3372
+
3373
+ // ──────────────────────────────────────────────────────────────────────────────
3374
+ // ЛИТЕРАЛЫ И CSS-ТОКЕНЫ
3375
+ // ──────────────────────────────────────────────────────────────────────────────
3376
+ /** Список допустимых типов диаграммы. `as const` даёт runtime-доступ для dropdown-ов. */
3377
+ const CHART_TYPES = ["bar", "line", "pie", "stack"];
3378
+ /** Выравнивание текста/блоков. */
3379
+ const ALIGNMENTS = ["left", "center", "right"];
3380
+ /** Режим отображения коллекций. */
3381
+ const VIEW_MODES = ["grid", "list"];
3362
3382
  var ContainerTemplate;
3363
3383
  (function (ContainerTemplate) {
3364
3384
  ContainerTemplate["Pages"] = "Pages";
@@ -4079,6 +4099,17 @@ const ServerNotificationsProvider = ({ url, initialized, apiClient, children })
4079
4099
  }, children: children }));
4080
4100
  };
4081
4101
 
4102
+ /**
4103
+ * Контекст виджет-фрейма. Возвращаемый объект включает поля и {@link DashboardContext},
4104
+ * и {@link FeatureCardContext}, а гибридные (`config`, `isEditing`, `isLoading`, `pageIndex`,
4105
+ * `filters`, `changeFilters`, `dataSources`, `expandContainer`, `expandedContainers`,
4106
+ * `selectedTabId`, `setSelectedTabId`, `nextPage`, `prevPage`, `changePage`) выбираются по `type`.
4107
+ *
4108
+ * Generic-параметр `T extends WidgetType` сейчас используется только как **намерение** —
4109
+ * сигнализирует, под какой виджет настраивается код. Дальнейшее сужение возвращаемого типа
4110
+ * через `WidgetContextMap[T]` потребует разделения {@link DashboardContext} и
4111
+ * {@link FeatureCardContext} на пересекающуюся базу и виджет-специфичные расширения.
4112
+ */
4082
4113
  const useWidgetContext = (type = WidgetType.Dashboard) => {
4083
4114
  const { toggleLayersVisibility, visibleLayers, projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, selectAttachmentsFromCatalog, config: dashboardConfig, containerIds, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, editMode: projectEditMode, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = useContext(DashboardContext) || {};
4084
4115
  const { layerInfo, attributes, feature, controls, changeControls, closeFeatureCard, config: featureConfig, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, editMode: featureEditMode, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = useContext(FeatureCardContext) || {};
@@ -6221,7 +6252,7 @@ const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
6221
6252
 
6222
6253
  const getAttributeValue = (element, attributes) => {
6223
6254
  const attribute = getAttributeByName(element?.attributeName, attributes);
6224
- const { maxLength, separator, expandable, lineBreak } = element.options || {};
6255
+ const { maxLength, wordBreak, separator, expandable, lineBreak } = element.options || {};
6225
6256
  let value;
6226
6257
  if (attribute?.type === AttributeType.Boolean && typeof attribute.value === "boolean") {
6227
6258
  return jsx(DashboardCheckbox, { title: attribute.alias || attribute.attributeName, checked: attribute.value });
@@ -6236,7 +6267,7 @@ const getAttributeValue = (element, attributes) => {
6236
6267
  ? JSON.stringify(rawValue)
6237
6268
  : (rawValue || "");
6238
6269
  }
6239
- return typeof value === "string" && maxLength && maxLength < value.length ? (jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
6270
+ return typeof value === "string" && maxLength && maxLength < value.length ? (jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
6240
6271
  };
6241
6272
 
6242
6273
  const getChartAxes = (chartElement) => chartElement?.options?.relatedDataSources?.filter(({ chartAxis }) => chartAxis === "y");
@@ -7366,7 +7397,7 @@ const TabsContainer = memo(({ elementConfig, type }) => {
7366
7397
  const { palette } = useTheme();
7367
7398
  const { selectedTabId, setSelectedTabId } = useWidgetContext(type);
7368
7399
  const { id, options, style, children: tabs } = elementConfig || {};
7369
- const { radius, column, bgColor, noBg, onlyIcon, shownItems, maxLength = 12 } = options || {};
7400
+ const { radius, column, bgColor, noBg, onlyIcon, shownItems, maxLength = 12, wordBreak } = options || {};
7370
7401
  const renderIcon = useCallback((icon, active) => {
7371
7402
  if (!icon)
7372
7403
  return null;
@@ -7374,16 +7405,16 @@ const TabsContainer = memo(({ elementConfig, type }) => {
7374
7405
  return jsx(Icon, { kind: icon });
7375
7406
  return icon.endsWith(".svg") ? (jsx(SvgImage, { url: icon, width: 16, fontColor: active ? palette.textContrast : palette.textSecondary })) : (jsx("img", { src: icon, alt: "" }));
7376
7407
  }, [palette.textContrast, palette.textSecondary]);
7377
- const onClick = useCallback((id) => {
7378
- setSelectedTabId(id);
7379
- window.location.hash = `#${id}`;
7408
+ const onClick = useCallback((tabId) => {
7409
+ setSelectedTabId(tabId);
7410
+ window.location.hash = `#${tabId}`;
7380
7411
  }, [setSelectedTabId]);
7381
7412
  useEffect(() => {
7382
7413
  if (!selectedTabId) {
7383
7414
  setSelectedTabId(tabs[0].id);
7384
7415
  }
7385
7416
  }, []);
7386
- return (jsx(SwiperContainer, { id: id, style: style, children: jsx(Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id, value, options: tabOptions }) => (jsxs(SwiperSlide, { children: [jsxs(TabContainer, { href: `#${id}`, active: selectedTabId === id, column: column, bgColor: bgColor, noBg: noBg, radius: radius, onlyIcon: onlyIcon, hasIcon: !!tabOptions?.icon, onClick: () => onClick(id), children: [renderIcon(tabOptions?.icon, selectedTabId === id), !onlyIcon && (jsx(TabValue, { children: jsx(TextTrim, { maxLength: maxLength, children: value }) }))] }), jsx(TabAnchor, { id: id })] }, id))) }) }));
7417
+ return (jsx(SwiperContainer, { id: id, style: style, children: jsx(Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id: tabId, value, options: tabOptions }) => (jsxs(SwiperSlide, { children: [jsxs(TabContainer, { href: `#${tabId}`, active: selectedTabId === tabId, column: column, bgColor: bgColor, noBg: noBg, radius: radius, onlyIcon: onlyIcon, hasIcon: !!tabOptions?.icon, onClick: () => onClick(tabId), children: [renderIcon(tabOptions?.icon, selectedTabId === tabId), !onlyIcon && (jsx(TabValue, { children: jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, children: value }) }))] }), jsx(TabAnchor, { id: tabId })] }, tabId))) }) }));
7387
7418
  });
7388
7419
 
7389
7420
  const ContainerIconValue = styled(Flex) ``;
@@ -7491,7 +7522,7 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
7491
7522
  feature,
7492
7523
  });
7493
7524
  const { id, options, style, children } = elementConfig || {};
7494
- const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
7525
+ const { maxLength, wordBreak, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
7495
7526
  const iconElement = children?.find(item => item.id === "icon");
7496
7527
  const aliasElement = children?.find(item => item.id === "alias");
7497
7528
  const unitsElement = children?.find(item => item.id === "units");
@@ -7510,7 +7541,7 @@ const RoundedBackgroundContainer = memo(({ type, elementConfig, feature, renderE
7510
7541
  return null;
7511
7542
  return (jsx(FlexSpan, { width: iconElement.options?.width || "1rem", alignItems: "center", mr: "0.5rem", children: renderElement({ id: "icon", wrap: false }) }));
7512
7543
  }, [iconElement, renderElement]);
7513
- const renderAlias = useMemo(() => (jsx(ContainerAlias, { style: aliasElement?.style, children: jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
7544
+ const renderAlias = useMemo(() => (jsx(ContainerAlias, { style: aliasElement?.style, children: jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, wordBreak: wordBreak, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement, wordBreak]);
7514
7545
  const renderValue = useMemo(() => isNil(value) ? null : (jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
7515
7546
  if (isNil(value) && hideEmpty)
7516
7547
  return null;
@@ -8475,17 +8506,22 @@ const DividerContainer = memo(({ elementConfig, config }) => {
8475
8506
  return (jsx(Container, { id: id, style: style, children: jsx(ContainerDivider, { "$bgColor": config?.options?.bgColor }) }));
8476
8507
  });
8477
8508
 
8509
+ // `ProgressContainer` и `RoundedBackgroundContainer` исторически принимают `InnerContainerProps`
8510
+ // (см. `DataSourceInnerContainer/types.ts`). `<Name>ContainerProps` ⊆ `InnerContainerProps`
8511
+ // по структуре — каст оправдан, расхождение только в generic-параметре `propTypes`.
8512
+ const ProgressContainerTyped = ProgressContainer;
8513
+ const RoundedBackgroundContainerTyped = RoundedBackgroundContainer;
8478
8514
  const containerComponents = {
8479
8515
  [ContainerTemplate.DefaultAttributes]: DefaultAttributesContainer,
8480
8516
  [ContainerTemplate.Pages]: PagesContainer,
8481
8517
  [ContainerTemplate.Tabs]: TabsContainer,
8482
8518
  [ContainerTemplate.Title]: TitleContainer,
8483
- [ContainerTemplate.RoundedBackground]: RoundedBackgroundContainer,
8519
+ [ContainerTemplate.RoundedBackground]: RoundedBackgroundContainerTyped,
8484
8520
  [ContainerTemplate.OneColumn]: OneColumnContainer,
8485
8521
  [ContainerTemplate.TwoColumn]: TwoColumnContainer,
8486
8522
  [ContainerTemplate.DataSource]: DataSourceContainer,
8487
8523
  [ContainerTemplate.DataSourceProgress]: DataSourceProgressContainer,
8488
- [ContainerTemplate.Progress]: ProgressContainer,
8524
+ [ContainerTemplate.Progress]: ProgressContainerTyped,
8489
8525
  [ContainerTemplate.Image]: ImageContainer,
8490
8526
  [ContainerTemplate.Icon]: IconContainer,
8491
8527
  [ContainerTemplate.Layers]: LayersContainer,
@@ -8509,6 +8545,7 @@ const containerComponents = {
8509
8545
  [ContainerTemplate.EditAttachment]: EditAttachmentContainer,
8510
8546
  [ContainerTemplate.Attachment]: AttachmentContainer,
8511
8547
  [ContainerTemplate.EditGroup]: EditGroupContainer,
8548
+ [ContainerTemplate.ContainersGroup]: ContainersGroupContainer,
8512
8549
  default: ContainersGroupContainer,
8513
8550
  };
8514
8551
 
@@ -8748,15 +8785,7 @@ const RowHeaderMixin = css `
8748
8785
  const OverlayHeaderMixin = (overlay) => css `
8749
8786
  &&& {
8750
8787
  :after {
8751
- content: "";
8752
- z-index: 2;
8753
- position: absolute;
8754
- top: 0;
8755
- left: 0;
8756
- width: 100%;
8757
- height: 100%;
8758
8788
  background: ${overlay};
8759
- pointer-events: none;
8760
8789
  }
8761
8790
  }
8762
8791
  `;
@@ -8812,8 +8841,10 @@ const LayerIconContainer = styled.div `
8812
8841
  display: flex;
8813
8842
  align-items: center;
8814
8843
  justify-content: center;
8815
- min-width: 2rem;
8816
- margin-right: 0.5rem;
8844
+ min-width: 1.5rem;
8845
+ width: 1.5rem;
8846
+ height: 1.5rem;
8847
+ margin-right: 1rem;
8817
8848
  `;
8818
8849
  const AlertIconContainer = styled(Flex) `
8819
8850
  align-items: center;
@@ -9445,29 +9476,49 @@ const ElementIcon = memo(({ type, elementConfig }) => {
9445
9476
  return (jsx(StyledIcon, { kind: iconValue, fontSize: fontSize, fontColor: fontColor, style: style }));
9446
9477
  });
9447
9478
 
9448
- const ElementImage = memo(({ type, elementConfig }) => {
9479
+ const useElementImage = ({ type, elementConfig, }) => {
9449
9480
  const { attributes } = useWidgetContext(type);
9450
- const { value, attributeName, options, style } = elementConfig || {};
9451
- const { width } = options || {};
9452
- const firstImage = useMemo(() => {
9453
- if (value) {
9481
+ const { value, attributeName } = elementConfig || {};
9482
+ const attribute = useMemo(() => {
9483
+ if (!attributeName || Array.isArray(attributeName))
9484
+ return undefined;
9485
+ return attributes?.find(item => item.attributeName === attributeName);
9486
+ }, [attributeName, attributes]);
9487
+ const isAttachmentAttribute = attribute?.subType === StringSubType.Attachments;
9488
+ const { items } = useAttachmentItems({ type, elementConfig });
9489
+ const imageItems = useMemo(() => items
9490
+ .filter(item => IMAGE_FILE_TYPES.includes(getFileType(item.mimeType, item.name)))
9491
+ .slice(0, 1), [items]);
9492
+ const attachmentImages = useAttachmentPreviewImages({
9493
+ items: imageItems,
9494
+ active: isAttachmentAttribute,
9495
+ });
9496
+ const stringUrl = useMemo(() => {
9497
+ if (value)
9454
9498
  return getResourceUrl(value.toString());
9455
- }
9456
- if (!attributeName || Array.isArray(attributeName)) {
9499
+ if (isAttachmentAttribute)
9500
+ return null;
9501
+ if (!attributeName || Array.isArray(attributeName))
9457
9502
  return null;
9458
- }
9459
- const attribute = attributes?.find(item => item.attributeName === attributeName);
9460
9503
  const imageUrl = attribute?.value?.split(";")?.[0];
9461
- if (!imageUrl) {
9504
+ if (!imageUrl)
9462
9505
  return null;
9463
- }
9464
9506
  return getResourceUrl(imageUrl);
9465
- }, [attributeName, attributes, value]);
9466
- const blobUrl = useFetchImageWithAuth(firstImage);
9467
- if (!blobUrl) {
9507
+ }, [value, isAttachmentAttribute, attributeName, attribute]);
9508
+ const stringBlobUrl = useFetchImageWithAuth(stringUrl);
9509
+ const attachmentSrc = attachmentImages[0]?.src || null;
9510
+ const src = isAttachmentAttribute ? attachmentSrc : stringBlobUrl;
9511
+ const alt = isAttachmentAttribute ? attachmentImages[0]?.fileName ?? "" : stringUrl ?? "";
9512
+ return { src, alt };
9513
+ };
9514
+
9515
+ const ElementImage = memo(({ type, elementConfig }) => {
9516
+ const { options, style } = elementConfig || {};
9517
+ const { width } = options || {};
9518
+ const { src, alt } = useElementImage({ type, elementConfig });
9519
+ if (!src)
9468
9520
  return null;
9469
- }
9470
- return (jsx("img", { src: blobUrl, alt: firstImage ?? "", width: width, style: style }));
9521
+ return jsx("img", { src: src, alt: alt, width: width, style: style });
9471
9522
  });
9472
9523
 
9473
9524
  const ElementLegend = memo(({ type, element, elementConfig }) => {
@@ -9835,7 +9886,8 @@ const SlideshowHeaderWrapper = styled.div `
9835
9886
  position: absolute;
9836
9887
  top: 0;
9837
9888
  left: 0;
9838
- right: 0;
9889
+ width: 100%;
9890
+ height: 100%;
9839
9891
  pointer-events: none;
9840
9892
  }
9841
9893
 
@@ -9845,8 +9897,7 @@ const SlideshowHeaderWrapper = styled.div `
9845
9897
  }
9846
9898
 
9847
9899
  :after {
9848
- height: 4.5rem;
9849
- background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0) 100%);
9900
+ background: linear-gradient(180deg, rgba(17, 37, 47, 0.75) 0%, rgba(17, 37, 47, 0.00) 100%);
9850
9901
  }
9851
9902
 
9852
9903
  :hover {
@@ -9894,12 +9945,13 @@ const HeaderSlideshow = styled.div `
9894
9945
  `;
9895
9946
 
9896
9947
  const FeatureCardBackgroundHeader = () => {
9948
+ const { themeName: pageThemeName } = useGlobalContext();
9897
9949
  const { config } = useWidgetConfig(WidgetType.FeatureCard);
9898
9950
  const { header } = config || {};
9899
9951
  const { options } = header || {};
9900
9952
  const { fontColor, bgColor, height, overlay, bigIcon, withPadding, bottomBlur, themeName, column } = options || {};
9901
9953
  const renderElement = useHeaderRender(header);
9902
- return (jsx(BackgroundHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$height": height, "$bigIcon": bigIcon, "$withPadding": withPadding, "$bottomBlur": bottomBlur, children: jsx(ThemeProvider, { theme: getThemeByName(themeName), children: jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxs(HeaderFrontView, { children: [jsxs(HeaderContainer, { column: column, children: [jsx(HeaderLayerIcon, {}), jsx(FeatureCardTitle, { title: renderElement({
9954
+ return (jsx(BackgroundHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$height": height, "$bigIcon": bigIcon, "$withPadding": withPadding, "$bottomBlur": bottomBlur, children: jsx(ThemeProvider, { theme: getThemeByName(themeName ?? pageThemeName), children: jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxs(HeaderFrontView, { children: [jsxs(HeaderContainer, { column: column, children: [jsx(HeaderLayerIcon, {}), jsx(FeatureCardTitle, { title: renderElement({
9903
9955
  id: "title",
9904
9956
  wrap: false,
9905
9957
  }), description: renderElement({
@@ -10285,8 +10337,8 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
10285
10337
  return "";
10286
10338
  }
10287
10339
  const alias = attribute?.alias || attributeName || "";
10288
- const { maxLength, lineBreak, expandable } = options || {};
10289
- return alias && maxLength && maxLength < alias.length ? (jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: alias })) : (alias);
10340
+ const { maxLength, wordBreak, lineBreak, expandable } = options || {};
10341
+ return alias && maxLength && maxLength < alias.length ? (jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, expandable: expandable, lineBreak: lineBreak, children: alias })) : (alias);
10290
10342
  }
10291
10343
  if (type === "attributeValue") {
10292
10344
  /* return isHandbookAttribute(attribute?.name, layerInfo) ? (
@@ -10308,7 +10360,9 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
10308
10360
  if (type === "layerName") {
10309
10361
  return layerInfo?.name || "";
10310
10362
  }
10311
- const ElementComponent = type ? elementComponents[type] : null;
10363
+ const ElementComponent = (type && type in elementComponents
10364
+ ? elementComponents[type]
10365
+ : null);
10312
10366
  return ElementComponent ? (jsx(ElementComponent, { ...props })) : (getDefaultContainer?.());
10313
10367
  };
10314
10368
 
@@ -11747,6 +11801,10 @@ const useChartChange = ({ dataSources, chartId, width, height, relatedAttributes
11747
11801
  return [customize, onChange];
11748
11802
  };
11749
11803
 
11804
+ /**
11805
+ * Generic-параметр `T` сейчас идёт как намерение (под какой виджет). Дальнейшее сужение
11806
+ * `config` под конкретный виджет — отдельная задача.
11807
+ */
11750
11808
  const useWidgetConfig = (type = WidgetType.Dashboard) => {
11751
11809
  const { config: configProp, containerIds, projectInfo, layerInfo, isEditing } = useWidgetContext(type);
11752
11810
  const config = useMemo(() => {
@@ -11781,6 +11839,9 @@ const useWidgetConfig = (type = WidgetType.Dashboard) => {
11781
11839
  };
11782
11840
  };
11783
11841
 
11842
+ /**
11843
+ * Generic-параметр `T` — намерение под виджет. Дальнейшая параметризация — отдельная задача.
11844
+ */
11784
11845
  const useWidgetPage = (type = WidgetType.Dashboard) => {
11785
11846
  const { t } = useGlobalContext();
11786
11847
  const { pageIndex, changePage, projectInfo, updateProject } = useWidgetContext(type);
@@ -12159,20 +12220,28 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
12159
12220
  properties: item.properties || item.attributes,
12160
12221
  }))
12161
12222
  : items;
12223
+ const rawAttributes = response.status === "fulfilled"
12224
+ ? response.value?.attributes
12225
+ : undefined;
12226
+ const normalizedAttributes = Array.isArray(rawAttributes)
12227
+ ? rawAttributes
12228
+ : rawAttributes && typeof rawAttributes === "object"
12229
+ ? Object.entries(rawAttributes).map(([attributeName, val]) => ({
12230
+ attributeName,
12231
+ ...(val && typeof val === "object" ? val : {}),
12232
+ }))
12233
+ : null;
12162
12234
  newDataSources[index].attributes =
12163
12235
  response.status === "rejected" ||
12164
12236
  (!isQueryDataSource && !isPythonDataSource)
12165
12237
  ? null
12166
- : response.value
12167
- ?.attributes ||
12238
+ : normalizedAttributes ||
12168
12239
  (isPythonDataSource && items?.[0]?.properties
12169
- ? Object.fromEntries(Object.entries(items[0].properties).map(([key, val]) => [
12170
- key,
12171
- {
12172
- type: typeof val === "number" ? "Float" : "String",
12173
- isDisplayed: true,
12174
- },
12175
- ]))
12240
+ ? Object.entries(items[0].properties).map(([attributeName, val]) => ({
12241
+ attributeName,
12242
+ type: typeof val === "number" ? "Float" : "String",
12243
+ isDisplayed: true,
12244
+ }))
12176
12245
  : null);
12177
12246
  });
12178
12247
  return newDataSources;
@@ -13131,15 +13200,20 @@ const SvgImage = memo(({ url, width, height, fontColor }) => {
13131
13200
  return (jsx(StyledSvg, { "$width": width, "$height": height, "$fontColor": fontColor, dangerouslySetInnerHTML: { __html: svg } }));
13132
13201
  });
13133
13202
 
13134
- const TextTrim = memo(({ maxLength, expandable, lineBreak, children }) => {
13203
+ const TextTrimValue = styled.div `
13204
+ word-break: ${({ wordBreak }) => wordBreak ?? "break-word"};
13205
+ overflow: hidden;
13206
+ `;
13207
+
13208
+ const TextTrim = memo(({ maxLength, expandable, lineBreak, wordBreak, children }) => {
13135
13209
  const { t } = useGlobalContext();
13136
13210
  const [expanded, toggleExpanded] = useToggle();
13137
13211
  const text = children?.toString();
13138
13212
  const formatValue = useCallback((value) => {
13139
13213
  if (!lineBreak)
13140
- return value;
13141
- return jsx("div", { dangerouslySetInnerHTML: { __html: unescape(value).split(lineBreak).join("<br />") } });
13142
- }, [lineBreak]);
13214
+ return jsx(TextTrimValue, { wordBreak: wordBreak, children: value });
13215
+ return jsx(TextTrimValue, { wordBreak: wordBreak, dangerouslySetInnerHTML: { __html: unescape(value).split(lineBreak).join("<br />") } });
13216
+ }, [lineBreak, wordBreak]);
13143
13217
  if (!text?.length || !maxLength || text.length <= maxLength)
13144
13218
  return jsx(Fragment$1, { children: formatValue(text) });
13145
13219
  const substring = `${text.substring(0, maxLength)}...`;
@@ -13457,5 +13531,5 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
13457
13531
  }, children: children }), upperSiblings] }));
13458
13532
  };
13459
13533
 
13460
- export { AddFeatureButton, AddFeatureContainer, AlertIconContainer, AttachmentContainer, AttributeGalleryContainer, AttributeLabel, BASE_CONTAINER_STYLE, BaseMapTheme, 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, 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, WidgetType, addDataSource, addDataSources, adjustColor, applyFiltersToCondition, applyQueryFilters, applyVarsToCondition, checkEqualOrIncludes, checkIsLoading, createConfigLayer, createConfigPage, createNewPageId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, 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, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, metersPerPixel, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, toRenderableValue, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, updateDataSource, useAppHeight, useAttachmentItems, useAttachmentPreviewImages, useAutoCompleteControl, useChartChange, useChartData, useContainerAttributes, useCurrentPageLayers, useCustomFeatureSelect, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useEditGroupAttributes, useExpandableContainers, useExportPdf, useFetchImageWithAuth, useFetchWithAuth, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerHiddenAttributes, useLayerParams, useMapContext, useMapDraw, useMapImages, useMaxZoomTo, useProjectDashboardInit, usePythonSandbox, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useVisibleProjectItems, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
13534
+ 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, 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, applyVarsToCondition, asAttributeName, asChartId, asContainerId, asDataSourceName, asFilterName, asLayerName, asModalId, asResourceId, asTabId, checkEqualOrIncludes, checkIsLoading, createConfigLayer, createConfigPage, createNewPageId, createTreeNode, dateOptions, debounce, decimalOpacityToHex, eqlParametersToPayload, findAttributeInExpression, formatArea, formatAttributeValue, formatChartRelatedValue, formatConditionValue, formatDataSourceCondition, formatDate$1 as formatDate, formatElementValue, formatLength, formatNumber, formatPolygonMeasure, 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, isLayerService, isNotValidSelectedTab, isNumeric, isObject, isProxyService, isVisibleContainer, metersPerPixel, numberOptions, parseClientStyle, parseIconNames, parseIconNamesFromClientStyle, pieChartTooltipFromAttributes, pieChartTooltipFromRelatedFeatures, pointOptions, removeDataSource, rgbToHex, roundTotalSum, sliceShownOtherItems, timeOptions, toRenderableValue, tooltipNameFromAttributes, tooltipValueFromAttributes, tooltipValueFromRelatedFeatures, transparentizeColor, treeNodesToProjectItems, updateDataSource, useAppHeight, useAttachmentItems, useAttachmentPreviewImages, useAutoCompleteControl, useChartChange, useChartData, useContainerAttributes, useCurrentPageLayers, useCustomFeatureSelect, useDashboardHeader, useDataSources, useDebouncedCallback, useDiffPage, useEditGroupAttributes, useExpandableContainers, useExportPdf, useFetchImageWithAuth, useFetchWithAuth, useGetConfigLayer, useGlobalContext, useHeaderRender, useHideIfEmptyDataSource, useIconsFromLayers, useLayerHiddenAttributes, useLayerParams, useMapContext, useMapDraw, useMapImages, useMaxZoomTo, useProjectDashboardInit, usePythonSandbox, usePythonTask, useRedrawLayer, useRelatedDataSourceAttributes, useRenderElement, useServerNotificationsContext, useShownOtherItems, useToggle, useUpdateDataSource, useVisibleProjectItems, useWidgetConfig, useWidgetContext, useWidgetFilters, useWidgetPage, useWindowResize, useZoomToFeatures, useZoomToPoint };
13461
13535
  //# sourceMappingURL=react.esm.js.map