@evergis/react 4.0.100 → 4.0.102

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Everpoint
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Everpoint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # @evergis/react
2
-
3
- В данном репозитории находятся специфичные (в отличии от `@evergis/uilib-gl`) для `Evergis Online`,
4
- но в целом переиспользуемые на других проектах, построенных на Evergis API, React-компоненты.
5
-
6
- ***ВАЖНО!!!***: Разрабатываемые компоненты не должны иметь зависимостей
7
- от системы поддержки мультиязычности `Evergis Online`!
1
+ # @evergis/react
2
+
3
+ В данном репозитории находятся специфичные (в отличии от `@evergis/uilib-gl`) для `Evergis Online`,
4
+ но в целом переиспользуемые на других проектах, построенных на Evergis API, React-компоненты.
5
+
6
+ ***ВАЖНО!!!***: Разрабатываемые компоненты не должны иметь зависимостей
7
+ от системы поддержки мультиязычности `Evergis Online`!
@@ -154,7 +154,7 @@ export interface CameraContainerConfig extends Omit<ConfigContainerChild, "optio
154
154
  export interface CameraContainerProps extends Omit<ContainerProps, "elementConfig"> {
155
155
  elementConfig?: CameraContainerConfig;
156
156
  }
157
- export type ChartContainerOptions = Pick<ConfigOptions, "twoColumns" | "hideEmpty" | "width" | "height" | "chartFill">;
157
+ export type ChartContainerOptions = Pick<ConfigOptions, "twoColumns" | "hideEmpty" | "width" | "height" | "fill">;
158
158
  export interface ChartAliasChild extends Omit<ConfigContainerChild, "id"> {
159
159
  id: "alias";
160
160
  }
@@ -0,0 +1,15 @@
1
+ /** Значение контекста вписывания тела графика в контейнер (`options.fill` контейнера Chart). */
2
+ export interface FillContextValue {
3
+ /** Вписать тело графика в контейнер: по ширине всегда, по высоте — при заданной высоте (object-fit: contain). */
4
+ fill: boolean;
5
+ /** У контейнера ограниченная высота ⇒ можно фитить по высоте (иначе только по ширине). */
6
+ fitHeight: boolean;
7
+ }
8
+ /**
9
+ * Контекст вписывания графика (`options.fill` контейнера Chart).
10
+ *
11
+ * Компонент `Chart` рендерится через `renderElement({ id: "chart" })` и получает только дочерний
12
+ * узел `{ id: "chart" }` — опции контейнера до него не доходят. `ChartContainer` оборачивает
13
+ * график в провайдер этого контекста, а `Chart` читает значение через `useContext`.
14
+ */
15
+ export declare const FillContext: import('react').Context<FillContextValue>;
@@ -15,6 +15,7 @@ export declare const PieChartCenter: import('styled-components').StyledComponent
15
15
  export declare const ChartWrapperContainer: import('styled-components').StyledComponent<"div", any, {
16
16
  column: boolean;
17
17
  }, never>;
18
+ export declare const ChartFillMeasure: import('styled-components').StyledComponent<"div", any, {}, never>;
18
19
  export declare const Tooltip: import('styled-components').StyledComponent<"div", any, {
19
20
  transform?: CSSProperties["transform"];
20
21
  }, never>;
@@ -1,5 +1,5 @@
1
1
  import { CSSObject } from 'styled-components';
2
- import { AttributeType } from '@evergis/api';
2
+ import { AttributeType, QueryLayerServiceInfoDc } from '@evergis/api';
3
3
  import { ConfigContainer, ConfigContainerChild } from './types';
4
4
  export declare const CONFIG_PAGES_ID = "pages";
5
5
  export declare const CONFIG_PAGE_ID = "page";
@@ -31,6 +31,8 @@ export declare const DEFAULT_ZOOM = 10;
31
31
  export declare const NUMERIC_ATTRIBUTE_TYPES: AttributeType[];
32
32
  export declare const GEOMETRY_ATTRIBUTE = "geometry";
33
33
  export declare const DEFAULT_ID_ATTRIBUTE_NAME = "gid";
