@evergis/react 4.0.142 → 4.0.143
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.
|
@@ -11,9 +11,4 @@ export declare const useDataSources: ({ type: widgetType, config, attributes, fi
|
|
|
11
11
|
getDataSourcePromises: ({ ds, query, parameters, layerName, limit, condition, url, resourceId, fileName, methodName, }: ConfigDataSource, newFilters?: SelectedFilters, offset?: number) => Promise<EqlDataSource | PagedFeaturesListDc>;
|
|
12
12
|
getUpdatingDataSources: () => ConfigDataSource[];
|
|
13
13
|
getUpdatedDataSources: (responses: DataSourcePromise[], currentDataSources: ConfigDataSource[], otherDataSources: FetchedDataSource[]) => any;
|
|
14
|
-
zoomToLayersExtent: (layers: Array<{
|
|
15
|
-
layerName: string;
|
|
16
|
-
conditions: string[];
|
|
17
|
-
parameters?: Record<string, any>;
|
|
18
|
-
}>) => Promise<void>;
|
|
19
14
|
};
|
|
@@ -522,7 +522,22 @@ export interface ConfigDataSource {
|
|
|
522
522
|
methodName?: string;
|
|
523
523
|
url?: string;
|
|
524
524
|
type?: string;
|
|
525
|
+
/**
|
|
526
|
+
* Перезапрашивать источник, когда сервер сообщает об изменении объектов ЕГО слоя
|
|
527
|
+
* ({@link ConfigDataSource.layerName}). Только для источников со слоем; источникам
|
|
528
|
+
* query / python слушать нечего — им нужен {@link ConfigDataSource.autoSyncLayers}.
|
|
529
|
+
*/
|
|
525
530
|
autoSyncLayer?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Имена слоёв, за изменением объектов которых следит источник: пришло серверное
|
|
533
|
+
* уведомление по любому из них — источник перезапрашивается.
|
|
534
|
+
*
|
|
535
|
+
* Только для источников БЕЗ {@link ConfigDataSource.layerName} — query (`ds` + `query`),
|
|
536
|
+
* внешних (`url`) и python (`resourceId`). У них нет собственного слоя, а данные они
|
|
537
|
+
* считают по чужим, поэтому связь задаётся явно. Если `layerName` задан, поле
|
|
538
|
+
* игнорируется и работает {@link ConfigDataSource.autoSyncLayer}.
|
|
539
|
+
*/
|
|
540
|
+
autoSyncLayers?: string[];
|
|
526
541
|
/**
|
|
527
542
|
* Задержка перед запросом источника, мс. `0` или отсутствие поля — запрос сразу.
|
|
528
543
|
*
|
package/dist/index.js
CHANGED
|
@@ -7689,33 +7689,10 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
7689
7689
|
});
|
|
7690
7690
|
return newDataSources;
|
|
7691
7691
|
}, []);
|
|
7692
|
-
const zoomToLayersExtent = React.useCallback(async (layers) => {
|
|
7693
|
-
const newExtent = await api.layers.getBulkExtents({ srId: 4326 }, layers?.map(({ layerName, conditions, parameters }) => ({
|
|
7694
|
-
layerName,
|
|
7695
|
-
conditions,
|
|
7696
|
-
parameters,
|
|
7697
|
-
})));
|
|
7698
|
-
const { coordinates } = newExtent.overall || {};
|
|
7699
|
-
if (!coordinates) {
|
|
7700
|
-
return;
|
|
7701
|
-
}
|
|
7702
|
-
const hasEmptyCoordinate = coordinates.some(([x, y]) => !x && !y);
|
|
7703
|
-
if (hasEmptyCoordinate) {
|
|
7704
|
-
return;
|
|
7705
|
-
}
|
|
7706
|
-
/* const bbox = new Bbox(coordinates[0], coordinates[1], map.crs);
|
|
7707
|
-
const resolution = Math.max(bbox.width / painter.width, bbox.height / painter.height);
|
|
7708
|
-
|
|
7709
|
-
animateTo({
|
|
7710
|
-
position: bbox.center,
|
|
7711
|
-
resolution: map.getAdjustedResolution(resolution),
|
|
7712
|
-
});*/
|
|
7713
|
-
}, [api.layers]);
|
|
7714
7692
|
return {
|
|
7715
7693
|
getDataSourcePromises,
|
|
7716
7694
|
getUpdatingDataSources,
|
|
7717
7695
|
getUpdatedDataSources,
|
|
7718
|
-
zoomToLayersExtent,
|
|
7719
7696
|
};
|
|
7720
7697
|
};
|
|
7721
7698
|
|