@evergis/react 3.1.126 → 3.1.128
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/components/Dashboard/elements/ElementModal/index.d.ts +3 -0
- package/dist/components/Dashboard/elements/ElementModal/styled.d.ts +1 -0
- package/dist/components/Dashboard/elements/registry.d.ts +1 -0
- package/dist/components/Dashboard/types.d.ts +17 -0
- package/dist/components/Dashboard/utils/getElementValue.d.ts +1 -1
- package/dist/index.js +179 -108
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +179 -108
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ModalIcon: import('styled-components').StyledComponent<"span", any, import('@evergis/uilib-gl').IIconProps, never>;
|
|
@@ -149,6 +149,7 @@ export interface ConfigOptions {
|
|
|
149
149
|
baseMapName?: string;
|
|
150
150
|
baseMapSettings?: Record<string, BaseMapSettings>;
|
|
151
151
|
expandedLayers?: boolean;
|
|
152
|
+
modalId?: string;
|
|
152
153
|
}
|
|
153
154
|
export interface ConfigDataSource {
|
|
154
155
|
name: string;
|
|
@@ -225,6 +226,21 @@ export interface ConfigTask {
|
|
|
225
226
|
updateDate?: string;
|
|
226
227
|
id?: string;
|
|
227
228
|
}
|
|
229
|
+
export interface ConfigModalOptions {
|
|
230
|
+
title?: string;
|
|
231
|
+
maxWidth?: string;
|
|
232
|
+
minWidth?: string;
|
|
233
|
+
minHeight?: string;
|
|
234
|
+
}
|
|
235
|
+
export interface ConfigModalContentRef {
|
|
236
|
+
containerId: string;
|
|
237
|
+
}
|
|
238
|
+
export type ConfigModalContentItem = ConfigContainerChild | ConfigModalContentRef;
|
|
239
|
+
export interface ConfigModal {
|
|
240
|
+
id: string;
|
|
241
|
+
options?: ConfigModalOptions;
|
|
242
|
+
children: ConfigModalContentItem[];
|
|
243
|
+
}
|
|
228
244
|
export interface ConfigContainerHeader {
|
|
229
245
|
id?: string;
|
|
230
246
|
templateName?: HeaderTemplate;
|
|
@@ -238,6 +254,7 @@ export interface ConfigContainer {
|
|
|
238
254
|
dataSources?: ConfigDataSource[];
|
|
239
255
|
filters?: ConfigFilter[];
|
|
240
256
|
tasks?: ConfigTask[];
|
|
257
|
+
modals?: ConfigModal[];
|
|
241
258
|
options?: ConfigOptions;
|
|
242
259
|
header?: ConfigContainerHeader;
|
|
243
260
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ClientFeatureAttribute, ConfigContainerChild, ContainerProps, RenderElementValue } from '../types';
|
|
3
3
|
import { LayerInfo } from '../../../types';
|
|
4
|
-
export declare const getElementValue: ({ getDefaultContainer, ...props }: Pick<ContainerProps, "type" | "elementConfig" | "renderElement"> & {
|
|
4
|
+
export declare const getElementValue: ({ getDefaultContainer, ...props }: Pick<ContainerProps, "type" | "config" | "elementConfig" | "renderElement"> & {
|
|
5
5
|
layerInfo: LayerInfo;
|
|
6
6
|
attributes: ClientFeatureAttribute[];
|
|
7
7
|
element: ConfigContainerChild;
|
package/dist/index.js
CHANGED
|
@@ -5579,35 +5579,36 @@ const LayerListContainer = styled(uilibGl.Flex) `
|
|
|
5579
5579
|
|
|
5580
5580
|
const ElementValueWrapper = styled.div `
|
|
5581
5581
|
transition: background-color ${uilibGl.transition.toggle};
|
|
5582
|
-
|
|
5583
|
-
${({ noMargin }) =>
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5582
|
+
|
|
5583
|
+
${({ noMargin }) => !!noMargin &&
|
|
5584
|
+
styled.css `
|
|
5585
|
+
&&&& {
|
|
5586
|
+
margin-bottom: 0;
|
|
5587
|
+
}
|
|
5588
|
+
`};
|
|
5588
5589
|
`;
|
|
5589
5590
|
const Container = styled(uilibGl.Flex) `
|
|
5590
5591
|
flex-direction: column;
|
|
5591
5592
|
width: 100%;
|
|
5592
|
-
|
|
5593
|
+
|
|
5593
5594
|
${({ isColumn }) => isColumn
|
|
5594
5595
|
? styled.css `
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5596
|
+
&&& > * {
|
|
5597
|
+
justify-content: flex-start;
|
|
5598
|
+
}
|
|
5599
|
+
> * {
|
|
5600
|
+
width: 100%;
|
|
5601
|
+
|
|
5602
|
+
:not(:last-child) {
|
|
5603
|
+
margin-bottom: 0.5rem;
|
|
5604
|
+
}
|
|
5605
|
+
}
|
|
5606
|
+
`
|
|
5606
5607
|
: styled.css `
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5608
|
+
flex-direction: row;
|
|
5609
|
+
justify-content: space-between;
|
|
5610
|
+
align-items: center;
|
|
5611
|
+
`}
|
|
5611
5612
|
|
|
5612
5613
|
${({ isTitle }) => isTitle &&
|
|
5613
5614
|
styled.css `
|
|
@@ -5616,12 +5617,13 @@ const Container = styled(uilibGl.Flex) `
|
|
|
5616
5617
|
}
|
|
5617
5618
|
`}
|
|
5618
5619
|
|
|
5619
|
-
${({ noBorders }) => noBorders &&
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5620
|
+
${({ noBorders }) => noBorders &&
|
|
5621
|
+
styled.css `
|
|
5622
|
+
${ContainerWrapper} {
|
|
5623
|
+
box-shadow: none;
|
|
5624
|
+
padding: 0;
|
|
5625
|
+
}
|
|
5626
|
+
`}
|
|
5625
5627
|
`;
|
|
5626
5628
|
const ContainerWrapper = styled(uilibGl.Flex) `
|
|
5627
5629
|
position: relative;
|
|
@@ -5636,12 +5638,13 @@ const ContainerWrapper = styled(uilibGl.Flex) `
|
|
|
5636
5638
|
color: ${({ theme: { palette } }) => palette.textPrimary};
|
|
5637
5639
|
z-index: ${({ $zIndex }) => $zIndex ?? 1};
|
|
5638
5640
|
transition: background-color ${uilibGl.transition.toggle};
|
|
5639
|
-
|
|
5640
|
-
${({ $noMargin }) => $noMargin &&
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5641
|
+
|
|
5642
|
+
${({ $noMargin }) => $noMargin &&
|
|
5643
|
+
styled.css `
|
|
5644
|
+
&&&& {
|
|
5645
|
+
margin-bottom: 0;
|
|
5646
|
+
}
|
|
5647
|
+
`}
|
|
5645
5648
|
`;
|
|
5646
5649
|
const DashboardChip = styled(uilibGl.Chip) `
|
|
5647
5650
|
margin: 0 0.25rem 0.25rem 0;
|
|
@@ -5656,7 +5659,7 @@ const DashboardChip = styled(uilibGl.Chip) `
|
|
|
5656
5659
|
}
|
|
5657
5660
|
|
|
5658
5661
|
span[kind]:after {
|
|
5659
|
-
color: ${({ $isDefault, $fontColor, theme: { palette } }) =>
|
|
5662
|
+
color: ${({ $isDefault, $fontColor, theme: { palette } }) => $isDefault ? palette.icon : $fontColor || "#fff"};
|
|
5660
5663
|
}
|
|
5661
5664
|
`;
|
|
5662
5665
|
const DashboardPlaceholderWrap = styled(uilibGl.Flex) `
|
|
@@ -5677,7 +5680,7 @@ const DashboardPlaceholder = styled(uilibGl.Flex) `
|
|
|
5677
5680
|
styled.css `
|
|
5678
5681
|
width: 6.25rem;
|
|
5679
5682
|
`}
|
|
5680
|
-
|
|
5683
|
+
|
|
5681
5684
|
&&& > * {
|
|
5682
5685
|
margin-bottom: 0;
|
|
5683
5686
|
}
|
|
@@ -5844,7 +5847,7 @@ const PresentationPanelContainer = styled.div `
|
|
|
5844
5847
|
height: auto;
|
|
5845
5848
|
margin: 0 -1.125rem -1.5rem;
|
|
5846
5849
|
padding: 0;
|
|
5847
|
-
|
|
5850
|
+
|
|
5848
5851
|
${LayerGroupList} {
|
|
5849
5852
|
padding: 0;
|
|
5850
5853
|
}
|
|
@@ -5871,7 +5874,7 @@ const DataSourceErrorContainer = styled(uilibGl.Flex) `
|
|
|
5871
5874
|
`;
|
|
5872
5875
|
const AttributeLabel = styled(uilibGl.Description) `
|
|
5873
5876
|
margin-top: 0 !important;
|
|
5874
|
-
margin-bottom: ${({ forCheckbox }) =>
|
|
5877
|
+
margin-bottom: ${({ forCheckbox }) => forCheckbox ? "0.75rem" : "0.25rem"} !important;
|
|
5875
5878
|
padding-left: ${({ isEdit }) => (isEdit ? "0.5rem" : "0")};
|
|
5876
5879
|
`;
|
|
5877
5880
|
const FeatureControls = styled(uilibGl.Flex) `
|
|
@@ -5896,9 +5899,11 @@ const getAttributeByName = (attributeName, attributes) => {
|
|
|
5896
5899
|
};
|
|
5897
5900
|
|
|
5898
5901
|
const formatElementValue = ({ t, value, elementConfig, attributes, wrap, }) => {
|
|
5899
|
-
const { id, type, defaultValue, options, style, attributeName, templateName } = elementConfig || {};
|
|
5900
|
-
const attribute = attributeName
|
|
5901
|
-
|
|
5902
|
+
const { id, type, defaultValue, options, style, attributeName, templateName, } = elementConfig || {};
|
|
5903
|
+
const attribute = attributeName
|
|
5904
|
+
? getAttributeByName(attributeName, attributes)
|
|
5905
|
+
: null;
|
|
5906
|
+
const { fontColor, fontSize, noUnits, tagView, bgColor, withDivider, radius, noMargin, } = options || {};
|
|
5902
5907
|
const valueOrDefault = value || defaultValue;
|
|
5903
5908
|
const resultValue = type === "attributeValue" && attribute?.type && attribute?.stringFormat
|
|
5904
5909
|
? formatAttributeValue({
|
|
@@ -6169,7 +6174,7 @@ const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) =
|
|
|
6169
6174
|
const { id, value, hideEmpty, style, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6170
6175
|
if (!value && hideEmpty)
|
|
6171
6176
|
return null;
|
|
6172
|
-
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" })] }), jsxRuntime.jsxs(ContainerValue, { children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] }));
|
|
6177
|
+
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_CONTAINER_STYLE, ...style }, children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] }));
|
|
6173
6178
|
}, [getRenderContainerItem, elementConfig]);
|
|
6174
6179
|
return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(renderContainer) })) : (renderContainer());
|
|
6175
6180
|
});
|
|
@@ -6182,7 +6187,7 @@ const TwoColumnContainer = React.memo(({ elementConfig, type, renderElement }) =
|
|
|
6182
6187
|
const { id, value, hideEmpty, style, hasIcon, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6183
6188
|
if (!value && hideEmpty)
|
|
6184
6189
|
return null;
|
|
6185
|
-
return (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style: 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));
|
|
6190
|
+
return (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style: style, children: [jsxRuntime.jsxs(ContainerAlias, { children: [hasIcon && (jsxRuntime.jsx(ContainerAliasIcon, { children: render({ id: "icon" }) })), render({ id: "alias" }), render({ id: "tooltip" }), render({ id: "modal" })] }), jsxRuntime.jsxs(ContainerValue, { big: true, children: [value, hasUnits && (jsxRuntime.jsx(ContainerUnits, { children: render({ id: "units" }) }))] })] }, attribute));
|
|
6186
6191
|
}, [getRenderContainerItem, elementConfig]);
|
|
6187
6192
|
return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
6188
6193
|
});
|
|
@@ -9129,6 +9134,131 @@ const ElementUploader = React.memo(({ elementConfig, type }) => {
|
|
|
9129
9134
|
return (jsxRuntime.jsx(UploaderContainer, { id: id, style: style, children: jsxRuntime.jsx("div", { children: jsxRuntime.jsx(uilibGl.Uploader, { currentRef: refInput, title: renderTitle, accept: fileExtensions, width: "100%", fileItems: files, isMultiple: multiSelect, onUpload: onUpload, onDelete: onDelete }) }) }));
|
|
9130
9135
|
});
|
|
9131
9136
|
|
|
9137
|
+
const ModalIcon = styled(uilibGl.Icon) `
|
|
9138
|
+
&&& {
|
|
9139
|
+
cursor: pointer;
|
|
9140
|
+
|
|
9141
|
+
:after {
|
|
9142
|
+
font-size: 0.75rem;
|
|
9143
|
+
color: ${({ theme: { palette } }) => palette.iconDisabled};
|
|
9144
|
+
transition: color ${uilibGl.transition.hover};
|
|
9145
|
+
}
|
|
9146
|
+
|
|
9147
|
+
:hover:after {
|
|
9148
|
+
color: ${({ theme: { palette } }) => palette.icon};
|
|
9149
|
+
}
|
|
9150
|
+
}
|
|
9151
|
+
`;
|
|
9152
|
+
|
|
9153
|
+
const isEmptyElementValue = (value) => value === "" || value === null || value === undefined;
|
|
9154
|
+
|
|
9155
|
+
const isHiddenEmptyValue = ({ value, children, hideEmpty, renderElement, }) => {
|
|
9156
|
+
const valueElement = children?.find(item => item.id === "value");
|
|
9157
|
+
const renderedValue = valueElement ? renderElement({ id: "value" }) : null;
|
|
9158
|
+
const isEmpty = isEmptyElementValue(value) || (valueElement && (renderedValue === null || renderedValue === ""));
|
|
9159
|
+
return isEmpty && hideEmpty;
|
|
9160
|
+
};
|
|
9161
|
+
|
|
9162
|
+
const isNotValidSelectedTab = (tabId, selectedTabId) => {
|
|
9163
|
+
if (!tabId || !selectedTabId)
|
|
9164
|
+
return false;
|
|
9165
|
+
return Array.isArray(tabId) ? !tabId.includes(selectedTabId) : tabId !== selectedTabId;
|
|
9166
|
+
};
|
|
9167
|
+
|
|
9168
|
+
const isVisibleContainer = (id, expandable, expanded, expandedContainers) => !expandable || (expandedContainers?.[id] !== undefined ? expandedContainers[id] : expanded) || false;
|
|
9169
|
+
|
|
9170
|
+
const isContainerRef = (element) => "containerId" in element &&
|
|
9171
|
+
!("templateName" in element) &&
|
|
9172
|
+
!("type" in element) &&
|
|
9173
|
+
!("children" in element);
|
|
9174
|
+
const getRenderElement = ({ t, config, elementConfig, attributes = [], layerInfo, selectedTabId, setSelectedTabId, pageIndex, expandedContainers, type = exports.WidgetType.FeatureCard, }) => (props) => {
|
|
9175
|
+
const { id, index, wrap = true } = props;
|
|
9176
|
+
const currentConfig = elementConfig || config;
|
|
9177
|
+
let element = id
|
|
9178
|
+
? findAnd.returnFound(currentConfig?.children, { id })
|
|
9179
|
+
: index !== undefined
|
|
9180
|
+
? currentConfig?.children[index]
|
|
9181
|
+
: null;
|
|
9182
|
+
if (Array.isArray(element)) {
|
|
9183
|
+
element = element[0];
|
|
9184
|
+
}
|
|
9185
|
+
if (element && isContainerRef(element)) {
|
|
9186
|
+
let container = findAnd.returnFound(config, { id: element.containerId });
|
|
9187
|
+
if (Array.isArray(container))
|
|
9188
|
+
container = container[0];
|
|
9189
|
+
element = container || undefined;
|
|
9190
|
+
}
|
|
9191
|
+
const { options, children, templateName } = element || {};
|
|
9192
|
+
const { tabId, hideEmpty, expandable, expanded, innerTemplateName } = options || {};
|
|
9193
|
+
if (isNotValidSelectedTab(tabId, selectedTabId))
|
|
9194
|
+
return null;
|
|
9195
|
+
const renderElement = getRenderElement({
|
|
9196
|
+
t,
|
|
9197
|
+
config,
|
|
9198
|
+
elementConfig: element,
|
|
9199
|
+
attributes,
|
|
9200
|
+
layerInfo,
|
|
9201
|
+
expandedContainers,
|
|
9202
|
+
selectedTabId,
|
|
9203
|
+
setSelectedTabId,
|
|
9204
|
+
pageIndex,
|
|
9205
|
+
type,
|
|
9206
|
+
});
|
|
9207
|
+
const value = getElementValue({
|
|
9208
|
+
type,
|
|
9209
|
+
element: currentConfig,
|
|
9210
|
+
elementConfig: element,
|
|
9211
|
+
config,
|
|
9212
|
+
attributes,
|
|
9213
|
+
layerInfo,
|
|
9214
|
+
renderElement,
|
|
9215
|
+
getDefaultContainer: () => {
|
|
9216
|
+
if (!templateName) {
|
|
9217
|
+
return null;
|
|
9218
|
+
}
|
|
9219
|
+
const ContainerTemplateValue = getContainerComponent(templateName);
|
|
9220
|
+
if (!ContainerTemplateValue) {
|
|
9221
|
+
return null;
|
|
9222
|
+
}
|
|
9223
|
+
return (jsxRuntime.jsx(ContainerTemplateValue, { id: id, type: type, config: config, elementConfig: element, layerInfo: layerInfo, attributes: attributes, innerComponent: getContainerComponent(innerTemplateName), isVisible: isVisibleContainer(id, expandable, expanded, expandedContainers), renderElement: renderElement }, id));
|
|
9224
|
+
},
|
|
9225
|
+
});
|
|
9226
|
+
if (isHiddenEmptyValue({ value, children, hideEmpty, renderElement }))
|
|
9227
|
+
return null;
|
|
9228
|
+
return formatElementValue({
|
|
9229
|
+
t,
|
|
9230
|
+
value,
|
|
9231
|
+
elementConfig: element,
|
|
9232
|
+
attributes,
|
|
9233
|
+
wrap,
|
|
9234
|
+
});
|
|
9235
|
+
};
|
|
9236
|
+
|
|
9237
|
+
const ElementModal = React.memo(({ type = exports.WidgetType.Dashboard, elementConfig }) => {
|
|
9238
|
+
const { config } = useWidgetConfig(type);
|
|
9239
|
+
const { expandedContainers, attributes, isLoading } = useWidgetContext(type);
|
|
9240
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
9241
|
+
const { options } = elementConfig || {};
|
|
9242
|
+
const { modalId, icon } = options || {};
|
|
9243
|
+
const modalConfig = React.useMemo(() => (config?.modals ?? []).find(({ id }) => id === modalId) ?? null, [config?.modals, modalId]);
|
|
9244
|
+
const modalContent = React.useMemo(() => (modalConfig?.children ?? []), [modalConfig]);
|
|
9245
|
+
const renderElementConfig = React.useMemo(() => ({ children: modalContent }), [modalContent]);
|
|
9246
|
+
const renderElement = React.useMemo(() => getRenderElement({
|
|
9247
|
+
type,
|
|
9248
|
+
config,
|
|
9249
|
+
elementConfig: renderElementConfig,
|
|
9250
|
+
attributes,
|
|
9251
|
+
expandedContainers,
|
|
9252
|
+
}), [type, config, renderElementConfig, attributes, expandedContainers]);
|
|
9253
|
+
const handleOpen = React.useCallback(() => setIsOpen(true), []);
|
|
9254
|
+
const handleClose = React.useCallback(() => setIsOpen(false), []);
|
|
9255
|
+
if (!modalConfig)
|
|
9256
|
+
return null;
|
|
9257
|
+
const { options: modalOptions } = modalConfig;
|
|
9258
|
+
const { title, maxWidth, minWidth, minHeight } = modalOptions || {};
|
|
9259
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalIcon, { kind: icon || "new_window", onClick: handleOpen }), jsxRuntime.jsxs(uilibGl.Dialog, { isOpen: isOpen, onCloseRequest: handleClose, modal: true, maxWidth: maxWidth, minWidth: minWidth, minHeight: minHeight, style: { paddingBottom: "2rem" }, children: [jsxRuntime.jsx(uilibGl.DialogTitle, { children: jsxRuntime.jsxs(uilibGl.Flex, { justifyContent: "space-between", alignItems: "center", children: [!!title && jsxRuntime.jsx("span", { children: title }), jsxRuntime.jsx(uilibGl.IconButton, { kind: "close", onClick: handleClose })] }) }), jsxRuntime.jsx(uilibGl.DialogContent, { children: isLoading ? (jsxRuntime.jsx(DashboardLoading, {})) : (jsxRuntime.jsx(Container, { isColumn: true, noBorders: true, children: jsxRuntime.jsx(ContainerChildren, { type: type, items: modalContent, isMain: true, renderElement: renderElement }) })) })] })] }));
|
|
9260
|
+
});
|
|
9261
|
+
|
|
9132
9262
|
const elementComponents = {
|
|
9133
9263
|
control: ElementControl,
|
|
9134
9264
|
image: ElementImage,
|
|
@@ -9144,6 +9274,7 @@ const elementComponents = {
|
|
|
9144
9274
|
legend: ElementLegend,
|
|
9145
9275
|
markdown: ElementMarkdown,
|
|
9146
9276
|
uploader: ElementUploader,
|
|
9277
|
+
modal: ElementModal,
|
|
9147
9278
|
};
|
|
9148
9279
|
|
|
9149
9280
|
const getElementValue = ({ getDefaultContainer, ...props }) => {
|
|
@@ -9172,10 +9303,13 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
|
|
|
9172
9303
|
}
|
|
9173
9304
|
if (type === "attributeDescription") {
|
|
9174
9305
|
const attribute = getAttributeByName(attributeName, attributes);
|
|
9175
|
-
return attribute?.name
|
|
9306
|
+
return attribute?.name
|
|
9307
|
+
? layerInfo.layerDefinition.attributes[attribute.name]?.description ||
|
|
9308
|
+
null
|
|
9309
|
+
: null;
|
|
9176
9310
|
}
|
|
9177
9311
|
const ElementComponent = type ? elementComponents[type] : null;
|
|
9178
|
-
return ElementComponent ? jsxRuntime.jsx(ElementComponent, { ...props }) : getDefaultContainer?.();
|
|
9312
|
+
return ElementComponent ? (jsxRuntime.jsx(ElementComponent, { ...props })) : (getDefaultContainer?.());
|
|
9179
9313
|
};
|
|
9180
9314
|
|
|
9181
9315
|
const getLayerAttributes = (layerDefinition) => {
|
|
@@ -10144,69 +10278,6 @@ const getRelatedAttribute = (layerInfo, sourceAttributeName, relatedLayerName) =
|
|
|
10144
10278
|
return attributeConfig?.options?.relatedAttributes?.find(({ layerName }) => layerName === relatedLayerName);
|
|
10145
10279
|
};
|
|
10146
10280
|
|
|
10147
|
-
const isEmptyElementValue = (value) => value === "" || value === null || value === undefined;
|
|
10148
|
-
|
|
10149
|
-
const isHiddenEmptyValue = ({ value, children, hideEmpty, renderElement, }) => {
|
|
10150
|
-
const valueElement = children?.find(item => item.id === "value");
|
|
10151
|
-
const renderedValue = valueElement ? renderElement({ id: "value" }) : null;
|
|
10152
|
-
const isEmpty = isEmptyElementValue(value) || (valueElement && (renderedValue === null || renderedValue === ""));
|
|
10153
|
-
return isEmpty && hideEmpty;
|
|
10154
|
-
};
|
|
10155
|
-
|
|
10156
|
-
const isNotValidSelectedTab = (tabId, selectedTabId) => {
|
|
10157
|
-
if (!tabId || !selectedTabId)
|
|
10158
|
-
return false;
|
|
10159
|
-
return Array.isArray(tabId) ? !tabId.includes(selectedTabId) : tabId !== selectedTabId;
|
|
10160
|
-
};
|
|
10161
|
-
|
|
10162
|
-
const isVisibleContainer = (id, expandable, expanded, expandedContainers) => !expandable || (expandedContainers?.[id] !== undefined ? expandedContainers[id] : expanded) || false;
|
|
10163
|
-
|
|
10164
|
-
const getRenderElement = ({ t, config, elementConfig, attributes = [], layerInfo, selectedTabId, setSelectedTabId, pageIndex, expandedContainers, type = exports.WidgetType.FeatureCard, }) => (props) => {
|
|
10165
|
-
const { id, index, wrap = true } = props;
|
|
10166
|
-
const currentConfig = elementConfig || config;
|
|
10167
|
-
let element = id ? findAnd.returnFound(currentConfig?.children, { id }) : index ? currentConfig?.children[index] : null;
|
|
10168
|
-
if (Array.isArray(element)) {
|
|
10169
|
-
element = element[0];
|
|
10170
|
-
}
|
|
10171
|
-
const { options, children, templateName } = element || {};
|
|
10172
|
-
const { tabId, hideEmpty, expandable, expanded, innerTemplateName } = options || {};
|
|
10173
|
-
if (isNotValidSelectedTab(tabId, selectedTabId))
|
|
10174
|
-
return null;
|
|
10175
|
-
const renderElement = getRenderElement({
|
|
10176
|
-
t,
|
|
10177
|
-
config,
|
|
10178
|
-
elementConfig: element,
|
|
10179
|
-
attributes,
|
|
10180
|
-
layerInfo,
|
|
10181
|
-
expandedContainers,
|
|
10182
|
-
selectedTabId,
|
|
10183
|
-
setSelectedTabId,
|
|
10184
|
-
pageIndex,
|
|
10185
|
-
type,
|
|
10186
|
-
});
|
|
10187
|
-
const value = getElementValue({
|
|
10188
|
-
type,
|
|
10189
|
-
element: currentConfig,
|
|
10190
|
-
elementConfig: element,
|
|
10191
|
-
attributes,
|
|
10192
|
-
layerInfo,
|
|
10193
|
-
renderElement,
|
|
10194
|
-
getDefaultContainer: () => {
|
|
10195
|
-
if (!templateName) {
|
|
10196
|
-
return null;
|
|
10197
|
-
}
|
|
10198
|
-
const ContainerTemplateValue = getContainerComponent(templateName);
|
|
10199
|
-
if (!ContainerTemplateValue) {
|
|
10200
|
-
return null;
|
|
10201
|
-
}
|
|
10202
|
-
return (jsxRuntime.jsx(ContainerTemplateValue, { id: id, type: type, config: config, elementConfig: element, layerInfo: layerInfo, attributes: attributes, innerComponent: getContainerComponent(innerTemplateName), isVisible: isVisibleContainer(id, expandable, expanded, expandedContainers), renderElement: renderElement }, id));
|
|
10203
|
-
},
|
|
10204
|
-
});
|
|
10205
|
-
if (isHiddenEmptyValue({ value, children, hideEmpty, renderElement }))
|
|
10206
|
-
return null;
|
|
10207
|
-
return formatElementValue({ t, value, elementConfig: element, attributes, wrap });
|
|
10208
|
-
};
|
|
10209
|
-
|
|
10210
10281
|
const getResourceUrl = (url) => {
|
|
10211
10282
|
return url ? (url.startsWith("http") ? url : `/sp/resources/file/${url}`) : "";
|
|
10212
10283
|
};
|