34
+ /** Заглушка для потребителей, ожидающих non-null layerInfo у источника без описания атрибутов. */
35
+ export declare const EMPTY_DATA_SOURCE_LAYER_INFO: QueryLayerServiceInfoDc;
34
36
  export declare const DEFAULT_DROPDOWN_WIDTH = 312;
35
37
  export declare const DEFAULT_FILTER_PADDING = 12;
36
38
  /** Базовый отступ обёртки контейнера. Снимается, когда контейнер занимает ячейку целиком. */
@@ -2,9 +2,11 @@ export declare const CheckboxWrapper: import('styled-components').StyledComponen
2
2
  fontColor?: string;
3
3
  big?: boolean;
4
4
  column?: boolean;
5
+ $fill?: boolean;
5
6
  }, never>;
6
7
  export declare const ChipsWrapper: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
7
8
  fontColor?: string;
8
9
  big?: boolean;
9
10
  column?: boolean;
11
+ $fill?: boolean;
10
12
  }, never>;
@@ -2,13 +2,16 @@ export declare const ContainerAlias: import('styled-components').StyledComponent
2
2
  hasBottomMargin?: boolean;
3
3
  }, never>;
4
4
  export declare const ContainerAliasIcon: import('styled-components').StyledComponent<"div", any, {}, never>;
5
- export declare const ContainerChart: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
5
+ export declare const ContainerChart: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
6
+ $fill?: boolean;
7
+ }, never>;
6
8
  export declare const ContainerLegend: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
7
9
  export declare const ContainerUnits: import('styled-components').StyledComponent<"div", any, {}, never>;
8
10
  export declare const ContainerValue: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
9
11
  fontColor?: string;
10
12
  big?: boolean;
11
13
  column?: boolean;
14
+ $fill?: boolean;
12
15
  }, never>;
