@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/index.js CHANGED
@@ -3361,6 +3361,26 @@ Transform.prototype = {
3361
3361
 
3362
3362
  Transform.prototype;
3363
3363
 
3364
+ // ── Конструкторы (single-source casting) ─────────────────────────────────────
3365
+ const asContainerId = (value) => value;
3366
+ const asChartId = (value) => value;
3367
+ const asModalId = (value) => value;
3368
+ const asTabId = (value) => value;
3369
+ const asFilterName = (value) => value;
3370
+ const asLayerName = (value) => value;
3371
+ const asAttributeName = (value) => value;
3372
+ const asDataSourceName = (value) => value;
3373
+ const asResourceId = (value) => value;
3374
+
3375
+ // ──────────────────────────────────────────────────────────────────────────────
3376
+ // ЛИТЕРАЛЫ И CSS-ТОКЕНЫ
3377
+ // ──────────────────────────────────────────────────────────────────────────────
3378
+ /** Список допустимых типов диаграммы. `as const` даёт runtime-доступ для dropdown-ов. */
3379
+ const CHART_TYPES = ["bar", "line", "pie", "stack"];
3380
+ /** Выравнивание текста/блоков. */
3381
+ const ALIGNMENTS = ["left", "center", "right"];
3382
+ /** Режим отображения коллекций. */
3383
+ const VIEW_MODES = ["grid", "list"];
3364
3384
  exports.ContainerTemplate = void 0;
3365
3385
  (function (ContainerTemplate) {
3366
3386
  ContainerTemplate["Pages"] = "Pages";
@@ -4081,6 +4101,17 @@ const ServerNotificationsProvider = ({ url, initialized, apiClient, children })
4081
4101
  }, children: children }));
4082
4102
  };
4083
4103
 
4104
+ /**
4105
+ * Контекст виджет-фрейма. Возвращаемый объект включает поля и {@link DashboardContext},
4106
+ * и {@link FeatureCardContext}, а гибридные (`config`, `isEditing`, `isLoading`, `pageIndex`,
4107
+ * `filters`, `changeFilters`, `dataSources`, `expandContainer`, `expandedContainers`,
4108
+ * `selectedTabId`, `setSelectedTabId`, `nextPage`, `prevPage`, `changePage`) выбираются по `type`.
4109
+ *
4110
+ * Generic-параметр `T extends WidgetType` сейчас используется только как **намерение** —
4111
+ * сигнализирует, под какой виджет настраивается код. Дальнейшее сужение возвращаемого типа
4112
+ * через `WidgetContextMap[T]` потребует разделения {@link DashboardContext} и
4113
+ * {@link FeatureCardContext} на пересекающуюся базу и виджет-специфичные расширения.
4114
+ */
4084
4115
  const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
4085
4116
  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, } = React.useContext(DashboardContext) || {};
4086
4117
  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, } = React.useContext(FeatureCardContext) || {};
@@ -6223,7 +6254,7 @@ const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
6223
6254
 
