@evergis/react 3.1.73 → 3.1.75

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.
@@ -0,0 +1,9 @@
1
+ import { FC, CSSProperties } from 'react';
2
+ import { ITerminalInitOnlyOptions, ITerminalOptions } from '@xterm/xterm';
3
+ export interface TaskLogTerminalProps {
4
+ log?: string | Record<string, any>;
5
+ className?: string;
6
+ styles?: CSSProperties;
7
+ terminalOptions?: ITerminalOptions & ITerminalInitOnlyOptions;
8
+ }
9
+ export declare const LogTerminal: FC<TaskLogTerminalProps>;
@@ -0,0 +1 @@
1
+ export declare const TerminalWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -13,6 +13,7 @@ export * from './FeatureCardHeader';
13
13
  export * from './FeatureCardTitle';
14
14
  export * from './HiddenTitleItems';
15
15
  export * from './Loading';
16
+ export * from './LogTerminal';
16
17
  export * from './Pagination';
17
18
  export * from './Pagination/styled';
18
19
  export * from './StackBar';
package/dist/index.js CHANGED
@@ -24,9 +24,9 @@ require('mapbox-gl/dist/mapbox-gl.css');
24
24
  var react = require('swiper/react');
25
25
  var ReactMarkdown = require('react-markdown');
26
26
  var remarkGfm = require('remark-gfm');
27
- require('@xterm/xterm/css/xterm.css');
28
27
  var xterm = require('@xterm/xterm');
29
28
  var addonFit = require('@xterm/addon-fit');
29
+ require('@xterm/xterm/css/xterm.css');
30
30
 
