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