@evergis/react 3.1.56 → 3.1.57

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,3 +1,8 @@
1
- export declare const LayersContainerWrapper: import('styled-components').StyledComponent<any, any, {
1
+ export declare const LayersContainerWrapper: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
2
+ isTitle?: boolean;
3
+ isColumn?: boolean;
4
+ isMain?: boolean;
5
+ noBorders?: boolean;
6
+ } & {
2
7
  isPresentationMode?: boolean;
3
- }, string | number | symbol>;
8
+ }, never>;
@@ -1 +1,6 @@
1
- export declare const UploaderContainer: import('styled-components').StyledComponent<any, any, object, string | number | symbol>;
1
+ export declare const UploaderContainer: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
2
+ isTitle?: boolean;
3
+ isColumn?: boolean;
4
+ isMain?: boolean;
5
+ noBorders?: boolean;
6
+ }, never>;
@@ -1,5 +1,17 @@
1
- export declare const Container: any;
2
- export declare const ContainerWrapper: any;
1
+ import { CSSProperties } from 'react';
2
+ export declare const ElementValueWrapper: import('styled-components').StyledComponent<"div", any, {
3
+ noMargin?: boolean;
4
+ }, never>;
5
+ export declare const Container: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
6
+ isTitle?: boolean;
7
+ isColumn?: boolean;
8
+ isMain?: boolean;
9
+ noBorders?: boolean;
10
+ }, never>;
11
+ export declare const ContainerWrapper: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
12
+ $zIndex?: CSSProperties["zIndex"];
13
+ $noMargin?: boolean;
14
+ }, never>;
3
15
  export declare const DashboardChip: import('styled-components').StyledComponent<any, any, any, any>;
4
16
  export declare const DashboardPlaceholderWrap: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
5
17
  export declare const DashboardPlaceholder: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
package/dist/index.js CHANGED
@@ -4507,75 +4507,6 @@ const DashboardChip$1 = styled(uilibGl.Chip) `
4507
4507
  ${({ $fontColor, $isDefault }) => !!$fontColor && !$isDefault && CustomChipColorMixin}
4508
4508
  `;
4509
4509
 
4510
- const getAttributeByName = (attributeName, attributes) => {
4511
- return Array.isArray(attributeName)
4512
- ? null
4513
- : attributeName
4514
- ? attributes?.find(({ name }) => name === attributeName)
4515
- : null;
4516
- };
4517
-
4518
- const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
4519
- const { id, type, defaultValue, options, style, attributeName, templateName } = elementConfig || {};
4520
- const attribute = attributeName ? getAttributeByName(attributeName, attributes) : null;
4521
- const { fontColor, fontSize, noUnits, tagView, bgColor, withDivider, radius } = options || {};
4522
- const valueOrDefault = value || defaultValue;
4523
- const resultValue = type === "attributeValue" && attribute?.type && attribute?.stringFormat
4524
- ? formatAttributeValue({
4525
- t,
4526
- type: attribute.type,
4527
- value: valueOrDefault,
4528
- stringFormat: attribute.stringFormat,
4529
- noUnits,
4530
- })
4531
- : valueOrDefault;
4532
- if (!wrap)
4533
- return resultValue;
4534
- return (jsxRuntime.jsxs(React.Fragment, { children: [tagView ? (jsxRuntime.jsx(DashboardChip$1, { text: resultValue, "$bgColor": bgColor, "$fontColor": fontColor, "$fontSize": fontSize, "$radius": radius, style: style })) : resultValue, withDivider && jsxRuntime.jsx(uilibGl.Divider, {})] }, id));
4535
- };
4536
-
4537
- const getAttributeValue = (element, attributes) => {
4538
- const attribute = getAttributeByName(element?.attributeName, attributes);
4539
- const { maxLength, separator, expandable, lineBreak } = element.options || {};
4540
- let value = "";
4541
- if (attribute?.type === api.AttributeType.Boolean && typeof attribute.value === "boolean") {
4542
- return jsxRuntime.jsx(DashboardCheckbox, { title: attribute.alias || attribute.name, checked: attribute.value });
4543
- }
4544
- if (Array.isArray(element?.attributeName)) {
4545
- const concatAttributes = element.attributeName.map((attributeName) => attributes?.find(({ name }) => name === attributeName)?.value || "");
4546
- value = concatAttributes.join(separator || ", ");
4547
- }
4548
- else {
4549
- value = attribute?.value?.toString() || "";
4550
- }
4551
- return maxLength && maxLength < value.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
4552
- };
4553
-
4554
- const getChartAxes = (chartElement) => chartElement?.options?.relatedDataSources?.filter(({ chartAxis }) => chartAxis === "y");
4555
-
4556
- const getChartFilterName = (relatedDataSources) => {
4557
- const relatedAttributes = relatedDataSources || [];
4558
- const axes = relatedAttributes.filter(({ chartAxis }) => chartAxis === "y");
4559
- return axes?.[0]?.filterName;
4560
- };
4561
-
4562
- function getValueIndex(items, attributes) {
4563
- return items?.findIndex(({ name }) => name.toString() === attributes.value?.toString());
4564
- }
4565
- const getChartMarkers = (items, markers, dataSources) => {
4566
- if (typeof markers === "string") {
4567
- const dataSource = getDataSource(markers, dataSources);
4568
- return dataSource?.features?.map(({ attributes }) => ({
4569
- ...attributes,
4570
- value: getValueIndex(items, attributes),
4571
- })) || [];
4572
- }
4573
- return (markers?.map(marker => ({
4574
- ...marker,
4575
- value: getValueIndex(items, marker),
4576
- })) || []);
4577
- };
4578
-
4579
4510
  const LayerGroupContainer = styled(uilibGl.Flex) `
4580
4511
  display: flex;
4581
4512
  justify-content: center;
@@ -5104,21 +5035,34 @@ const LayerListContainer = styled(uilibGl.Flex) `
5104
5035
  box-sizing: border-box;
