@evergis/react 3.1.113 → 3.1.118
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/containers/EditBooleanContainer/index.d.ts +3 -0
- package/dist/components/Dashboard/containers/EditGroupContainer/index.d.ts +3 -0
- package/dist/components/Dashboard/containers/EditStringContainer/index.d.ts +3 -0
- package/dist/components/Dashboard/containers/registry.d.ts +3 -0
- package/dist/components/Dashboard/hooks/index.d.ts +0 -1
- package/dist/components/Dashboard/types.d.ts +3 -0
- package/dist/components/Dashboard/utils/getTemplateNameFromAttribute.d.ts +2 -0
- package/dist/components/Dashboard/utils/index.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +145 -127
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +145 -129
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/components/Dashboard/hooks/useMultipleAttributesRender.d.ts +0 -13
|
@@ -30,5 +30,8 @@ export declare const containerComponents: {
|
|
|
30
30
|
readonly Upload: import('react').FC<import('../types').ContainerProps>;
|
|
31
31
|
readonly Task: import('react').FC<import('../types').ContainerProps>;
|
|
32
32
|
readonly Edit: import('react').FC<import('../types').ContainerProps>;
|
|
33
|
+
readonly EditBoolean: import('react').FC<import('../types').ContainerProps>;
|
|
34
|
+
readonly EditString: import('react').FC<import('../types').ContainerProps>;
|
|
35
|
+
readonly EditGroup: import('react').FC<import('../types').ContainerProps>;
|
|
33
36
|
readonly default: import('react').FC<import('../types').ContainerProps>;
|
|
34
37
|
};
|
|
@@ -16,6 +16,5 @@ export * from './useRenderElement';
|
|
|
16
16
|
export * from './useShownOtherItems';
|
|
17
17
|
export * from './useUpdateDataSource';
|
|
18
18
|
export * from './useWidgetConfig';
|
|
19
|
-
export * from './useMultipleAttributesRender';
|
|
20
19
|
export * from './useWidgetContext';
|
|
21
20
|
export * from './useWidgetPage';
|
|
@@ -278,7 +278,10 @@ export declare enum ContainerTemplate {
|
|
|
278
278
|
ExportPdf = "ExportPdf",
|
|
279
279
|
Upload = "Upload",
|
|
280
280
|
Task = "Task",
|
|
281
|
+
EditGroup = "EditGroup",
|
|
281
282
|
Edit = "Edit",
|
|
283
|
+
EditString = "EditString",
|
|
284
|
+
EditBoolean = "EditBoolean",
|
|
282
285
|
Divider = "Divider"
|
|
283
286
|
}
|
|
284
287
|
export declare enum HeaderTemplate {
|
|
@@ -43,6 +43,7 @@ export * from './getResourceUrl';
|
|
|
43
43
|
export * from './getSelectedFilterValue';
|
|
44
44
|
export * from './getSlideshowImages';
|
|
45
45
|
export * from './getSvgUrl';
|
|
46
|
+
export * from './getTemplateNameFromAttribute';
|
|
46
47
|
export * from './getTotalFromAttributes';
|
|
47
48
|
export * from './getTotalFromRelatedFeatures';
|
|
48
49
|
export * from './getRootElementId';
|
package/dist/index.js
CHANGED
|
@@ -3389,7 +3389,10 @@ exports.ContainerTemplate = void 0;
|
|
|
3389
3389
|
ContainerTemplate["ExportPdf"] = "ExportPdf";
|
|
3390
3390
|
ContainerTemplate["Upload"] = "Upload";
|
|
3391
3391
|
ContainerTemplate["Task"] = "Task";
|
|
3392
|
+
ContainerTemplate["EditGroup"] = "EditGroup";
|
|
3392
3393
|
ContainerTemplate["Edit"] = "Edit";
|
|
3394
|
+
ContainerTemplate["EditString"] = "EditString";
|
|
3395
|
+
ContainerTemplate["EditBoolean"] = "EditBoolean";
|
|
3393
3396
|
ContainerTemplate["Divider"] = "Divider";
|
|
3394
3397
|
})(exports.ContainerTemplate || (exports.ContainerTemplate = {}));
|
|
3395
3398
|
exports.HeaderTemplate = void 0;
|
|
@@ -5522,7 +5525,7 @@ const LayerTree = ({ layers, onlyMainTools }) => {
|
|
|
5522
5525
|
if (!page) {
|
|
5523
5526
|
return;
|
|
5524
5527
|
}
|
|
5525
|
-
page.layers = treeNodesToProjectItems(page.layers, updatedNodes
|
|
5528
|
+
page.layers = treeNodesToProjectItems(page.layers, updatedNodes);
|
|
5526
5529
|
updateProject(newProjectInfo);
|
|
5527
5530
|
}, [pageIndex, projectInfo, updateProject]);
|
|
5528
5531
|
return (jsxRuntime.jsx(uilibGl.DraggableTree, { nodes: nodes, disableDrag: onlyMainTools, options: { pastePlaceholderHeight: "0.0625rem" }, onUpdate: onUpdate }));
|
|
@@ -6124,31 +6127,31 @@ const useRenderContainerItem = (type, renderElement) => {
|
|
|
6124
6127
|
}, []);
|
|
6125
6128
|
};
|
|
6126
6129
|
|
|
6127
|
-
const BASE_STYLE = {
|
|
6130
|
+
const BASE_STYLE$2 = {
|
|
6128
6131
|
marginBottom: "1rem",
|
|
6129
6132
|
};
|
|
6130
6133
|
const OneColumnContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
6131
6134
|
const getRenderContainerItem = useRenderContainerItem(type, renderElement);
|
|
6132
6135
|
const { options } = elementConfig || {};
|
|
6133
|
-
const { attributes: renderAttributes
|
|
6136
|
+
const { attributes: renderAttributes } = options || {};
|
|
6134
6137
|
const renderContainer = React.useCallback((attribute) => {
|
|
6135
6138
|
const { id, value, hideEmpty, style, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6136
6139
|
if (!value && hideEmpty)
|
|
6137
6140
|
return null;
|
|
6138
|
-
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...
|
|
6139
|
-
}, [getRenderContainerItem, elementConfig
|
|
6141
|
+
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE$2, ...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" }) })] })] }));
|
|
6142
|
+
}, [getRenderContainerItem, elementConfig]);
|
|
6140
6143
|
return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
6141
6144
|
});
|
|
6142
6145
|
|
|
6143
6146
|
const TwoColumnContainer = React.memo(({ elementConfig, type, renderElement }) => {
|
|
6144
6147
|
const getRenderContainerItem = useRenderContainerItem(type, renderElement);
|
|
6145
6148
|
const { options } = elementConfig || {};
|
|
6146
|
-
const { attributes: renderAttributes
|
|
6149
|
+
const { attributes: renderAttributes } = options || {};
|
|
6147
6150
|
const renderContainer = React.useCallback((attribute) => {
|
|
6148
6151
|
const { id, value, hideEmpty, style, hasIcon, hasUnits, render } = getRenderContainerItem(elementConfig, attribute);
|
|
6149
6152
|
if (!value && hideEmpty)
|
|
6150
6153
|
return null;
|
|
6151
|
-
return (jsxRuntime.jsxs(TwoColumnContainerWrapper, { id: id, style:
|
|
6154
|
+
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));
|
|
6152
6155
|
}, [getRenderContainerItem, elementConfig]);
|
|
6153
6156
|
return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
6154
6157
|
});
|
|
@@ -7378,6 +7381,61 @@ const EditContainer = ({ type, elementConfig, renderElement }) => {
|
|
|
7378
7381
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExpandableTitle, { elementConfig: elementConfig, type: type, renderElement: renderElement }), jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: style, children: [jsxRuntime.jsx(ContainerAlias, { hasBottomMargin: true, children: renderElement({ id: "alias" }) }), jsxRuntime.jsx(ContainerValue, { children: renderElement({ id: "value" }) })] })] }));
|
|
7379
7382
|
};
|
|
7380
7383
|
|
|
7384
|
+
const BASE_STYLE$1 = {
|
|
7385
|
+
marginBottom: "1rem",
|
|
7386
|
+
};
|
|
7387
|
+
const EditBooleanContainer = ({ elementConfig, renderElement }) => {
|
|
7388
|
+
const { id, style } = elementConfig || {};
|
|
7389
|
+
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE$1, ...style }, children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsxRuntime.jsxs(ContainerValue, { children: [jsxRuntime.jsx(uilibGl.Checkbox, { label: "\u0414\u0430", checked: false, onChange: () => {
|
|
7390
|
+
console.info("onChange yes");
|
|
7391
|
+
} }), jsxRuntime.jsx(uilibGl.Checkbox, { label: "\u041D\u0435\u0442", checked: false, onChange: () => {
|
|
7392
|
+
console.info("onChange no");
|
|
7393
|
+
} })] })] }));
|
|
7394
|
+
};
|
|
7395
|
+
|
|
7396
|
+
const BASE_STYLE = {
|
|
7397
|
+
marginBottom: "1rem",
|
|
7398
|
+
};
|
|
7399
|
+
const EditStringContainer = ({ elementConfig, renderElement }) => {
|
|
7400
|
+
const { id, style } = elementConfig || {};
|
|
7401
|
+
return (jsxRuntime.jsxs(Container, { id: id, isColumn: true, style: { ...BASE_STYLE, ...style }, children: [jsxRuntime.jsxs(ContainerAlias, { hasBottomMargin: true, children: [renderElement({ id: "alias" }), renderElement({ id: "tooltip" })] }), jsxRuntime.jsx(ContainerValue, { children: jsxRuntime.jsx(uilibGl.Input, { value: renderElement({ id: "value", wrap: false }) }) })] }));
|
|
7402
|
+
};
|
|
7403
|
+
|
|
7404
|
+
const EditGroupContainer = React.memo(({ type, elementConfig, renderElement }) => {
|
|
7405
|
+
const { config, attributes, layerInfo, expandedContainers } = useWidgetContext(type);
|
|
7406
|
+
const getRenderContainerItem = useRenderContainerItem(type, renderElement);
|
|
7407
|
+
const { id, options } = elementConfig || {};
|
|
7408
|
+
const { attributes: renderAttributes } = options || {};
|
|
7409
|
+
const renderContainer = React.useCallback((attribute) => {
|
|
7410
|
+
const itemAttribute = attributes.find(({ name }) => name === attribute);
|
|
7411
|
+
const templateName = getTemplateNameFromAttribute(itemAttribute);
|
|
7412
|
+
const itemConfig = {
|
|
7413
|
+
...elementConfig,
|
|
7414
|
+
children: elementConfig.children.map(child => ({ ...child, attributeName: attribute })),
|
|
7415
|
+
templateName,
|
|
7416
|
+
};
|
|
7417
|
+
const { expandable, expanded } = elementConfig.options;
|
|
7418
|
+
const { id, value, style, render } = getRenderContainerItem(itemConfig, attribute);
|
|
7419
|
+
const ContainerTemplateValue = getContainerComponent(templateName);
|
|
7420
|
+
if (!ContainerTemplateValue) {
|
|
7421
|
+
return null;
|
|
7422
|
+
}
|
|
7423
|
+
return (jsxRuntime.jsx(ContainerTemplateValue, { id: attribute, type: type, config: config, elementConfig: itemConfig, layerInfo: layerInfo, attributes: attributes, innerComponent: getContainerComponent(templateName), isVisible: isVisibleContainer(id, expandable, expanded, expandedContainers), renderElement: render }, attribute));
|
|
7424
|
+
/* return (
|
|
7425
|
+
<Container id={id} isColumn style={{ ...BASE_STYLE, ...style }}>
|
|
7426
|
+
<ContainerAlias hasBottomMargin>
|
|
7427
|
+
{render({ id: "alias" })}
|
|
7428
|
+
{render({ id: "tooltip" })}
|
|
7429
|
+
</ContainerAlias>
|
|
7430
|
+
<ContainerValue>
|
|
7431
|
+
{value}
|
|
7432
|
+
</ContainerValue>
|
|
7433
|
+
</Container>
|
|
7434
|
+
);*/
|
|
7435
|
+
}, [id, attributes, elementConfig, expandedContainers]);
|
|
7436
|
+
return renderAttributes?.length ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderAttributes.map(attribute => renderContainer(attribute)) })) : (renderContainer());
|
|
7437
|
+
});
|
|
7438
|
+
|
|
7381
7439
|
const ContainerDivider = styled(uilibGl.Divider) `
|
|
7382
7440
|
width: 100%;
|
|
7383
7441
|
border-color: ${({ theme: { palette }, $bgColor }) => $bgColor || palette.elementDeep};
|
|
@@ -7412,6 +7470,9 @@ const containerComponents = {
|
|
|
7412
7470
|
[exports.ContainerTemplate.Upload]: UploadContainer,
|
|
7413
7471
|
[exports.ContainerTemplate.Task]: TaskContainer,
|
|
7414
7472
|
[exports.ContainerTemplate.Edit]: EditContainer,
|
|
7473
|
+
[exports.ContainerTemplate.EditBoolean]: EditBooleanContainer,
|
|
7474
|
+
[exports.ContainerTemplate.EditString]: EditStringContainer,
|
|
7475
|
+
[exports.ContainerTemplate.EditGroup]: EditGroupContainer,
|
|
7415
7476
|
default: ContainersGroupContainer,
|
|
7416
7477
|
};
|
|
7417
7478
|
|
|
@@ -7683,6 +7744,8 @@ const HeaderTitle = ({ noFeature }) => {
|
|
|
7683
7744
|
const LayerIconContainer = styled.div `
|
|
7684
7745
|
display: flex;
|
|
7685
7746
|
align-items: center;
|
|
7747
|
+
justify-content: center;
|
|
7748
|
+
min-width: 2rem;
|
|
7686
7749
|
margin-right: 0.75rem;
|
|
7687
7750
|
`;
|
|
7688
7751
|
const AlertIconContainer = styled(uilibGl.Flex) `
|
|
@@ -8091,36 +8154,39 @@ const SmallPreview = ({ images, totalCount, currentIndex, isLoading, setCurrentI
|
|
|
8091
8154
|
return (jsxRuntime.jsxs(SmallPreviewContainer$1, { currentIndex: currentIndex + 1, prevIndex: prevIndex + 1, children: [isLoading && jsxRuntime.jsx(uilibGl.LinearProgress, {}), images.length > 1 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SmallPreviewLeft, { "$isDisabled": isPrevDisabled, onClick: prev }), jsxRuntime.jsx(SmallPreviewRight, { "$isDisabled": isNextDisabled, onClick: next }), jsxRuntime.jsx(SmallPreviewCounter, { children: jsxRuntime.jsxs("div", { children: [currentIndex + 1, " ", t("of", { ns: "dashboard", defaultValue: "из" }), " ", total] }) })] })), jsxRuntime.jsx(SmallPreviewImages, { onClick: onClick, children: images.map(image => (jsxRuntime.jsx("img", { src: image.src, alt: "" }, image.src))) })] }));
|
|
8092
8155
|
};
|
|
8093
8156
|
|
|
8094
|
-
const DEFAULT_ARCHIVED_PERIOD = "#24h";
|
|
8095
|
-
const SNAPSHOTS_PER_PAGE = 10;
|
|
8096
|
-
const getDuration = (archivePeriod) => {
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
};
|
|
8157
|
+
// const DEFAULT_ARCHIVED_PERIOD = "#24h";
|
|
8158
|
+
// const SNAPSHOTS_PER_PAGE = 10;
|
|
8159
|
+
/* const getDuration = (archivePeriod: string): Record<string, number> => {
|
|
8160
|
+
const lastLetter = archivePeriod[archivePeriod.length - 1];
|
|
8161
|
+
const value = archivePeriod.slice(1, -1);
|
|
8162
|
+
|
|
8163
|
+
const prop =
|
|
8164
|
+
lastLetter === "d"
|
|
8165
|
+
? "days"
|
|
8166
|
+
: lastLetter === "h"
|
|
8167
|
+
? "hours"
|
|
8168
|
+
: lastLetter === "m"
|
|
8169
|
+
? "minutes"
|
|
8170
|
+
: lastLetter === "s"
|
|
8171
|
+
? "seconds"
|
|
8172
|
+
: null;
|
|
8173
|
+
|
|
8174
|
+
if (!lastLetter || !value || !prop) return {};
|
|
8175
|
+
|
|
8176
|
+
return { [prop]: Number(value) };
|
|
8177
|
+
};*/
|
|
8112
8178
|
const useCameraAttribute = (cameraId) => {
|
|
8113
|
-
const { api } = useGlobalContext();
|
|
8179
|
+
// const { api } = useGlobalContext();
|
|
8114
8180
|
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
8115
8181
|
const [currentPage, setCurrentPage] = React.useState(0);
|
|
8116
|
-
const [timeline, setTimeline] = React.useState([]);
|
|
8182
|
+
const [timeline, /* setTimeline*/] = React.useState([]);
|
|
8117
8183
|
const [isLoadingSnapshot, setLoadingSnapshot] = React.useState(false);
|
|
8118
8184
|
const [isLoadingTimeline, setLoadingTimeline] = React.useState(false);
|
|
8119
8185
|
const [isOpenGallery, toggleGallery] = useToggle();
|
|
8120
8186
|
const [galleryImages, setGalleryImages] = React.useState([]);
|
|
8121
8187
|
const imagesRef = React.useRef([]);
|
|
8122
8188
|
// Todo get archivePeriod from project configuration
|
|
8123
|
-
const archivePeriod = /* appConfig?.settings?.cameraAttribute?.archivePeriod ||*/ DEFAULT_ARCHIVED_PERIOD;
|
|
8189
|
+
// const archivePeriod = /* appConfig?.settings?.cameraAttribute?.archivePeriod ||*/ DEFAULT_ARCHIVED_PERIOD;
|
|
8124
8190
|
const onNextPage = React.useCallback(() => {
|
|
8125
8191
|
setCurrentPage(currentPage + 1);
|
|
8126
8192
|
}, [currentPage]);
|
|
@@ -8145,44 +8211,53 @@ const useCameraAttribute = (cameraId) => {
|
|
|
8145
8211
|
fileName: formatDate$1(new Date()),
|
|
8146
8212
|
},
|
|
8147
8213
|
]);
|
|
8148
|
-
|
|
8149
|
-
const
|
|
8150
|
-
const
|
|
8214
|
+
// api.cameras was removed, so the next code is temporarily commented
|
|
8215
|
+
/* const formatDateOptions = { dateFormat: DateFormat.UTC };
|
|
8216
|
+
const startTime = formatDate(sub(new Date(), getDuration(archivePeriod)), formatDateOptions);
|
|
8217
|
+
const endTime = formatDate(new Date(), formatDateOptions);
|
|
8151
8218
|
const timelineResponse = await api.cameras.getArchiveTimeline({ cameraId, startTime, endTime });
|
|
8152
|
-
|
|
8153
|
-
|
|
8219
|
+
|
|
8220
|
+
if (!timelineResponse.success || !timelineResponse.timeline.length) return;
|
|
8221
|
+
|
|
8154
8222
|
timelineResponse.timeline.reverse();
|
|
8155
|
-
|
|
8223
|
+
|
|
8224
|
+
setTimeline(timelineResponse.timeline);*/
|
|
8156
8225
|
})();
|
|
8157
8226
|
}, [cameraId]);
|
|
8158
8227
|
React.useEffect(() => {
|
|
8159
|
-
if (!timeline.length)
|
|
8160
|
-
|
|
8228
|
+
/* if (!timeline.length) return;
|
|
8229
|
+
|
|
8161
8230
|
const timelinePage = timeline.slice(currentPage * SNAPSHOTS_PER_PAGE, (currentPage + 1) * SNAPSHOTS_PER_PAGE);
|
|
8231
|
+
|
|
8162
8232
|
for (const item of timelinePage) {
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8233
|
+
if (!item) continue;
|
|
8234
|
+
|
|
8235
|
+
api.cameras
|
|
8236
|
+
.getArchiveSnapshot({
|
|
8237
|
+
cameraId,
|
|
8238
|
+
time: item.startTime,
|
|
8169
8239
|
})
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
}
|
|
8240
|
+
.then(response => {
|
|
8241
|
+
const newImages = [
|
|
8242
|
+
...imagesRef.current,
|
|
8243
|
+
{ src: URL.createObjectURL(response), startTime: new Date(item.startTime) },
|
|
8244
|
+
];
|
|
8245
|
+
|
|
8246
|
+
newImages.sort((a, b) => (a.startTime < b.startTime ? 1 : a.startTime > b.startTime ? -1 : 0));
|
|
8247
|
+
imagesRef.current = newImages;
|
|
8248
|
+
|
|
8249
|
+
setGalleryImages(
|
|
8250
|
+
newImages.map(newImage => ({
|
|
8251
|
+
src: newImage.src,
|
|
8252
|
+
fileName: formatDate(newImage.startTime, { dateFormat: DateFormat.DateTime }),
|
|
8253
|
+
})),
|
|
8254
|
+
);
|
|
8255
|
+
|
|
8256
|
+
if (newImages.length === timelinePage.length) {
|
|
8257
|
+
setLoadingTimeline(false);
|
|
8258
|
+
}
|
|
8184
8259
|
});
|
|
8185
|
-
}
|
|
8260
|
+
}*/
|
|
8186
8261
|
}, [timeline, currentPage]);
|
|
8187
8262
|
return [
|
|
8188
8263
|
{
|
|
@@ -10019,6 +10094,16 @@ const getSvgUrl = ({ elementConfig, layerInfo, attributes, }) => {
|
|
|
10019
10094
|
return getResourceUrl(url);
|
|
10020
10095
|
};
|
|
10021
10096
|
|
|
10097
|
+
const getTemplateNameFromAttribute = (attribute) => {
|
|
10098
|
+
switch (attribute?.type) {
|
|
10099
|
+
case api.AttributeType.Boolean: return exports.ContainerTemplate.EditBoolean;
|
|
10100
|
+
case api.AttributeType.String:
|
|
10101
|
+
case api.AttributeType.LineString:
|
|
10102
|
+
case api.AttributeType.Unknown:
|
|
10103
|
+
default: return exports.ContainerTemplate.EditString;
|
|
10104
|
+
}
|
|
10105
|
+
};
|
|
10106
|
+
|
|
10022
10107
|
const getTotalFromAttributes = (children, attributes) => {
|
|
10023
10108
|
const total = children?.reduce((result, { attributeName }) => {
|
|
10024
10109
|
const value = attributes?.find(({ name }) => name === attributeName)?.value || 0;
|
|
@@ -10786,75 +10871,6 @@ const useUpdateDataSource = ({ dataSource, config, filters, attributes, layerPar
|
|
|
10786
10871
|
}, [dataSource, getDataSourcePromises, getUpdatedDataSources, dataSources]);
|
|
10787
10872
|
};
|
|
10788
10873
|
|
|
10789
|
-
const useMultipleAttributesRender = (config, elementConfig, type, renderElement) => {
|
|
10790
|
-
const { selectedTabId, layerInfo, attributes } = useWidgetContext(type);
|
|
10791
|
-
const { attributes: renderAttributes, attributesExclude } = elementConfig?.options || {};
|
|
10792
|
-
const getAttributesToRender = React.useCallback(() => {
|
|
10793
|
-
if (renderAttributes) {
|
|
10794
|
-
return renderAttributes;
|
|
10795
|
-
}
|
|
10796
|
-
if (attributesExclude) {
|
|
10797
|
-
const allAttributes = attributes?.map(attr => attr.name) || [];
|
|
10798
|
-
return allAttributes.filter(attr => !attributesExclude.includes(attr));
|
|
10799
|
-
}
|
|
10800
|
-
return null;
|
|
10801
|
-
}, [renderAttributes, attributesExclude, attributes]);
|
|
10802
|
-
const renderContainer = React.useCallback((attribute) => {
|
|
10803
|
-
const { id, options, style, children } = elementConfig || {};
|
|
10804
|
-
const { hideEmpty, innerTemplateStyle } = options || {};
|
|
10805
|
-
const hasUnits = children?.some(({ id }) => id === "units");
|
|
10806
|
-
const iconIndex = children?.findIndex(({ id }) => id === "icon");
|
|
10807
|
-
const icon = children?.[iconIndex];
|
|
10808
|
-
const hasIcon = !!icon;
|
|
10809
|
-
const elementChildren = elementConfig?.children?.map(child => ({
|
|
10810
|
-
type: "attributeValue",
|
|
10811
|
-
...child,
|
|
10812
|
-
attributeName: attribute,
|
|
10813
|
-
options: { noUnits: hasUnits, ...child.options },
|
|
10814
|
-
}));
|
|
10815
|
-
const attr = attribute
|
|
10816
|
-
? layerInfo?.layerAttributes?.find(({ attributeName }) => attributeName === attribute)
|
|
10817
|
-
: null;
|
|
10818
|
-
if (hasIcon) {
|
|
10819
|
-
elementChildren[iconIndex] = {
|
|
10820
|
-
...elementChildren[iconIndex],
|
|
10821
|
-
type: attr?.icon?.type?.toLowerCase(),
|
|
10822
|
-
value: attr?.icon?.resourceId || attr?.icon?.url || attr?.icon?.iconName,
|
|
10823
|
-
attributeName: null,
|
|
10824
|
-
};
|
|
10825
|
-
}
|
|
10826
|
-
const render = attribute
|
|
10827
|
-
? getRenderElement({
|
|
10828
|
-
config,
|
|
10829
|
-
elementConfig: {
|
|
10830
|
-
...elementConfig,
|
|
10831
|
-
children: elementChildren,
|
|
10832
|
-
},
|
|
10833
|
-
selectedTabId,
|
|
10834
|
-
attributes,
|
|
10835
|
-
layerInfo,
|
|
10836
|
-
type,
|
|
10837
|
-
})
|
|
10838
|
-
: renderElement;
|
|
10839
|
-
const value = render({ id: "value" });
|
|
10840
|
-
if (!value && hideEmpty)
|
|
10841
|
-
return null;
|
|
10842
|
-
return {
|
|
10843
|
-
render,
|
|
10844
|
-
value,
|
|
10845
|
-
hasUnits,
|
|
10846
|
-
id,
|
|
10847
|
-
style: innerTemplateStyle || style,
|
|
10848
|
-
hasIcon,
|
|
10849
|
-
attr,
|
|
10850
|
-
};
|
|
10851
|
-
}, [attributes, config, getRenderElement, layerInfo, renderElement, selectedTabId, type, elementConfig]);
|
|
10852
|
-
return {
|
|
10853
|
-
getAttributesToRender,
|
|
10854
|
-
renderContainer,
|
|
10855
|
-
};
|
|
10856
|
-
};
|
|
10857
|
-
|
|
10858
10874
|
const StackBar = ({ data, filterName, type, alias, options, renderElement, renderTooltip }) => {
|
|
10859
10875
|
const { height, showTotal, cornerRadius, groupTooltip } = options || {};
|
|
10860
10876
|
const { t } = useGlobalContext();
|
|
@@ -11727,6 +11743,7 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
|
|
|
11727
11743
|
|
|
11728
11744
|
exports.AddFeatureButton = AddFeatureButton;
|
|
11729
11745
|
exports.AddFeatureContainer = AddFeatureContainer;
|
|
11746
|
+
exports.AlertIconContainer = AlertIconContainer;
|
|
11730
11747
|
exports.AttributeGalleryContainer = AttributeGalleryContainer;
|
|
11731
11748
|
exports.AttributeLabel = AttributeLabel;
|
|
11732
11749
|
exports.CONFIG_PAGES_ID = CONFIG_PAGES_ID;
|
|
@@ -11829,6 +11846,7 @@ exports.LayerDescription = LayerDescription;
|
|
|
11829
11846
|
exports.LayerGroup = LayerGroup;
|
|
11830
11847
|
exports.LayerGroupList = LayerGroupList;
|
|
11831
11848
|
exports.LayerIcon = LayerIcon;
|
|
11849
|
+
exports.LayerIconContainer = LayerIconContainer;
|
|
11832
11850
|
exports.LayerListContainer = LayerListContainer;
|
|
11833
11851
|
exports.LayerTree = LayerTree;
|
|
11834
11852
|
exports.LayersContainer = LayersContainer;
|
|
@@ -11942,6 +11960,7 @@ exports.getRootElementId = getRootElementId;
|
|
|
11942
11960
|
exports.getSelectedFilterValue = getSelectedFilterValue;
|
|
11943
11961
|
exports.getSlideshowImages = getSlideshowImages;
|
|
11944
11962
|
exports.getSvgUrl = getSvgUrl;
|
|
11963
|
+
exports.getTemplateNameFromAttribute = getTemplateNameFromAttribute;
|
|
11945
11964
|
exports.getTotalFromAttributes = getTotalFromAttributes;
|
|
11946
11965
|
exports.getTotalFromRelatedFeatures = getTotalFromRelatedFeatures;
|
|
11947
11966
|
exports.hexToRgba = hexToRgba;
|
|
@@ -11990,7 +12009,6 @@ exports.useLayerParams = useLayerParams;
|
|
|
11990
12009
|
exports.useMapContext = useMapContext;
|
|
11991
12010
|
exports.useMapDraw = useMapDraw;
|
|
11992
12011
|
exports.useMapImages = useMapImages;
|
|
11993
|
-
exports.useMultipleAttributesRender = useMultipleAttributesRender;
|
|
11994
12012
|
exports.useProjectDashboardInit = useProjectDashboardInit;
|
|
11995
12013
|
exports.usePythonTask = usePythonTask;
|
|
11996
12014
|
exports.useRedrawLayer = useRedrawLayer;
|