31
31
  const AddFeatureButton = ({ title, icon = "feature_add" /* , layerName, geometryType*/ }) => {
32
32
  // const [, handleAddFeature] = useFeatureCreator(layerName, geometryType);
@@ -5687,14 +5687,15 @@ const OneColumnContainer = React.memo(({ elementConfig, renderElement }) => {
5687
5687
  const TwoColumnContainer = React.memo(({ config, elementConfig, type, renderElement }) => {
5688
5688
  const { selectedTabId, layerInfo, attributes } = useWidgetContext(type);
5689
5689
  const { attributes: renderAttributes } = elementConfig?.options || {};
5690
- const renderContainer = React.useCallback((element, attribute) => {
5691
- const { id, options, style, children } = element || {};
5690
+ const renderContainer = React.useCallback((attribute) => {
5691
+ const { id, options, style, children } = elementConfig || {};
5692
5692
  const { hideEmpty, innerTemplateStyle } = options || {};
5693
5693
  const hasUnits = children?.some(({ id }) => id === "units");
5694
5694
  const iconIndex = children?.findIndex(({ id }) => id === "icon");
5695
5695
  const icon = children?.[iconIndex];
5696
5696
  const hasIcon = !!icon;
5697
- const elementChildren = element?.children?.map(child => ({
5697
+ const elementChildren = elementConfig?.children?.map(child => ({
5698
+ type: "attributeValue",
5698
5699
  ...child,
5699
5700
  attributeName: attribute,
5700
5701
  options: { noUnits: hasUnits, ...child.options },
@@ -5714,7 +5715,7 @@ const TwoColumnContainer = React.memo(({ config, elementConfig, type, renderElem
5714
5715
  ? getRenderElement({
5715
5716
  config,
5716
5717
  elementConfig: {
5717
- ...element,
5718
+ ...elementConfig,
5718
5719
  children: elementChildren,
5719
5720
  },
5720
5721
  selectedTabId,
@@ -5727,8 +5728,8 @@ const TwoColumnContainer = React.memo(({ config, elementConfig, type, renderElem
5727
5728
  if (!value && hideEmpty)
5728
5729
  return null;
5729
5730
  return (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style: innerTemplateStyle || style, children: [jsxRuntime.jsxs(ContainerAlias, { children: [hasIcon && jsxRuntime.jsx(ContainerAliasIcon, { children: render({ id: "icon" }) }), render({ id: "alias" }), render({ id: "tooltip" })] }), jsxRuntime.jsxs(ContainerValue, { big: true, children: [value, hasUnits && jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) })] })] }, attribute));
5730
- }, [attributes, config, getRenderElement, layerInfo, renderElement, selectedTabId, type]);
5731
- return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(elementConfig, attribute)) })) : (renderContainer(elementConfig));
5731
+ }, [attributes, config, getRenderElement, layerInfo, renderElement, selectedTabId, type, elementConfig]);
5732
+ return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
5732
5733
  });
5733
5734
 
5734
5735
  const InnerContainerWrapper = styled.div `
@@ -6847,121 +6848,6 @@ const StatusBadge = styled(uilibGl.Chip) `
6847
6848
  color: ${({ theme }) => theme.palette.iconContrast};
6848
6849
  `;
6849
6850
 
6850
- const TerminalWrapper = styled.div `
6851
- flex: 1;
6852
- overflow: hidden;
6853
- padding: 0;
6854
- margin: 0;
6855
- box-sizing: border-box;
6856
- min-height: 0;
6857
-
6858
- .xterm-viewport {
6859
- overflow-y: auto;
6860
- }
6861
-
6862
- .xterm-screen .xterm-rows span {
6863
- letter-spacing: 0 !important;
6864
- }
6865
- `;
6866
-
6867
- const LogTerminal = ({ log }) => {
6868
- const terminalRef = React.useRef(null);
6869
- const xtermRef = React.useRef(null);
6870
- const fitAddonRef = React.useRef(null);
6871
- const previousLogRef = React.useRef("");
6872
- const theme = styled.useTheme();
6873
- React.useEffect(() => {
6874
- if (!terminalRef.current)
6875
- return;
6876
- // Create terminal instance
6877
- const terminal = new xterm.Terminal({
6878
- cursorBlink: false,
6879
- fontSize: 12,
6880
- fontFamily: '"Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace',
6881
- scrollback: 10000,
6882
- convertEol: true,
6883
- lineHeight: 1.5,
6884
- theme: {
6885
- background: theme.palette.background,
6886
- foreground: theme.palette.textPrimary,
6887
- cursor: theme.palette.primary,
6888
- },
6889
- });
6890
- // Create fit addon
6891
- const fitAddon = new addonFit.FitAddon();
6892
- terminal.loadAddon(fitAddon);
6893
- // Open terminal
6894
- terminal.open(terminalRef.current);
6895
- fitAddon.fit();
6896
- // Store refs
6897
- xtermRef.current = terminal;
6898
- fitAddonRef.current = fitAddon;
6899
- // Handle window resize
6900
- const handleResize = () => {
6901
- fitAddon.fit();
6902
- };
6903
- window.addEventListener("resize", handleResize);
6904
- // Cleanup
6905
- return () => {
6906
- window.removeEventListener("resize", handleResize);
6907
- terminal.dispose();
6908
- xtermRef.current = null;
6909
- fitAddonRef.current = null;
6910
- };
6911
- }, [theme]);
6912
- // Update log content
6913
- React.useEffect(() => {
6914
- if (!xtermRef.current)
6915
- return;
6916
- // Handle different log types
6917
- if (typeof log === "string") {
6918
- // For string logs, only write the new content (append mode)
6919
- const previousLog = previousLogRef.current;
6920
- if (log !== previousLog) {
6921
- if (log.startsWith(previousLog)) {
6922
- // Log is accumulated - write only the new part
6923
- const newContent = log.substring(previousLog.length);
6924
- xtermRef.current.write(newContent);
6925
- }
6926
- else {
6927
- // Log was replaced completely - clear and write all
6928
- xtermRef.current.clear();
6929
- xtermRef.current.write(log);
6930
- }
6931
- previousLogRef.current = log;
6932
- }
6933
- }
6934
- else if (typeof log === "object") {
6935
- // JSON object (results) - always replace
6936
- xtermRef.current.clear();
6937
- const formatted = JSON.stringify(log, null, 2);
6938
- xtermRef.current.write(formatted);
6939
- previousLogRef.current = "";
6940
- }
6941
- else if (!log) {
6942
- // No log - clear terminal
6943
- xtermRef.current.clear();
6944
- previousLogRef.current = "";
6945
- }
6946
- // Scroll to bottom
6947
- xtermRef.current.scrollToBottom();
6948
- }, [log]);
6949
- React.useEffect(() => {
6950
- if (!fitAddonRef.current)
6951
- return;
6952
- const resizeObserver = new ResizeObserver(() => {
6953
- fitAddonRef.current?.fit();
6954
- });
6955
- if (terminalRef.current) {
6956
- resizeObserver.observe(terminalRef.current);
6957
- }
6958
- return () => {
6959
- resizeObserver.disconnect();
6960
- };
6961
- }, []);
6962
- return jsxRuntime.jsx(TerminalWrapper, { ref: terminalRef });
6963
- };
6964
-
6965
6851
  const STATUS_TRANSLATION_KEYS = {
6966
6852
  [api.RemoteTaskStatus.Process]: "taskProcess",
6967
6853
  [api.RemoteTaskStatus.Completed]: "taskCompleted",
@@ -7417,9 +7303,11 @@ const GradientHeaderWrapper = styled.div `
7417
7303
  const FeatureCardGradientHeader = ({ isRow }) => {
7418
7304
  const { layerInfo } = useWidgetContext(exports.WidgetType.FeatureCard);
7419
7305
  const { config } = useWidgetConfig(exports.WidgetType.FeatureCard);
7420
- const { header, options } = config || {};
7306
+ const { header } = config || {};
7307
+ const { options } = header || {};
7308
+ const { fontColor, bgColor } = options || {};
7421
7309
  const renderElement = useHeaderRender(header);
7422
- return (jsxRuntime.jsx(GradientHeaderWrapper, { "$fontColor": options?.fontColor, "$bgColor": options?.bgColor, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.defaultTheme, children: jsxRuntime.jsx(Header, { "$isRow": isRow, children: jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
7310
+ return (jsxRuntime.jsx(GradientHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.defaultTheme, children: jsxRuntime.jsx(Header, { "$isRow": isRow, children: jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
7423
7311
  id: "title",
7424
7312
  wrap: false,
7425
7313
  }), description: renderElement({
@@ -7429,7 +7317,7 @@ const FeatureCardGradientHeader = ({ isRow }) => {
7429
7317
  };
7430
7318
 
7431
7319
  const HeaderFontColorMixin = styled.css `
7432
- ${HeaderTitleContainer}, ${LayerDescription} {
7320
+ ${HeaderTitleContainer}, ${HeaderTitleContainer} *, ${LayerDescription} {
7433
7321
  color: ${({ $fontColor }) => $fontColor};
7434
7322
  }
7435
7323
  `;
@@ -7507,9 +7395,11 @@ const IconHeaderWrapper = styled.div `
7507
7395
  const FeatureCardIconHeader = ({ isRow }) => {
7508
7396
  const { layerInfo } = useWidgetContext(exports.WidgetType.FeatureCard);
7509
7397
  const { config } = useWidgetConfig(exports.WidgetType.FeatureCard);
7510
- const { header, options } = config || {};
7398
+ const { header } = config || {};
7399
+ const { options } = header || {};
7400
+ const { fontColor, bgColor, bigIcon } = options || {};
7511
7401
  const renderElement = useHeaderRender(header);
7512
- return (jsxRuntime.jsx(IconHeaderWrapper, { "$fontColor": options?.fontColor, "$bgColor": options?.bgColor, "$bigIcon": options?.bigIcon, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.defaultTheme, children: jsxRuntime.jsxs(Header, { "$isRow": isRow, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
7402
+ return (jsxRuntime.jsx(IconHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$bigIcon": bigIcon, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.defaultTheme, children: jsxRuntime.jsxs(Header, { "$isRow": isRow, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
7513
7403
  id: "title",
7514
7404
  wrap: false,
7515
7405
  }), description: renderElement({
@@ -7976,8 +7866,13 @@ const LocalLinkButton = styled(uilibGl.IconButton).attrs(() => ({
7976
7866
  width: 1rem;
7977
7867
  height: 1rem;
7978
7868
  background-color: ${({ theme: { palette } }) => palette.primary};
7869
+ padding: 0;
7979
7870
  border-radius: 50%;
7980
7871
 
7872
+ :hover {
7873
+ background-color: ${({ theme: { palette } }) => palette.primary};
7874
+ }
7875
+
7981
7876
  span[kind] {
7982
7877
  display: flex;
7983
7878
  justify-content: center;
@@ -8007,8 +7902,8 @@ const LocalLink = React.memo(({ link }) => {
8007
7902
  const ElementLink = React.memo(({ type, elementConfig }) => {
8008
7903
  const { attributes } = useWidgetContext(type);
8009
7904
  const attribute = getAttributeByName(elementConfig?.attributeName, attributes);
8010
- const link = attribute?.value;
8011
- if (!link || typeof link !== "string")
7905
+ const link = getResourceUrl(attribute?.value?.toString());
7906
+ if (!link)
8012
7907
  return null;
8013
7908
  return link.startsWith("http") ? jsxRuntime.jsx(ExternalLink, { onClick: () => window.open(link) }) : jsxRuntime.jsx(LocalLink, { link: link });
8014
7909
  });
@@ -8312,9 +8207,11 @@ const HeaderSlideshow = styled.div `
8312
8207
  const FeatureCardSlideshowHeader = ({ isRow }) => {
8313
8208
  const { layerInfo } = useWidgetContext(exports.WidgetType.FeatureCard);
8314
8209
  const { config } = useWidgetConfig(exports.WidgetType.FeatureCard);
8315
- const { header, options } = config || {};
8210
+ const { header } = config || {};
8211
+ const { options } = header || {};
8212
+ const { height, withPadding } = options || {};
8316
8213
  const renderElement = useHeaderRender(header);
8317
- return (jsxRuntime.jsx(SlideshowHeaderWrapper, { big: true, withPadding: options?.withPadding, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.darkTheme, children: jsxRuntime.jsxs(Header, { "$isRow": isRow, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
8214
+ return (jsxRuntime.jsx(SlideshowHeaderWrapper, { big: true, withPadding: withPadding, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.darkTheme, children: jsxRuntime.jsxs(Header, { "$isRow": isRow, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(LayerIcon, { layerInfo: layerInfo }), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
8318
8215
  id: "title",
8319
8216
  wrap: false,
8320
8217
  }), description: renderElement({
@@ -8323,7 +8220,7 @@ const FeatureCardSlideshowHeader = ({ isRow }) => {
8323
8220
  }) })] }), jsxRuntime.jsx(FeatureCardButtons, {})] }), jsxRuntime.jsx(ImageContainerBg, { children: renderElement({
8324
8221
  id: "bgImage",
8325
8222
  wrap: false,
8326
- }) }), jsxRuntime.jsx(HeaderSlideshow, { height: options?.height, children: renderElement({
8223
+ }) }), jsxRuntime.jsx(HeaderSlideshow, { height: height, children: renderElement({
8327
8224
  id: "slideshow",
8328
8225
  wrap: false,
8329
8226
  }) })] }) }) }));
@@ -10615,7 +10512,7 @@ const ContainerChildren = React.memo(({ type, items, isColumn, isMain, renderEle
10615
10512
  });
10616
10513
  if (checkIfEmptyDataSource(item.options?.hideIfEmptyDataSource))
10617
10514
  return null;
10618
- return isMain ? (jsxRuntime.jsx(ContainerWrapper, { "data-id": item.id, "data-templatename": item.templateName, "$noMargin": item.options?.noMargin, children: jsxRuntime.jsx(DashboardWrapper, { children: render }) }, index)) : (jsxRuntime.jsx(React.Fragment, { children: render }, index));
10515
+ return isMain ? (jsxRuntime.jsx(ContainerWrapper, { "$noMargin": item.options?.noMargin, children: jsxRuntime.jsx(DashboardWrapper, { children: render }) }, index)) : (jsxRuntime.jsx(React.Fragment, { children: render }, index));
10619
10516
  }) }));
10620
10517
  });
10621
10518
 
@@ -10787,6 +10684,122 @@ const HiddenTitleItems = React.memo(({ elementConfig, config, type, filter }) =>
10787
10684
  getConfigFilter(filterName, configFilters)?.defaultValue, index)) }));
10788
10685
  });