5105
5036
  `;
5106
5037
 
5038
+ const ElementValueWrapper = styled.div `
5039
+ transition: background-color ${uilibGl.transition.toggle};
5040
+
5041
+ ${({ noMargin }) => styled.css `
5042
+ &&&& {
5043
+ margin-bottom: 0;
5044
+ }
5045
+ `};
5046
+ `;
5107
5047
  const Container = styled(uilibGl.Flex) `
5108
5048
  flex-direction: column;
5109
5049
  width: 100%;
5110
-
5050
+
5111
5051
  ${({ isColumn }) => isColumn
5112
5052
  ? styled.css `
5113
- > * {
5114
- width: 100%;
5053
+ > * {
5054
+ width: 100%;
5055
+
5056
+ :not(:last-child) {
5057
+ margin-bottom: 1.5rem;
5115
5058
  }
5116
- `
5059
+ }
5060
+ `
5117
5061
  : styled.css `
5118
- flex-direction: row;
5119
- justify-content: space-between;
5120
- align-items: center;
5121
- `}
5062
+ flex-direction: row;
5063
+ justify-content: space-between;
5064
+ align-items: center;
5065
+ `}
5122
5066
 
5123
5067
  ${({ isTitle }) => isTitle &&
5124
5068
  styled.css `
@@ -5147,10 +5091,6 @@ const ContainerWrapper = styled(uilibGl.Flex) `
5147
5091
  color: ${({ theme: { palette } }) => palette.textPrimary};
5148
5092
  z-index: ${({ $zIndex }) => $zIndex ?? 1};
5149
5093
  transition: background-color ${uilibGl.transition.toggle};
5150
-
5151
- ${Container} > :not(:last-child) {
5152
- margin-bottom: 1.5rem;
5153
- }
5154
5094
 
5155
5095
  ${({ $noMargin }) => $noMargin && styled.css `
5156
5096
  &&&& {
@@ -5192,6 +5132,7 @@ const DashboardPlaceholder = styled(uilibGl.Flex) `
5192
5132
  styled.css `
5193
5133
  width: 6.25rem;
5194
5134
  `}
5135
+
5195
5136
  &&& > * {
5196
5137
  margin-bottom: 0;
5197
5138
  }
@@ -5401,13 +5342,82 @@ const FeatureControls = styled(uilibGl.Flex) `
5401
5342
  }
5402
5343
  `;
5403
5344
 
5345
+ const getAttributeByName = (attributeName, attributes) => {
5346
+ return Array.isArray(attributeName)
5347
+ ? null
5348
+ : attributeName
5349
+ ? attributes?.find(({ name }) => name === attributeName)
5350
+ : null;
5351
+ };
5352
+
5353
+ const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
5354
+ const { id, type, defaultValue, options, style, attributeName, templateName } = elementConfig || {};
5355
+ const attribute = attributeName ? getAttributeByName(attributeName, attributes) : null;
5356
+ const { fontColor, fontSize, noUnits, tagView, bgColor, withDivider, radius, noMargin } = options || {};
5357
+ const valueOrDefault = value || defaultValue;
5358
+ const resultValue = type === "attributeValue" && attribute?.type && attribute?.stringFormat
5359
+ ? formatAttributeValue({
5360
+ t,
5361
+ type: attribute.type,
5362
+ value: valueOrDefault,
5363
+ stringFormat: attribute.stringFormat,
5364
+ noUnits,
5365
+ })
5366
+ : valueOrDefault;
5367
+ if (!wrap)
5368
+ return resultValue;
5369
+ return (jsxRuntime.jsxs(React.Fragment, { children: [tagView ? (jsxRuntime.jsx(DashboardChip$1, { "data-id": id, "data-templatename": templateName, style: style, text: resultValue, "$bgColor": bgColor, "$fontColor": fontColor, "$fontSize": fontSize, "$radius": radius })) : (jsxRuntime.jsx(ElementValueWrapper, { "data-id": id, "data-templatename": templateName, style: style, noMargin: noMargin, children: resultValue })), withDivider && jsxRuntime.jsx(uilibGl.Divider, {})] }, id));
5370
+ };
5371
+
5372
+ const getAttributeValue = (element, attributes) => {
5373
+ const attribute = getAttributeByName(element?.attributeName, attributes);
5374
+ const { maxLength, separator, expandable, lineBreak } = element.options || {};
5375
+ let value = "";
5376
+ if (attribute?.type === api.AttributeType.Boolean && typeof attribute.value === "boolean") {
5377
+ return jsxRuntime.jsx(DashboardCheckbox, { title: attribute.alias || attribute.name, checked: attribute.value });
5378
+ }
5379
+ if (Array.isArray(element?.attributeName)) {
5380
+ const concatAttributes = element.attributeName.map((attributeName) => attributes?.find(({ name }) => name === attributeName)?.value || "");
5381
+ value = concatAttributes.join(separator || ", ");
5382
+ }
5383
+ else {
5384
+ value = attribute?.value?.toString() || "";
5385
+ }
5386
+ return maxLength && maxLength < value.length ? (jsxRuntime.jsx(TextTrim, { maxLength: maxLength, expandable: expandable, lineBreak: lineBreak, children: value })) : (value);
5387
+ };
5388
+
5389
+ const getChartAxes = (chartElement) => chartElement?.options?.relatedDataSources?.filter(({ chartAxis }) => chartAxis === "y");
5390
+
5391
+ const getChartFilterName = (relatedDataSources) => {
5392
+ const relatedAttributes = relatedDataSources || [];
5393
+ const axes = relatedAttributes.filter(({ chartAxis }) => chartAxis === "y");
5394
+ return axes?.[0]?.filterName;
5395
+ };
5396
+
5397
+ function getValueIndex(items, attributes) {
5398
+ return items?.findIndex(({ name }) => name.toString() === attributes.value?.toString());
5399
+ }
5400
+ const getChartMarkers = (items, markers, dataSources) => {
5401
+ if (typeof markers === "string") {
5402
+ const dataSource = getDataSource(markers, dataSources);
5403
+ return dataSource?.features?.map(({ attributes }) => ({
5404
+ ...attributes,
5405
+ value: getValueIndex(items, attributes),
5406
+ })) || [];
5407
+ }
5408
+ return (markers?.map(marker => ({
5409
+ ...marker,
5410
+ value: getValueIndex(items, marker),
5411
+ })) || []);
5412
+ };
5413
+
5404
5414
  const ContainersGroupContainer = React.memo(({ elementConfig, type, renderElement }) => {
5405
5415
  const { expandedContainers } = useWidgetContext(type);
5406
- const { id, children, options, style } = elementConfig || {};
5416
+ const { id, children, options } = elementConfig || {};
5407
5417
  const { column, expandable, expanded } = options || {};
5408
5418
  const isColumn = column === undefined || column;
5409
5419
  const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
5410
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, isColumn: isColumn, style: style, children: jsxRuntime.jsx(ContainerChildren, { items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
5420
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), isVisible && (jsxRuntime.jsx(Container, { id: id, isColumn: isColumn, children: jsxRuntime.jsx(ContainerChildren, { items: children, elementConfig: elementConfig, isColumn: isColumn, isMain: id?.startsWith(CONFIG_PAGE_ID), renderElement: renderElement }) }))] }));
5411
5421
  });
5412
5422
 
5413
5423
  const ChartLegendContainer = styled(uilibGl.Flex) `
@@ -10827,6 +10837,7 @@ exports.ElementMarkdown = ElementMarkdown;
10827
10837
  exports.ElementSlideshow = ElementSlideshow;
10828
10838
  exports.ElementSvg = ElementSvg;
10829
10839
  exports.ElementTooltip = ElementTooltip;
10840
+ exports.ElementValueWrapper = ElementValueWrapper;
10830
10841
  exports.ExpandableTitle = ExpandableTitle;
10831
10842
  exports.FEATURE_CARD_DEFAULT_COLORS = FEATURE_CARD_DEFAULT_COLORS;
10832
10843
  exports.FEATURE_CARD_OTHER_COLOR = FEATURE_CARD_OTHER_COLOR;