@evergis/react 4.0.117 → 4.0.119

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 (49) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +7 -7
  3. package/dist/components/Dashboard/componentTypes.d.ts +11 -2
  4. package/dist/components/Dashboard/constants.d.ts +15 -0
  5. package/dist/components/Dashboard/containers/ContainersGroupContainer/FlowGroup.d.ts +4 -0
  6. package/dist/components/Dashboard/containers/ContainersGroupContainer/index.d.ts +6 -0
  7. package/dist/components/Dashboard/containers/GridRowContainer/index.d.ts +11 -0
  8. package/dist/components/Dashboard/containers/index.d.ts +1 -0
  9. package/dist/components/Dashboard/containers/registry.d.ts +1 -0
  10. package/dist/components/Dashboard/grid/GridEditContext/index.d.ts +9 -0
  11. package/dist/components/Dashboard/grid/GridEditSession/index.d.ts +11 -0
  12. package/dist/components/Dashboard/grid/GridGroup/index.d.ts +11 -0
  13. package/dist/components/Dashboard/grid/GridGroupView/index.d.ts +10 -0
  14. package/dist/components/Dashboard/grid/components/GridContextMenu/index.d.ts +16 -0
  15. package/dist/components/Dashboard/grid/components/GridContextMenu/styled.d.ts +8 -0
  16. package/dist/components/Dashboard/grid/components/GridHeightResizer/index.d.ts +14 -0
  17. package/dist/components/Dashboard/grid/components/GridResizer/index.d.ts +13 -0
  18. package/dist/components/Dashboard/grid/components/GridResizer/styled.d.ts +11 -0
  19. package/dist/components/Dashboard/grid/components/GridTrack/index.d.ts +24 -0
  20. package/dist/components/Dashboard/grid/components/GridTracks/index.d.ts +21 -0
  21. package/dist/components/Dashboard/grid/components/GridTracks/styled.d.ts +51 -0
  22. package/dist/components/Dashboard/grid/constants.d.ts +77 -0
  23. package/dist/components/Dashboard/grid/hooks/useGridCellSwap.d.ts +25 -0
  24. package/dist/components/Dashboard/grid/hooks/useGridDraft.d.ts +22 -0
  25. package/dist/components/Dashboard/grid/hooks/useGridHeightResize.d.ts +20 -0
  26. package/dist/components/Dashboard/grid/hooks/useGridMenuOptions.d.ts +2 -0
  27. package/dist/components/Dashboard/grid/hooks/useGridResize.d.ts +27 -0
  28. package/dist/components/Dashboard/grid/hooks/useGridSelection.d.ts +12 -0
  29. package/dist/components/Dashboard/grid/types.d.ts +78 -0
  30. package/dist/components/Dashboard/grid/utils/createGridNodeId.d.ts +23 -0
  31. package/dist/components/Dashboard/grid/utils/gridMenuActions.d.ts +14 -0
  32. package/dist/components/Dashboard/grid/utils/gridOperations.d.ts +18 -0
  33. package/dist/components/Dashboard/grid/utils/gridResizeOperations.d.ts +18 -0
  34. package/dist/components/Dashboard/grid/utils/gridTracks.d.ts +33 -0
  35. package/dist/components/Dashboard/grid/utils/gridTree.d.ts +58 -0
  36. package/dist/components/Dashboard/grid/utils/readCellAtPoint.d.ts +13 -0
  37. package/dist/components/Dashboard/grid/utils/readTrackPixels.d.ts +16 -0
  38. package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +1 -0
  39. package/dist/components/Dashboard/types.d.ts +21 -0
  40. package/dist/components/Dashboard/utils/getRenderElement.d.ts +1 -1
  41. package/dist/components/Dashboard/utils/getWrapperSizeStyle.d.ts +6 -1
  42. package/dist/constants/styling.d.ts +17 -0
  43. package/dist/contexts/DashboardContext/types.d.ts +10 -1
  44. package/dist/contexts/FeatureCardContext/types.d.ts +4 -1
  45. package/dist/index.js +4988 -3425
  46. package/dist/index.js.map +1 -1
  47. package/dist/react.esm.js +4970 -3428
  48. package/dist/react.esm.js.map +1 -1
  49. 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`!
@@ -192,7 +192,7 @@ export interface ChartContainerConfig extends Omit<ConfigContainerChild, "option
192
192
  export interface ChartContainerProps extends Omit<ContainerProps, "elementConfig"> {
193
193
  elementConfig?: ChartContainerConfig;
194
194
  }
195
- export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded" | "alignItems"> & ContainerBoxOptions;
195
+ export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded" | "alignItems" | "grid" | "editMode" | "gap"> & ContainerBoxOptions;
196
196
  export interface ContainersGroupContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
197
197
  templateName?: ContainerTemplate.ContainersGroup;
198
198
  options?: ContainersGroupContainerOptions;
@@ -348,6 +348,14 @@ export interface FiltersContainerConfig extends Omit<ConfigContainerChild, "opti
348
348
  export interface FiltersContainerProps extends Omit<ContainerProps, "elementConfig"> {
349
349
  elementConfig?: FiltersContainerConfig;
350
350
  }
351
+ export type GridRowContainerOptions = Pick<ConfigOptions, "gap" | "alignItems"> & ContainerBoxOptions;
352
+ export interface GridRowContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
353
+ templateName?: ContainerTemplate.GridRow;
354
+ options?: GridRowContainerOptions;
355
+ }
356
+ export interface GridRowContainerProps extends Omit<ContainerProps, "elementConfig"> {
357
+ elementConfig?: GridRowContainerConfig;
358
+ }
351
359
  export type IconContainerOptions = Record<string, never>;
352
360
  export interface IconContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
353
361
  templateName?: ContainerTemplate.Icon;
@@ -489,7 +497,7 @@ export interface FeatureCardSlideshowHeaderConfig extends Omit<ConfigContainerHe
489
497
  * Поскольку оба поля помечены как опциональные (`?`), значения **без** дискриминатора по-прежнему
490
498
  * приемлемы для любой ветви — это переходная мягкая совместимость с legacy-конфигами.
491
499
  */
492
- export type DashboardChild = ElementButtonConfig | ElementCameraConfig | ElementChartConfig | ElementChipsConfig | ElementControlConfig | ElementIconConfig | ElementImageConfig | ElementLegendConfig | ElementLinkConfig | ElementMarkdownConfig | ElementModalConfig | ElementSlideshowConfig | ElementSvgConfig | ElementTooltipConfig | ElementUploaderConfig | AddFeatureContainerConfig | AttachmentContainerConfig | CameraContainerConfig | ChartContainerConfig | ContainersGroupContainerConfig | DataSourceContainerConfig | DataSourceProgressContainerConfig | DefaultAttributesContainerConfig | DividerContainerElementConfig | EditContainerConfig | EditGroupContainerConfig | EditBooleanContainerConfig | EditStringContainerConfig | EditNumberContainerConfig | EditDropdownContainerConfig | EditChipsContainerConfig | EditCheckboxContainerConfig | EditDateContainerConfig | EditAttachmentContainerConfig | ExportPdfContainerConfig | FiltersContainerConfig | IconContainerConfig | ImageContainerConfig | LayersContainerConfig | OneColumnContainerConfig | ProgressContainerConfig | RoundedBackgroundContainerConfig | SlideshowContainerConfig | TabsContainerConfig | TaskContainerConfig | TitleContainerConfig | TwoColumnContainerConfig | UploadContainerConfig;
500
+ export type DashboardChild = ElementButtonConfig | ElementCameraConfig | ElementChartConfig | ElementChipsConfig | ElementControlConfig | ElementIconConfig | ElementImageConfig | ElementLegendConfig | ElementLinkConfig | ElementMarkdownConfig | ElementModalConfig | ElementSlideshowConfig | ElementSvgConfig | ElementTooltipConfig | ElementUploaderConfig | AddFeatureContainerConfig | AttachmentContainerConfig | CameraContainerConfig | ChartContainerConfig | ContainersGroupContainerConfig | DataSourceContainerConfig | DataSourceProgressContainerConfig | DefaultAttributesContainerConfig | DividerContainerElementConfig | EditContainerConfig | EditGroupContainerConfig | EditBooleanContainerConfig | EditStringContainerConfig | EditNumberContainerConfig | EditDropdownContainerConfig | EditChipsContainerConfig | EditCheckboxContainerConfig | EditDateContainerConfig | EditAttachmentContainerConfig | ExportPdfContainerConfig | FiltersContainerConfig | GridRowContainerConfig | IconContainerConfig | ImageContainerConfig | LayersContainerConfig | OneColumnContainerConfig | ProgressContainerConfig | RoundedBackgroundContainerConfig | SlideshowContainerConfig | TabsContainerConfig | TaskContainerConfig | TitleContainerConfig | TwoColumnContainerConfig | UploadContainerConfig;
493
501
  /**
494
502
  * Строгий authoring-тип узла конфига. В отличие от мягкого {@link ConfigContainerChild}
495
503
  * (`id?` — опционален ради legacy-совместимости), здесь `id` **обязателен** и рекурсивно
@@ -557,6 +565,7 @@ export type ContainerTemplateToProps = {
557
565
  [ContainerTemplate.EditAttachment]: EditAttachmentContainerProps;
558
566
  [ContainerTemplate.ExportPdf]: ExportPdfContainerProps;
559
567
  [ContainerTemplate.Filters]: FiltersContainerProps;
568
+ [ContainerTemplate.GridRow]: GridRowContainerProps;
560
569
  [ContainerTemplate.Icon]: IconContainerProps;
561
570
  [ContainerTemplate.Image]: ImageContainerProps;
562
571
  [ContainerTemplate.Layers]: LayersContainerProps;
@@ -3,6 +3,13 @@ import { AttributeIconType, AttributeType, QueryLayerServiceInfoDc } from '@ever
3
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
+ /**
7
+ * Slot-id детей, которые контейнер отдаёт заголовку (`ExpandableTitle`), а не телу.
8
+ *
9
+ * `ContainerChildren` исключает их из рендера тела; сетка обязана исключать их же при сборке
10
+ * `grid-template-*`, иначе слот заголовка съест трек и раскладка съедет.
11
+ */
12
+ export declare const TITLE_SLOT_IDS: string[];
6
13
  export declare const DEFAULT_PAGES_CONFIG: ConfigContainerChild;
7
14
  export declare const DEFAULT_DASHBOARD_CONFIG: ConfigContainer;
8
15
  export declare const FEATURE_CARD_OTHER_COLOR = "#D4DADD";
@@ -57,3 +64,11 @@ export declare const CONTAINER_BODY_ATTRIBUTE = "data-container-body";
57
64
  * `flex-shrink: 0` и не сжимается.
58
65
  */
59
66
  export declare const CONTAINER_BODY_FILL_STYLE: CSSObject;
67
+ /**
68
+ * Дефолт корневой обёртки группы контейнеров.
69
+ *
70
+ * `border-box` — чтобы `padding` из авторского `style` не раздувал бокс сверх выданного размера.
71
+ * Особенно чувствительно в сетке: ячейка с отступами иначе перерастает свой трек, и указывать
72
+ * `boxSizing` руками пришлось бы в каждом узле конфига.
73
+ */
74
+ export declare const CONTAINERS_GROUP_DEFAULTS: CSSObject;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { ContainersGroupContainerProps } from '../../types';
3
+ /** Обычная (не сеточная) раскладка группы: дети в колонку или в строку. */
4
+ export declare const FlowGroup: FC<ContainersGroupContainerProps>;
@@ -1,3 +1,9 @@
1
1
  import { FC } from 'react';
2
2
  import { ContainersGroupContainerProps } from '../../types';
3
+ /**
4
+ * Диспетчер двух раскладок группы: обычной и сеточной.
5
+ *
6
+ * Собственных хуков здесь намеренно нет. `options.grid` переключается на лету (контрол в
7
+ * сторибуке, редактор дашборда), и любой хук до ветвления менял бы их порядок между рендерами.
8
+ */
3
9
  export declare const ContainersGroupContainer: FC<ContainersGroupContainerProps>;
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { GridRowContainerProps } from '../../types';
3
+ /**
4
+ * Строка сетки: её дети — ячейки, доли берутся из их `options.width`.
5
+ *
6
+ * Заголовка у строки нет: это структурный узел, всё содержимое живёт в ячейках. Собственная
7
+ * доля строки (`options.height`) читается РОДИТЕЛЬСКОЙ сеткой при сборке `grid-template-rows`,
8
+ * а сама строка получает от неё готовую высоту трека — и занимает её целиком
9
+ * ({@link GRID_FILL_DEFAULTS}), иначе колонки внутри строки схлопнулись бы до содержимого.
10
+ */
11
+ export declare const GridRowContainer: FC<GridRowContainerProps>;
@@ -9,6 +9,7 @@ export * from './DataSourceProgressContainer';
9
9
  export * from './DefaultAttributesContainer';
10
10
  export * from './DividerContainer';
11
11
  export * from './FiltersContainer';
12
+ export * from './GridRowContainer';
12
13
  export * from './IconContainer';
13
14
  export * from './ImageContainer';
14
15
  export * from './LayersContainer';
@@ -43,5 +43,6 @@ export declare const getContainerComponents: () => {
43
43
  readonly Attachment: FC<import('../componentTypes').AttachmentContainerProps>;
44
44
  readonly EditGroup: FC<import('../componentTypes').EditGroupContainerProps>;
45
45
  readonly ContainersGroup: FC<import('../componentTypes').ContainersGroupContainerProps>;
46
+ readonly GridRow: FC<import('../componentTypes').GridRowContainerProps>;
46
47
  readonly default: FC<import('../componentTypes').ContainersGroupContainerProps>;
47
48
  };
@@ -0,0 +1,9 @@
1
+ import { GridEditSessionValue } from '../types';
2
+ /**
3
+ * Сессия редактирования раскладки. Создаётся ВНЕШНИМ grid-узлом с `options.editMode`;
4
+ * вложенные сетки её только читают, собственный `editMode` у них игнорируется.
5
+ *
6
+ * `null` — режим просмотра: ни выделения, ни ручек, ни контекстного меню.
7
+ */
8
+ export declare const GridEditContext: import('react').Context<GridEditSessionValue>;
9
+ export declare const useGridEdit: () => GridEditSessionValue | null;
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { ContainerProps } from '../../types';
3
+ /**
4
+ * Сессия редактирования раскладки: черновик, выделение и контекстное меню на всё дерево сетки.
5
+ *
6
+ * Черновик отличается структурой от конфига, пришедшего сверху, поэтому `renderElement` из пропсов
7
+ * здесь не годится — он замкнут на исходный узел и не найдёт ячейки, созданные split/add. Вместо
8
+ * него строится собственный, замкнутый на черновик; всё дерево ниже получает его по цепочке
9
+ * рекурсии `getRenderElement`.
10
+ */
11
+ export declare const GridEditSession: FC<ContainerProps>;
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ import { ContainersGroupContainerProps } from '../../componentTypes';
3
+ /**
4
+ * Точка входа в сетку.
5
+ *
6
+ * Сессию редактирования открывает только ВНЕШНИЙ узел: вложенные сетки наследуют её через
7
+ * контекст, а собственный `options.editMode` у них игнорируется — иначе на одном дереве
8
+ * оказалось бы несколько независимых черновиков, и правки во вложенной сетке не попали бы
9
+ * в конфиг, который внешняя отдаёт в `onChange`.
10
+ */
11
+ export declare const GridGroup: FC<ContainersGroupContainerProps>;
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { ContainerProps } from '../../types';
3
+ /**
4
+ * Сетка: дети контейнера трактуются как строки, доли берутся из их `options.height`.
5
+ *
6
+ * По умолчанию сетка занимает всю высоту выделенного ей бокса ({@link GRID_FILL_DEFAULTS}) —
7
+ * иначе `1fr`-строки раскладываются по содержимому. Если высота не определена и у родителя,
8
+ * пропорции всё равно не заработают: взять их неоткуда, нужна заданная `options.height`.
9
+ */
10
+ export declare const GridGroupView: FC<ContainerProps>;
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ import { GridMenuPosition } from '../../types';
3
+ interface GridContextMenuProps {
4
+ /** `null` — меню закрыто. */
5
+ position: GridMenuPosition | null;
6
+ onClose: VoidFunction;
7
+ }
8
+ /**
9
+ * Контекстное меню сетки, открывающееся в точке курсора.
10
+ *
11
+ * `Popup` построен на tippy и пробрасывает в него незнакомые пропсы, поэтому позиционирование
12
+ * по координатам делается штатным tippy-механизмом `getReferenceClientRect` — виртуальным
13
+ * прямоугольником нулевого размера в точке нажатия.
14
+ */
15
+ export declare const GridContextMenu: FC<GridContextMenuProps>;
16
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Технический якорь меню.
3
+ *
4
+ * Меню открывается в точке курсора через tippy-проп `getReferenceClientRect`, но самому tippy
5
+ * всё равно нужен реальный элемент, к которому он монтируется. Этот узел ничего не занимает
6
+ * и не виден.
7
+ */
8
+ export declare const MenuAnchor: import('styled-components').StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,14 @@
1
+ import { FC } from 'react';
2
+ interface GridHeightResizerProps {
3
+ /** Доли всех строк сетки — база для пересчёта. */
4
+ sizes: number[];
5
+ getGrid: () => HTMLElement | null;
6
+ onCommit: (height: string, sizes: number[]) => void;
7
+ }
8
+ /**
9
+ * Ручка на нижней границе сетки: тянет высоту последней строки вместе с высотой самой сетки.
10
+ *
11
+ * Выглядит так же, как ручка между треками, но соседа снизу у неё нет — растёт сам контейнер.
12
+ */
13
+ export declare const GridHeightResizer: FC<GridHeightResizerProps>;
14
+ export {};
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { GridAxis } from '../../types';
3
+ interface GridResizerProps {
4
+ axis: GridAxis;
5
+ /** Граница между треками `index` и `index + 1`. */
6
+ index: number;
7
+ /** Доли пары треков из конфига — база для пересчёта. */
8
+ sizes: [number, number];
9
+ getGrid: () => HTMLElement | null;
10
+ onCommit: (index: number, sizes: [number, number]) => void;
11
+ }
12
+ export declare const GridResizer: FC<GridResizerProps>;
13
+ export {};
@@ -0,0 +1,11 @@
1
+ import { GridAxis } from '../../types';
2
+ /**
3
+ * Ручка перетаскивания границы треков.
4
+ *
5
+ * Абсолютная и целиком лежит в зазоре, поэтому включение режима редактирования не сдвигает
6
+ * раскладку ни на пиксель. Сам ползунок (`::after`) появляется только при наведении и во время
7
+ * перетаскивания — в покое сетка выглядит как обычно.
8
+ */
9
+ export declare const ResizeHandle: import('styled-components').StyledComponent<"div", any, {
10
+ $axis: GridAxis;
11
+ }, never>;
@@ -0,0 +1,24 @@
1
+ import { FC } from 'react';
2
+ import { ConfigContainerChild, RenderElementFunction } from '../../../types';
3
+ import { GridAxis } from '../../types';
4
+ interface GridTrackProps {
5
+ item: ConfigContainerChild;
6
+ axis: GridAxis;
7
+ index: number;
8
+ /** Доли текущего трека и следующего. `null` — трек последний, границы за ним нет. */
9
+ pairSizes: [number, number] | null;
10
+ /** Доли всех строк сетки — переданы последней строке, за которой тянется нижняя граница. */
11
+ outerSizes?: number[];
12
+ getGrid: () => HTMLElement | null;
13
+ onResizeCommit: (index: number, sizes: [number, number]) => void;
14
+ onHeightCommit: (height: string, sizes: number[]) => void;
15
+ renderElement: RenderElementFunction;
16
+ }
17
+ /**
18
+ * Один трек сетки: обёртка + содержимое + ручка ресайза на дальней границе.
19
+ *
20
+ * Выделение и меню доступны только на оси ячеек: строка — структурный узел, самостоятельных
21
+ * операций над ней нет, добавление и удаление строк идут через выбранную в строке ячейку.
22
+ */
23
+ export declare const GridTrack: FC<GridTrackProps>;
24
+ export {};
@@ -0,0 +1,21 @@
1
+ import { FC } from 'react';
2
+ import { ConfigContainerChild, RenderElementFunction } from '../../../types';
3
+ import { ContainerBodyProps } from '../../../hooks/useContainerRoot';
4
+ import { GridAxis } from '../../types';
5
+ interface GridTracksProps {
6
+ /** Узел, чьи дети становятся треками: сетка (строки) или строка (ячейки). */
7
+ node: ConfigContainerChild;
8
+ axis: GridAxis;
9
+ renderElement: RenderElementFunction;
10
+ /** Пропсы тела контейнера из `useContainerRoot`. */
11
+ body?: ContainerBodyProps;
12
+ gap?: number;
13
+ }
14
+ /**
15
+ * Раскладка одной оси сетки: собирает `grid-template-*` из долей детей и рендерит треки.
16
+ *
17
+ * Каждый ребёнок обязательно получает собственную DOM-обёртку, даже если его содержимое не
18
+ * отрендерилось: иначе число узлов разойдётся с числом треков и сетка съедет.
19
+ */
20
+ export declare const GridTracks: FC<GridTracksProps>;
21
+ export {};
@@ -0,0 +1,51 @@
1
+ import { GridAxis } from '../../types';
2
+ /**
3
+ * Тело сетки.
4
+ *
5
+ * Наследуется от обычного `Container` в колоночном режиме: строчная ветка базы даёт
6
+ * `justify-content: space-between` (растащил бы треки) и `align-items: center` (отключил бы
7
+ * stretch у ячеек) — в неё лучше не входить вовсе. Из колоночной гасим ровно одно правило —
8
+ * фиксированный `margin-bottom` у детей, потому что в сетке зазор задаёт `gap`.
9
+ *
10
+ * Унаследованные `width: 100%` и `min-width: 0` у детей оставлены намеренно: для grid-item это
11
+ * ровно то, что нужно, а попытка их перебить упёрлась бы в равную специфичность с `$sizeCss`
12
+ * самой ячейки.
13
+ */
14
+ export declare const GridBody: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps & import('../../../styled').ContainerRootProps & {
15
+ isTitle?: boolean;
16
+ isColumn?: boolean;
17
+ isMain?: boolean;
18
+ noBorders?: boolean;
19
+ $alignItems?: import('../../..').AlignItems;
20
+ } & {
21
+ $template: string;
22
+ $axis: GridAxis;
23
+ $gap: number;
24
+ }, never>;
25
+ /**
26
+ * Обёртка одного трека.
27
+ *
28
+ * Существует ради двух вещей. Во-первых, гарантирует соответствие «трек ↔ DOM-узел»: содержимое
29
+ * ячейки может не отрендериться (`hideIfEmptyDataSource`, чужой `tabId`, пустое значение), и без
30
+ * обёртки пропавший узел утащил бы всю сетку на трек влево. Во-вторых, даёт систему координат
31
+ * (`position: relative`) для ручки ресайза, лежащей в зазоре.
32
+ */
33
+ export declare const GridTrackBox: import('styled-components').StyledComponent<"div", any, {
34
+ $selected?: boolean;
35
+ $selectable?: boolean;
36
+ $hoverable?: boolean;
37
+ }, never>;
38
+ /**
39
+ * Содержимое трека, запертое в его границах.
40
+ *
41
+ * Трек объявлен как `minmax(0, Nfr)` и по содержимому не растёт, а корень контейнера внутри —
42
+ * flex-элемент, который ниже собственного содержимого не сжимается. Без явного `overflow` лишнее
43
+ * рисовалось бы ЗА пределами трека, поверх соседней строки: обе обёртки позиционированы, поэтому
44
+ * поверх оказывается та, что ниже по DOM. Ярче всего это вылезало после объединения ячеек —
45
+ * оно складывает их содержимое в столбик и разом удваивает требуемую высоту.
46
+ *
47
+ * Отдельный узел, а не `overflow` на самой обёртке трека: ручки ресайза лежат в ней же и
48
+ * намеренно выходят за границы трека на `HANDLE_BLEED_PX` — скролл-контейнер срезал бы им
49
+ * половину зоны захвата.
50
+ */
51
+ export declare const GridTrackContent: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,77 @@
1
+ import { CSSObject } from 'styled-components';
2
+ /**
3
+ * Минимальный размер трека, px. Ниже него ресайз не пускает — иначе ячейку не за что схватить.
4
+ *
5
+ * Это верхняя граница минимума, а не жёсткое значение: в низкой сетке пара треков может не
6
+ * набирать и двух таких минимумов, и фиксированный порог запер бы границу намертво.
7
+ */
8
+ export declare const MIN_TRACK_PX = 40;
9
+ /** Какую долю пары треков минимум разрешено занимать каждому из них в тесной сетке. */
10
+ export declare const MIN_TRACK_RATIO = 0.25;
11
+ /**
12
+ * Дефолт корневой обёртки сетки и строки: занять по вертикали весь выделенный бокс.
13
+ *
14
+ * Без него высота узла определяется содержимым, а `1fr`-треки внутри неопределённой высоты по
15
+ * спецификации CSS раскладываются по контенту — пропорции не работают. Сильнее всего это било по
16
+ * вложенным сеткам: ячейка собственной высоты не имеет, она приходит ей от трека, и внутренняя
17
+ * сетка съёживалась до контента вместе с возможностью тянуть её границы.
18
+ *
19
+ * Явный `options.height` дефолт перекрывает — см. {@link getWrapperSizeStyle}.
20
+ */
21
+ export declare const GRID_FILL_DEFAULTS: CSSObject;
22
+ /**
23
+ * Зазор между треками по умолчанию, px.
24
+ *
25
+ * Ноль: сетка бесшовная, ячейки стыкуются вплотную. Зазор — оформительское решение конкретной
26
+ * раскладки, поэтому задаётся явно через `options.gap`, а не навязывается всем сеткам.
27
+ */
28
+ export declare const DEFAULT_GRID_GAP = 0;
29
+ /**
30
+ * Насколько ручка ресайза заходит на содержимое с каждой стороны, px.
31
+ *
32
+ * По умолчанию зазора нет вовсе, так что попасть курсором ровно в границу невозможно — зона
33
+ * захвата всегда шире зазора на эту величину с каждой стороны. Ручка абсолютная и в раскладке
34
+ * не участвует, поэтому расширение ничего не сдвигает.
35
+ */
36
+ export declare const HANDLE_BLEED_PX = 3;
37
+ /**
38
+ * Сдвиг курсора, после которого нажатие на ячейке считается перетаскиванием, px.
39
+ *
40
+ * До порога жест остаётся кликом: ячейку выделяют тем же нажатием, и дрожание руки не должно
41
+ * превращать выделение в перестановку.
42
+ */
43
+ export declare const DRAG_THRESHOLD_PX = 4;
44
+ /** Маркер ячейки в DOM: по нему ищется цель перетаскивания под курсором. */
45
+ export declare const GRID_CELL_ATTR = "data-grid-cell";
46
+ /** Маркер ручки ресайза: нажатие на ней тянет границу, а не ячейку. */
47
+ export declare const GRID_HANDLE_ATTR = "data-grid-handle";
48
+ /** Тот же маркер пропсами: имя атрибута вычисляемое, а в JSX такое подставляется только спредом. */
49
+ export declare const GRID_HANDLE_PROPS: {
50
+ "data-grid-handle": boolean;
51
+ };
52
+ /**
53
+ * Нажатия, которые перетаскиванием ячейки не считаются.
54
+ *
55
+ * Ручка тянет границу трека, а поля ввода живут своей жизнью: там нажатие ставит каретку и
56
+ * выделяет текст, и подменять это перестановкой ячеек нельзя.
57
+ */
58
+ export declare const NO_CELL_DRAG_SELECTOR = "[data-grid-handle], input, textarea, select, [contenteditable=\"true\"]";
59
+ /**
60
+ * Разметка идущего жеста: ячейка-источник, цель под курсором и сам факт перетаскивания.
61
+ *
62
+ * Атрибутами, а не пропсами: цель меняется десятки раз за жест, и каждая смена перерисовывала бы
63
+ * поддерево сетки вместе с `renderElement`. Ровно так же ресайз рисует превью — прямо в DOM, а в
64
+ * состояние результат уходит один раз, на отпускание мыши.
65
+ */
66
+ export declare const GRID_DRAG_SOURCE_ATTR = "data-grid-drag-source";
67
+ export declare const GRID_DROP_TARGET_ATTR = "data-grid-drop-target";
68
+ export declare const GRID_DRAGGING_ATTR = "data-grid-dragging";
69
+ /** Потолок на число треков в одном родителе — страховка от бесконечного дробления через split. */
70
+ export declare const MAX_TRACKS = 12;
71
+ /** Доля трека новой ячейки/строки, если посчитать среднее не из чего. */
72
+ export declare const DEFAULT_TRACK_FR = 1;
73
+ /** Знаменатель округления долей: три знака после запятой. */
74
+ export declare const FR_PRECISION = 1000;
75
+ /** Префиксы id создаваемых узлов. Не должны начинаться с `CONFIG_PAGE_ID` (`"page"`). */
76
+ export declare const GRID_ROW_ID_PREFIX = "gridRow_";
77
+ export declare const GRID_CELL_ID_PREFIX = "gridCell_";
@@ -0,0 +1,25 @@
1
+ import { MouseEvent as ReactMouseEvent } from 'react';
2
+ import { ConfigContainerChild } from '../../types';
3
+ import { GridEditAction } from '../types';
4
+ interface UseGridCellSwapParams {
5
+ /** Актуальная раскладка: по ней проверяется, можно ли меняться с ячейкой под курсором. */
6
+ draft: ConfigContainerChild;
7
+ applyAction: (action: GridEditAction) => void;
8
+ }
9
+ export interface GridCellSwap {
10
+ beginDrag: (cellId: string, event: ReactMouseEvent<HTMLElement>) => void;
11
+ /** `true` — этим кликом закончилось перетаскивание, и выделение он менять не должен. */
12
+ consumeDragClick: () => boolean;
13
+ }
14
+ /**
15
+ * Перетаскивание ячейки на место другой ячейки.
16
+ *
17
+ * Один экземпляр на сессию: жест начинается в одной ячейке, а заканчивается в другой, возможно из
18
+ * другой строки или вложенной сетки, — держать его в самой ячейке негде.
19
+ *
20
+ * Пока жест идёт, в состояние не пишется ничего: источник и цель размечаются атрибутами прямо в
21
+ * DOM, как ресайз рисует инлайн-превью. В конфиг уходит ровно одна правка — на отпускание мыши
22
+ * над валидной целью.
23
+ */
24
+ export declare const useGridCellSwap: ({ draft, applyAction }: UseGridCellSwapParams) => GridCellSwap;
25
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ConfigContainerChild, WidgetType } from '../../types';
2
+ import { GridAxis, GridEditAction } from '../types';
3
+ interface UseGridDraftParams {
4
+ /** Узел сетки из конфига — начальное значение черновика. */
5
+ node: ConfigContainerChild;
6
+ type: WidgetType;
7
+ onChange?: (config: ConfigContainerChild) => void;
8
+ }
9
+ export interface GridDraft {
10
+ draft: ConfigContainerChild;
11
+ applyAction: (action: GridEditAction) => void;
12
+ commitResize: (parentId: string, index: number, sizes: [number, number], axis: GridAxis) => void;
13
+ commitHeight: (height: string, sizes: number[]) => void;
14
+ }
15
+ /**
16
+ * Локальный черновик раскладки: правки применяются сразу, наружу уходят через `onChange`.
17
+ *
18
+ * Черновик, а не controlled-проп, по двум причинам: редактирование работает даже если хост
19
+ * `onChange` не обслуживает, и промежуточные состояния не гоняются через внешний стейт.
20
+ */
21
+ export declare const useGridDraft: ({ node, type, onChange }: UseGridDraftParams) => GridDraft;
22
+ export {};
@@ -0,0 +1,20 @@
1
+ import { GridResize } from './useGridResize';
2
+ interface UseGridHeightResizeParams {
3
+ /** Доли всех строк сетки — их сумма сохраняется при пересчёте. */
4
+ sizes: number[];
5
+ getGrid: () => HTMLElement | null;
6
+ onCommit: (height: string, sizes: number[]) => void;
7
+ }
8
+ /**
9
+ * Перетаскивание НИЖНЕЙ границы сетки — внешней, за которой уже нет соседнего трека.
10
+ *
11
+ * Отличается от обычного ресайза тем, что менять доли не за счёт кого-то: последняя строка растёт
12
+ * вместе с самой сеткой. Поэтому в конфиг уходит и новая `options.height` корня, и пересчитанные
13
+ * доли всех строк — без пересчёта верхние строки разъехались бы пропорционально новой высоте,
14
+ * хотя их границ никто не трогал.
15
+ *
16
+ * Высота пишется в пикселях: единица, в которой её задал автор конфига, при таком жесте не
17
+ * восстановима, а пиксели дают ровно тот результат, который пользователь видел под курсором.
18
+ */
19
+ export declare const useGridHeightResize: ({ sizes, getGrid, onCommit }: UseGridHeightResizeParams) => GridResize;
20
+ export {};
@@ -0,0 +1,2 @@
1
+ import { IOption } from '@evergis/uilib-gl';
2
+ export declare const useGridMenuOptions: () => IOption[];
@@ -0,0 +1,27 @@
1
+ import { GridAxis } from '../types';
2
+ interface UseGridResizeParams {
3
+ axis: GridAxis;
4
+ /** Граница между треками `index` и `index + 1`. */
5
+ index: number;
6
+ /** Доли пары треков из конфига. */
7
+ sizes: [number, number];
8
+ getGrid: () => HTMLElement | null;
9
+ onCommit: (index: number, sizes: [number, number]) => void;
10
+ }
11
+ export interface GridResize {
12
+ /** Callback-ref для ручки: `useDragAndDropEffect` принимает элемент, а не ref. */
13
+ setHandle: (element: HTMLElement | null) => void;
14
+ dragging: boolean;
15
+ }
16
+ /**
17
+ * Перетаскивание границы между двумя соседними треками.
18
+ *
19
+ * Во время жеста раскладка меняется ИНЛАЙН-стилем на самом гриде, без обновления состояния:
20
+ * каждый `mousemove` иначе перерисовывал бы всё поддерево сетки. В конфиг доли уходят один раз,
21
+ * на отпускание мыши.
22
+ *
23
+ * Пиксельный снимок треков берётся однократно на `mousedown` — если пересчитывать его на каждом
24
+ * шаге уже после применения новых долей, округление `fr → px → fr` даёт дрейф границы.
25
+ */
26
+ export declare const useGridResize: ({ axis, index, sizes, getGrid, onCommit }: UseGridResizeParams) => GridResize;
27
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface GridSelection {
2
+ selectedIds: string[];
3
+ selectCell: (id: string, additive: boolean) => void;
4
+ clearSelection: VoidFunction;
5
+ }
6
+ /**
7
+ * Выделение ячеек сетки. Shift (`additive`) добавляет и убирает, обычный клик — заменяет.
8
+ *
9
+ * Выделяются только ячейки: строки структурны, самостоятельных операций над ними нет —
10
+ * добавление и удаление строк делается через выбранную в ней ячейку.
11
+ */
12
+ export declare const useGridSelection: () => GridSelection;