10789
10686
 
10687
+ const TerminalWrapper = styled.div `
10688
+ flex: 1;
10689
+ overflow: hidden;
10690
+ padding: 0;
10691
+ margin: 0;
10692
+ box-sizing: border-box;
10693
+ min-height: 0;
10694
+
10695
+ .xterm-viewport {
10696
+ overflow-y: auto;
10697
+ }
10698
+
10699
+ .xterm-screen .xterm-rows span {
10700
+ letter-spacing: 0 !important;
10701
+ }
10702
+ `;
10703
+
10704
+ const LogTerminal = ({ log, terminalOptions, className, styles }) => {
10705
+ const terminalRef = React.useRef(null);
10706
+ const xtermRef = React.useRef(null);
10707
+ const fitAddonRef = React.useRef(null);
10708
+ const previousLogRef = React.useRef("");
10709
+ const theme = styled.useTheme();
10710
+ React.useEffect(() => {
10711
+ if (!terminalRef.current)
10712
+ return;
10713
+ // Create terminal instance
10714
+ const terminal = new xterm.Terminal({
10715
+ cursorBlink: false,
10716
+ fontSize: 12,
10717
+ fontFamily: '"Monaco", "Menlo", "Ubuntu Mono", "Consolas", "source-code-pro", monospace',
10718
+ scrollback: 10000,
10719
+ convertEol: true,
10720
+ lineHeight: 1.5,
10721
+ theme: {
10722
+ background: theme.palette.background,
10723
+ foreground: theme.palette.textPrimary,
10724
+ cursor: theme.palette.primary,
10725
+ },
10726
+ ...terminalOptions,
10727
+ });
10728
+ // Create fit addon
10729
+ const fitAddon = new addonFit.FitAddon();
10730
+ terminal.loadAddon(fitAddon);
10731
+ // Open terminal
10732
+ terminal.open(terminalRef.current);
10733
+ fitAddon.fit();
10734
+ // Store refs
10735
+ xtermRef.current = terminal;
10736
+ fitAddonRef.current = fitAddon;
10737
+ // Handle window resize
10738
+ const handleResize = () => {
10739
+ fitAddon.fit();
10740
+ };
10741
+ window.addEventListener("resize", handleResize);
10742
+ // Cleanup
10743
+ return () => {
10744
+ window.removeEventListener("resize", handleResize);
10745
+ terminal.dispose();
10746
+ xtermRef.current = null;
10747
+ fitAddonRef.current = null;
10748
+ };
10749
+ }, [theme, terminalOptions]);
10750
+ // Update log content
10751
+ React.useEffect(() => {
10752
+ if (!xtermRef.current)
10753
+ return;
10754
+ // Handle different log types
10755
+ if (typeof log === "string") {
10756
+ // For string logs, only write the new content (append mode)
10757
+ const previousLog = previousLogRef.current;
10758
+ if (log !== previousLog) {
10759
+ if (log.startsWith(previousLog)) {
10760
+ // Log is accumulated - write only the new part
10761
+ const newContent = log.substring(previousLog.length);
10762
+ xtermRef.current.write(newContent);
10763
+ }
10764
+ else {
10765
+ // Log was replaced completely - clear and write all
10766
+ xtermRef.current.clear();
10767
+ xtermRef.current.write(log);
10768
+ }
10769
+ previousLogRef.current = log;
10770
+ }
10771
+ }
10772
+ else if (typeof log === "object") {
10773
+ // JSON object (results) - always replace
10774
+ xtermRef.current.clear();
10775
+ const formatted = JSON.stringify(log, null, 2);
10776
+ xtermRef.current.write(formatted);
10777
+ previousLogRef.current = "";
10778
+ }
10779
+ else if (!log) {
10780
+ // No log - clear terminal
10781
+ xtermRef.current.clear();
10782
+ previousLogRef.current = "";
10783
+ }
10784
+ // Scroll to bottom
10785
+ xtermRef.current.scrollToBottom();
10786
+ }, [log]);
10787
+ React.useEffect(() => {
10788
+ if (!fitAddonRef.current)
10789
+ return;
10790
+ const resizeObserver = new ResizeObserver(() => {
10791
+ fitAddonRef.current?.fit();
10792
+ });
10793
+ if (terminalRef.current) {
10794
+ resizeObserver.observe(terminalRef.current);
10795
+ }
10796
+ return () => {
10797
+ resizeObserver.disconnect();
10798
+ };
10799
+ }, []);
10800
+ return jsxRuntime.jsx(TerminalWrapper, { ref: terminalRef, className: className, style: styles });
10801
+ };
10802
+
10790
10803
  const PageNavigator = styled(uilibGl.Flex) `
10791
10804
  margin-right: -0.5rem;
10792
10805
  align-items: center;
@@ -11210,6 +11223,7 @@ exports.LayerTree = LayerTree;
11210
11223
  exports.LayersContainer = LayersContainer;
11211
11224
  exports.LayersListWrapper = LayersListWrapper;
11212
11225
  exports.LinearProgressContainer = LinearProgressContainer;
11226
+ exports.LogTerminal = LogTerminal;
11213
11227
  exports.LogoContainer = LogoContainer;
11214
11228
  exports.MAX_CHART_WIDTH = MAX_CHART_WIDTH;
11215
11229
  exports.Map = Map$1;