@evergis/react 3.1.131 → 3.1.132

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.
@@ -1,4 +1,5 @@
1
1
  export * from './useAutoCompleteControl';
2
+ export * from './useFetchImageWithAuth';
2
3
  export * from './useFetchWithAuth';
3
4
  export * from './useChartChange';
4
5
  export * from './useChartData';
@@ -0,0 +1 @@
1
+ export declare const useFetchImageWithAuth: (url: string | null) => string | null;
package/dist/index.js CHANGED
@@ -3954,6 +3954,9 @@ const useFetchWithAuth = (url, transform, cleanup) => {
3954
3954
  return data;
3955
3955
  };
3956
3956
 
3957
+ const toObjectUrl = (res) => res.blob().then(blob => URL.createObjectURL(blob));
3958
+ const useFetchImageWithAuth = (url) => useFetchWithAuth(url, toObjectUrl, URL.revokeObjectURL);
3959
+
3957
3960
  const DashboardContext = React.createContext({});
3958
3961
  const DashboardProvider = React.memo(({ children, ...props }) => {
3959
3962
  return jsxRuntime.jsx(DashboardContext.Provider, { value: props, children: children });
@@ -7802,10 +7805,10 @@ const PageTitleContainer = styled(uilibGl.Flex) `
7802
7805
  `;
7803
7806
 
7804
7807
  const DashboardDefaultHeader = React.memo(() => {
7805
- const { title } = useDashboardHeader();
7808
+ const { title, pageId, image, icon, tooltip, themeName } = useDashboardHeader();
7806
7809
  const { toggleLayersVisibility, components: { ProjectPanelMenu, ProjectPagesMenu }, } = useWidgetContext();
7807
- const { pageId, image, icon, tooltip, themeName } = useDashboardHeader();
7808
- return (jsxRuntime.jsxs(DefaultHeaderContainer, { image: getResourceUrl(image), isDark: themeName === exports.ThemeName.Dark, children: [!pageId && jsxRuntime.jsx(uilibGl.LinearProgress, {}), jsxRuntime.jsxs(uilibGl.Flex, { column: true, gap: "1rem", children: [jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsxs(TopContainer, { children: [jsxRuntime.jsx(LogoContainer, { children: icon }), jsxRuntime.jsx(TopContainerButtons, { children: jsxRuntime.jsx(ProjectPanelMenu, {}) })] }) }), jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsx(uilibGl.Flex, { column: true, gap: "0.25rem", children: jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", children: [jsxRuntime.jsxs(PageTitleContainer, { children: [jsxRuntime.jsx(uilibGl.Tooltip, { arrow: true, content: tooltip, children: ref => (jsxRuntime.jsx(PageTitle, { ref: ref, onClick: toggleLayersVisibility, children: title })) }), jsxRuntime.jsx(ProjectPagesMenu, {})] }), jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsx(Pagination, {}) })] }) }) }) })] })] }));
7810
+ const backgroundImage = useFetchImageWithAuth(image ? getResourceUrl(image) : null);
7811
+ return (jsxRuntime.jsxs(DefaultHeaderContainer, { image: backgroundImage ?? undefined, isDark: themeName === exports.ThemeName.Dark, children: [!pageId && jsxRuntime.jsx(uilibGl.LinearProgress, {}), jsxRuntime.jsxs(uilibGl.Flex, { column: true, gap: "1rem", children: [jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsxs(TopContainer, { children: [jsxRuntime.jsx(LogoContainer, { children: icon }), jsxRuntime.jsx(TopContainerButtons, { children: jsxRuntime.jsx(ProjectPanelMenu, {}) })] }) }), jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsx(uilibGl.Flex, { column: true, gap: "0.25rem", children: jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", children: [jsxRuntime.jsxs(PageTitleContainer, { children: [jsxRuntime.jsx(uilibGl.Tooltip, { arrow: true, content: tooltip, children: ref => (jsxRuntime.jsx(PageTitle, { ref: ref, onClick: toggleLayersVisibility, children: title })) }), jsxRuntime.jsx(ProjectPagesMenu, {})] }), jsxRuntime.jsx(uilibGl.FlexSpan, { children: jsxRuntime.jsx(Pagination, {}) })] }) }) }) })] })] }));
7809
7812
  });
7810
7813
 
7811
7814
  const HeaderFrontView = styled(uilibGl.Flex) `
@@ -8545,7 +8548,6 @@ const ElementIcon = React.memo(({ type, elementConfig }) => {
8545
8548
  return jsxRuntime.jsx(StyledIcon, { kind: iconValue, fontSize: fontSize, fontColor: fontColor, style: style });
8546
8549
  });
8547
8550
 
8548
- const toObjectUrl = (res) => res.blob().then(blob => URL.createObjectURL(blob));
8549
8551
  const ElementImage = React.memo(({ type, elementConfig }) => {
8550
8552
  const { attributes } = useWidgetContext(type);
8551
8553
  const { value, attributeName, options, style } = elementConfig || {};
@@ -8563,7 +8565,7 @@ const ElementImage = React.memo(({ type, elementConfig }) => {
8563
8565
  return null;
8564
8566
  return getResourceUrl(imageUrl);
8565
8567
  }, [attributeName, attributes, value]);
8566
- const blobUrl = useFetchWithAuth(firstImage, toObjectUrl, URL.revokeObjectURL);
8568
+ const blobUrl = useFetchImageWithAuth(firstImage);
8567
8569
  if (!blobUrl)
8568
8570
  return null;
8569
8571
  return (jsxRuntime.jsx("img", { src: blobUrl, alt: firstImage ?? "", width: width, style: style }));
@@ -12257,6 +12259,7 @@ exports.useDebouncedCallback = useDebouncedCallback;
12257
12259
  exports.useDiffPage = useDiffPage;
12258
12260
  exports.useExpandableContainers = useExpandableContainers;
12259
12261
  exports.useExportPdf = useExportPdf;
12262
+ exports.useFetchImageWithAuth = useFetchImageWithAuth;
12260
12263
  exports.useFetchWithAuth = useFetchWithAuth;
12261
12264
  exports.useGetConfigLayer = useGetConfigLayer;
12262
12265
  exports.useGlobalContext = useGlobalContext;