@evergis/react 4.0.125 → 4.0.128

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.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -7
  3. package/dist/components/Dashboard/componentTypes.d.ts +43 -6
  4. package/dist/components/Dashboard/containers/StructuredDataContainer/StructuredDataContext.d.ts +9 -0
  5. package/dist/components/Dashboard/containers/StructuredDataContainer/components/DeleteRowDialog.d.ts +9 -0
  6. package/dist/components/Dashboard/containers/StructuredDataContainer/constants.d.ts +14 -0
  7. package/dist/components/Dashboard/containers/StructuredDataContainer/index.d.ts +10 -0
  8. package/dist/components/Dashboard/containers/StructuredDataContainer/styled.d.ts +18 -0
  9. package/dist/components/Dashboard/containers/StructuredDataContainer/types.d.ts +48 -0
  10. package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredData.d.ts +28 -0
  11. package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataDraft.d.ts +25 -0
  12. package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSave.d.ts +17 -0
  13. package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSchema.d.ts +11 -0
  14. package/dist/components/Dashboard/containers/StructuredDataContainer/utils/buildSchema.d.ts +14 -0
  15. package/dist/components/Dashboard/containers/StructuredDataContainer/utils/draftRows.d.ts +23 -0
  16. package/dist/components/Dashboard/containers/StructuredDataContainer/utils/filterValue.d.ts +14 -0
  17. package/dist/components/Dashboard/containers/StructuredDataContainer/utils/saveToSource.d.ts +18 -0
  18. package/dist/components/Dashboard/containers/index.d.ts +1 -0
  19. package/dist/components/Dashboard/containers/registry.d.ts +1 -0
  20. package/dist/components/Dashboard/elements/ElementTable/components/TableCell.d.ts +10 -0
  21. package/dist/components/Dashboard/elements/ElementTable/constants.d.ts +13 -0
  22. package/dist/components/Dashboard/elements/ElementTable/index.d.ts +9 -0
  23. package/dist/components/Dashboard/elements/ElementTable/styled.d.ts +28 -0
  24. package/dist/components/Dashboard/elements/ElementTable/types.d.ts +15 -0
  25. package/dist/components/Dashboard/elements/ElementTable/useCellEditing.d.ts +15 -0
  26. package/dist/components/Dashboard/elements/ElementTable/useTableView.d.ts +16 -0
  27. package/dist/components/Dashboard/elements/ElementTable/utils/isSameCellValue.d.ts +10 -0
  28. package/dist/components/Dashboard/elements/ElementTable/utils/sortRows.d.ts +12 -0
  29. package/dist/components/Dashboard/elements/index.d.ts +1 -0
  30. package/dist/components/Dashboard/elements/registry.d.ts +1 -0
  31. package/dist/components/Dashboard/types.d.ts +70 -14
  32. package/dist/components/Dashboard/utils/applyTreeFilterToCondition.d.ts +1 -6
  33. package/dist/components/Dashboard/utils/filterValueKind.d.ts +19 -0
  34. package/dist/components/Dashboard/utils/formatDataSourceCondition.d.ts +2 -1
  35. package/dist/components/Dashboard/utils/getSelectedFilterValue.d.ts +1 -1
  36. package/dist/components/Dashboard/utils/index.d.ts +1 -0
  37. package/dist/constants/styling.d.ts +1 -1
  38. package/dist/hooks/map/useIconsFromLayers.d.ts +1 -1
  39. package/dist/index.js +5929 -5109
  40. package/dist/index.js.map +1 -1
  41. package/dist/react.esm.js +5931 -5114
  42. package/dist/react.esm.js.map +1 -1
  43. package/package.json +2 -3
@@ -14,4 +14,5 @@ export declare const elementComponents: {
14
14
  readonly markdown: import('react').FC<import('../componentTypes').ElementMarkdownProps>;
15
15
  readonly uploader: import('react').FC<import('../componentTypes').ElementUploaderProps>;
16
16
  readonly modal: import('react').FC<import('../componentTypes').ElementModalProps>;
17
+ readonly table: import('react').FC<import('../componentTypes').ElementTableProps>;
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, FC, ReactNode } from 'react';
2
- import { Geometry } from 'geojson';
2
+ import { FeatureCollection, Geometry } from 'geojson';
3
3
  import { i18n } from 'i18next';
