@evergis/react 4.0.64 → 4.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6214,6 +6214,8 @@ const getAttributeByName = (name, attributes) => {
6214
6214
  : null;
6215
6215
  };
6216
6216
 
6217
+ const isEmptyElementValue = (value) => value === "" || value === null || value === undefined;
6218
+
6217
6219
  /**
6218
6220
  * Returns a value safe to render as a React child.
6219
6221
  *
@@ -6238,7 +6240,7 @@ const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
6238
6240
  ? getAttributeByName(attributeName, attributes)
6239
6241
  : null;
6240
6242
  const { fontColor, fontSize, noUnits, tagView, bgColor, withDivider, radius, noMargin, } = options || {};
6241
- const valueOrDefault = value || defaultValue;
6243
+ const valueOrDefault = isEmptyElementValue(value) ? defaultValue : value;
6242
6244
  const resultValue = type === "attributeValue" && attribute?.type && attribute?.stringFormat
6243
6245
  ? formatAttributeValue({
6244
6246
  t,
@@ -6262,14 +6264,14 @@ const getAttributeValue = (element, attributes) => {
6262
6264
  return jsxRuntime.jsx(DashboardCheckbox, { title: attribute.alias || attribute.attributeName, checked: attribute.value });
6263
6265
  }
6264
6266
  if (Array.isArray(element?.attributeName)) {
6265
- const concatAttributes = element.attributeName.map((name) => attributes?.find(({ attributeName }) => attributeName === name)?.value || "");
6267
+ const concatAttributes = element.attributeName.map((name) => attributes?.find(({ attributeName }) => attributeName === name)?.value ?? "");
6266
6268
  value = concatAttributes.join(separator || ", ");
6267
6269
  }
6268
6270
  else {
6269
6271
  const rawValue = attribute?.value;
6270
- value = rawValue && typeof rawValue === "object"
6272
+ value = rawValue !== null && rawValue !== undefined && typeof rawValue === "object"
6271
6273
  ? JSON.stringify(rawValue)
6272
- : (rawValue || "");
6274
+ : (rawValue ?? "");
6273
6275
  }
6274
6276
  return typeof value === "string" && maxLength && maxLength < value.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, wordBreak: wordBreak, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
6275
6277
  };
@@ -6478,7 +6480,7 @@ const useRenderContainer = ({ elementConfig, type, renderElement, renderBody, })
6478
6480
  return (jsxRuntime.jsx(OverrideContainer, { type: type, elementConfig: itemConfig, renderElement: item.render }, attribute));
6479
6481
  }
6480
6482
  }
6481
- if (!item.value && item.hideEmpty)
6483
+ if (isEmptyElementValue(item.value) && item.hideEmpty)
6482
6484
  return null;
6483
6485
  return renderBody(item, attribute);
6484
6486
  }, [getRenderContainerItem, elementConfig, attributes, type, renderBody]);
@@ -7647,7 +7649,7 @@ const LogDialog = ({ isOpen, onClose, onMinimize, logs, status, statusColors })
7647
7649
  const getStatusColor = React.useCallback((currentStatus) => {
7648
7650
  return statusColors?.[currentStatus] || STATUS_COLORS[currentStatus] || STATUS_COLORS[api.RemoteTaskStatus.Unknown];
7649
7651
  }, [statusColors]);
7650
- return (jsxRuntime.jsxs(uilibGl.Dialog, { isOpen: isOpen, onCloseRequest: onClose, modal: true, maxWidth: "800px", minWidth: "600px", minHeight: "600px", children: [jsxRuntime.jsx(uilibGl.DialogTitle, { children: jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", children: [jsxRuntime.jsx(uilibGl.FlexSpan, { marginRight: "1rem", children: t("taskLogs", { ns: "dashboard", defaultValue: "Логи выполнения задачи" }) }), jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.darkTheme, children: jsxRuntime.jsx(StatusBadge, { text: getStatusTitle(status), bgColor: getStatusColor(status) }) })] }), jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", width: "auto", children: [onMinimize && jsxRuntime.jsx(uilibGl.IconButton, { kind: "change_geom", onClick: onMinimize }), jsxRuntime.jsx(uilibGl.IconButton, { kind: "close", onClick: onClose })] })] }) }), jsxRuntime.jsx(uilibGl.DialogContent, { children: jsxRuntime.jsx(uilibGl.Flex, { flexDirection: "column", height: "100%", marginBottom: "2rem", children: jsxRuntime.jsx(LogTerminal, { log: logs || t("taskLogsEmpty", { ns: "dashboard", defaultValue: "Логи отсутствуют" }) }) }) })] }));
7652
+ return (jsxRuntime.jsxs(uilibGl.Dialog, { isOpen: isOpen, onCloseRequest: onClose, modal: true, maxWidth: "800px", minWidth: "600px", minHeight: "600px", children: [jsxRuntime.jsx(uilibGl.DialogTitle, { children: jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", children: [jsxRuntime.jsx(uilibGl.FlexSpan, { marginRight: "1rem", children: t("taskLogs", { ns: "dashboard", defaultValue: "Логи выполнения задачи" }) }), jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: uilibGl.darkTheme, children: jsxRuntime.jsx(StatusBadge, { text: getStatusTitle(status), bgColor: getStatusColor(status) }) })] }), jsxRuntime.jsxs(uilibGl.Flex, { alignItems: "center", width: "auto", children: [onMinimize && jsxRuntime.jsx(uilibGl.IconButton, { kind: "rollup", onClick: onMinimize }), jsxRuntime.jsx(uilibGl.IconButton, { kind: "close", onClick: onClose })] })] }) }), jsxRuntime.jsx(uilibGl.DialogContent, { children: jsxRuntime.jsx(uilibGl.Flex, { flexDirection: "column", height: "100%", marginBottom: "2rem", children: jsxRuntime.jsx(LogTerminal, { log: logs || t("taskLogsEmpty", { ns: "dashboard", defaultValue: "Логи отсутствуют" }) }) }) })] }));
7651
7653
  };
7652
7654
 
7653
7655
  exports.ThemeName = void 0;
@@ -9038,115 +9040,6 @@ const FeatureCardDefaultHeader = ({ noFeature }) => {
9038
9040
  return (jsxRuntime.jsx(DefaultHeaderWrapper, { withPadding: withPadding, height: height, children: jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: getThemeByName(themeName), children: jsxRuntime.jsx(Header, { "$overlay": overlay, "$isRow": !column, children: jsxRuntime.jsxs(HeaderFrontView, { isDefault: !column, children: [jsxRuntime.jsxs(HeaderContainer, { children: [jsxRuntime.jsx(HeaderLayerIcon, {}), jsxRuntime.jsx(HeaderTitle, { noFeature: noFeature })] }), jsxRuntime.jsx(FeatureCardButtons, {})] }) }) }) }));
9039
9041
  };
9040
9042
 
9041
- const HeaderWrapperMixin = styled.css `
9042
- ${Header} {
9043
- min-height: 5.25rem;
9044
- }
9045
-
9046
- ${HeaderContainer} {
9047
- max-width: 100%;
9048
- width: 100%;
9049
- }
9050
-
9051
- ${FeatureControls} {
9052
- max-width: calc(100% - 2rem);
9053
- width: calc(100% - 2rem);
9054
- margin-top: -0.5rem;
9055
- padding-top: 1rem;
9056
- border-radius: ${({ theme: { borderRadius } }) => borderRadius.medium};
9057
- }
9058
-
9059
- ${({ $fontColor }) => !!$fontColor && HeaderFontColorMixin};
9060
- `;
9061
- const HeaderIcon = styled(uilibGl.Flex) `
9062
- position: absolute;
9063
- top: 0;
9064
- right: 0;
9065
- align-items: center;
9066
- justify-content: center;
9067
- width: 7.625rem;
9068
- height: 100%;
9069
-
9070
- span[kind] {
9071
- width: 4rem;
9072
-
9073
- :after {
9074
- font-size: 4rem;
9075
- color: rgba(255, 255, 255, 0.36);
9076
- }
9077
- }
9078
-
9079
- span[kind]:after,
9080
- path,
9081
- line,
9082
- circle {
9083
- fill: rgba(255, 255, 255, 0.36);
9084
- }
9085
-
9086
- && > * {
9087
- display: flex;
9088
- align-items: center;
9089
- height: 100%;
9090
- }
9091
- `;
9092
- const BigIconHeaderMixin = styled.css `
9093
- ${HeaderIcon} {
9094
- min-width: 14rem;
9095
- right: -3rem;
9096
-
9097
- span[kind]:after {
9098
- font-size: 14rem;
9099
- }
9100
- }
9101
- `;
9102
- const WithPaddingHeaderMixin = styled.css `
9103
- ${Header} {
9104
- width: 100%;
9105
- margin: -0.5rem -0.5rem 0.5rem -0.5rem;
9106
- }
9107
- `;
9108
- const BottomBlurHeaderMixin = styled.css `
9109
- ${Header} {
9110
- margin-bottom: 0;
9111
-
9112
- &::after {
9113
- content: "";
9114
- position: absolute;
9115
- top: 0;
9116
- right: 0;
9117
- bottom: 0;
9118
- left: 0;
9119
- z-index: 11;
9120
- pointer-events: none;
9121
- background: ${({ theme: { palette } }) => palette.background};
9122
- mask-image: linear-gradient(to top, #000 0%, transparent 100%);
9123
- -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 100%);
9124
- }
9125
- }
9126
-
9127
- ${HeaderFrontView} {
9128
- z-index: 12;
9129
- }
9130
- `;
9131
- const BackgroundHeaderWrapper = styled.div `
9132
- ${Header} {
9133
- width: calc(100% + 1rem);
9134
- height: ${({ $height }) => $height ? `${$height}px` : "auto"};
9135
- margin: -1rem -1rem 1rem -1rem;
9136
- border-radius: 0.5rem;
9137
- background: ${({ $bgColor }) => $bgColor || "linear-gradient(96.55deg, #FFFCD3 0%, #B4DC47 100%)"};
9138
- overflow: hidden;
9139
- }
9140
-
9141
- ${HeaderWrapperMixin};
9142
-
9143
- ${({ $bigIcon }) => $bigIcon && BigIconHeaderMixin};
9144
-
9145
- ${({ $withPadding }) => $withPadding && WithPaddingHeaderMixin};
9146
-
9147
- ${({ $bottomBlur }) => $bottomBlur && BottomBlurHeaderMixin};
9148
- `;
9149
-
9150
9043
  const ImageContainerButton = styled(uilibGl.FlatButton) `
9151
9044
  min-height: 1.5rem;
9152
9045
  border-radius: ${({ theme: { borderRadius } }) => borderRadius.large};
@@ -10065,6 +9958,121 @@ const HeaderSlideshow = styled.div `
10065
9958
  }
10066
9959
  `;
10067
9960
 
9961
+ const HeaderWrapperMixin = styled.css `
9962
+ ${Header} {
9963
+ min-height: 5.25rem;
9964
+ }
9965
+
9966
+ ${HeaderContainer} {
9967
+ max-width: 100%;
9968
+ width: 100%;
9969
+ }
9970
+
9971
+ ${FeatureControls} {
9972
+ max-width: calc(100% - 2rem);
9973
+ width: calc(100% - 2rem);
9974
+ margin-top: -0.5rem;
9975
+ padding-top: 1rem;
9976
+ border-radius: ${({ theme: { borderRadius } }) => borderRadius.medium};
9977
+ }
9978
+
9979
+ ${({ $fontColor }) => !!$fontColor && HeaderFontColorMixin};
9980
+ `;
9981
+ const HeaderIcon = styled(uilibGl.Flex) `
9982
+ position: absolute;
9983
+ top: 0;
9984
+ right: 0;
9985
+ align-items: center;
9986
+ justify-content: center;
9987
+ width: 7.625rem;
9988
+ height: 100%;
9989
+
9990
+ span[kind] {
9991
+ width: 4rem;
9992
+
9993
+ :after {
9994
+ font-size: 4rem;
9995
+ color: rgba(255, 255, 255, 0.36);
9996
+ }
9997
+ }
9998
+
9999
+ span[kind]:after,
10000
+ path,
10001
+ line,
10002
+ circle {
10003
+ fill: rgba(255, 255, 255, 0.36);
10004
+ }
10005
+
10006
+ && > * {
10007
+ display: flex;
10008
+ align-items: center;
10009
+ height: 100%;
10010
+ }
10011
+ `;
10012
+ const BigIconHeaderMixin = styled.css `
10013
+ ${HeaderIcon} {
10014
+ min-width: 14rem;
10015
+ right: -3rem;
10016
+
10017
+ span[kind]:after {
10018
+ font-size: 14rem;
10019
+ }
10020
+ }
10021
+ `;
10022
+ const WithPaddingHeaderMixin = styled.css `
10023
+ ${Header} {
10024
+ width: 100%;
10025
+ margin: -0.5rem -0.5rem 0.5rem -0.5rem;
10026
+ }
10027
+ `;
10028
+ const BottomBlurHeaderMixin = styled.css `
10029
+ ${Header} {
10030
+ margin-bottom: 0;
10031
+
10032
+ &::before {
10033
+ -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
10034
+ mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
10035
+ }
10036
+ }
10037
+
10038
+ ${ImageContainerBg} {
10039
+ -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
10040
+ mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
10041
+ }
10042
+
10043
+ ${HeaderFrontView} {
10044
+ z-index: 12;
10045
+ }
10046
+ `;
10047
+ const BackgroundHeaderWrapper = styled.div `
10048
+ ${Header} {
10049
+ position: relative;
10050
+ width: calc(100% + 1rem);
10051
+ height: ${({ $height }) => $height ? `${$height}px` : "auto"};
10052
+ margin: -1rem -1rem 1rem -1rem;
10053
+ border-radius: 0.5rem;
10054
+ background: transparent;
10055
+ overflow: hidden;
10056
+
10057
+ &::before {
10058
+ content: "";
10059
+ position: absolute;
10060
+ inset: 0;
10061
+ z-index: 0;
10062
+ pointer-events: none;
10063
+ background: ${({ $bgColor }) => $bgColor || "linear-gradient(96.55deg, #FFFCD3 0%, #B4DC47 100%)"};
10064
+ }
10065
+ }
10066
+
10067
+ ${HeaderWrapperMixin};
10068
+
10069
+ ${({ $bigIcon }) => $bigIcon && BigIconHeaderMixin};
10070
+
10071
+ ${({ $withPadding }) => $withPadding && WithPaddingHeaderMixin};
10072
+
10073
+ ${({ $bottomBlur }) => $bottomBlur && BottomBlurHeaderMixin};
10074
+ `;
10075
+
10068
10076
  const FeatureCardBackgroundHeader = () => {
10069
10077
  const { themeName: pageThemeName } = useGlobalContext();
10070
10078
  const { config } = useWidgetConfig(exports.WidgetType.FeatureCard);
@@ -10320,8 +10328,6 @@ const ModalIcon = styled(uilibGl.IconButton) `
10320
10328
  }
10321
10329
  `;
10322
10330
 
10323
- const isEmptyElementValue = (value) => value === "" || value === null || value === undefined;
10324
-
10325
10331
  const isHiddenEmptyValue = ({ value, children, hideEmpty, renderElement, }) => {
10326
10332
  const valueElement = children?.find(item => item.id === "value");
10327
10333
  const renderedValue = valueElement ? renderElement({ id: "value" }) : null;