6224
6255
  const getAttributeValue = (element, attributes) => {
6225
6256
  const attribute = getAttributeByName(element?.attributeName, attributes);
6226
- const { maxLength, separator, expandable, lineBreak } = element.options || {};
6257
+ const { maxLength, wordBreak, separator, expandable, lineBreak } = element.options || {};
6227
6258
  let value;
6228
6259
  if (attribute?.type === api.AttributeType.Boolean && typeof attribute.value === "boolean") {
6229
6260
  return jsxRuntime.jsx(DashboardCheckbox, { title: attribute.alias || attribute.attributeName, checked: attribute.value });
@@ -6238,7 +6269,7 @@ const getAttributeValue = (element, attributes) => {
6238
6269
  ? JSON.stringify(rawValue)
6239
6270
  : (rawValue || "");
6240
6271
  }
6241
- return typeof value === "string" && maxLength && maxLength < value.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
6272
+ return typeof value === "string" && maxLength && maxLength < value.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
6242
6273
  };
6243
6274
 
6244
6275
  const getChartAxes = (chartElement) => chartElement?.options?.relatedDataSources?.filter(({ chartAxis }) => chartAxis === "y");
@@ -7368,7 +7399,7 @@ const TabsContainer = React.memo(({ elementConfig, type }) => {
7368
7399
  const { palette } = styled.useTheme();
7369
7400
  const { selectedTabId, setSelectedTabId } = useWidgetContext(type);
7370
7401
  const { id, options, style, children: tabs } = elementConfig || {};
7371
- const { radius, column, bgColor, noBg, onlyIcon, shownItems, maxLength = 12 } = options || {};
7402
+ const { radius, column, bgColor, noBg, onlyIcon, shownItems, maxLength = 12, wordBreak } = options || {};
7372
7403
  const renderIcon = React.useCallback((icon, active) => {
7373
7404
  if (!icon)
7374
7405
  return null;
@@ -7376,16 +7407,16 @@ const TabsContainer = React.memo(({ elementConfig, type }) => {
7376
7407
  return jsxRuntime.jsx(uilibGl.Icon, { kind: icon });
7377
7408
  return icon.endsWith(".svg") ? (jsxRuntime.jsx(SvgImage, { url: icon, width: 16, fontColor: active ? palette.textContrast : palette.textSecondary })) : (jsxRuntime.jsx("img", { src: icon, alt: "" }));
7378
7409
  }, [palette.textContrast, palette.textSecondary]);
7379
- const onClick = React.useCallback((id) => {
7380
- setSelectedTabId(id);
7381
- window.location.hash = `#${id}`;
7410
+ const onClick = React.useCallback((tabId) => {
7411
+ setSelectedTabId(tabId);
7412
+ window.location.hash = `#${tabId}`;
7382
7413
  }, [setSelectedTabId]);
7383
7414
  React.useEffect(() => {
7384
7415
  if (!selectedTabId) {
7385
7416
  setSelectedTabId(tabs[0].id);
7386
7417
  }
7387
7418
  }, []);
7388
- return (jsxRuntime.jsx(SwiperContainer, { id: id, style: style, children: jsxRuntime.jsx(react.Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id, value, options: tabOptions }) => (jsxRuntime.jsxs(react.SwiperSlide, { children: [jsxRuntime.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 && (jsxRuntime.jsx(TabValue, { children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength, children: value }) }))] }), jsxRuntime.jsx(TabAnchor, { id: id })] }, id))) }) }));
7419
+ return (jsxRuntime.jsx(SwiperContainer, { id: id, style: style, children: jsxRuntime.jsx(react.Swiper, { spaceBetween: 0, slidesPerView: shownItems || 2, children: tabs.map(({ id: tabId, value, options: tabOptions }) => (jsxRuntime.jsxs(react.SwiperSlide, { children: [jsxRuntime.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 && (jsxRuntime.jsx(TabValue, { children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, children: value }) }))] }), jsxRuntime.jsx(TabAnchor, { id: tabId })] }, tabId))) }) }));
7389
7420
  });
7390
7421
 
7391
7422
  const ContainerIconValue = styled(uilibGl.Flex) ``;
