@evergis/react 4.0.111 → 4.0.112
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 +21 -21
- package/README.md +7 -7
- package/dist/components/Dashboard/componentTypes.d.ts +4 -3
- package/dist/components/Dashboard/constants.d.ts +7 -2
- package/dist/components/Dashboard/containers/RoundedBackgroundContainer/styled.d.ts +8 -0
- package/dist/components/Dashboard/hooks/useEqualTileWidth.d.ts +17 -3
- package/dist/components/Dashboard/types.d.ts +5 -1
- package/dist/components/Dashboard/utils/getAttributeByName.d.ts +1 -1
- package/dist/components/Dashboard/utils/getAttributeIconElement.d.ts +10 -0
- package/dist/components/Dashboard/utils/getAttributeIconUrl.d.ts +12 -0
- package/dist/components/Dashboard/utils/getImageUrl.d.ts +14 -0
- package/dist/components/Dashboard/utils/getSvgUrl.d.ts +4 -5
- package/dist/components/Dashboard/utils/index.d.ts +3 -0
- package/dist/index.js +3046 -2908
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +3044 -2910
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
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`!
|
|
@@ -47,8 +47,9 @@ export interface ElementIconConfig extends Omit<ConfigContainerChild, "options"
|
|
|
47
47
|
}
|
|
48
48
|
export interface ElementIconProps extends Omit<ContainerProps, "elementConfig"> {
|
|
49
49
|
elementConfig?: ElementIconConfig;
|
|
50
|
+
attributes?: ClientFeatureAttribute[];
|
|
50
51
|
}
|
|
51
|
-
export type ElementImageOptions = Pick<ConfigOptions, "width" | "height" | "fit">;
|
|
52
|
+
export type ElementImageOptions = Pick<ConfigOptions, "width" | "height" | "fit" | "resourceId" | "url">;
|
|
52
53
|
export interface ElementImageConfig extends Omit<ConfigContainerChild, "options" | "type"> {
|
|
53
54
|
type?: "image";
|
|
54
55
|
options?: ElementImageOptions;
|
|
@@ -199,7 +200,7 @@ export interface ContainersGroupContainerConfig extends Omit<ConfigContainerChil
|
|
|
199
200
|
export interface ContainersGroupContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
200
201
|
elementConfig?: ContainersGroupContainerConfig;
|
|
201
202
|
}
|
|
202
|
-
export type DataSourceContainerOptions = Pick<ConfigOptions, "column" | "relatedDataSource" | "innerTemplateName" | "expandable" | "expanded" | "columns" | "gap" | "align" | "shownItems" | "otherItems"> & ContainerBoxOptions;
|
|
203
|
+
export type DataSourceContainerOptions = Pick<ConfigOptions, "column" | "relatedDataSource" | "innerTemplateName" | "expandable" | "expanded" | "columns" | "gap" | "innerGap" | "align" | "shownItems" | "otherItems"> & ContainerBoxOptions;
|
|
203
204
|
export interface DataSourceContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
|
|
204
205
|
templateName?: ContainerTemplate.DataSource;
|
|
205
206
|
options?: DataSourceContainerOptions;
|
|
@@ -398,7 +399,7 @@ export interface ProgressContainerConfig extends Omit<ConfigContainerChild, "opt
|
|
|
398
399
|
export interface ProgressContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
399
400
|
elementConfig?: ProgressContainerConfig;
|
|
400
401
|
}
|
|
401
|
-
export type RoundedBackgroundContainerOptions = Pick<ConfigOptions, "maxLength" | "maxLines" | "wordBreak" | "center" | "fontColor" | "innerTemplateStyle" | "inlineUnits" | "big" | "bigIcon" | "hideEmpty" | "colorAttribute" | "align" | "columns" | "gap">;
|
|
402
|
+
export type RoundedBackgroundContainerOptions = Pick<ConfigOptions, "maxLength" | "maxLines" | "wordBreak" | "center" | "fontColor" | "bgColor" | "innerTemplateStyle" | "inlineUnits" | "big" | "bigIcon" | "hideEmpty" | "colorAttribute" | "align" | "columns" | "gap" | "innerGap">;
|
|
402
403
|
export interface RoundedBackgroundContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
|
|
403
404
|
templateName?: ContainerTemplate.RoundedBackground;
|
|
404
405
|
options?: RoundedBackgroundContainerOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSObject } from 'styled-components';
|
|
2
|
-
import { AttributeType, QueryLayerServiceInfoDc } from '@evergis/api';
|
|
3
|
-
import { ConfigContainer, ConfigContainerChild } from './types';
|
|
2
|
+
import { AttributeIconType, AttributeType, QueryLayerServiceInfoDc } from '@evergis/api';
|
|
3
|
+
import { ConfigContainer, ConfigContainerChild, ConfigElementType } from './types';
|
|
4
4
|
export declare const CONFIG_PAGES_ID = "pages";
|
|
5
5
|
export declare const CONFIG_PAGE_ID = "page";
|
|
6
6
|
export declare const DEFAULT_PAGES_CONFIG: ConfigContainerChild;
|
|
@@ -31,6 +31,11 @@ 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
|
+
/**
|
|
35
|
+
* Каким элементом рендерится иконка атрибута из настроек слоя (`AttributeConfigurationDc.icon`).
|
|
36
|
+
* `Unknown` не отображается — по нему не понять, что лежит в значении.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ATTRIBUTE_ICON_ELEMENT_TYPES: Partial<Record<AttributeIconType, ConfigElementType>>;
|
|
34
39
|
/** Заглушка для потребителей, ожидающих non-null layerInfo у источника без описания атрибутов. */
|
|
35
40
|
export declare const EMPTY_DATA_SOURCE_LAYER_INFO: QueryLayerServiceInfoDc;
|
|
36
41
|
export declare const DEFAULT_DROPDOWN_WIDTH = 312;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
export declare const ContainerIconValue: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
2
|
+
/**
|
|
3
|
+
* Обёртка иконки плитки. Собственный styled нужен, чтобы до иконки можно было дотянуться стилями:
|
|
4
|
+
* сам элемент рисуют ElementIcon/ElementSvg своими компонентами, а обёртка принадлежит контейнеру.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ContainerIconWrapper: import('styled-components').StyledComponent<"span", any, import('@evergis/uilib-gl').FlexSpanProps, never>;
|
|
2
7
|
export declare const RoundedBackgroundContainerWrapper: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & {
|
|
3
8
|
$center?: boolean;
|
|
4
9
|
$color?: string;
|
|
10
|
+
$bgColor?: string;
|
|
11
|
+
$iconColor?: string;
|
|
5
12
|
$inlineUnits?: boolean;
|
|
6
13
|
$big?: boolean;
|
|
7
14
|
$bigIcon?: boolean;
|
|
8
15
|
$fillWidth?: boolean;
|
|
16
|
+
$innerGap?: number;
|
|
9
17
|
}, never>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
+
interface UseEqualTileWidthParams {
|
|
3
|
+
/** `false` — режим «Растянуть», «В столбец» или старые конфиги без `columns`. */
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
itemsCount: number;
|
|
6
|
+
/** Число плиток в ряду: по нему считается ширина ячейки, шире которой плитка быть не может. */
|
|
7
|
+
columns: number;
|
|
8
|
+
/** Отступ между плитками, px — вычитается из ширины ряда вместе с остальными зазорами. */
|
|
9
|
+
gap: number;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Уравнивает ширину всех плиток контейнера по самой широкой.
|
|
4
13
|
*
|
|
@@ -7,7 +16,12 @@ import { RefObject } from 'react';
|
|
|
7
16
|
* зацикливает ResizeObserver — итоговый максимум совпадает с уже применённым). Возвращаемое число
|
|
8
17
|
* контейнер прокидывает в CSS-переменную `--tile-width`, которую читает каждая плитка.
|
|
9
18
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
19
|
+
* Результат ограничен шириной ячейки ряда: плитка задаёт свою ширину в пикселях и в grid не
|
|
20
|
+
* сжимается вместе с треком (`flex-shrink` там не действует, а `min-width: 0` базового
|
|
21
|
+
* контейнера позволяет треку ужаться), поэтому натуральная ширина шире ячейки означала бы
|
|
22
|
+
* наложение соседних плиток друг на друга.
|
|
23
|
+
*
|
|
24
|
+
* `enabled: false` полностью отключает измерение — ширина берётся из grid-ячейки.
|
|
12
25
|
*/
|
|
13
|
-
export declare const useEqualTileWidth: (enabled
|
|
26
|
+
export declare const useEqualTileWidth: ({ enabled, itemsCount, columns, gap, }: UseEqualTileWidthParams) => [RefObject<HTMLDivElement>, number | undefined];
|
|
27
|
+
export {};
|
|
@@ -188,8 +188,10 @@ export interface ConfigLayoutOptions {
|
|
|
188
188
|
align?: TileAlignment;
|
|
189
189
|
/** Число плиток в строке ряда плиточного контейнера */
|
|
190
190
|
columns?: number;
|
|
191
|
-
/**
|
|
191
|
+
/** Отступ между плитками, px */
|
|
192
192
|
gap?: number;
|
|
193
|
+
/** Отступ между элементами внутри плитки (иконка, значение, единицы измерения, подпись), px */
|
|
194
|
+
innerGap?: number;
|
|
193
195
|
/** Выравнивание детей контейнера по поперечной оси. В ряду по умолчанию `center`. */
|
|
194
196
|
alignItems?: AlignItems;
|
|
195
197
|
/** Масштабирование изображения элемента `image`. */
|
|
@@ -271,6 +273,8 @@ export interface ConfigVisualOptions {
|
|
|
271
273
|
icon?: IconTypesKeys;
|
|
272
274
|
iconAttribute?: string;
|
|
273
275
|
image?: string;
|
|
276
|
+
/** Id файлового ресурса с картинкой — разворачивается в `/sp/resources/file/<id>`. */
|
|
277
|
+
resourceId?: string;
|
|
274
278
|
overlay?: string;
|
|
275
279
|
onlyIcon?: boolean;
|
|
276
280
|
bigIcon?: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ClientFeatureAttribute } from '../types';
|
|
2
|
-
export declare const getAttributeByName: (name: string | string[], attributes
|
|
2
|
+
export declare const getAttributeByName: (name: string | string[], attributes?: ClientFeatureAttribute[]) => ClientFeatureAttribute;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AttributeIconDc } from '@evergis/api';
|
|
2
|
+
import { ConfigContainerChild } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Собирает тип и значение элемента для иконки атрибута из настроек слоя
|
|
5
|
+
* (`attributesConfiguration.attributes[].icon`).
|
|
6
|
+
*
|
|
7
|
+
* `Icon` — иконка из библиотеки EverGIS, задаётся именем; `PNG` и `SVG` — файлы,
|
|
8
|
+
* задаются id ресурса или адресом.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getAttributeIconElement: (icon?: AttributeIconDc) => Pick<ConfigContainerChild, "type" | "value">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueryLayerServiceInfoDc } from '@evergis/api';
|
|
2
|
+
/**
|
|
3
|
+
* Достаёт ссылку на картинку из настроек атрибута слоя (`attributesConfiguration.attributes[].icon`).
|
|
4
|
+
*
|
|
5
|
+
* Источник элемента `svg` (поле `attributeIcon`): в настройках атрибута картинка задаётся
|
|
6
|
+
* либо id ресурса, либо готовым url. Форма `icon.iconName` (иконка из библиотеки EverGIS)
|
|
7
|
+
* здесь не поддерживается — это не файл.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getAttributeIconUrl: ({ attributeName, layerInfo, }: {
|
|
10
|
+
attributeName?: string;
|
|
11
|
+
layerInfo?: QueryLayerServiceInfoDc;
|
|
12
|
+
}) => string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClientFeatureAttribute, ConfigContainerChild } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Резолвит адрес картинки элемента `image` из всех источников конфига, кроме вложений.
|
|
4
|
+
*
|
|
5
|
+
* Порядок — первый непустой источник выигрывает:
|
|
6
|
+
* `options.resourceId` → `options.url` → `value` → `attributeName`.
|
|
7
|
+
*
|
|
8
|
+
* Атрибут-вложение даёт `null`: такие картинки грузятся отдельным каналом
|
|
9
|
+
* (`useAttachmentItems` + `useAttachmentPreviewImages`), см. `useElementImage`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getImageUrl: ({ elementConfig, attributes, }: {
|
|
12
|
+
elementConfig?: ConfigContainerChild;
|
|
13
|
+
attributes?: ClientFeatureAttribute[];
|
|
14
|
+
}) => string | null;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { QueryLayerServiceInfoDc } from '@evergis/api';
|
|
2
|
-
import { ConfigContainerChild } from '../types';
|
|
3
|
-
import { FeatureAttribute } from '../../../types';
|
|
2
|
+
import { ClientFeatureAttribute, ConfigContainerChild } from '../types';
|
|
4
3
|
export declare const getSvgUrl: ({ elementConfig, layerInfo, attributes, }: {
|
|
5
|
-
elementConfig
|
|
6
|
-
layerInfo
|
|
7
|
-
attributes
|
|
4
|
+
elementConfig?: ConfigContainerChild;
|
|
5
|
+
layerInfo?: QueryLayerServiceInfoDc;
|
|
6
|
+
attributes?: ClientFeatureAttribute[];
|
|
8
7
|
}) => string;
|
|
@@ -14,6 +14,8 @@ export * from './formatDataSourceCondition';
|
|
|
14
14
|
export * from './formatElementValue';
|
|
15
15
|
export * from './getAttributeByName';
|
|
16
16
|
export * from './getAttributeConfigurationByName';
|
|
17
|
+
export * from './getAttributeIconElement';
|
|
18
|
+
export * from './getAttributeIconUrl';
|
|
17
19
|
export * from './getAttributesConfiguration';
|
|
18
20
|
export * from './getAttributeValue';
|
|
19
21
|
export * from './getChartAxes';
|
|
@@ -35,6 +37,7 @@ export * from './getFilterComponent';
|
|
|
35
37
|
export * from './getFilterSelectedItems';
|
|
36
38
|
export * from './getFilterValue';
|
|
37
39
|
export * from './getFormattedAttributes';
|
|
40
|
+
export * from './getImageUrl';
|
|
38
41
|
export * from './getLayerInfo';
|
|
39
42
|
export * from './getLayerInfoAttribute';
|
|
40
43
|
export * from './getLayerInfoFromDataSources';
|