@evergis/react 4.0.124 → 4.0.127
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 +45 -8
- package/dist/components/Dashboard/containers/GridRowContainer/index.d.ts +4 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/StructuredDataContext.d.ts +9 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/components/DeleteRowDialog.d.ts +9 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/constants.d.ts +14 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/index.d.ts +10 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/styled.d.ts +18 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/types.d.ts +48 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredData.d.ts +28 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataDraft.d.ts +25 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSave.d.ts +17 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSchema.d.ts +11 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/utils/buildSchema.d.ts +14 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/utils/draftRows.d.ts +23 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/utils/filterValue.d.ts +14 -0
- package/dist/components/Dashboard/containers/StructuredDataContainer/utils/saveToSource.d.ts +18 -0
- package/dist/components/Dashboard/containers/index.d.ts +1 -0
- package/dist/components/Dashboard/containers/registry.d.ts +1 -0
- package/dist/components/Dashboard/elements/ElementTable/components/TableCell.d.ts +10 -0
- package/dist/components/Dashboard/elements/ElementTable/constants.d.ts +13 -0
- package/dist/components/Dashboard/elements/ElementTable/index.d.ts +9 -0
- package/dist/components/Dashboard/elements/ElementTable/styled.d.ts +28 -0
- package/dist/components/Dashboard/elements/ElementTable/types.d.ts +15 -0
- package/dist/components/Dashboard/elements/ElementTable/useCellEditing.d.ts +15 -0
- package/dist/components/Dashboard/elements/ElementTable/useTableView.d.ts +16 -0
- package/dist/components/Dashboard/elements/ElementTable/utils/isSameCellValue.d.ts +10 -0
- package/dist/components/Dashboard/elements/ElementTable/utils/sortRows.d.ts +12 -0
- package/dist/components/Dashboard/elements/index.d.ts +1 -0
- package/dist/components/Dashboard/elements/registry.d.ts +1 -0
- package/dist/components/Dashboard/grid/GridGroupView/index.d.ts +3 -0
- package/dist/components/Dashboard/grid/components/GridHeightResizer/index.d.ts +2 -0
- package/dist/components/Dashboard/grid/components/GridTrack/index.d.ts +2 -0
- package/dist/components/Dashboard/grid/components/GridTracks/styled.d.ts +14 -1
- package/dist/components/Dashboard/grid/constants.d.ts +8 -0
- package/dist/components/Dashboard/grid/hooks/useGridHeightResize.d.ts +8 -1
- package/dist/components/Dashboard/grid/utils/gridTracks.d.ts +11 -3
- package/dist/components/Dashboard/types.d.ts +89 -14
- package/dist/components/Dashboard/utils/applyTreeFilterToCondition.d.ts +1 -6
- package/dist/components/Dashboard/utils/filterValueKind.d.ts +19 -0
- package/dist/components/Dashboard/utils/formatDataSourceCondition.d.ts +2 -1
- package/dist/components/Dashboard/utils/getSelectedFilterValue.d.ts +1 -1
- package/dist/components/Dashboard/utils/getWrapperSizeStyle.d.ts +7 -1
- package/dist/components/Dashboard/utils/index.d.ts +1 -0
- package/dist/constants/styling.d.ts +1 -1
- package/dist/hooks/map/useIconsFromLayers.d.ts +1 -1
- package/dist/index.js +6268 -5387
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +6269 -5392
- package/dist/react.esm.js.map +1 -1
- package/package.json +5 -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`!
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryLayerServiceInfoDc } from '@evergis/api';
|
|
2
|
-
import { ClientFeatureAttribute, ConfigContainer, ConfigContainerChild, ConfigContainerHeader, ConfigOptions, ContainerProps, ContainerTemplate, HeaderTemplate, NumericSizeOptions } from './types';
|
|
2
|
+
import { ClientFeatureAttribute, ConfigContainer, ConfigContainerChild, ConfigContainerHeader, ConfigOptions, ContainerProps, ContainerTemplate, FilterType, HeaderTemplate, NumericSizeOptions } from './types';
|
|
3
3
|
export type ElementButtonOptions = Record<string, never>;
|
|
4
4
|
export interface ElementButtonConfig extends Omit<ConfigContainerChild, "options" | "type"> {
|
|
5
5
|
type?: "button";
|
|
@@ -109,6 +109,14 @@ export interface ElementSvgProps extends Omit<ContainerProps, "elementConfig"> {
|
|
|
109
109
|
layerInfo?: QueryLayerServiceInfoDc;
|
|
110
110
|
attributes?: ClientFeatureAttribute[];
|
|
111
111
|
}
|
|
112
|
+
export type ElementTableOptions = Pick<ConfigOptions, "columnNames" | "sort">;
|
|
113
|
+
export interface ElementTableConfig extends Omit<ConfigContainerChild, "options" | "type"> {
|
|
114
|
+
type?: "table";
|
|
115
|
+
options?: ElementTableOptions;
|
|
116
|
+
}
|
|
117
|
+
export interface ElementTableProps extends Omit<ContainerProps, "elementConfig"> {
|
|
118
|
+
elementConfig?: ElementTableConfig;
|
|
119
|
+
}
|
|
112
120
|
export type ElementTooltipOptions = Pick<ConfigOptions, "icon">;
|
|
113
121
|
export interface ElementTooltipConfig extends Omit<ConfigContainerChild, "options" | "type"> {
|
|
114
122
|
type?: "tooltip";
|
|
@@ -192,7 +200,7 @@ export interface ChartContainerConfig extends Omit<ConfigContainerChild, "option
|
|
|
192
200
|
export interface ChartContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
193
201
|
elementConfig?: ChartContainerConfig;
|
|
194
202
|
}
|
|
195
|
-
export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded" | "alignItems" | "grid" | "editMode" | "fixedHeight" | "gap"> & ContainerBoxOptions;
|
|
203
|
+
export type ContainersGroupContainerOptions = Pick<ConfigOptions, "column" | "expandable" | "expanded" | "alignItems" | "grid" | "editMode" | "fixedHeight" | "autoHeight" | "gap"> & ContainerBoxOptions;
|
|
196
204
|
export interface ContainersGroupContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
|
|
197
205
|
templateName?: ContainerTemplate.ContainersGroup;
|
|
198
206
|
options?: ContainersGroupContainerOptions;
|
|
@@ -332,12 +340,13 @@ export type FiltersContainerOptions = Pick<ConfigOptions, "padding" | "bgColor"
|
|
|
332
340
|
/**
|
|
333
341
|
* Опции ребёнка FiltersContainer. Набор — объединение того, что реально читают все восемь
|
|
334
342
|
* реализаций фильтра: dropdown берёт `variants`/`noEmptyOption`, text — `searchFilterName`
|
|
335
|
-
* и `multiSelect`, chips — цвета и иконку, rangeNumber — `step` и границы, rangeDate — `withTime
|
|
343
|
+
* и `multiSelect`, chips — цвета и иконку, rangeNumber — `step` и границы, rangeDate — `withTime`,
|
|
344
|
+
* barChart — геометрию столбцов (`barWidth`/`padding`/`barHeight`/`radius`) и палитру.
|
|
336
345
|
*/
|
|
337
|
-
export type FilterChildOptions = Pick<ConfigOptions, "filterName" | "searchFilterName" | "label" | "placeholder" | "control" | "controls" | "relatedDataSource" | "minValue" | "maxValue" | "step" | "withTime" | "multiSelect" | "variants" | "noEmptyOption" | "width" | "height" | "align" | "shownItems" | "icon" | "iconAttribute" | "colorAttribute" | "fontColor" | "backgroundColor" | "maxTextWidth">;
|
|
346
|
+
export type FilterChildOptions = Pick<ConfigOptions, "filterName" | "searchFilterName" | "label" | "placeholder" | "control" | "controls" | "relatedDataSource" | "minValue" | "maxValue" | "step" | "withTime" | "multiSelect" | "variants" | "noEmptyOption" | "width" | "height" | "align" | "shownItems" | "icon" | "iconAttribute" | "colorAttribute" | "fontColor" | "backgroundColor" | "maxTextWidth" | "barWidth" | "barHeight" | "padding" | "radius" | "markers" | "colors" | "defaultColor" | "primaryColor" | "drawMinMax">;
|
|
338
347
|
export interface FilterChild extends Omit<ConfigContainerChild, "options" | "type"> {
|
|
339
|
-
/**
|
|
340
|
-
type?:
|
|
348
|
+
/** Тип фильтра — по нему FiltersContainer выбирает реализацию. */
|
|
349
|
+
type?: FilterType;
|
|
341
350
|
options?: FilterChildOptions;
|
|
342
351
|
}
|
|
343
352
|
export interface FiltersContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName" | "children"> {
|
|
@@ -348,7 +357,7 @@ export interface FiltersContainerConfig extends Omit<ConfigContainerChild, "opti
|
|
|
348
357
|
export interface FiltersContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
349
358
|
elementConfig?: FiltersContainerConfig;
|
|
350
359
|
}
|
|
351
|
-
export type GridRowContainerOptions = Pick<ConfigOptions, "gap" | "alignItems"> & ContainerBoxOptions;
|
|
360
|
+
export type GridRowContainerOptions = Pick<ConfigOptions, "gap" | "alignItems" | "autoHeight"> & ContainerBoxOptions;
|
|
352
361
|
export interface GridRowContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName"> {
|
|
353
362
|
templateName?: ContainerTemplate.GridRow;
|
|
354
363
|
options?: GridRowContainerOptions;
|
|
@@ -423,6 +432,32 @@ export interface SlideshowContainerConfig extends Omit<ConfigContainerChild, "op
|
|
|
423
432
|
export interface SlideshowContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
424
433
|
elementConfig?: SlideshowContainerConfig;
|
|
425
434
|
}
|
|
435
|
+
export type StructuredDataContainerOptions = Pick<ConfigOptions, "attributesDescription" | "relatedDataSource" | "filterName" | "editMode" | "expandable" | "expanded"> & ContainerBoxOptions;
|
|
436
|
+
export interface StructuredDataTableChild extends Omit<ConfigContainerChild, "id" | "type" | "options"> {
|
|
437
|
+
id: "data";
|
|
438
|
+
type?: "table";
|
|
439
|
+
options?: ElementTableOptions;
|
|
440
|
+
}
|
|
441
|
+
export interface StructuredDataAliasChild extends Omit<ConfigContainerChild, "id"> {
|
|
442
|
+
id: "alias";
|
|
443
|
+
}
|
|
444
|
+
export interface StructuredDataTitleChild extends Omit<ConfigContainerChild, "id" | "type"> {
|
|
445
|
+
id: "title";
|
|
446
|
+
type?: "text";
|
|
447
|
+
}
|
|
448
|
+
export interface StructuredDataTitleIconChild extends Omit<ConfigContainerChild, "id" | "type"> {
|
|
449
|
+
id: "titleIcon";
|
|
450
|
+
type?: "icon";
|
|
451
|
+
}
|
|
452
|
+
export type StructuredDataContainerChild = StructuredDataTableChild | StructuredDataAliasChild | StructuredDataTitleChild | StructuredDataTitleIconChild;
|
|
453
|
+
export interface StructuredDataContainerConfig extends Omit<ConfigContainerChild, "options" | "templateName" | "children"> {
|
|
454
|
+
templateName?: ContainerTemplate.StructuredData;
|
|
455
|
+
options?: StructuredDataContainerOptions;
|
|
456
|
+
children?: StructuredDataContainerChild[];
|
|
457
|
+
}
|
|
458
|
+
export interface StructuredDataContainerProps extends Omit<ContainerProps, "elementConfig"> {
|
|
459
|
+
elementConfig?: StructuredDataContainerConfig;
|
|
460
|
+
}
|
|
426
461
|
export type TabsContainerOptions = Pick<ConfigOptions, "radius" | "column" | "bgColor" | "noBg" | "onlyIcon" | "shownItems" | "maxLength" | "wordBreak">;
|
|
427
462
|
export type TabOptions = Pick<ConfigOptions, "icon">;
|
|
428
463
|
export interface TabChild extends Omit<ConfigContainerChild, "options" | "type" | "children"> {
|
|
@@ -497,7 +532,7 @@ export interface FeatureCardSlideshowHeaderConfig extends Omit<ConfigContainerHe
|
|
|
497
532
|
* Поскольку оба поля помечены как опциональные (`?`), значения **без** дискриминатора по-прежнему
|
|
498
533
|
* приемлемы для любой ветви — это переходная мягкая совместимость с legacy-конфигами.
|
|
499
534
|
*/
|
|
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;
|
|
535
|
+
export type DashboardChild = ElementButtonConfig | ElementCameraConfig | ElementChartConfig | ElementChipsConfig | ElementControlConfig | ElementIconConfig | ElementImageConfig | ElementLegendConfig | ElementLinkConfig | ElementMarkdownConfig | ElementModalConfig | ElementSlideshowConfig | ElementSvgConfig | ElementTableConfig | 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 | StructuredDataContainerConfig | TabsContainerConfig | TaskContainerConfig | TitleContainerConfig | TwoColumnContainerConfig | UploadContainerConfig;
|
|
501
536
|
/**
|
|
502
537
|
* Строгий authoring-тип узла конфига. В отличие от мягкого {@link ConfigContainerChild}
|
|
503
538
|
* (`id?` — опционален ради legacy-совместимости), здесь `id` **обязателен** и рекурсивно
|
|
@@ -574,6 +609,7 @@ export type ContainerTemplateToProps = {
|
|
|
574
609
|
[ContainerTemplate.Progress]: ProgressContainerProps;
|
|
575
610
|
[ContainerTemplate.RoundedBackground]: RoundedBackgroundContainerProps;
|
|
576
611
|
[ContainerTemplate.Slideshow]: SlideshowContainerProps;
|
|
612
|
+
[ContainerTemplate.StructuredData]: StructuredDataContainerProps;
|
|
577
613
|
[ContainerTemplate.Tabs]: TabsContainerProps;
|
|
578
614
|
[ContainerTemplate.Task]: TaskContainerProps;
|
|
579
615
|
[ContainerTemplate.Title]: TitleContainerProps;
|
|
@@ -603,6 +639,7 @@ export type ElementTypeToProps = {
|
|
|
603
639
|
markdown: ElementMarkdownProps;
|
|
604
640
|
uploader: ElementUploaderProps;
|
|
605
641
|
modal: ElementModalProps;
|
|
642
|
+
table: ElementTableProps;
|
|
606
643
|
};
|
|
607
644
|
/**
|
|
608
645
|
* Типобезопасный реестр контейнеров. Ключ `default` указывает FC для случая, когда `templateName`
|
|
@@ -7,5 +7,9 @@ import { GridRowContainerProps } from '../../types';
|
|
|
7
7
|
* доля строки (`options.height`) читается РОДИТЕЛЬСКОЙ сеткой при сборке `grid-template-rows`,
|
|
8
8
|
* а сама строка получает от неё готовую высоту трека — и занимает её целиком
|
|
9
9
|
* ({@link GRID_FILL_DEFAULTS}), иначе колонки внутри строки схлопнулись бы до содержимого.
|
|
10
|
+
*
|
|
11
|
+
* Собственный `options.autoHeight` строки заменяет это «целиком» на минимум и разрешает ЯЧЕЙКАМ
|
|
12
|
+
* растить строку своим содержимым. Родительская сетка увидит рост, только если включила
|
|
13
|
+
* `autoHeight` у себя: опция читается у каждого узла и вверх сама не поднимается.
|
|
10
14
|
*/
|
|
11
15
|
export declare const GridRowContainer: FC<GridRowContainerProps>;
|
package/dist/components/Dashboard/containers/StructuredDataContainer/StructuredDataContext.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StructuredDataContextValue } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Канал «контейнер → представление». Схему, строки и колбэки правки держит
|
|
4
|
+
* `StructuredDataContainer`, а рендерит их элемент-представление (`ElementTable`),
|
|
5
|
+
* который контейнер получает слотом `data` через `renderElement`.
|
|
6
|
+
*
|
|
7
|
+
* Значение `null` означает, что представление отрендерили вне контейнера — рендерить нечего.
|
|
8
|
+
*/
|
|
9
|
+
export declare const StructuredDataContext: import('react').Context<StructuredDataContextValue>;
|
package/dist/components/Dashboard/containers/StructuredDataContainer/components/DeleteRowDialog.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface DeleteRowDialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** Удаление реальных объектов источника необратимо — предупреждаем об этом отдельно. */
|
|
5
|
+
isSourceRow: boolean;
|
|
6
|
+
onConfirm: VoidFunction;
|
|
7
|
+
onCancel: VoidFunction;
|
|
8
|
+
}
|
|
9
|
+
export declare const DeleteRowDialog: FC<DeleteRowDialogProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AttributeType } from '@evergis/api';
|
|
2
|
+
/**
|
|
3
|
+
* Типы атрибутов с редактором ячейки. Атрибут любого другого типа показывается только на чтение,
|
|
4
|
+
* даже если помечен `isEditable: true` — редактора для него нет.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EDITABLE_ATTRIBUTE_TYPES: AttributeType[];
|
|
7
|
+
/** Типы, для которых ячейка редактируется числовым инпутом. */
|
|
8
|
+
export declare const NUMBER_EDITOR_TYPES: AttributeType[];
|
|
9
|
+
/** Типы, значение которых хранится целым числом — дробную часть в них не пускаем. */
|
|
10
|
+
export declare const INTEGER_ATTRIBUTE_TYPES: AttributeType[];
|
|
11
|
+
/** Тип атрибута, когда его не задали ни конфиг, ни источник. */
|
|
12
|
+
export declare const DEFAULT_ATTRIBUTE_TYPE = AttributeType.String;
|
|
13
|
+
/** Сколько миллисекунд висит нотификация об ошибке записи. */
|
|
14
|
+
export declare const SAVE_ERROR_DURATION = 5000;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { StructuredDataContainerProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Таблица структурированных данных со схемой в конфиге.
|
|
5
|
+
*
|
|
6
|
+
* Контейнер владеет схемой, черновиком и записью, а рисует данные ребёнок-представление
|
|
7
|
+
* (слот `data`, элемент `table`) — он получает всё через {@link StructuredDataContext}.
|
|
8
|
+
* Правки копятся в черновике: источник и потребители фильтра узнают о них только по «Сохранить».
|
|
9
|
+
*/
|
|
10
|
+
export declare const StructuredDataContainer: FC<StructuredDataContainerProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Панель действий: добавление строки слева, запись и откат — справа.
|
|
3
|
+
*
|
|
4
|
+
* Вторая группа прижимается к краю собственным `margin-left: auto`, а не раскладкой панели:
|
|
5
|
+
* родительский `Container` в режиме колонки перебивает выравнивание своих детей
|
|
6
|
+
* (`&&& > * { justify-content: flex-start }`), и `justify-content` здесь не сработал бы.
|
|
7
|
+
*/
|
|
8
|
+
export declare const StructuredDataToolbar: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
9
|
+
/**
|
|
10
|
+
* Группа кнопок панели. `width: auto` обязателен: базовый `Flex` растянут на 100%, и две
|
|
11
|
+
* такие группы делили бы панель пополам — правая начиналась бы из середины вместо края.
|
|
12
|
+
*/
|
|
13
|
+
export declare const StructuredDataActions: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
14
|
+
/**
|
|
15
|
+
* Область представления. Прокручивается внутри себя, чтобы длинная таблица не растягивала
|
|
16
|
+
* контейнер за пределы отведённой ему ячейки; `min-height: 0` разрешает flex-ребёнку сжиматься.
|
|
17
|
+
*/
|
|
18
|
+
export declare const StructuredDataView: import('styled-components').StyledComponent<"div", any, import('@evergis/uilib-gl').FlexProps, never>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AttributeType } from '@evergis/api';
|
|
2
|
+
import { FeatureAttributeValue } from '../../../../types';
|
|
3
|
+
import { ConfigAttributeDescription } from '../../types';
|
|
4
|
+
/** Состояние строки черновика относительно последнего сохранения. */
|
|
5
|
+
export type DraftRowState = "pristine" | "created" | "updated" | "deleted";
|
|
6
|
+
/**
|
|
7
|
+
* Строка черновика. Правки копятся здесь и уходят в источник и потребителям фильтра
|
|
8
|
+
* только по «Сохранить» — прецедент staging'а взят у tree-фильтра (`useTreeFilterSelection`).
|
|
9
|
+
*/
|
|
10
|
+
export interface DraftRow {
|
|
11
|
+
/**
|
|
12
|
+
* Стабильный локальный ключ строки. Живёт независимо от `featureId`: у добавленной вручную
|
|
13
|
+
* строки id источника появляется только после успешного создания.
|
|
14
|
+
*/
|
|
15
|
+
key: string;
|
|
16
|
+
/** Id объекта источника. Нет — строка в источнике ещё не создана. */
|
|
17
|
+
featureId?: string;
|
|
18
|
+
properties: Record<string, FeatureAttributeValue>;
|
|
19
|
+
state: DraftRowState;
|
|
20
|
+
}
|
|
21
|
+
/** Атрибут схемы после слияния `attributesDescription` с атрибутами источника. */
|
|
22
|
+
export interface StructuredDataAttribute {
|
|
23
|
+
attributeName: string;
|
|
24
|
+
type: AttributeType;
|
|
25
|
+
alias: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
isEditable: boolean;
|
|
28
|
+
stringFormat?: ConfigAttributeDescription["stringFormat"];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Значение {@link StructuredDataContext} — всё, что нужно представлению (`ElementTable`)
|
|
32
|
+
* для рендера и правки. Сортировка сюда не входит: она чисто вид и живёт в представлении.
|
|
33
|
+
*/
|
|
34
|
+
export interface StructuredDataContextValue {
|
|
35
|
+
schema: StructuredDataAttribute[];
|
|
36
|
+
/** Видимые строки в исходном порядке — тот же порядок уходит в фильтр. */
|
|
37
|
+
rows: DraftRow[];
|
|
38
|
+
loading: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Правка разрешена конфигом (`options.editMode`). Без неё представление показывает значения
|
|
41
|
+
* только на чтение: редакторов в ячейках нет, как и удаления строк.
|
|
42
|
+
*/
|
|
43
|
+
canEdit: boolean;
|
|
44
|
+
/** Строки можно удалять: правка разрешена И источник поддерживает запись (либо его нет вовсе). */
|
|
45
|
+
canDeleteRows: boolean;
|
|
46
|
+
onCellChange: (key: string, attributeName: string, value: FeatureAttributeValue) => void;
|
|
47
|
+
onRowDelete: (key: string) => void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { StructuredDataContainerConfig, WidgetType } from '../../types';
|
|
2
|
+
import { StructuredDataContextValue } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Оркестратор контейнера: собирает схему, черновик и запись в одно состояние экрана.
|
|
5
|
+
*
|
|
6
|
+
* Правку открывает `options.editMode`: не задан или `false` — таблица целиком на чтение, без
|
|
7
|
+
* редакторов ячеек, добавления, удаления и кнопок сохранения.
|
|
8
|
+
*
|
|
9
|
+
* Источник без `layerName` (EQL, python-скрипт, внешний url) записи не поддерживает — контейнер
|
|
10
|
+
* деградирует в «ручную структуру поверх данных источника»: строки правятся и уезжают в фильтр,
|
|
11
|
+
* но добавление и удаление строк недоступны.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useStructuredData: (type: WidgetType, elementConfig?: StructuredDataContainerConfig) => {
|
|
14
|
+
contextValue: StructuredDataContextValue;
|
|
15
|
+
dirty: boolean;
|
|
16
|
+
saving: boolean;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
hasError: boolean;
|
|
19
|
+
canEdit: boolean;
|
|
20
|
+
canAddRows: boolean;
|
|
21
|
+
isDeleteConfirmOpen: boolean;
|
|
22
|
+
isDeletingSourceRow: boolean;
|
|
23
|
+
onAddRow: () => void;
|
|
24
|
+
onCancel: () => void;
|
|
25
|
+
onSave: () => Promise<void>;
|
|
26
|
+
onDeleteConfirm: () => void;
|
|
27
|
+
onDeleteCancel: () => void;
|
|
28
|
+
};
|
package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataDraft.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FeatureAttributeValue } from '../../../../types';
|
|
2
|
+
import { SelectedFilter, WidgetDataSource } from '../../types';
|
|
3
|
+
import { DraftRow, StructuredDataAttribute } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Черновик строк: правки копятся локально и никого не трогают до «Сохранить».
|
|
6
|
+
*
|
|
7
|
+
* База (`baseline`) — последнее сохранённое состояние; «Отменить» возвращает к нему.
|
|
8
|
+
* Пока черновик грязный, приходящие обновления источника его НЕ затирают — иначе фоновая
|
|
9
|
+
* перезагрузка данных стирала бы набранное пользователем.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useStructuredDataDraft: ({ schema, dataSource, hasDataSource, filterValue, }: {
|
|
12
|
+
schema: StructuredDataAttribute[];
|
|
13
|
+
dataSource?: WidgetDataSource;
|
|
14
|
+
hasDataSource: boolean;
|
|
15
|
+
filterValue?: SelectedFilter["value"];
|
|
16
|
+
}) => {
|
|
17
|
+
rows: DraftRow[];
|
|
18
|
+
visibleRows: DraftRow[];
|
|
19
|
+
dirty: boolean;
|
|
20
|
+
changeCell: (key: string, attributeName: string, value: FeatureAttributeValue) => void;
|
|
21
|
+
addRow: () => void;
|
|
22
|
+
deleteRow: (key: string) => void;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
commitSaved: (next: DraftRow[]) => void;
|
|
25
|
+
};
|
package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSave.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { WidgetType } from '../../types';
|
|
2
|
+
import { DraftRow, StructuredDataAttribute } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Запись черновика: сперва в источник (если он поддерживает запись), затем в фильтр.
|
|
5
|
+
*
|
|
6
|
+
* Порядок не случаен: потребители фильтра не должны увидеть данные, которых источник не принял.
|
|
7
|
+
* При ошибке черновик остаётся нетронутым — пользователь может исправить значения и повторить.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useStructuredDataSave: ({ type, schema, layerName, filterName, }: {
|
|
10
|
+
type: WidgetType;
|
|
11
|
+
schema: StructuredDataAttribute[];
|
|
12
|
+
layerName?: string;
|
|
13
|
+
filterName?: string;
|
|
14
|
+
}) => {
|
|
15
|
+
save: (rows: DraftRow[]) => Promise<DraftRow[] | null>;
|
|
16
|
+
saving: boolean;
|
|
17
|
+
};
|
package/dist/components/Dashboard/containers/StructuredDataContainer/useStructuredDataSchema.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StructuredDataContainerConfig, WidgetType } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Схема структурированных данных и источник, к которому она привязана.
|
|
4
|
+
*
|
|
5
|
+
* Источник резолвится через общий `useRelatedDataSourceAttributes`: он собирает layerInfo
|
|
6
|
+
* реального слоя, а для EQL/python-источников — синтетический из атрибутов ответа.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useStructuredDataSchema: (type: WidgetType, elementConfig?: StructuredDataContainerConfig) => {
|
|
9
|
+
schema: import('./types').StructuredDataAttribute[];
|
|
10
|
+
dataSource: import('../../types').WidgetDataSource;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AttributesConfigurationDc } from '@evergis/api';
|
|
2
|
+
import { ConfigAttributeDescription } from '../../../types';
|
|
3
|
+
import { StructuredDataAttribute } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Схема структурированных данных.
|
|
6
|
+
*
|
|
7
|
+
* С источником `attributesDescription` — переопределение его схемы: задаёт состав, порядок,
|
|
8
|
+
* `alias`, `stringFormat` и `isEditable`, тогда как типы приходят от источника. Без описания
|
|
9
|
+
* берутся все атрибуты источника. Без источника описание — единственная схема, и оно обязательно.
|
|
10
|
+
*/
|
|
11
|
+
export declare const buildStructuredDataSchema: ({ attributesDescription, attributesConfiguration, }: {
|
|
12
|
+
attributesDescription?: ConfigAttributeDescription[];
|
|
13
|
+
attributesConfiguration?: AttributesConfigurationDc;
|
|
14
|
+
}) => StructuredDataAttribute[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FeatureDc } from '@evergis/api';
|
|
2
|
+
import { FeatureAttributeValue } from '../../../../../types';
|
|
3
|
+
import { DraftRow, StructuredDataAttribute } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Оставляет от произвольного набора свойств только атрибуты схемы. Отсутствующие добавляет
|
|
6
|
+
* как `null`: строка всегда имеет одинаковый набор ключей, иначе представление и
|
|
7
|
+
* FeatureCollection получали бы «рваные» строки.
|
|
8
|
+
*/
|
|
9
|
+
export declare const pickSchemaProperties: (properties: Record<string, FeatureAttributeValue>, schema: StructuredDataAttribute[]) => Record<string, FeatureAttributeValue>;
|
|
10
|
+
/** Объекты источника → строки черновика. `featureId` нужен для последующих update/delete. */
|
|
11
|
+
export declare const featuresToDraftRows: (features: FeatureDc[], schema: StructuredDataAttribute[]) => DraftRow[];
|
|
12
|
+
/** Пустая строка: все атрибуты схемы объявлены, значения — `null`. */
|
|
13
|
+
export declare const createEmptyRow: (schema: StructuredDataAttribute[]) => DraftRow;
|
|
14
|
+
/**
|
|
15
|
+
* Черновик после успешной записи: удалённые строки уходят, созданные получают id из ответа
|
|
16
|
+
* источника, все остальные становятся базой для следующего «Отменить».
|
|
17
|
+
*/
|
|
18
|
+
export declare const toSavedRows: (rows: DraftRow[], createdIds: Record<string, string>) => DraftRow[];
|
|
19
|
+
/**
|
|
20
|
+
* Свойства строки для features-API — только редактируемые атрибуты. Нередактируемые не
|
|
21
|
+
* передаются вовсе: их значение принадлежит источнику, а у новой строки его попросту нет.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getEditableProperties: (row: DraftRow, schema: StructuredDataAttribute[]) => Record<string, FeatureAttributeValue>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FeaturesFilterValue } from '../../../types';
|
|
2
|
+
import { DraftRow, StructuredDataAttribute } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Строки черновика → значение фильтра `valueType: "features"`.
|
|
5
|
+
*
|
|
6
|
+
* В `properties` попадают ВСЕ атрибуты схемы, а не только показанные колонками: схема и вид
|
|
7
|
+
* разделены, и вид не должен резать данные. Геометрия не поддерживается — `geometry: null`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const toFeaturesFilterValue: (rows: DraftRow[], schema: StructuredDataAttribute[]) => FeaturesFilterValue;
|
|
10
|
+
/**
|
|
11
|
+
* Значение фильтра → строки черновика. Нужно режиму без источника: вернувшись на страницу,
|
|
12
|
+
* пользователь видит набранную ранее структуру, а не пустую таблицу.
|
|
13
|
+
*/
|
|
14
|
+
export declare const fromFeaturesFilterValue: (value: FeaturesFilterValue, schema: StructuredDataAttribute[]) => DraftRow[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Api } from '@evergis/api';
|
|
2
|
+
import { DraftRow, StructuredDataAttribute } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Применяет черновик к слою источника: удаление → обновление → создание.
|
|
5
|
+
*
|
|
6
|
+
* Порядок важен: удаление первым освобождает уникальные значения, которые могут быть заняты
|
|
7
|
+
* создаваемыми строками. В features-API уходят только редактируемые атрибуты — значение
|
|
8
|
+
* нередактируемого принадлежит источнику, а у новой строки его попросту нет.
|
|
9
|
+
*
|
|
10
|
+
* Возвращает соответствие «ключ строки → id созданного объекта»: без него повторное сохранение
|
|
11
|
+
* создало бы дубли вместо обновления только что добавленных строк.
|
|
12
|
+
*/
|
|
13
|
+
export declare const saveToSource: ({ api, layerName, rows, schema, }: {
|
|
14
|
+
api: Api;
|
|
15
|
+
layerName: string;
|
|
16
|
+
rows: DraftRow[];
|
|
17
|
+
schema: StructuredDataAttribute[];
|
|
18
|
+
}) => Promise<Record<string, string>>;
|
|
@@ -18,6 +18,7 @@ export * from './PagesContainer';
|
|
|
18
18
|
export * from './ProgressContainer';
|
|
19
19
|
export * from './RoundedBackgroundContainer';
|
|
20
20
|
export * from './SlideshowContainer';
|
|
21
|
+
export * from './StructuredDataContainer';
|
|
21
22
|
export * from './TabsContainer';
|
|
22
23
|
export * from './TitleContainer';
|
|
23
24
|
export * from './TwoColumnContainer';
|
|
@@ -59,5 +59,6 @@ export declare const getContainerComponents: () => {
|
|
|
59
59
|
readonly EditGroup: FC<import('../componentTypes').EditGroupContainerProps>;
|
|
60
60
|
readonly ContainersGroup: FC<import('../componentTypes').ContainersGroupContainerProps>;
|
|
61
61
|
readonly GridRow: FC<import('../componentTypes').GridRowContainerProps>;
|
|
62
|
+
readonly StructuredData: FC<import('../componentTypes').StructuredDataContainerProps>;
|
|
62
63
|
readonly default: FC<import('../componentTypes').ContainersGroupContainerProps>;
|
|
63
64
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TableCellProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Ячейка таблицы.
|
|
5
|
+
*
|
|
6
|
+
* Вне фокуса значение всегда показано через `stringFormat` — редактор подставляется по клику.
|
|
7
|
+
* Иначе форматирование (округление, разряды, единицы) пришлось бы дублировать внутри инпута,
|
|
8
|
+
* а вводить в отформатированное поле нельзя.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TableCell: FC<TableCellProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Признак времени в шаблоне `stringFormat.format`.
|
|
3
|
+
*
|
|
4
|
+
* Варианты времени в конфигурации атрибута — `hh:mm`, `hh:mm tt`, `hh:mm:ss`, `hh:mm:ss tt`
|
|
5
|
+
* (см. `timeOptions` в `utils/format`), поэтому достаточно найти часы с минутами.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TIME_FORMAT: RegExp;
|
|
8
|
+
/**
|
|
9
|
+
* Контейнер порталов `@evergis/uilib-gl` — в него попадают выпадающие слои контролов,
|
|
10
|
+
* в том числе календарь `DatePicker`. Клик по ним DOM-деревом лежит вне ячейки, поэтому
|
|
11
|
+
* закрытие редактора по клику снаружи обязано этот контейнер пропускать.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PORTAL_ROOT_SELECTOR = "#portal-root";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ElementTableProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Представление структурированных данных в виде таблицы.
|
|
5
|
+
*
|
|
6
|
+
* Данные, схему и колбэки правки берёт из `StructuredDataContext` родительского
|
|
7
|
+
* `StructuredDataContainer` — вне контейнера показывать нечего.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ElementTable: FC<ElementTableProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const TableWrapper: import('styled-components').StyledComponent<"table", any, {}, never>;
|
|
2
|
+
/** Шапка липнет к верху области прокрутки — при длинной таблице заголовки остаются видны. */
|
|
3
|
+
export declare const TableHead: import('styled-components').StyledComponent<"thead", any, {}, never>;
|
|
4
|
+
export declare const TableHeadCell: import('styled-components').StyledComponent<"th", any, {
|
|
5
|
+
$sortable?: boolean;
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const TableHeadContent: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
8
|
+
export declare const TableRow: import('styled-components').StyledComponent<"tr", any, {}, never>;
|
|
9
|
+
export declare const TableCellWrapper: import('styled-components').StyledComponent<"td", any, {}, never>;
|
|
10
|
+
/** Колонка действий: узкая, не растягивается содержимым. */
|
|
11
|
+
export declare const TableActionsCell: import('styled-components').StyledComponent<"td", any, {}, never>;
|
|
12
|
+
export declare const CellText: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
13
|
+
/**
|
|
14
|
+
* Редактируемая ячейка вне фокуса. Показывает значение по `stringFormat`, а редактор
|
|
15
|
+
* подставляется по клику — иначе форматирование пришлось бы дублировать внутри инпута.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CellButton: import('styled-components').StyledComponent<"button", any, {}, never>;
|
|
18
|
+
export declare const CellPlaceholder: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
19
|
+
/**
|
|
20
|
+
* Ячейка в режиме правки: редактор лежит поверх невидимой копии значения.
|
|
21
|
+
*
|
|
22
|
+
* Копия остаётся в потоке и держит ширину колонки ровно такой, какой она была до клика, —
|
|
23
|
+
* иначе таблица дёргалась бы на каждый вход в правку и выход из неё.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CellEditor: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const CellGhost: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
27
|
+
export declare const CellField: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
28
|
+
export declare const TableEmpty: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FeatureAttributeValue } from '../../../../types';
|
|
2
|
+
import { DraftRow, StructuredDataAttribute } from '../../containers/StructuredDataContainer/types';
|
|
3
|
+
export type SortDirection = "asc" | "desc";
|
|
4
|
+
/** Сортировка представления: одна колонка за раз, `null` — исходный порядок строк. */
|
|
5
|
+
export interface TableSort {
|
|
6
|
+
attributeName: string;
|
|
7
|
+
direction: SortDirection;
|
|
8
|
+
}
|
|
9
|
+
export interface TableCellProps {
|
|
10
|
+
attribute: StructuredDataAttribute;
|
|
11
|
+
row: DraftRow;
|
|
12
|
+
/** Правка разрешена контейнером (`options.editMode`). Иначе ячейка — только текст. */
|
|
13
|
+
canEdit: boolean;
|
|
14
|
+
onChange: (key: string, attributeName: string, value: FeatureAttributeValue) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Режим правки одной ячейки: открывается кликом по значению, закрывается кликом снаружи.
|
|
4
|
+
*
|
|
5
|
+
* Закрывать по `blur` нельзя: `DatePicker` уводит фокус из поля уже на клике по иконке
|
|
6
|
+
* календаря — редактор исчезал бы раньше, чем календарь успевал открыться. Поэтому слушаем
|
|
7
|
+
* `mousedown` на документе, а клики внутри портала (`#portal-root`) считаем «своими»:
|
|
8
|
+
* выпадающие слои контролов uilib живут именно там, вне DOM-поддерева ячейки.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useCellEditing: () => {
|
|
11
|
+
editing: boolean;
|
|
12
|
+
editorRef: import('react').MutableRefObject<HTMLDivElement>;
|
|
13
|
+
startEditing: () => void;
|
|
14
|
+
onKeyDown: ({ key }: KeyboardEvent<HTMLDivElement>) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ElementTableConfig } from '../../types';
|
|
2
|
+
import { TableSort } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Вид таблицы: набор и порядок колонок из `columnNames` плюс локальная сортировка.
|
|
5
|
+
*
|
|
6
|
+
* Сортировка живёт здесь, а не в контейнере: она ничего не меняет в данных и не должна
|
|
7
|
+
* влиять на порядок строк, уходящих в фильтр.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTableView: (elementConfig?: ElementTableConfig) => {
|
|
10
|
+
context: import('../../containers/StructuredDataContainer/types').StructuredDataContextValue;
|
|
11
|
+
columns: import('../../containers/StructuredDataContainer/types').StructuredDataAttribute[];
|
|
12
|
+
rows: import('../../containers/StructuredDataContainer/types').DraftRow[];
|
|
13
|
+
sort: TableSort;
|
|
14
|
+
sortEnabled: boolean;
|
|
15
|
+
onSortToggle: (attributeName: string) => void;
|
|
16
|
+
};
|