@@ -7493,7 +7524,7 @@ const RoundedBackgroundContainer = React.memo(({ type, elementConfig, feature, r
7493
7524
  feature,
7494
7525
  });
7495
7526
  const { id, options, style, children } = elementConfig || {};
7496
- const { maxLength, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
7527
+ const { maxLength, wordBreak, center, fontColor, innerTemplateStyle, inlineUnits, big, bigIcon, hideEmpty, colorAttribute } = options || {};
7497
7528
  const iconElement = children?.find(item => item.id === "icon");
7498
7529
  const aliasElement = children?.find(item => item.id === "alias");
7499
7530
  const unitsElement = children?.find(item => item.id === "units");
@@ -7512,7 +7543,7 @@ const RoundedBackgroundContainer = React.memo(({ type, elementConfig, feature, r
7512
7543
  return null;
7513
7544
  return (jsxRuntime.jsx(uilibGl.FlexSpan, { width: iconElement.options?.width || "1rem", alignItems: "center", mr: "0.5rem", children: renderElement({ id: "icon", wrap: false }) }));
7514
7545
  }, [iconElement, renderElement]);
7515
- const renderAlias = React.useMemo(() => (jsxRuntime.jsx(ContainerAlias, { style: aliasElement?.style, children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement]);
7546
+ const renderAlias = React.useMemo(() => (jsxRuntime.jsx(ContainerAlias, { style: aliasElement?.style, children: jsxRuntime.jsx(TextTrim, { maxLength: maxLength || ALIAS_DEFAULT_MAX_LENGTH, wordBreak: wordBreak, children: renderElement({ id: "alias", wrap: false }) }) })), [aliasElement?.style, maxLength, renderElement, wordBreak]);
7516
7547
  const renderValue = React.useMemo(() => lodash.isNil(value) ? null : (jsxRuntime.jsxs(ContainerValue, { style: valueElement?.style, big: true, children: [value, !!unitsElement && (jsxRuntime.jsx(ContainerUnits, { style: unitsElement?.style, children: renderElement({ id: "units" }) }))] })), [valueElement?.style, value, unitsElement, renderElement]);
7517
7548
  if (lodash.isNil(value) && hideEmpty)
7518
7549
  return null;
@@ -8477,17 +8508,22 @@ const DividerContainer = React.memo(({ elementConfig, config }) => {
8477
8508
  return (jsxRuntime.jsx(Container, { id: id, style: style, children: jsxRuntime.jsx(ContainerDivider, { "$bgColor": config?.options?.bgColor }) }));
8478
8509
  });
8479
8510
 
8511
+ // `ProgressContainer` и `RoundedBackgroundContainer` исторически принимают `InnerContainerProps`
8512
+ // (см. `DataSourceInnerContainer/types.ts`). `<Name>ContainerProps` ⊆ `InnerContainerProps`
8513
+ // по структуре — каст оправдан, расхождение только в generic-параметре `propTypes`.
8514
+ const ProgressContainerTyped = ProgressContainer;
8515
+ const RoundedBackgroundContainerTyped = RoundedBackgroundContainer;
8480
8516
  const containerComponents = {
8481
8517
  [exports.ContainerTemplate.DefaultAttributes]: DefaultAttributesContainer,
8482
8518
  [exports.ContainerTemplate.Pages]: PagesContainer,
8483
8519
  [exports.ContainerTemplate.Tabs]: TabsContainer,
8484
8520
  [exports.ContainerTemplate.Title]: TitleContainer,
8485
- [exports.ContainerTemplate.RoundedBackground]: RoundedBackgroundContainer,
8521
+ [exports.ContainerTemplate.RoundedBackground]: RoundedBackgroundContainerTyped,
8486
8522
  [exports.ContainerTemplate.OneColumn]: OneColumnContainer,
8487
8523
  [exports.ContainerTemplate.TwoColumn]: TwoColumnContainer,
8488
8524
  [exports.ContainerTemplate.DataSource]: DataSourceContainer,
8489
8525
  [exports.ContainerTemplate.DataSourceProgress]: DataSourceProgressContainer,
8490
- [exports.ContainerTemplate.Progress]: ProgressContainer,
8526
+ [exports.ContainerTemplate.Progress]: ProgressContainerTyped,
8491
8527
  [exports.ContainerTemplate.Image]: ImageContainer,
8492
8528
  [exports.ContainerTemplate.Icon]: IconContainer,
8493
8529
  [exports.ContainerTemplate.Layers]: LayersContainer,
@@ -8511,6 +8547,7 @@ const containerComponents = {
8511
8547
  [exports.ContainerTemplate.EditAttachment]: EditAttachmentContainer,
8512
8548
  [exports.ContainerTemplate.Attachment]: AttachmentContainer,
8513
8549
  [exports.ContainerTemplate.EditGroup]: EditGroupContainer,
8550
+ [exports.ContainerTemplate.ContainersGroup]: ContainersGroupContainer,
8514
8551
  default: ContainersGroupContainer,
8515
8552
  };
8516
8553
 
@@ -8750,15 +8787,7 @@ const RowHeaderMixin = styled.css `
8750
8787
  const OverlayHeaderMixin = (overlay) => styled.css `
8751
8788
  &&& {
8752
8789
  :after {
8753
- content: "";
8754
- z-index: 2;
8755
- position: absolute;
8756
- top: 0;
8757
- left: 0;
8758
- width: 100%;
8759
- height: 100%;
8760
8790
  background: ${overlay};
8761
- pointer-events: none;
8762
8791
  }
8763
8792
  }
8764
8793
  `;
@@ -8814,8 +8843,10 @@ const LayerIconContainer = styled.div `
8814
8843
  display: flex;
8815
8844
  align-items: center;
8816
8845
  justify-content: center;
8817
- min-width: 2rem;
8818
- margin-right: 0.5rem;
8846
+ min-width: 1.5rem;
8847
+ width: 1.5rem;
8848
+ height: 1.5rem;
8849
+ margin-right: 1rem;
8819
8850
  `;
8820
8851
  const AlertIconContainer = styled(uilibGl.Flex) `
8821
8852
  align-items: center;
@@ -9447,29 +9478,49 @@ const ElementIcon = React.memo(({ type, elementConfig }) => {
9447
9478
  return (jsxRuntime.jsx(StyledIcon, { kind: iconValue, fontSize: fontSize, fontColor: fontColor, style: style }));
9448
9479
  });
9449
9480
 
9450
- const ElementImage = React.memo(({ type, elementConfig }) => {
9481
+ const useElementImage = ({ type, elementConfig, }) => {
9451
9482
  const { attributes } = useWidgetContext(type);
9452
- const { value, attributeName, options, style } = elementConfig || {};
9453
- const { width } = options || {};
9454
- const firstImage = React.useMemo(() => {
9455
- if (value) {
9483
+ const { value, attributeName } = elementConfig || {};
9484
+ const attribute = React.useMemo(() => {
9485
+ if (!attributeName || Array.isArray(attributeName))
9486
+ return undefined;
9487
+ return attributes?.find(item => item.attributeName === attributeName);
9488
+ }, [attributeName, attributes]);
9489
+ const isAttachmentAttribute = attribute?.subType === api.StringSubType.Attachments;
9490
+ const { items } = useAttachmentItems({ type, elementConfig });
9491
+ const imageItems = React.useMemo(() => items
9492
+ .filter(item => IMAGE_FILE_TYPES.includes(getFileType(item.mimeType, item.name)))
9493
+ .slice(0, 1), [items]);
9494
+ const attachmentImages = useAttachmentPreviewImages({
9495
+ items: imageItems,
9496
+ active: isAttachmentAttribute,
9497
+ });
9498
+ const stringUrl = React.useMemo(() => {
9499
+ if (value)
9456
9500
  return getResourceUrl(value.toString());
9457
- }
9458
- if (!attributeName || Array.isArray(attributeName)) {
9501
+ if (isAttachmentAttribute)
9502
+ return null;
9503
+ if (!attributeName || Array.isArray(attributeName))
9459
9504
  return null;
9460
- }
9461
- const attribute = attributes?.find(item => item.attributeName === attributeName);
9462
9505
  const imageUrl = attribute?.value?.split(";")?.[0];
9463
- if (!imageUrl) {
9506
+ if (!imageUrl)
9464
9507
  return null;
9465
- }
9466
9508
  return getResourceUrl(imageUrl);
9467
- }, [attributeName, attributes, value]);
9468
- const blobUrl = useFetchImageWithAuth(firstImage);
9469
- if (!blobUrl) {
9509
+ }, [value, isAttachmentAttribute, attributeName, attribute]);
9510
+ const stringBlobUrl = useFetchImageWithAuth(stringUrl);
9511
+ const attachmentSrc = attachmentImages[0]?.src || null;
9512
+ const src = isAttachmentAttribute ? attachmentSrc : stringBlobUrl;
9513
+ const alt = isAttachmentAttribute ? attachmentImages[0]?.fileName ?? "" : stringUrl ?? "";
9514
+ return { src, alt };
9515
+ };
9516
+
9517
+ const ElementImage = React.memo(({ type, elementConfig }) => {
9518
+ const { options, style } = elementConfig || {};
9519
+ const { width } = options || {};
9520
+ const { src, alt } = useElementImage({ type, elementConfig });
9521
+ if (!src)
9470
9522
  return null;
9471
- }
9472
- return (jsxRuntime.jsx("img", { src: blobUrl, alt: firstImage ?? "", width: width, style: style }));
9523
+ return jsxRuntime.jsx("img", { src: src, alt: alt, width: width, style: style });
9473
9524
  });
9474
9525
 
9475
9526
  const ElementLegend = React.memo(({ type, element, elementConfig }) => {
@@ -9837,7 +9888,8 @@ const SlideshowHeaderWrapper = styled.div `
9837
9888
  position: absolute;
9838
9889
  top: 0;
9839
9890
  left: 0;
9840
- right: 0;
9891
+ width: 100%;
9892
+ height: 100%;
9841
9893
  pointer-events: none;
9842
9894
  }
9843
9895
 
@@ -9847,8 +9899,7 @@ const SlideshowHeaderWrapper = styled.div `
9847
9899
  }
9848
9900
 
9849
9901
  :after {
9850
- height: 4.5rem;
9851
- background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0) 100%);
9902
+ background: linear-gradient(180deg, rgba(17, 37, 47, 0.75) 0%, rgba(17, 37, 47, 0.00) 100%);
9852
9903
  }
9853
9904
 
9854
9905
  :hover {
@@ -9896,12 +9947,13 @@ const HeaderSlideshow = styled.div `
9896
9947
  `;
9897
9948
 
9898
9949
  const FeatureCardBackgroundHeader = () => {
9950
+ const { themeName: pageThemeName } = useGlobalContext();
9899
9951
  const { config } = useWidgetConfig(exports.WidgetType.FeatureCard);
9900
9952
  const { header } = config || {};
9901
9953
  const { options } = header || {};
9902
9954
  const { fontColor, bgColor, height, overlay, bigIcon, withPadding, bottomBlur, themeName, column } = options || {};
9903
9955
  const renderElement = useHeaderRender(header);
9904
- return (jsxRuntime.jsx(BackgroundHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$height": height, "$bigIcon": bigIcon, "$withPadding": withPadding, "$bottomBlur": bottomBlur, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: getThemeByName(themeName), children: jsxRuntime.jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { column: column, children: [jsxRuntime.jsx(HeaderLayerIcon, {}), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
9956
+ return (jsxRuntime.jsx(BackgroundHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$height": height, "$bigIcon": bigIcon, "$withPadding": withPadding, "$bottomBlur": bottomBlur, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: getThemeByName(themeName ?? pageThemeName), children: jsxRuntime.jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { column: column, children: [jsxRuntime.jsx(HeaderLayerIcon, {}), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
9905
9957
  id: "title",
9906
9958
  wrap: false,
9907
9959
  }), description: renderElement({
@@ -10287,8 +10339,8 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
10287
10339
  return "";
10288
10340
  }
10289
10341
  const alias = attribute?.alias || attributeName || "";
10290
- const { maxLength, lineBreak, expandable } = options || {};
10291
- return alias && maxLength && maxLength < alias.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: alias })) : (alias);
10342
+ const { maxLength, wordBreak, lineBreak, expandable } = options || {};
10343
+ return alias && maxLength && maxLength < alias.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, expandable: expandable, lineBreak: lineBreak, children: alias })) : (alias);
10292
10344
  }
10293
10345
  if (type === "attributeValue") {
10294
10346
  /* return isHandbookAttribute(attribute?.name, layerInfo) ? (
@@ -10310,7 +10362,9 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
10310
10362
  if (type === "layerName") {
10311
10363
  return layerInfo?.name || "";
10312
10364
  }
10313
- const ElementComponent = type ? elementComponents[type] : null;
10365
+ const ElementComponent = (type && type in elementComponents
10366
+ ? elementComponents[type]
10367
+ : null);
10314
10368
  return ElementComponent ? (jsxRuntime.jsx(ElementComponent, { ...props })) : (getDefaultContainer?.());
10315
10369
  };
10316
10370
 
@@ -11749,6 +11803,10 @@ const useChartChange = ({ dataSources, chartId, width, height, relatedAttributes
11749
11803
  return [customize, onChange];
11750
11804
  };
11751
11805
 
11806
+ /**
11807
+ * Generic-параметр `T` сейчас идёт как намерение (под какой виджет). Дальнейшее сужение
11808
+ * `config` под конкретный виджет — отдельная задача.
11809
+ */
11752
11810
  const useWidgetConfig = (type = exports.WidgetType.Dashboard) => {
11753
11811
  const { config: configProp, containerIds, projectInfo, layerInfo, isEditing } = useWidgetContext(type);
11754
11812
  const config = React.useMemo(() => {
@@ -11783,6 +11841,9 @@ const useWidgetConfig = (type = exports.WidgetType.Dashboard) => {
11783
11841
  };
11784
11842
  };
11785
11843
 
11844
+ /**
11845
+ * Generic-параметр `T` — намерение под виджет. Дальнейшая параметризация — отдельная задача.
11846
+ */
11786
11847
  const useWidgetPage = (type = exports.WidgetType.Dashboard) => {
11787
11848
  const { t } = useGlobalContext();
11788
11849
  const { pageIndex, changePage, projectInfo, updateProject } = useWidgetContext(type);
@@ -12161,20 +12222,28 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
12161
12222
  properties: item.properties || item.attributes,
12162
12223
  }))
12163
12224
  : items;
12225
+ const rawAttributes = response.status === "fulfilled"
12226
+ ? response.value?.attributes
12227
+ : undefined;
12228
+ const normalizedAttributes = Array.isArray(rawAttributes)
12229
+ ? rawAttributes
12230
+ : rawAttributes && typeof rawAttributes === "object"
12231
+ ? Object.entries(rawAttributes).map(([attributeName, val]) => ({
12232
+ attributeName,
12233
+ ...(val && typeof val === "object" ? val : {}),
12234
+ }))
12235
+ : null;
12164
12236
  newDataSources[index].attributes =
12165
12237
  response.status === "rejected" ||
12166
12238
  (!isQueryDataSource && !isPythonDataSource)
12167
12239
  ? null
12168
- : response.value
12169
- ?.attributes ||
12240
+ : normalizedAttributes ||
12170
12241
  (isPythonDataSource && items?.[0]?.properties
12171
- ? Object.fromEntries(Object.entries(items[0].properties).map(([key, val]) => [
12172
- key,
12173
- {
12174
- type: typeof val === "number" ? "Float" : "String",
12175
- isDisplayed: true,
12176
- },
12177
- ]))
12242
+ ? Object.entries(items[0].properties).map(([attributeName, val]) => ({
12243
+ attributeName,
12244
+ type: typeof val === "number" ? "Float" : "String",
12245
+ isDisplayed: true,
12246
+ }))
12178
12247
  : null);
12179
12248
  });
12180
12249
  return newDataSources;
@@ -13133,15 +13202,20 @@ const SvgImage = React.memo(({ url, width, height, fontColor }) => {
13133
13202
  return (jsxRuntime.jsx(StyledSvg, { "$width": width, "$height": height, "$fontColor": fontColor, dangerouslySetInnerHTML: { __html: svg } }));
13134
13203
  });
13135
13204
 
13136
- const TextTrim = React.memo(({ maxLength, expandable, lineBreak, children }) => {
13205
+ const TextTrimValue = styled.div `
13206
+ word-break: ${({ wordBreak }) => wordBreak ?? "break-word"};
13207
+ overflow: hidden;
13208
+ `;
13209
+
13210
+ const TextTrim = React.memo(({ maxLength, expandable, lineBreak, wordBreak, children }) => {
13137
13211
  const { t } = useGlobalContext();
13138
13212
  const [expanded, toggleExpanded] = useToggle();
13139
13213
  const text = children?.toString();
13140
13214
  const formatValue = React.useCallback((value) => {
13141
13215
  if (!lineBreak)
13142
- return value;
13143
- return jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: lodash.unescape(value).split(lineBreak).join("<br />") } });
13144
- }, [lineBreak]);
13216
+ return jsxRuntime.jsx(TextTrimValue, { wordBreak: wordBreak, children: value });
13217
+ return jsxRuntime.jsx(TextTrimValue, { wordBreak: wordBreak, dangerouslySetInnerHTML: { __html: lodash.unescape(value).split(lineBreak).join("<br />") } });
13218
+ }, [lineBreak, wordBreak]);
13145
13219
  if (!text?.length || !maxLength || text.length <= maxLength)
13146
13220
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: formatValue(text) });
13147
13221
  const substring = `${text.substring(0, maxLength)}...`;
@@ -13459,6 +13533,7 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
13459
13533
  }, children: children }), upperSiblings] }));
