@evergis/react 4.0.130 → 4.0.131
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/constants.d.ts +12 -0
- package/dist/components/Dashboard/hooks/index.d.ts +1 -0
- package/dist/components/Dashboard/hooks/useDataSourceLoading.d.ts +2 -0
- package/dist/components/Dashboard/hooks/useGlobalContext.d.ts +2 -0
- package/dist/components/Dashboard/types.d.ts +8 -0
- package/dist/components/Dashboard/utils/applyQueryFilters.d.ts +3 -1
- package/dist/components/Dashboard/utils/formatDataSourceCondition.d.ts +5 -1
- package/dist/components/Dashboard/utils/getMapViewDataSources.d.ts +7 -0
- package/dist/components/Dashboard/utils/index.d.ts +2 -0
- package/dist/components/Dashboard/utils/toConditionsArray.d.ts +2 -0
- package/dist/contexts/GlobalContext/types.d.ts +4 -0
- package/dist/index.js +96 -14
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +90 -15
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredData.d.ts +0 -28
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataDraft.d.ts +0 -25
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSave.d.ts +0 -17
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSchema.d.ts +0 -11
- package/dist/components/Dashboard/containers/StructuredDataContainer/utils/viewScroll.d.ts +0 -17
- package/dist/components/Dashboard/elements/ElementTable/hooks/useSurfaceColor.d.ts +0 -16
- package/dist/components/Dashboard/elements/ElementTable/useCellEditing.d.ts +0 -15
- package/dist/components/Dashboard/elements/ElementTable/useTableView.d.ts +0 -16
- package/dist/components/Dashboard/elements/ElementTable/utils/surfaceColor.d.ts +0 -13
|
@@ -22,6 +22,18 @@ export declare const DEFAULT_CHART_ANGLE = 4;
|
|
|
22
22
|
export declare const DEFAULT_CHART_HEIGHT = 90;
|
|
23
23
|
export declare const STACK_BAR_TOTAL_HEIGHT = 20;
|
|
24
24
|
export declare const FILTER_PREFIX = "%";
|
|
25
|
+
/** Имя системного геометрического фильтра — выделение, нарисованное пользователем на карте. */
|
|
26
|
+
export declare const GEOMETRY_FILTER_NAME = "geometry";
|
|
27
|
+
/** Имя системного фильтра «экстент видимой области карты» (EWKT, `SRID=3857`). */
|
|
28
|
+
export declare const EXTENT_FILTER_NAME = "extent";
|
|
29
|
+
/** Имя системного фильтра «уровень зума карты» (целое число). */
|
|
30
|
+
export declare const ZOOM_FILTER_NAME = "zoom";
|
|
31
|
+
/**
|
|
32
|
+
* Системные фильтры текущего вида карты. Их значения приходят не из `SelectedFilters`, а из
|
|
33
|
+
* `GlobalContext`, поэтому имена зарезервированы: одноимённый пользовательский фильтр будет
|
|
34
|
+
* перехвачен системной подстановкой — ровно как в случае `geometry`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MAP_VIEW_FILTER_NAMES: string[];
|
|
25
37
|
export declare const PROVIDER_PREFIX = "$";
|
|
26
38
|
export declare enum ProviderPrefix {
|
|
27
39
|
Card = "card",
|
|
@@ -9,6 +9,7 @@ export * from './useFetchWithAuth';
|
|
|
9
9
|
export * from './useChartChange';
|
|
10
10
|
export * from './useChartData';
|
|
11
11
|
export * from './useDashboardHeader';
|
|
12
|
+
export * from './useDataSourceLoading';
|
|
12
13
|
export * from './useDataSources';
|
|
13
14
|
export * from './useDiffPage';
|
|
14
15
|
export * from './useEqualTileWidth';
|
|
@@ -5,6 +5,8 @@ export declare const useGlobalContext: () => {
|
|
|
5
5
|
themeName: import('../../..').ThemeName;
|
|
6
6
|
api: import('@evergis/api').Api;
|
|
7
7
|
ewktGeometry: string;
|
|
8
|
+
ewktExtent: string;
|
|
9
|
+
zoomLevel: number;
|
|
8
10
|
notification: {
|
|
9
11
|
add: (item: import('@evergis/uilib-gl').INotificationItem) => void;
|
|
10
12
|
update: (patch: Partial<import('@evergis/uilib-gl').INotificationItem> & {
|
|
@@ -482,6 +482,14 @@ export interface ConfigDataSource {
|
|
|
482
482
|
url?: string;
|
|
483
483
|
type?: string;
|
|
484
484
|
autoSyncLayer?: boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Задержка перед запросом источника, мс. `0` или отсутствие поля — запрос сразу.
|
|
487
|
+
*
|
|
488
|
+
* Дебаунсит ЛЮБОЙ перезапрос источника: смену фильтров, движение карты (`%extent` / `%zoom`),
|
|
489
|
+
* autoSync-уведомления, правку конфига и первичную загрузку. Нужна тяжёлым источникам, чтобы
|
|
490
|
+
* серия быстрых событий схлопывалась в один запрос.
|
|
491
|
+
*/
|
|
492
|
+
debounce?: number;
|
|
485
493
|
}
|
|
486
494
|
export interface EqlDataSource {
|
|
487
495
|
items: FeatureDc[];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ClientFeatureAttribute, ConfigFilter, SelectedFilters, WidgetDataSource } from '../types';
|
|
2
2
|
import { QueryLayerServiceInfoDc } from '@evergis/api';
|
|
3
|
-
export declare const applyQueryFilters: ({ parameters: configParameters, filters: configFilters, selectedFilters, geometry, attributes, layerInfo, dataSources, projectDataSources, }: {
|
|
3
|
+
export declare const applyQueryFilters: ({ parameters: configParameters, filters: configFilters, selectedFilters, geometry, extent, zoomLevel, attributes, layerInfo, dataSources, projectDataSources, }: {
|
|
4
4
|
parameters: Record<string, any>;
|
|
5
5
|
filters: ConfigFilter[];
|
|
6
6
|
selectedFilters?: SelectedFilters;
|
|
7
7
|
geometry?: string;
|
|
8
|
+
extent?: string;
|
|
9
|
+
zoomLevel?: number;
|
|
8
10
|
attributes?: ClientFeatureAttribute[];
|
|
9
11
|
layerInfo?: QueryLayerServiceInfoDc;
|
|
10
12
|
dataSources: WidgetDataSource[];
|
|
@@ -9,13 +9,15 @@ export declare const applyFiltersToCondition: ({ condition, name, defaultValue,
|
|
|
9
9
|
isSetParams?: boolean;
|
|
10
10
|
configFilter?: ConfigFilter;
|
|
11
11
|
}) => string | number;
|
|
12
|
-
export declare const applyVarsToCondition: <T extends string | string[]>({ section, configFilters, filters, attributes, layerParams, eqlParameters, geometry, isSetParams, }: Pick<QueryLayerServiceConfigurationDc, "eqlParameters"> & {
|
|
12
|
+
export declare const applyVarsToCondition: <T extends string | string[]>({ section, configFilters, filters, attributes, layerParams, eqlParameters, geometry, extent, zoomLevel, isSetParams, }: Pick<QueryLayerServiceConfigurationDc, "eqlParameters"> & {
|
|
13
13
|
section: T;
|
|
14
14
|
configFilters: ConfigFilter[];
|
|
15
15
|
filters: SelectedFilters;
|
|
16
16
|
attributes?: ClientFeatureAttribute[];
|
|
17
17
|
layerParams?: Record<string, string>;
|
|
18
18
|
geometry?: string;
|
|
19
|
+
extent?: string;
|
|
20
|
+
zoomLevel?: number;
|
|
19
21
|
isSetParams?: boolean;
|
|
20
22
|
}) => T;
|
|
21
23
|
type FormatDataSourceConditionParams = {
|
|
@@ -25,6 +27,8 @@ type FormatDataSourceConditionParams = {
|
|
|
25
27
|
eqlParameters?: QueryLayerServiceConfigurationDc["eqlParameters"];
|
|
26
28
|
layerParams?: Record<string, string>;
|
|
27
29
|
geometry?: string;
|
|
30
|
+
extent?: string;
|
|
31
|
+
zoomLevel?: number;
|
|
28
32
|
};
|
|
29
33
|
export declare const formatDataSourceCondition: ({ condition, ...rest }: FormatDataSourceConditionParams & {
|
|
30
34
|
condition?: string | string[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfigDataSource } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Источники, чей запрос зависит от текущего вида карты — в `parameters` или `condition` у них
|
|
4
|
+
* есть `%extent` / `%zoom`. Перезапрашивают при движении карты только их: иначе каждый пан
|
|
5
|
+
* дёргал бы все запросы страницы.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getMapViewDataSources: (dataSources?: ConfigDataSource[]) => ConfigDataSource[];
|
|
@@ -38,6 +38,7 @@ export * from './getFeatureCardHeader';
|
|
|
38
38
|
export * from './getFilterComponent';
|
|
39
39
|
export * from './getFilterSelectedItems';
|
|
40
40
|
export * from './getFilterValue';
|
|
41
|
+
export * from './getMapViewDataSources';
|
|
41
42
|
export * from './getFormattedAttributes';
|
|
42
43
|
export * from './getImageUrl';
|
|
43
44
|
export * from './getLayerInfo';
|
|
@@ -69,6 +70,7 @@ export * from './pieChartTooltipFromRelatedFeatures';
|
|
|
69
70
|
export * from './removeDataSource';
|
|
70
71
|
export * from './updateDataSource';
|
|
71
72
|
export * from './sliceShownOtherItems';
|
|
73
|
+
export * from './toConditionsArray';
|
|
72
74
|
export * from './toCssSize';
|
|
73
75
|
export * from './toRenderableValue';
|
|
74
76
|
export * from './tooltipNameFromAttributes';
|
|
@@ -7,6 +7,10 @@ export type GlobalContextProps = PropsWithChildren<{
|
|
|
7
7
|
t?: i18n["t"];
|
|
8
8
|
language?: string;
|
|
9
9
|
ewktGeometry?: string;
|
|
10
|
+
/** Экстент видимой области карты в EWKT (`SRID=3857;POLYGON((...))`) — плейсхолдер `%extent`. */
|
|
11
|
+
ewktExtent?: string;
|
|
12
|
+
/** Целый уровень зума карты — плейсхолдер `%zoom`. */
|
|
13
|
+
zoomLevel?: number;
|
|
10
14
|
themeName?: ThemeName;
|
|
11
15
|
api?: Api;
|
|
12
16
|
notification?: {
|
package/dist/index.js
CHANGED
|
@@ -3541,6 +3541,18 @@ const DEFAULT_CHART_ANGLE = 4;
|
|
|
3541
3541
|
const DEFAULT_CHART_HEIGHT = 90;
|
|
3542
3542
|
const STACK_BAR_TOTAL_HEIGHT = 20;
|
|
3543
3543
|
const FILTER_PREFIX = "%";
|
|
3544
|
+
/** Имя системного геометрического фильтра — выделение, нарисованное пользователем на карте. */
|
|
3545
|
+
const GEOMETRY_FILTER_NAME = "geometry";
|
|
3546
|
+
/** Имя системного фильтра «экстент видимой области карты» (EWKT, `SRID=3857`). */
|
|
3547
|
+
const EXTENT_FILTER_NAME = "extent";
|
|
3548
|
+
/** Имя системного фильтра «уровень зума карты» (целое число). */
|
|
3549
|
+
const ZOOM_FILTER_NAME = "zoom";
|
|
3550
|
+
/**
|
|
3551
|
+
* Системные фильтры текущего вида карты. Их значения приходят не из `SelectedFilters`, а из
|
|
3552
|
+
* `GlobalContext`, поэтому имена зарезервированы: одноимённый пользовательский фильтр будет
|
|
3553
|
+
* перехвачен системной подстановкой — ровно как в случае `geometry`.
|
|
3554
|
+
*/
|
|
3555
|
+
const MAP_VIEW_FILTER_NAMES = [EXTENT_FILTER_NAME, ZOOM_FILTER_NAME];
|
|
3544
3556
|
const PROVIDER_PREFIX = "$";
|
|
3545
3557
|
exports.ProviderPrefix = void 0;
|
|
3546
3558
|
(function (ProviderPrefix) {
|
|
@@ -4221,7 +4233,7 @@ const getSelectedFilterValue = (filterName, selectedFilters, defaultValue) => {
|
|
|
4221
4233
|
: selectedFilters?.[filterName]?.value) ?? defaultValue);
|
|
4222
4234
|
};
|
|
4223
4235
|
|
|
4224
|
-
const applyQueryFilters = ({ parameters: configParameters, filters: configFilters, selectedFilters, geometry, attributes, layerInfo, dataSources, projectDataSources, }) => {
|
|
4236
|
+
const applyQueryFilters = ({ parameters: configParameters, filters: configFilters, selectedFilters, geometry, extent, zoomLevel, attributes, layerInfo, dataSources, projectDataSources, }) => {
|
|
4225
4237
|
if (!configParameters) {
|
|
4226
4238
|
return {};
|
|
4227
4239
|
}
|
|
@@ -4266,12 +4278,27 @@ const applyQueryFilters = ({ parameters: configParameters, filters: configFilter
|
|
|
4266
4278
|
const [filterName, filterProp] = filterFullName.includes(".") ? filterFullName.split(".") : [filterFullName, null];
|
|
4267
4279
|
const configFilter = getConfigFilter(filterName, configFilters);
|
|
4268
4280
|
const { defaultValue, relatedDataSource, attributeAlias } = configFilter || {};
|
|
4269
|
-
if (filterName ===
|
|
4281
|
+
if (filterName === GEOMETRY_FILTER_NAME && geometry && !geometry.includes("()") && geometry.endsWith(")")) {
|
|
4270
4282
|
return {
|
|
4271
4283
|
...result,
|
|
4272
4284
|
[key]: geometry,
|
|
4273
4285
|
};
|
|
4274
4286
|
}
|
|
4287
|
+
// Системные фильтры вида карты: значение приходит из `GlobalContext`, а не из `SelectedFilters`,
|
|
4288
|
+
// поэтому резолвятся до веток `.min` / `.max` / `.property` — как `geometry` выше.
|
|
4289
|
+
if (filterName === EXTENT_FILTER_NAME && extent) {
|
|
4290
|
+
return {
|
|
4291
|
+
...result,
|
|
4292
|
+
[key]: extent,
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
// Единственная нестроковая системная подстановка: уровень зума уходит числом.
|
|
4296
|
+
if (filterName === ZOOM_FILTER_NAME && !lodash.isNil(zoomLevel)) {
|
|
4297
|
+
return {
|
|
4298
|
+
...result,
|
|
4299
|
+
[key]: zoomLevel,
|
|
4300
|
+
};
|
|
4301
|
+
}
|
|
4275
4302
|
if (configParameters[key].endsWith(".max")) {
|
|
4276
4303
|
return {
|
|
4277
4304
|
...result,
|
|
@@ -4522,7 +4549,7 @@ const applyFiltersToCondition = ({ condition, name, defaultValue, filters, isSin
|
|
|
4522
4549
|
}
|
|
4523
4550
|
return isSingle && isNumeric(result) ? Number(result) : result;
|
|
4524
4551
|
};
|
|
4525
|
-
const applyVarsToCondition = ({ section, configFilters, filters, attributes, layerParams, eqlParameters, geometry, isSetParams, }) => {
|
|
4552
|
+
const applyVarsToCondition = ({ section, configFilters, filters, attributes, layerParams, eqlParameters, geometry, extent, zoomLevel, isSetParams, }) => {
|
|
4526
4553
|
if (!section?.length)
|
|
4527
4554
|
return [];
|
|
4528
4555
|
const isSingle = typeof section === "string";
|
|
@@ -4531,6 +4558,17 @@ const applyVarsToCondition = ({ section, configFilters, filters, attributes, lay
|
|
|
4531
4558
|
if (geometry && !geometry.includes("()") && geometry.endsWith(")")) {
|
|
4532
4559
|
result[index] = result[index].replace(new RegExp("%geometry"), `'${geometry}'`);
|
|
4533
4560
|
}
|
|
4561
|
+
// Системные фильтры вида карты подставляются ДО цикла по `configFilters`: одноимённый
|
|
4562
|
+
// пользовательский фильтр не должен перехватывать `%extent` / `%zoom`. Lookahead `(?![\w.])`
|
|
4563
|
+
// оставляет фильтрам составные формы (`%zoomLevel`, `%extent_id`, `%zoom.min`) — та же
|
|
4564
|
+
// граница, что уже разводит `%name` и `%name2.l1` в `getUpdatingDataSources`.
|
|
4565
|
+
if (extent) {
|
|
4566
|
+
result[index] = result[index].replace(new RegExp(`${FILTER_PREFIX}${EXTENT_FILTER_NAME}(?![\\w.])`, "g"), `'${extent}'`);
|
|
4567
|
+
}
|
|
4568
|
+
// Зум — число, кавычки не ставим.
|
|
4569
|
+
if (!lodash.isNil(zoomLevel)) {
|
|
4570
|
+
result[index] = result[index].replace(new RegExp(`${FILTER_PREFIX}${ZOOM_FILTER_NAME}(?![\\w.])`, "g"), String(zoomLevel));
|
|
4571
|
+
}
|
|
4534
4572
|
if (configFilters?.length) {
|
|
4535
4573
|
configFilters.forEach(filter => {
|
|
4536
4574
|
result[index] = applyFiltersToCondition({
|
|
@@ -4559,7 +4597,7 @@ const applyVarsToCondition = ({ section, configFilters, filters, attributes, lay
|
|
|
4559
4597
|
});
|
|
4560
4598
|
return isSingle ? result?.[0] : result;
|
|
4561
4599
|
};
|
|
4562
|
-
const formatSingleCondition = (condition, { configFilters, filters, attributes, eqlParameters, layerParams, geometry }) => {
|
|
4600
|
+
const formatSingleCondition = (condition, { configFilters, filters, attributes, eqlParameters, layerParams, geometry, extent, zoomLevel, }) => {
|
|
4563
4601
|
const setParams = condition.match(new RegExp("\\$\\([^)]+\\)", "g"));
|
|
4564
4602
|
const setParamsSection = applyVarsToCondition({
|
|
4565
4603
|
section: setParams,
|
|
@@ -4569,6 +4607,8 @@ const formatSingleCondition = (condition, { configFilters, filters, attributes,
|
|
|
4569
4607
|
eqlParameters,
|
|
4570
4608
|
layerParams,
|
|
4571
4609
|
geometry,
|
|
4610
|
+
extent,
|
|
4611
|
+
zoomLevel,
|
|
4572
4612
|
isSetParams: true,
|
|
4573
4613
|
});
|
|
4574
4614
|
const splitter = " AND ";
|
|
@@ -4581,6 +4621,8 @@ const formatSingleCondition = (condition, { configFilters, filters, attributes,
|
|
|
4581
4621
|
eqlParameters,
|
|
4582
4622
|
layerParams,
|
|
4583
4623
|
geometry,
|
|
4624
|
+
extent,
|
|
4625
|
+
zoomLevel,
|
|
4584
4626
|
});
|
|
4585
4627
|
return setParamsSection?.length && conditionSection.length
|
|
4586
4628
|
? [setParamsSection.join(""), conditionSection.join(splitter)].join(" ")
|
|
@@ -6358,7 +6400,7 @@ const useAttachmentItems = ({ type, elementConfig, valueOverride, }) => {
|
|
|
6358
6400
|
};
|
|
6359
6401
|
|
|
6360
6402
|
const useGlobalContext = () => {
|
|
6361
|
-
const { t, language, themeName, api, ewktGeometry, notification } = React.useContext(GlobalContext) || {};
|
|
6403
|
+
const { t, language, themeName, api, ewktGeometry, ewktExtent, zoomLevel, notification } = React.useContext(GlobalContext) || {};
|
|
6362
6404
|
const translate = React.useCallback((value, options) => {
|
|
6363
6405
|
if (t)
|
|
6364
6406
|
return t(value, options);
|
|
@@ -6370,8 +6412,10 @@ const useGlobalContext = () => {
|
|
|
6370
6412
|
themeName,
|
|
6371
6413
|
api,
|
|
6372
6414
|
ewktGeometry,
|
|
6415
|
+
ewktExtent,
|
|
6416
|
+
zoomLevel,
|
|
6373
6417
|
notification,
|
|
6374
|
-
}), [language, translate, api, ewktGeometry, themeName, notification]);
|
|
6418
|
+
}), [language, translate, api, ewktGeometry, ewktExtent, zoomLevel, themeName, notification]);
|
|
6375
6419
|
};
|
|
6376
6420
|
|
|
6377
6421
|
const GRID_TILE_SIZE = "4.5rem";
|
|
@@ -7177,10 +7221,17 @@ const useDashboardHeader = () => {
|
|
|
7177
7221
|
};
|
|
7178
7222
|
};
|
|
7179
7223
|
|
|
7224
|
+
// Полноэкранная заглушка допустима только пока не пришёл ни один источник: дальше страницу
|
|
7225
|
+
// и модалку наполняют сами контейнеры — у каждого свой ContainerLoading / ChartLoading.
|
|
7226
|
+
const useDataSourceLoading = (type) => {
|
|
7227
|
+
const { dataSources, isLoading } = useWidgetContext(type);
|
|
7228
|
+
const { currentPage } = useWidgetPage(type);
|
|
7229
|
+
return React.useMemo(() => !!currentPage?.dataSources?.length && !dataSources?.length && !!isLoading, [currentPage?.dataSources?.length, dataSources?.length, isLoading]);
|
|
7230
|
+
};
|
|
7231
|
+
|
|
7180
7232
|
/* eslint-disable max-lines */
|
|
7181
|
-
const toConditionsArray = (value) => Array.isArray(value) ? value : value ? [value] : [];
|
|
7182
7233
|
const useDataSources = ({ type: widgetType, config, attributes, filters, layerParams, eqlParameters, }) => {
|
|
7183
|
-
const { ewktGeometry, api } = useGlobalContext();
|
|
7234
|
+
const { ewktGeometry, ewktExtent, zoomLevel, api } = useGlobalContext();
|
|
7184
7235
|
const { dataSources, layerInfo } = useWidgetContext(widgetType);
|
|
7185
7236
|
const { dataSources: projectDataSources } = useWidgetContext(exports.WidgetType.Dashboard);
|
|
7186
7237
|
const { filters: configFilters, dataSources: configDataSources } = config || {};
|
|
@@ -7208,6 +7259,8 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
7208
7259
|
attributes,
|
|
7209
7260
|
filters: configFilters,
|
|
7210
7261
|
geometry: ewktGeometry,
|
|
7262
|
+
extent: ewktExtent,
|
|
7263
|
+
zoomLevel,
|
|
7211
7264
|
layerInfo,
|
|
7212
7265
|
dataSources,
|
|
7213
7266
|
projectDataSources,
|
|
@@ -7282,6 +7335,8 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
7282
7335
|
configFilters,
|
|
7283
7336
|
filters: selectedFilters,
|
|
7284
7337
|
geometry: ewktGeometry,
|
|
7338
|
+
extent: ewktExtent,
|
|
7339
|
+
zoomLevel,
|
|
7285
7340
|
attributes,
|
|
7286
7341
|
layerParams,
|
|
7287
7342
|
eqlParameters,
|
|
@@ -7303,6 +7358,8 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
7303
7358
|
dataSources,
|
|
7304
7359
|
configFilters,
|
|
7305
7360
|
ewktGeometry,
|
|
7361
|
+
ewktExtent,
|
|
7362
|
+
zoomLevel,
|
|
7306
7363
|
api,
|
|
7307
7364
|
attributes,
|
|
7308
7365
|
layerParams,
|
|
@@ -15472,7 +15529,8 @@ const getRenderElement = ({ t, config, elementConfig, attributes = [], layerInfo
|
|
|
15472
15529
|
|
|
15473
15530
|
const ElementModal = React.memo(({ type = exports.WidgetType.Dashboard, elementConfig }) => {
|
|
15474
15531
|
const { config } = useWidgetConfig(type);
|
|
15475
|
-
const { expandedContainers, attributes
|
|
15532
|
+
const { expandedContainers, attributes } = useWidgetContext(type);
|
|
15533
|
+
const isDataSourceLoading = useDataSourceLoading(type);
|
|
15476
15534
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
15477
15535
|
const { options } = elementConfig || {};
|
|
15478
15536
|
const { modalId, icon } = options || {};
|
|
@@ -15492,7 +15550,7 @@ const ElementModal = React.memo(({ type = exports.WidgetType.Dashboard, elementC
|
|
|
15492
15550
|
return null;
|
|
15493
15551
|
const { options: modalOptions } = modalConfig;
|
|
15494
15552
|
const { title, maxWidth, minWidth, minHeight } = modalOptions || {};
|
|
15495
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalIcon, { kind: icon || "new_window", onClick: handleOpen, children: title }), jsxRuntime.jsxs(uilibGl.Dialog, { maxWidth: maxWidth, minWidth: minWidth, minHeight: minHeight, isOpen: isOpen, modal: true, onCloseRequest: handleClose, 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:
|
|
15553
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalIcon, { kind: icon || "new_window", onClick: handleOpen, children: title }), jsxRuntime.jsxs(uilibGl.Dialog, { maxWidth: maxWidth, minWidth: minWidth, minHeight: minHeight, isOpen: isOpen, modal: true, onCloseRequest: handleClose, 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: isDataSourceLoading ? (jsxRuntime.jsx(DashboardLoading, {})) : (jsxRuntime.jsx(Container, { isColumn: true, noBorders: true, children: jsxRuntime.jsx(ContainerChildren, { type: type, items: modalContent, isMain: true, renderElement: renderElement }) })) })] })] }));
|
|
15496
15554
|
});
|
|
15497
15555
|
|
|
15498
15556
|
const elementComponents = {
|
|
@@ -16844,6 +16902,25 @@ const getFilterValue = ({ selectedFilters, configFilters, filterName, newValue,
|
|
|
16844
16902
|
return valueType === "single" ? newValue : valueType === "range" ? [newValue, newValue] : [newValue];
|
|
16845
16903
|
};
|
|
16846
16904
|
|
|
16905
|
+
/** Условие источника задаётся строкой или массивом строк — приводим к массиву для единообразного обхода. */
|
|
16906
|
+
const toConditionsArray = (value) => Array.isArray(value) ? value : value ? [value] : [];
|
|
16907
|
+
|
|
16908
|
+
const MAP_VIEW_PLACEHOLDERS = MAP_VIEW_FILTER_NAMES.map(name => `${FILTER_PREFIX}${name}`);
|
|
16909
|
+
// Та же граница, что и при подстановке в `formatDataSourceCondition`: составные формы
|
|
16910
|
+
// (`%zoomLevel`, `%extent_id`, `%zoom.min`) принадлежат пользовательским фильтрам, не карте.
|
|
16911
|
+
const hasMapViewPlaceholder = (value) => MAP_VIEW_PLACEHOLDERS.some(placeholder => new RegExp(`${placeholder}(?![\\w.])`).test(value));
|
|
16912
|
+
/**
|
|
16913
|
+
* Источники, чей запрос зависит от текущего вида карты — в `parameters` или `condition` у них
|
|
16914
|
+
* есть `%extent` / `%zoom`. Перезапрашивают при движении карты только их: иначе каждый пан
|
|
16915
|
+
* дёргал бы все запросы страницы.
|
|
16916
|
+
*/
|
|
16917
|
+
const getMapViewDataSources = (dataSources) => dataSources?.filter(({ parameters, condition }) => {
|
|
16918
|
+
const hasInParameters = Object.values(parameters ?? {}).some(value => typeof value === "string" && MAP_VIEW_PLACEHOLDERS.includes(value));
|
|
16919
|
+
if (hasInParameters)
|
|
16920
|
+
return true;
|
|
16921
|
+
return toConditionsArray(condition).some(hasMapViewPlaceholder);
|
|
16922
|
+
}) ?? [];
|
|
16923
|
+
|
|
16847
16924
|
const getFormattedAttributes = (t, data, attributes, config) => {
|
|
16848
16925
|
const showOtherItems = config?.options?.otherItems < data?.length;
|
|
16849
16926
|
const otherIndex = config?.options?.otherItems + 1;
|
|
@@ -17420,11 +17497,9 @@ const DashboardLoading = React.memo(() => {
|
|
|
17420
17497
|
});
|
|
17421
17498
|
|
|
17422
17499
|
const Dashboard = React.memo(({ type = exports.WidgetType.Dashboard, noBorders }) => {
|
|
17423
|
-
const
|
|
17424
|
-
const { currentPage } = useWidgetPage(type);
|
|
17500
|
+
const isDataSourceLoading = useDataSourceLoading(type);
|
|
17425
17501
|
const isDiffPage = useDiffPage(type);
|
|
17426
|
-
|
|
17427
|
-
if (dataSourceLoading || isDiffPage) {
|
|
17502
|
+
if (isDataSourceLoading || isDiffPage) {
|
|
17428
17503
|
return (jsxRuntime.jsx(DashboardLoading, {}));
|
|
17429
17504
|
}
|
|
17430
17505
|
return (jsxRuntime.jsx(PagesContainer, { type: type, noBorders: noBorders }));
|
|
@@ -18156,6 +18231,7 @@ exports.DefaultHeaderContainer = DefaultHeaderContainer;
|
|
|
18156
18231
|
exports.DefaultHeaderWrapper = DefaultHeaderWrapper;
|
|
18157
18232
|
exports.DividerContainer = DividerContainer;
|
|
18158
18233
|
exports.EMPTY_DATA_SOURCE_LAYER_INFO = EMPTY_DATA_SOURCE_LAYER_INFO;
|
|
18234
|
+
exports.EXTENT_FILTER_NAME = EXTENT_FILTER_NAME;
|
|
18159
18235
|
exports.ElementButton = ElementButton;
|
|
18160
18236
|
exports.ElementCamera = ElementCamera;
|
|
18161
18237
|
exports.ElementChart = ElementChart;
|
|
@@ -18190,6 +18266,7 @@ exports.FeatureControls = FeatureControls;
|
|
|
18190
18266
|
exports.FeatureTitleContainer = FeatureTitleContainer;
|
|
18191
18267
|
exports.FiltersContainer = FiltersContainer;
|
|
18192
18268
|
exports.GEOMETRY_ATTRIBUTE = GEOMETRY_ATTRIBUTE;
|
|
18269
|
+
exports.GEOMETRY_FILTER_NAME = GEOMETRY_FILTER_NAME;
|
|
18193
18270
|
exports.GRID_AUTO_FILL_DEFAULTS = GRID_AUTO_FILL_DEFAULTS;
|
|
18194
18271
|
exports.GRID_CELL_ATTR = GRID_CELL_ATTR;
|
|
18195
18272
|
exports.GRID_CELL_ID_PREFIX = GRID_CELL_ID_PREFIX;
|
|
@@ -18225,6 +18302,7 @@ exports.LayersListWrapper = LayersListWrapper;
|
|
|
18225
18302
|
exports.LinearProgressContainer = LinearProgressContainer;
|
|
18226
18303
|
exports.LogTerminal = LogTerminal;
|
|
18227
18304
|
exports.LogoContainer = LogoContainer;
|
|
18305
|
+
exports.MAP_VIEW_FILTER_NAMES = MAP_VIEW_FILTER_NAMES;
|
|
18228
18306
|
exports.MAX_CHART_WIDTH = MAX_CHART_WIDTH;
|
|
18229
18307
|
exports.MAX_TRACKS = MAX_TRACKS;
|
|
18230
18308
|
exports.MIN_TRACK_PX = MIN_TRACK_PX;
|
|
@@ -18282,6 +18360,7 @@ exports.TopContainerButtons = TopContainerButtons;
|
|
|
18282
18360
|
exports.TwoColumnContainer = TwoColumnContainer;
|
|
18283
18361
|
exports.UploadContainer = UploadContainer;
|
|
18284
18362
|
exports.VIEW_MODES = VIEW_MODES;
|
|
18363
|
+
exports.ZOOM_FILTER_NAME = ZOOM_FILTER_NAME;
|
|
18285
18364
|
exports.addDataSource = addDataSource;
|
|
18286
18365
|
exports.addDataSources = addDataSources;
|
|
18287
18366
|
exports.adjustColor = adjustColor;
|
|
@@ -18367,6 +18446,7 @@ exports.getLayerInfo = getLayerInfo;
|
|
|
18367
18446
|
exports.getLayerInfoAttribute = getLayerInfoAttribute;
|
|
18368
18447
|
exports.getLayerInfoFromDataSources = getLayerInfoFromDataSources;
|
|
18369
18448
|
exports.getLayoutChildren = getLayoutChildren;
|
|
18449
|
+
exports.getMapViewDataSources = getMapViewDataSources;
|
|
18370
18450
|
exports.getPagesFromConfig = getPagesFromConfig;
|
|
18371
18451
|
exports.getPagesFromProjectInfo = getPagesFromProjectInfo;
|
|
18372
18452
|
exports.getProxyService = getProxyService;
|
|
@@ -18425,6 +18505,7 @@ exports.sizeCssMixin = sizeCssMixin;
|
|
|
18425
18505
|
exports.sliceShownOtherItems = sliceShownOtherItems;
|
|
18426
18506
|
exports.stretchPalette = stretchPalette;
|
|
18427
18507
|
exports.timeOptions = timeOptions;
|
|
18508
|
+
exports.toConditionsArray = toConditionsArray;
|
|
18428
18509
|
exports.toCssSize = toCssSize;
|
|
18429
18510
|
exports.toFrSize = toFrSize;
|
|
18430
18511
|
exports.toPxNumber = toPxNumber;
|
|
@@ -18447,6 +18528,7 @@ exports.useContainerRoot = useContainerRoot;
|
|
|
18447
18528
|
exports.useCurrentPageLayers = useCurrentPageLayers;
|
|
18448
18529
|
exports.useCustomFeatureSelect = useCustomFeatureSelect;
|
|
18449
18530
|
exports.useDashboardHeader = useDashboardHeader;
|
|
18531
|
+
exports.useDataSourceLoading = useDataSourceLoading;
|
|
18450
18532
|
exports.useDataSources = useDataSources;
|
|
18451
18533
|
exports.useDebouncedCallback = useDebouncedCallback;
|
|
18452
18534
|
exports.useDiffPage = useDiffPage;
|