@evergis/react 3.1.58 → 3.1.60

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
@@ -3918,7 +3918,7 @@ const ServerNotificationsProvider = ({ url, initialized, children }) => {
3918
3918
  };
3919
3919
 
3920
3920
  const useWidgetContext = (type = WidgetType.Dashboard) => {
3921
- const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, config: dashboardConfig, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = useContext(DashboardContext) || {};
3921
+ const { projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, config: dashboardConfig, containerIds, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = useContext(DashboardContext) || {};
3922
3922
  const { layerInfo, attributes, feature, closeFeatureCard, config: featureConfig, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = useContext(FeatureCardContext) || {};
3923
3923
  return {
3924
3924
  projectInfo,
@@ -3931,6 +3931,7 @@ const useWidgetContext = (type = WidgetType.Dashboard) => {
3931
3931
  attributes,
3932
3932
  feature,
3933
3933
  closeFeatureCard,
3934
+ containerIds,
3934
3935
  components: dashboardComponents,
3935
3936
  config: type === WidgetType.Dashboard ? dashboardConfig : featureConfig,
3936
3937
  isLoading: type === WidgetType.Dashboard ? projectLoading : featureLoading,
@@ -4838,7 +4839,7 @@ const usePythonTask = () => {
4838
4839
  setTaskId(null);
4839
4840
  setSubscriptionId(null);
4840
4841
  }, []);
4841
- const runTask = useCallback(async ({ resourceId, parameters, script, }) => {
4842
+ const runTask = useCallback(async ({ resourceId, parameters, script, fileName, methodName, }) => {
4842
4843
  reset();
4843
4844
  const start = Date.now();
4844
4845
  let prototypeId = await api.remoteTaskManager.createTaskPrototype({
@@ -4852,6 +4853,8 @@ const usePythonTask = () => {
4852
4853
  resourceId,
4853
4854
  parameters,
4854
4855
  script,
4856
+ fileName,
4857
+ methodName,
4855
4858
  method: "pythonrunner/run",
4856
4859
  },
4857
4860
  },
@@ -6735,7 +6738,7 @@ const TaskContainer = memo(({ type, elementConfig }) => {
6735
6738
  const { options } = elementConfig || {};
6736
6739
  const { title, relatedResources, center, icon } = options || {};
6737
6740
  const onClick = useCallback(async () => {
6738
- await Promise.all(relatedResources.map(({ resourceId, parameters, script }) => {
6741
+ await Promise.all(relatedResources.map(({ resourceId, parameters, script, fileName, methodName }) => {
6739
6742
  const newParams = applyQueryFilters({
6740
6743
  parameters,
6741
6744
  dataSources,
@@ -6743,7 +6746,7 @@ const TaskContainer = memo(({ type, elementConfig }) => {
6743
6746
  filters: currentPage.filters,
6744
6747
  geometry: ewktGeometry,
6745
6748
  });
6746
- return runTask({ resourceId, parameters: newParams, script });
6749
+ return runTask({ resourceId, parameters: newParams, script, fileName, methodName });
6747
6750
  }));
6748
6751
  }, [currentPage.filters, dataSources, ewktGeometry, relatedResources, runTask, selectedFilters]);
6749
6752
  return (jsx(Flex, { justifyContent: center ? "center" : "flex-start", children: jsxs(WaitingButton, { primary: true, isWaiting: loading, disabled: !relatedResources?.length, onClick: onClick, children: [icon && jsx(FlexSpan, { marginRight: "0.5rem", children: jsx(Icon, { kind: icon }) }), title || t("run", { ns: "dashboard", defaultValue: "Запуск" })] }) }));
@@ -9391,16 +9394,27 @@ const tooltipValueFromRelatedFeatures = (t, value, relatedAttributes, layerInfo)
9391
9394
  };
9392
9395
 
9393
9396
  const useWidgetConfig = (type = WidgetType.Dashboard) => {
9394
- const { config: configProp, projectInfo, layerInfo } = useWidgetContext(type);
9397
+ const { config: configProp, containerIds, projectInfo, layerInfo } = useWidgetContext(type);
9395
9398
  const config = useMemo(() => {
9396
9399
  if (configProp) {
9397
9400
  return configProp;
9398
9401
  }
9399
- if (type === WidgetType.Dashboard) {
9400
- return (projectInfo?.content?.dashboardConfiguration || {});
9402
+ const currentConfig = type === WidgetType.Dashboard
9403
+ ? (projectInfo?.content?.dashboardConfiguration || {})
9404
+ : (layerInfo?.configuration?.cardConfiguration || {});
9405
+ if (containerIds?.length) {
9406
+ const elements = containerIds.map(id => returnFound(currentConfig, { id })).filter(Boolean);
9407
+ if (!elements.length)
9408
+ return currentConfig;
9409
+ const newConfig = JSON.parse(JSON.stringify(currentConfig));
9410
+ const pages = getPagesFromConfig(newConfig);
9411
+ if (!pages?.[0]?.children)
9412
+ return currentConfig;
9413
+ pages[0].children = elements;
9414
+ return newConfig;
9401
9415
  }
9402
- return (layerInfo?.configuration?.cardConfiguration || {});
9403
- }, [configProp, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
9416
+ return currentConfig;
9417
+ }, [configProp, containerIds, layerInfo?.configuration?.cardConfiguration, projectInfo?.content?.dashboardConfiguration, type]);
9404
9418
  const pages = useMemo(() => (getPagesFromConfig(config) || []), [config]);
9405
9419
  return {
9406
9420
  config,
@@ -10336,9 +10350,9 @@ const ExpandableTitle = memo(({ elementConfig, type, renderElement }) => {
10336
10350
  const { id, options, templateName, children } = elementConfig || {};
10337
10351
  const { expandable, fontColor, expanded, layerNames } = options || {};
10338
10352
  const titleElement = children?.find(item => item.id === "title");
10339
- const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
10340
10353
  if (!titleElement)
10341
10354
  return null;
10355
+ const isVisible = isVisibleContainer(id, expandable, expanded, expandedContainers);
10342
10356
  return (jsx(TitleContainer, { containerId: id, elementConfig: titleElement, templateName: templateName, layerNames: layerNames, fontColor: fontColor, expandable: expandable, expanded: expanded, type: type, isVisible: isVisible, renderElement: renderElement }));
10343
10357
  });
10344
10358