13460
13534
  };
13461
13535
 
13536
+ exports.ALIGNMENTS = ALIGNMENTS;
13462
13537
  exports.AddFeatureButton = AddFeatureButton;
13463
13538
  exports.AddFeatureContainer = AddFeatureContainer;
13464
13539
  exports.AlertIconContainer = AlertIconContainer;
@@ -13466,6 +13541,7 @@ exports.AttachmentContainer = AttachmentContainer;
13466
13541
  exports.AttributeGalleryContainer = AttributeGalleryContainer;
13467
13542
  exports.AttributeLabel = AttributeLabel;
13468
13543
  exports.BASE_CONTAINER_STYLE = BASE_CONTAINER_STYLE;
13544
+ exports.CHART_TYPES = CHART_TYPES;
13469
13545
  exports.CONFIG_PAGES_ID = CONFIG_PAGES_ID;
13470
13546
  exports.CONFIG_PAGE_ID = CONFIG_PAGE_ID;
13471
13547
  exports.CameraContainer = CameraContainer;
@@ -13619,12 +13695,22 @@ exports.TopContainer = TopContainer;
13619
13695
  exports.TopContainerButtons = TopContainerButtons;
13620
13696
  exports.TwoColumnContainer = TwoColumnContainer;
13621
13697
  exports.UploadContainer = UploadContainer;
13698
+ exports.VIEW_MODES = VIEW_MODES;
13622
13699
  exports.addDataSource = addDataSource;
13623
13700
  exports.addDataSources = addDataSources;
13624
13701
  exports.adjustColor = adjustColor;
13625
13702
  exports.applyFiltersToCondition = applyFiltersToCondition;
13626
13703
  exports.applyQueryFilters = applyQueryFilters;
13627
13704
  exports.applyVarsToCondition = applyVarsToCondition;
13705
+ exports.asAttributeName = asAttributeName;
13706
+ exports.asChartId = asChartId;
13707
+ exports.asContainerId = asContainerId;
13708
+ exports.asDataSourceName = asDataSourceName;
13709
+ exports.asFilterName = asFilterName;
13710
+ exports.asLayerName = asLayerName;
13711
+ exports.asModalId = asModalId;
13712
+ exports.asResourceId = asResourceId;
13713
+ exports.asTabId = asTabId;
13628
13714
  exports.checkEqualOrIncludes = checkEqualOrIncludes;
13629
13715
  exports.checkIsLoading = checkIsLoading;
13630
13716
  exports.createConfigLayer = createConfigLayer;