13
16
  export declare const ContainerIcon: import('styled-components').StyledComponent<"span", any, import('@evergis/uilib-gl').IIconProps & {
14
17
  $fontColor?: string;
@@ -25,7 +25,7 @@ export * from './useHideIfEmptyDataSource';
25
25
  export * from './useProjectDashboardInit';
26
26
  export * from './useRelatedDataSourceAttributes';
27
27
  export * from './useRenderElement';
28
- export * from './useResizeWidth';
28
+ export * from './useResizeBox';
29
29
  export * from './useShownOtherItems';
30
30
  export * from './useUpdateDataSource';
31
31
  export * from './useWidgetConfig';
@@ -1,4 +1,4 @@
1
- import { FeatureDc, QueryLayerServiceInfoDc } from '@evergis/api';
1
+ import { FeatureDc } from '@evergis/api';
2
2
  import { ConfigContainerChild, FetchedDataSource, WidgetType } from '../types';
3
3
  export declare const useRelatedDataSourceAttributes: ({ type, elementConfig, dataSources, feature, }: {
4
4
  type: WidgetType;
@@ -6,7 +6,7 @@ export declare const useRelatedDataSourceAttributes: ({ type, elementConfig, dat
6
6
  dataSources: FetchedDataSource[];
7
7
  feature?: FeatureDc;
8
8
  }) => {
9
- layerInfo: QueryLayerServiceInfoDc;
9
+ layerInfo: import('@evergis/api').QueryLayerServiceInfoDc;
10
10
  attributes: import('../types').ClientFeatureAttribute[];
11
11
  dataSource: import('../types').WidgetDataSource;
12
12
  };
@@ -0,0 +1,17 @@
1
+ import { RefObject } from 'react';
2
+ /** Измеренный content-box наблюдаемого элемента: обе оси в пикселях либо `undefined` до первого замера. */
3
+ export interface ResizeBox {
4
+ width?: number;
5
+ height?: number;
6
+ }
7
+ /**
8
+ * Измеряет фактические ширину и высоту DOM-элемента и обновляет их на любой ресайз (ResizeObserver).
9
+ *
10
+ * Возвращает `[ref, box]`, где `box` — `{ width, height }` в пикселях (content-box) либо пустой объект,
11
+ * пока элемент ещё не измерен. Используется для «резинового» графика: d3-графикам нужны конкретные
12
+ * пиксельные размеры, а не CSS `100%`, а для вписывания (fit) нужны обе оси.
13
+ *
14
+ * `enabled: false` полностью отключает наблюдение — обычные (не fill) графики не измеряются
15
+ * и не вызывают лишних ре-рендеров.
16
+ */
17
+ export declare const useResizeBox: (enabled: boolean) => [RefObject<HTMLDivElement>, ResizeBox];
@@ -162,8 +162,8 @@ export interface ConfigLayoutOptions {
162
162
  cornerRadius?: number;
163
163
  column?: boolean;
164
164
  twoColumns?: boolean;
165
- /** Растянуть график контейнера Chart на всю ширину контейнера (график любого типа). */
166
- chartFill?: boolean;
165
+ /** Вписать график контейнера Chart в контейнер: по ширине всегда, по высоте — при заданной высоте (object-fit: contain). */
166
+ fill?: boolean;
167
167
  /** Горизонтальное выравнивание содержимого заголовка контейнера. */
168
168
  align?: Alignment;
169
169
  /** Выравнивание детей контейнера по поперечной оси. В ряду по умолчанию `center`. */
@@ -187,6 +187,10 @@ export interface MarkdownTagTypography {
187
187
  fontSize?: FontSizeToken | string;
188
188
  lineHeight?: string;
189
189
  fontWeight?: number | string;
190
+ /** Отступ снизу — задаёт расстояние до следующего блока (между тегами). */
191
+ marginBottom?: string;
192
+ /** Отступ сверху — задаёт расстояние до предыдущего блока (между тегами). */
193
+ marginTop?: string;
190
194
  }
191
195
  /**
192
196
  * Пер-тег типографика markdown-виджета. Отсутствующий тег или свойство —
@@ -344,9 +348,22 @@ export interface ConfigMiscOptions {
344
348
  */
345
349
  export interface ConfigOptions extends ConfigLayoutOptions, ConfigTypographyOptions, ConfigExpandableOptions, ConfigDataSourceBindingOptions, ConfigChartOptions, ConfigVisualOptions, ConfigTextDisplayOptions, ConfigCollectionOptions, ConfigMapLayerOptions, ConfigEditOptions, ConfigMiscOptions {
346
350
  }
351
+ /**
352
+ * Настройки атрибута источника данных, заданные в конфиге.
353
+ * Накладываются поверх атрибутов слоя/ответа EQL: `stringFormat` мержится по полям,
354
+ * поэтому задавать нужно только то, что переопределяется.
355
+ */
356
+ export interface ConfigDataSourceAttribute {
357
+ attributeName: string;
358
+ alias?: string;
359
+ type?: AttributeType;
360
+ stringFormat?: AttributeFormatConfigurationDc;
361
+ }
347
362
  export interface ConfigDataSource {
348
363
  name: string;
349
364
  alias?: string;
365
+ /** Формат и метаданные атрибутов источника. Не путать с `options.attributes` (список имён у элемента). */
366
+ attributes?: ConfigDataSourceAttribute[];
350
367
  condition?: string | string[];
351
368
  ds?: string;
352
369
  layerName?: string;
@@ -0,0 +1,8 @@
1
+ import { AttributeConfigurationDc, AttributesConfigurationDc } from '@evergis/api';
2
+ /**
3
+ * Находит конфигурацию атрибута по имени.
4
+ *
5
+ * `AttributesConfigurationDc["attributes"]` — массив, но часть источников отдаёт атрибуты
6
+ * объектом-мапой (см. нормализацию в `useDataSources`), поэтому поддерживаются обе формы.
7
+ */
8
+ export declare const getAttributeConfigurationByName: (attributes?: AttributesConfigurationDc["attributes"], name?: string) => AttributeConfigurationDc | undefined;
@@ -0,0 +1,17 @@
1
+ import { QueryLayerServiceInfoDc } from '@evergis/api';
2
+ import { ConfigDataSource, FetchedDataSource } from '../types';
3
+ /**
4
+ * Резолвит layerInfo источника данных и накладывает поверх атрибуты из его конфига.
5
+ *
6
+ * База — реальный слой по `layerName`, а если слоя нет (EQL, python) — атрибуты из ответа.
7
+ * Возвращает `null`, когда атрибутов нет вообще: потребители отличают по этому «источник без
8
+ * описания атрибутов» от загруженного, и non-null сломал бы их loading/empty-state.
9
+ *
10
+ * Синтетическому layerInfo намеренно не задаётся `name` — по нему ищут скрытые атрибуты слоя
11
+ * и рендерят элемент `layerName`, имя источника данных дало бы там ложные срабатывания.
12
+ */
13
+ export declare const getDataSourceLayerInfo: ({ layerInfos, configDataSource, fetchedDataSource, }: {
14
+ layerInfos?: QueryLayerServiceInfoDc[];
15
+ configDataSource?: ConfigDataSource;
16
+ fetchedDataSource?: FetchedDataSource;
17
+ }) => QueryLayerServiceInfoDc | null;
@@ -0,0 +1,3 @@
1
+ import { AttributeConfigurationDc, QueryLayerServiceInfoDc } from '@evergis/api';
2
+ /** Достаёт конфигурацию атрибута по имени прямо из layerInfo, снимая повторяющийся каст конфигурации. */
3
+ export declare const getLayerInfoAttribute: (layerInfo?: QueryLayerServiceInfoDc, name?: string) => AttributeConfigurationDc | undefined;
@@ -13,6 +13,7 @@ export * from './formatConditionValue';
13
13
  export * from './formatDataSourceCondition';
14
14
  export * from './formatElementValue';
15
15
  export * from './getAttributeByName';
16
+ export * from './getAttributeConfigurationByName';
16
17
  export * from './getAttributesConfiguration';
17
18
  export * from './getAttributeValue';
18
19
  export * from './getChartAxes';
@@ -25,6 +26,7 @@ export * from './getDataFromAttributes';
25
26
  export * from './getDataFromRelatedFeatures';
26
27
  export * from './getDataSource';
27
28
  export * from './getDataSourceFilterValue';
29
+ export * from './getDataSourceLayerInfo';
28
30
  export * from './getDefaultConfig';
29
31
  export * from './getElementValue';
30
32
  export * from './getFeatureAttributes';
@@ -34,6 +36,7 @@ export * from './getFilterSelectedItems';
34
36
  export * from './getFilterValue';
35
37
  export * from './getFormattedAttributes';
36
38
  export * from './getLayerInfo';
39
+ export * from './getLayerInfoAttribute';
37
40
  export * from './getLayerInfoFromDataSources';
38
41
  export * from './getPagesFromConfig';
39
42
  export * from './getPagesFromProjectInfo';
@@ -55,6 +58,7 @@ export * from './isEmptyValue';
55
58
  export * from './isHiddenEmptyValue';
56
59
  export * from './isNotValidSelectedTab';
57
60
  export * from './isVisibleContainer';
61
+ export * from './mergeAttributeConfigurations';
58
62
  export * from './pieChartTooltipFromAttributes';
59
63
  export * from './pieChartTooltipFromRelatedFeatures';
60
64
  export * from './removeDataSource';
@@ -0,0 +1,8 @@
1
+ import { AttributesConfigurationDc } from '@evergis/api';
2
+ import { ConfigDataSourceAttribute } from '../types';
3
+ /**
4
+ * Накладывает атрибуты из конфига источника поверх атрибутов слоя или ответа EQL.
5
+ * `stringFormat` мержится по полям — в конфиге задают только переопределяемое,
6
+ * остальное (в т.ч. критичный для форматирования `type`) наследуется от базы.
7
+ */
8
+ export declare const mergeAttributeConfigurations: (base?: AttributesConfigurationDc["attributes"], overlay?: ConfigDataSourceAttribute[]) => AttributesConfigurationDc["attributes"];