4
4
  import { PieChartData, BarChartMarker } from '@evergis/charts';
5
5
  import { IconTypesKeys, IOption } from '@evergis/uilib-gl';
@@ -189,13 +189,16 @@ export interface ConfigLayoutOptions {
189
189
  */
190
190
  grid?: boolean;
191
191
  /**
192
- * Режим редактирования РАСКЛАДКИ сетки: перетаскивание границ, выделение ячеек,
193
- * контекстное меню с объединением/разделением/удалением. Читается только у внешнего
194
- * узла с `grid`; вложенные сетки наследуют режим через контекст.
192
+ * Разрешение править содержимое контейнера. Читают двое:
193
+ * - `ContainersGroup` с `grid` режим редактирования РАСКЛАДКИ: перетаскивание границ,
194
+ * выделение ячеек, контекстное меню с объединением/разделением/удалением. Берётся только
195
+ * у внешнего узла сетки; вложенные наследуют режим через контекст;
196
+ * - `StructuredData` — режим редактирования ТАБЛИЦЫ: правка ячеек, добавление и удаление
197
+ * строк, кнопки «Отменить»/«Сохранить». Не задан или `false` — таблица только на чтение.
195
198
  *
196
199
  * Не путать с `editMode` у `DashboardProvider`/`FeatureCardProvider` (в контейнерах —
197
- * `isEditing`): тот переключает редактирование АТРИБУТОВ объекта и к раскладке отношения
198
- * не имеет.
200
+ * `isEditing`): тот переключает редактирование АТРИБУТОВ объекта и к содержимому
201
+ * контейнеров отношения не имеет.
199
202
  */
200
203
  editMode?: boolean;
201
204
  /**
@@ -292,6 +295,13 @@ export interface ConfigExpandableOptions {
292
295
  }
293
296
  /** Связь с источником данных. */
294
297
  export interface ConfigDataSourceBindingOptions {
298
+ /**
299
+ * Схема структурированных данных контейнера {@link ContainerTemplate.StructuredData}.
300
+ *
301
+ * С источником — переопределение схемы источника: типы приходят от него, конфиг задаёт состав,
302
+ * `alias`, `stringFormat` и `isEditable`. Без источника — единственный источник схемы, обязателен.
303
+ */
304
+ attributesDescription?: ConfigAttributeDescription[];
295
305
  /** ⚠️ entity-ref: имя источника. */
296
306
  relatedDataSource?: string;
297
307
  relatedDataSources?: ConfigRelatedDataSource[];
@@ -348,6 +358,14 @@ export interface ConfigCollectionOptions {
348
358
  otherItems?: number;
349
359
  orderByValue?: boolean;
350
360
  orderByTitle?: boolean;
361
+ /**
362
+ * Имена атрибутов схемы, показываемые колонками представления `table`. Подмножество
363
+ * `attributesDescription` родительского контейнера; порядок колонок — порядок этого массива.
364
+ * Не задано — показываются все атрибуты схемы.
365
+ */
366
+ columnNames?: string[];
367
+ /** Разрешить сортировку представления кликом по заголовку колонки. Сортировка локальная — только вид. */
368
+ sort?: boolean;
351
369
  viewMode?: ViewMode;
352
370
  hideEmpty?: boolean;
353
371
  limit?: number;
@@ -437,6 +455,21 @@ export interface ConfigDataSourceAttribute {
437
455
  description?: string;
438
456
  stringFormat?: AttributeFormatConfiguration;
439
457
  }
458
+ /**
459
+ * Описание одного атрибута структуры для {@link ConfigDataSourceBindingOptions.attributesDescription}.
460
+ *
461
+ * Повторяет форму `AttributeConfigurationDc` из `@evergis/api`, но со `stringFormat` пакета
462
+ * ({@link AttributeFormatConfiguration} = DC + `roundDigitGroup`) — так же, как {@link ConfigDataSourceAttribute}.
463
+ */
464
+ export interface ConfigAttributeDescription {
465
+ attributeName: string;
466
+ type?: AttributeType;
467
+ alias?: string;
468
+ description?: string;
469
+ /** Значение атрибута правится в ячейке. `false` — только чтение, в features-API не передаётся. */
470
+ isEditable?: boolean;
471
+ stringFormat?: AttributeFormatConfiguration;
472
+ }
440
473
  export interface ConfigDataSource {
441
474
  name: string;
442
475
  alias?: string;
@@ -460,7 +493,16 @@ export interface EqlDataSource {
460
493
  items: FeatureDc[];
461
494
  attributes?: AttributesConfigurationDc["attributes"];
462
495
  }
463
- export type ConfigFilterValueType = "single" | "range" | "array";
496
+ /**
497
+ * Вид значения фильтра. Задаётся в конфиге и служит дискриминатором для type guard-ов
498
+ * (`isTreeFilterValue`, `isFeaturesFilterValue`) — угадывать вид по форме значения нельзя:
499
+ * `tree` и `features` оба объекты.
500
+ *
501
+ * - `single` / `range` / `array` — скалярные значения, подставляются и в `condition`, и в `parameters`;
502
+ * - `tree` — {@link TreeFilterValue}, объект «уровень → массив id» (плейсхолдеры `%name.lN`);
503
+ * - `features` — {@link FeaturesFilterValue}, подставляется ТОЛЬКО в `parameters`, в `condition` — никогда.
504
+ */
505
+ export type ConfigFilterValueType = "single" | "range" | "array" | "tree" | "features";
464
506
  export interface ConfigFilter {
465
507
  name: string;
466
508
  relatedDataSource?: string;
@@ -506,13 +548,22 @@ export interface ChipOption {
506
548
  * Пример: `{ l1: [1, 2], l3: [1023] }`.
507
549
  */
508
550
  export type TreeFilterValue = Record<string, Array<string | number>>;
551
+ /**
552
+ * Значение фильтра `valueType: "features"` — коллекция строк структурированных данных
553
+ * ({@link ContainerTemplate.StructuredData}). Геометрия не поддерживается, поэтому у всех фич
554
+ * `geometry: null`; данные строки лежат в `properties`.
555
+ *
556
+ * Подставляется только в `parameters` (питон-таска, url-источник). В `condition` не попадает
557
+ * никогда: там значение прошло бы через `formatConditionValue` и выродилось в `[object Object]`.
558
+ */
559
+ export type FeaturesFilterValue = FeatureCollection<null, Record<string, FeatureAttributeValue>>;
509
560
  export interface SelectedFilter {
510
- value: string | number | string[] | number[] | Date | Date[] | TreeFilterValue;
561
+ value: string | number | string[] | number[] | Date | Date[] | TreeFilterValue | FeaturesFilterValue;
511
562
  min?: string | number | Date;
512
563
  max?: string | number | Date;
513
564
  }
514
- /** Значение фильтра без объектного варианта "tree" — для скалярных/массивных фильтров. */
515
- export type ScalarFilterValue = Exclude<SelectedFilter["value"], TreeFilterValue>;
565
+ /** Значение фильтра без объектных вариантов "tree"/"features" — для скалярных/массивных фильтров. */
566
+ export type ScalarFilterValue = Exclude<SelectedFilter["value"], TreeFilterValue | FeaturesFilterValue>;
516
567
  export interface ConfigLayer {
517
568
  name: string;
518
569
  alias?: string;
@@ -585,15 +636,19 @@ export type FilterType = "checkbox" | "rangeNumber" | "rangeDate" | "text" | "dr
585
636
  * `"attributeValue"`, `"attributeUnits"`, `"attributeDescription"`, `"layerName"`.
586
637
  * - элементы-компоненты (`elements/registry.ts`): `"control"`, `"image"`, `"slideshow"`, `"svg"`,
587
638
  * `"icon"`, `"tooltip"`, `"tags"`, `"link"`, `"button"`, `"camera"`, `"chart"`, `"legend"`,
588
- * `"markdown"`, `"uploader"`, `"modal"`.
639
+ * `"markdown"`, `"uploader"`, `"modal"`, `"table"`.
589
640
  *
590
641
  * Slot-id (`"alias"`, `"value"`, `"units"`, ...) сюда **не относится** — это значения поля
591
642
  * `id`, см. parent-specific child-типы.
592
643
  */
593
- export type ConfigElementType = "text" | "attributeAlias" | "attributeValue" | "attributeUnits" | "attributeDescription" | "layerName" | "control" | "image" | "slideshow" | "svg" | "icon" | "tooltip" | "tags" | "link" | "button" | "camera" | "chart" | "legend" | "markdown" | "uploader" | "modal";
644
+ export type ConfigElementType = "text" | "attributeAlias" | "attributeValue" | "attributeUnits" | "attributeDescription" | "layerName" | "control" | "image" | "slideshow" | "svg" | "icon" | "tooltip" | "tags" | "link" | "button" | "camera" | "chart" | "legend" | "markdown" | "uploader" | "modal" | "table";
594
645
  export interface ConfigContainerChild extends Partial<ConfigContainer> {
595
646
  id?: string;
596
- type?: ConfigElementType;
647
+ /**
648
+ * Узел-лист. Кроме элементов сюда попадают фильтры — дети FiltersContainer тоже узлы конфига,
649
+ * а их `type` берётся из {@link FilterType}, а не из {@link ConfigElementType}.
650
+ */
651
+ type?: ConfigElementType | FilterType;
597
652
  templateName?: ContainerTemplate | HeaderTemplate;
598
653
  value?: string | number;
599
654
  defaultValue?: string | number;
@@ -642,7 +697,8 @@ export declare enum ContainerTemplate {
642
697
  EditDate = "EditDate",
643
698
  EditAttachment = "EditAttachment",
644
699
  Attachment = "Attachment",
645
- Divider = "Divider"
700
+ Divider = "Divider",
701
+ StructuredData = "StructuredData"
646
702
  }
647
703
  export declare enum HeaderTemplate {
648
704
  Default = "Default",
@@ -1,9 +1,4 @@
1
- import { SelectedFilter, TreeFilterValue } from '../types';
2
- /**
3
- * Объектное значение иерархического фильтра "tree" («уровень → массив id»),
4
- * в отличие от скалярных/массивных значений остальных фильтров.
5
- */
6
- export declare const isTreeFilterValue: (value?: SelectedFilter["value"]) => value is TreeFilterValue;
1
+ import { TreeFilterValue } from '../types';
7
2
  /**
8
3
  * Подставляет плейсхолдеры уровней `%name.l{N}` значениями id соответствующего уровня
9
4
  * (формат `[id1,id2,...]` для оператора IN). Уровни, отсутствующие в значении (или пустые),
@@ -0,0 +1,19 @@
1
+ import { ConfigFilter, FeaturesFilterValue, SelectedFilter, TreeFilterValue } from '../types';
2
+ /**
3
+ * Значение фильтра `valueType: "features"` — FeatureCollection со строками структурированных
4
+ * данных (контейнер `StructuredData`).
5
+ *
6
+ * Форма самодостаточна (`type: "FeatureCollection"`), поэтому конфиг для проверки не нужен.
7
+ */
8
+ export declare const isFeaturesFilterValue: (value?: SelectedFilter["value"]) => value is FeaturesFilterValue;
9
+ /**
10
+ * Объектное значение иерархического фильтра "tree" («уровень → массив id»).
11
+ *
12
+ * Вид значения определяется по конфигу фильтра: угадывать его по форме ненадёжно — `tree` и
13
+ * `features` оба объекты. Решают только два значения `valueType`: `"tree"` — да, `"features"` — нет.
14
+ * Всё остальное уходит в структурный фолбэк: у tree-фильтров в существующих конфигах `valueType`
15
+ * либо не проставлен, либо объявлен как `"array"` (значение при этом всё равно объектное), и
16
+ * трактовать такой фильтр как не-tree значило бы сломать их. Фолбэк намеренно узкий: ключи вида
17
+ * `l{N}`, значения — массивы. Пустой объект — это tree с пустым выбором, а не «неизвестное значение».
18
+ */
19
+ export declare const isTreeFilterValue: (value?: SelectedFilter["value"], configFilter?: ConfigFilter) => value is TreeFilterValue;
@@ -1,12 +1,13 @@
1
1
  import { QueryLayerServiceConfigurationDc } from '@evergis/api';
2
2
  import { ClientFeatureAttribute, ConfigFilter, SelectedFilter, SelectedFilters } from '../types';
3
- export declare const applyFiltersToCondition: ({ condition, name, defaultValue, filters, isSingle, isSetParams, }: {
3
+ export declare const applyFiltersToCondition: ({ condition, name, defaultValue, filters, isSingle, isSetParams, configFilter, }: {
4
4
  condition: string;
5
5
  name: string;
6
6
  defaultValue: SelectedFilter["value"];
7
7
  filters: SelectedFilters;
8
8
  isSingle?: boolean;
9
9
  isSetParams?: boolean;
10
+ configFilter?: ConfigFilter;
10
11
  }) => string | number;
11
12
  export declare const applyVarsToCondition: <T extends string | string[]>({ section, configFilters, filters, attributes, layerParams, eqlParameters, geometry, isSetParams, }: Pick<QueryLayerServiceConfigurationDc, "eqlParameters"> & {
12
13
  section: T;
@@ -1,2 +1,2 @@
1
1
  import { SelectedFilter, SelectedFilters } from '../types';
2
- export declare const getSelectedFilterValue: (filterName: string, selectedFilters: SelectedFilters, defaultValue: SelectedFilter["value"]) => string | number | Date | import('../types').TreeFilterValue | (string | number | Date | import('../types').TreeFilterValue)[];
2
+ export declare const getSelectedFilterValue: (filterName: string, selectedFilters: SelectedFilters, defaultValue: SelectedFilter["value"]) => string | number | Date | import('../types').TreeFilterValue | import('../types').FeaturesFilterValue | (string | number | Date | import('../types').TreeFilterValue | import('../types').FeaturesFilterValue)[];
@@ -11,6 +11,7 @@ export * from './eqlParametersToPayload';
11
11
  export * from './formatChartRelatedValue';
12
12
  export * from './formatConditionValue';
13
13
  export * from './fetchQueryDescription';
14
+ export * from './filterValueKind';
14
15
  export * from './formatDataSourceCondition';
15
16
  export * from './formatElementValue';
16
17
  export * from './getAttributeByName';
@@ -16,7 +16,7 @@ export declare const DEFAULT_SYMBOL_HALO_COLOR = "#ffffff";
16
16
  export declare const DEFAULT_SYMBOL_PLACEMENT = "point";
17
17
  export declare const DEFAULT_SYMBOL_SPACING = 250;
18
18
  export declare const DEFAULT_ICON_OVERLAP = "never";
19
- export declare const DEFAULT_ICON_SIZE = 1;
19
+ export declare const DEFAULT_ICON_SIZE = 0.5;
20
20
  export declare const DEFAULT_ICON_ANCHOR = "center";
21
21
  export declare const DEFAULT_ICON_PADDING: number[];
22
22
  export declare const DEFAULT_ICON_ROTATE = 0;
@@ -1,4 +1,4 @@
1
- import { ClientStyle } from '../../types/styling';
1
+ import { ClientStyle } from '../../types';
2
2
  export interface LayerIconConfig {
3
3
  /** Идентификатор слоя */
4
4
  layerId: string;