@evergis/react 4.0.59 → 4.0.61
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/dist/components/Dashboard/branded.d.ts +52 -0
- package/dist/components/Dashboard/componentTypes.d.ts +571 -0
- package/dist/components/Dashboard/containers/AddFeatureContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/AttachmentContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/CameraContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/ChartContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/ContainersGroupContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/DataSourceContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/DataSourceProgressContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/DefaultAttributesContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/DividerContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditAttachmentContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditBooleanContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditCheckboxContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditChipsContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditDateContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditDropdownContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditGroupContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditNumberContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/components/EditStringContainer.d.ts +2 -2
- package/dist/components/Dashboard/containers/EditContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/ExportPdfContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/FiltersContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/IconContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/ImageContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/LayersContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/OneColumnContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/PagesContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/SlideshowContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/TabsContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/TaskContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/TitleContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/TwoColumnContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/UploadContainer/index.d.ts +2 -2
- package/dist/components/Dashboard/containers/registry.d.ts +37 -34
- package/dist/components/Dashboard/elements/ElementButton/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementCamera/types.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementChart/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementChips/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementControl/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementIcon/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementImage/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementLegend/index.d.ts +2 -4
- package/dist/components/Dashboard/elements/ElementLink/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementMarkdown/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementModal/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementSlideshow/types.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementSvg/index.d.ts +2 -6
- package/dist/components/Dashboard/elements/ElementTooltip/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementUploader/index.d.ts +2 -2
- package/dist/components/Dashboard/elements/registry.d.ts +12 -14
- package/dist/components/Dashboard/hooks/useWidgetConfig.d.ts +5 -1
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +12 -1
- package/dist/components/Dashboard/hooks/useWidgetPage.d.ts +4 -1
- package/dist/components/Dashboard/types.d.ts +197 -93
- package/dist/index.js +78 -12
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +67 -13
- package/dist/react.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,6 +6,31 @@ import { CircleLayerSpecification, FillLayerSpecification, LineLayerSpecificatio
|
|
|
6
6
|
import { AttributeFormatConfigurationDc, AttributeType, EqlRequestDc, FeatureDc, OgcGeometryType, PagedFeaturesListDc, PositionDc, QueryLayerServiceInfoDc, RemoteTaskStatus, StringSubType, AttributesConfigurationDc } from '@evergis/api';
|
|
7
7
|
import { FeatureAttributeValue, EditGeometryType, ThemeName } from '../../types';
|
|
8
8
|
import { InnerContainerProps } from './containers/DataSourceInnerContainer/types';
|
|
9
|
+
export * from './componentTypes';
|
|
10
|
+
export * from './branded';
|
|
11
|
+
/** Список допустимых типов диаграммы. `as const` даёт runtime-доступ для dropdown-ов. */
|
|
12
|
+
export declare const CHART_TYPES: readonly ["bar", "line", "pie", "stack"];
|
|
13
|
+
export type ChartType = (typeof CHART_TYPES)[number];
|
|
14
|
+
/** Выравнивание текста/блоков. */
|
|
15
|
+
export declare const ALIGNMENTS: readonly ["left", "center", "right"];
|
|
16
|
+
export type Alignment = (typeof ALIGNMENTS)[number];
|
|
17
|
+
/** Режим отображения коллекций. */
|
|
18
|
+
export declare const VIEW_MODES: readonly ["grid", "list"];
|
|
19
|
+
export type ViewMode = (typeof VIEW_MODES)[number];
|
|
20
|
+
/**
|
|
21
|
+
* CSS-длина для `fontSize`/etc. Template literal type ловит грубые ошибки вроде
|
|
22
|
+
* `fontSize: "fourteen"`, при этом пропускает корректные `"1rem"`, `"14px"`, `"100%"`, ...
|
|
23
|
+
*
|
|
24
|
+
* Применяется как **opt-in** для нового кода; ConfigOptions.fontSize пока остаётся `string`
|
|
25
|
+
* ради совместимости с legacy-конфигами.
|
|
26
|
+
*/
|
|
27
|
+
export type CssLength = `${number}rem` | `${number}px` | `${number}em` | `${number}%`;
|
|
28
|
+
export type DesignToken = `var(--${string})`;
|
|
29
|
+
export type FontSizeToken = CssLength | DesignToken | "larger" | "smaller";
|
|
30
|
+
/** CSS-цвет — рамочная проверка, не валидирует hex-формат полностью. */
|
|
31
|
+
export type CssColor = `#${string}` | `rgb(${string})` | `rgba(${string})` | `hsl(${string})` | `hsla(${string})` | `var(--${string})` | "transparent" | "currentColor" | "inherit";
|
|
32
|
+
/** Расширение файла одной строкой: `".csv"`, `".csv,.txt"`. */
|
|
33
|
+
export type FileExtensions = `.${string}` | `.${string},${string}`;
|
|
9
34
|
export interface DashboardsProps {
|
|
10
35
|
zIndex?: CSSProperties["zIndex"];
|
|
11
36
|
}
|
|
@@ -63,120 +88,186 @@ export interface CustomFeatureSelect {
|
|
|
63
88
|
layout?: FillLayerSpecification["layout"];
|
|
64
89
|
};
|
|
65
90
|
}
|
|
66
|
-
|
|
67
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Доменная группировка опций конфига.
|
|
93
|
+
*
|
|
94
|
+
* Идея — разбить flat-интерфейс {@link ConfigOptions} (100+ полей) на тематические миксины:
|
|
95
|
+
* Layout, Typography, Chart, Visual, ... — чтобы `<Name>Options` можно было собирать через
|
|
96
|
+
* `Pick<ConfigLayoutOptions, ...>` и сразу видеть «характер компонента».
|
|
97
|
+
*
|
|
98
|
+
* `ConfigOptions` остаётся плоским fallback-объединением всех доменов (extends всех миксинов),
|
|
99
|
+
* поэтому существующий код, использующий `Pick<ConfigOptions, ...>`, продолжает работать.
|
|
100
|
+
*
|
|
101
|
+
* Поля с пометкой ⚠️ entity-ref — это runtime-связи (`chartId`, `tabId`, `filterName`, ...),
|
|
102
|
+
* концептуально принадлежат домену {@link ConfigEntityRefOptions} и могут получить branded types.
|
|
103
|
+
*/
|
|
104
|
+
/** Размеры и раскладка. */
|
|
105
|
+
export interface ConfigLayoutOptions {
|
|
106
|
+
width?: number;
|
|
107
|
+
height?: number;
|
|
108
|
+
padding?: number;
|
|
109
|
+
radius?: number;
|
|
110
|
+
cornerRadius?: number;
|
|
111
|
+
column?: boolean;
|
|
112
|
+
twoColumns?: boolean;
|
|
113
|
+
align?: Alignment;
|
|
114
|
+
center?: boolean;
|
|
68
115
|
innerTemplateStyle?: CSSProperties;
|
|
69
|
-
position?: PositionDc;
|
|
70
|
-
themeName?: ThemeName;
|
|
71
|
-
relatedDataSources?: ConfigRelatedDataSource[];
|
|
72
|
-
relatedAttributes?: ConfigRelatedAttribute[];
|
|
73
|
-
relatedResources?: ConfigRelatedResource[];
|
|
74
|
-
statusColors?: Record<RemoteTaskStatus, string>;
|
|
75
|
-
chartType?: "bar" | "line" | "pie" | "stack";
|
|
76
|
-
layerNames?: string[];
|
|
77
|
-
layerName?: string;
|
|
78
|
-
geometryType?: OgcGeometryType | EditGeometryType;
|
|
79
|
-
fileExtensions?: string;
|
|
80
|
-
parentResourceId?: string;
|
|
81
|
-
srid?: string;
|
|
82
|
-
title?: string;
|
|
83
|
-
label?: string;
|
|
84
116
|
withPadding?: boolean;
|
|
85
117
|
withDivider?: boolean;
|
|
86
|
-
dotSnapping?: boolean;
|
|
87
118
|
bottomBlur?: boolean;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
119
|
+
noMargin?: boolean;
|
|
120
|
+
maxTextWidth?: number;
|
|
121
|
+
barWidth?: number;
|
|
122
|
+
barHeight?: number;
|
|
123
|
+
}
|
|
124
|
+
/** Типографика и цвета. */
|
|
125
|
+
export interface ConfigTypographyOptions {
|
|
126
|
+
fontSize?: string;
|
|
127
|
+
fontColor?: string;
|
|
95
128
|
bgColor?: string;
|
|
129
|
+
backgroundColor?: string;
|
|
130
|
+
primaryColor?: string;
|
|
131
|
+
defaultColor?: string;
|
|
96
132
|
noBg?: boolean;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
133
|
+
colors?: string[];
|
|
134
|
+
colorAttribute?: string;
|
|
135
|
+
statusColors?: Record<RemoteTaskStatus, string>;
|
|
136
|
+
}
|
|
137
|
+
/** Поведение «раскрытия». */
|
|
138
|
+
export interface ConfigExpandableOptions {
|
|
139
|
+
expandable?: boolean;
|
|
140
|
+
expanded?: boolean;
|
|
141
|
+
expandLength?: number;
|
|
142
|
+
}
|
|
143
|
+
/** Связь с источником данных. */
|
|
144
|
+
export interface ConfigDataSourceBindingOptions {
|
|
145
|
+
/** ⚠️ entity-ref: имя источника. */
|
|
146
|
+
relatedDataSource?: string;
|
|
147
|
+
relatedDataSources?: ConfigRelatedDataSource[];
|
|
148
|
+
relatedAttributes?: ConfigRelatedAttribute[];
|
|
149
|
+
relatedResources?: ConfigRelatedResource[];
|
|
150
|
+
responseFilters?: Record<string, string>;
|
|
151
|
+
hideIfEmptyDataSource?: string;
|
|
152
|
+
}
|
|
153
|
+
/** Опции графика. */
|
|
154
|
+
export interface ConfigChartOptions {
|
|
155
|
+
chartType?: ChartType;
|
|
156
|
+
/** ⚠️ entity-ref: ссылка на ChartContainer по id. */
|
|
112
157
|
chartId?: string;
|
|
158
|
+
markers?: BarChartMarker[] | string;
|
|
159
|
+
showLabels?: boolean;
|
|
160
|
+
showMarkers?: number;
|
|
113
161
|
showTotal?: boolean;
|
|
114
162
|
totalWord?: string;
|
|
115
163
|
totalAttribute?: string;
|
|
116
|
-
|
|
117
|
-
width?: number;
|
|
118
|
-
height?: number;
|
|
119
|
-
barWidth?: number;
|
|
120
|
-
barHeight?: number;
|
|
121
|
-
showLabels?: boolean;
|
|
122
|
-
showMarkers?: number;
|
|
123
|
-
markers?: BarChartMarker[] | string;
|
|
164
|
+
dotSnapping?: boolean;
|
|
124
165
|
drawMinMax?: boolean;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
166
|
+
angle?: number;
|
|
167
|
+
}
|
|
168
|
+
/** Иконки/изображения. */
|
|
169
|
+
export interface ConfigVisualOptions {
|
|
170
|
+
icon?: IconTypesKeys;
|
|
171
|
+
iconAttribute?: string;
|
|
172
|
+
image?: string;
|
|
173
|
+
overlay?: string;
|
|
174
|
+
onlyIcon?: boolean;
|
|
175
|
+
bigIcon?: boolean;
|
|
176
|
+
big?: boolean;
|
|
177
|
+
tagView?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/** Текст/заголовок. */
|
|
180
|
+
export interface ConfigTextDisplayOptions {
|
|
181
|
+
title?: string;
|
|
182
|
+
label?: string;
|
|
183
|
+
placeholder?: string;
|
|
184
|
+
hideTitle?: boolean;
|
|
185
|
+
simple?: boolean;
|
|
131
186
|
maxLength?: number;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
187
|
+
separator?: string;
|
|
188
|
+
lineBreak?: string;
|
|
189
|
+
}
|
|
190
|
+
/** Список/коллекция. */
|
|
191
|
+
export interface ConfigCollectionOptions {
|
|
137
192
|
shownItems?: number;
|
|
138
193
|
otherItems?: number;
|
|
139
|
-
angle?: number;
|
|
140
|
-
resolution?: number;
|
|
141
194
|
orderByValue?: boolean;
|
|
142
195
|
orderByTitle?: boolean;
|
|
143
|
-
|
|
144
|
-
expanded?: boolean;
|
|
145
|
-
expandLength?: number;
|
|
146
|
-
wrap?: boolean;
|
|
147
|
-
icon?: IconTypesKeys;
|
|
148
|
-
iconUrl?: string;
|
|
149
|
-
big?: boolean;
|
|
150
|
-
bigIcon?: boolean;
|
|
151
|
-
onlyIcon?: boolean;
|
|
196
|
+
viewMode?: ViewMode;
|
|
152
197
|
hideEmpty?: boolean;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
198
|
+
limit?: number;
|
|
199
|
+
}
|
|
200
|
+
/** Карта/слои. */
|
|
201
|
+
export interface ConfigMapLayerOptions {
|
|
202
|
+
/** ⚠️ entity-ref: имя слоя. */
|
|
203
|
+
layerName?: string;
|
|
204
|
+
/** ⚠️ entity-ref: имена слоёв. */
|
|
205
|
+
layerNames?: string[];
|
|
206
|
+
geometryType?: OgcGeometryType | EditGeometryType;
|
|
207
|
+
baseMapName?: string;
|
|
208
|
+
baseMapSettings?: Record<string, BaseMapSettings>;
|
|
209
|
+
expandedLayers?: boolean;
|
|
210
|
+
customFeatureSelect?: CustomFeatureSelect;
|
|
211
|
+
pitch?: number;
|
|
212
|
+
bearing?: number;
|
|
213
|
+
srid?: string;
|
|
214
|
+
maxZoomTo?: number;
|
|
215
|
+
position?: PositionDc;
|
|
216
|
+
resolution?: number;
|
|
217
|
+
}
|
|
218
|
+
/** Контролы редактирования / фильтры. */
|
|
219
|
+
export interface ConfigEditOptions {
|
|
160
220
|
control?: ConfigControl;
|
|
161
221
|
controls?: ConfigControl[];
|
|
222
|
+
/** ⚠️ entity-ref на ConfigFilter. */
|
|
162
223
|
filterName?: string;
|
|
224
|
+
/** ⚠️ entity-ref на ConfigFilter. */
|
|
163
225
|
searchFilterName?: string;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
226
|
+
variants?: IOption[] | ChipOption[];
|
|
227
|
+
multiSelect?: boolean;
|
|
228
|
+
withTime?: boolean;
|
|
229
|
+
step?: number;
|
|
230
|
+
minValue?: number | Date;
|
|
231
|
+
maxValue?: number | Date;
|
|
232
|
+
noEmptyOption?: boolean;
|
|
233
|
+
fileExtensions?: string;
|
|
234
|
+
}
|
|
235
|
+
/** Ссылки на сущности по id/name. */
|
|
236
|
+
export interface ConfigEntityRefOptions {
|
|
237
|
+
chartId?: string;
|
|
175
238
|
modalId?: string;
|
|
239
|
+
tabId?: string;
|
|
240
|
+
filterName?: string;
|
|
241
|
+
searchFilterName?: string;
|
|
242
|
+
layerName?: string;
|
|
243
|
+
layerNames?: string[];
|
|
244
|
+
relatedDataSource?: string;
|
|
245
|
+
parentResourceId?: string;
|
|
246
|
+
downloadById?: string;
|
|
247
|
+
}
|
|
248
|
+
/** Прочее — поля без явного домена, обычно широкого назначения. */
|
|
249
|
+
export interface ConfigMiscOptions {
|
|
250
|
+
innerTemplateName?: ContainerTemplate;
|
|
251
|
+
themeName?: ThemeName;
|
|
176
252
|
url?: string;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
253
|
+
inlineUnits?: boolean;
|
|
254
|
+
noUnits?: boolean;
|
|
255
|
+
attributes?: string[];
|
|
256
|
+
useProjectHiddenAttributes?: boolean;
|
|
257
|
+
innerValue?: boolean;
|
|
258
|
+
groupTooltip?: boolean;
|
|
259
|
+
wrap?: boolean;
|
|
260
|
+
modalId?: string;
|
|
261
|
+
tabId?: string;
|
|
262
|
+
downloadById?: string;
|
|
263
|
+
parentResourceId?: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Flat-объединение всех доменных миксинов. Существующие места, использующие
|
|
267
|
+
* `Pick<ConfigOptions, ...>`, продолжают работать. Для нового кода предпочтительно делать
|
|
268
|
+
* `Pick<Config<Domain>Options, ...>` — это лучше документирует, к какому домену относится опция.
|
|
269
|
+
*/
|
|
270
|
+
export interface ConfigOptions extends ConfigLayoutOptions, ConfigTypographyOptions, ConfigExpandableOptions, ConfigDataSourceBindingOptions, ConfigChartOptions, ConfigVisualOptions, ConfigTextDisplayOptions, ConfigCollectionOptions, ConfigMapLayerOptions, ConfigEditOptions, ConfigMiscOptions {
|
|
180
271
|
}
|
|
181
272
|
export interface ConfigDataSource {
|
|
182
273
|
name: string;
|
|
@@ -292,9 +383,23 @@ export interface ConfigContainer {
|
|
|
292
383
|
header?: ConfigContainerHeader;
|
|
293
384
|
}
|
|
294
385
|
export type FilterType = "checkbox" | "rangeNumber" | "rangeDate" | "text" | "dropdown" | "barChart" | "chips";
|
|
386
|
+
/**
|
|
387
|
+
* Литеральный union значений {@link ConfigContainerChild.type}.
|
|
388
|
+
*
|
|
389
|
+
* Делится на две группы:
|
|
390
|
+
* - text/attribute-рендеры (обрабатываются в `utils/getElementValue.tsx`): `"text"`, `"attributeAlias"`,
|
|
391
|
+
* `"attributeValue"`, `"attributeUnits"`, `"attributeDescription"`, `"layerName"`.
|
|
392
|
+
* - элементы-компоненты (`elements/registry.ts`): `"control"`, `"image"`, `"slideshow"`, `"svg"`,
|
|
393
|
+
* `"icon"`, `"tooltip"`, `"tags"`, `"link"`, `"button"`, `"camera"`, `"chart"`, `"legend"`,
|
|
394
|
+
* `"markdown"`, `"uploader"`, `"modal"`.
|
|
395
|
+
*
|
|
396
|
+
* Slot-id (`"alias"`, `"value"`, `"units"`, ...) сюда **не относится** — это значения поля
|
|
397
|
+
* `id`, см. parent-specific child-типы.
|
|
398
|
+
*/
|
|
399
|
+
export type ConfigElementType = "text" | "attributeAlias" | "attributeValue" | "attributeUnits" | "attributeDescription" | "layerName" | "control" | "image" | "slideshow" | "svg" | "icon" | "tooltip" | "tags" | "link" | "button" | "camera" | "chart" | "legend" | "markdown" | "uploader" | "modal";
|
|
295
400
|
export interface ConfigContainerChild extends Partial<ConfigContainer> {
|
|
296
401
|
id?: string;
|
|
297
|
-
type?:
|
|
402
|
+
type?: ConfigElementType;
|
|
298
403
|
templateName?: ContainerTemplate | HeaderTemplate;
|
|
299
404
|
value?: string | number;
|
|
300
405
|
defaultValue?: string | number;
|
|
@@ -420,4 +525,3 @@ export type ClientFeatureAttribute = {
|
|
|
420
525
|
stringFormat?: AttributeFormatConfigurationDc;
|
|
421
526
|
clientData?: unknown;
|
|
422
527
|
};
|
|
423
|
-
export {};
|
package/dist/index.js
CHANGED
|
@@ -3361,6 +3361,26 @@ Transform.prototype = {
|
|
|
3361
3361
|
|
|
3362
3362
|
Transform.prototype;
|
|
3363
3363
|
|
|
3364
|
+
// ── Конструкторы (single-source casting) ─────────────────────────────────────
|
|
3365
|
+
const asContainerId = (value) => value;
|
|
3366
|
+
const asChartId = (value) => value;
|
|
3367
|
+
const asModalId = (value) => value;
|
|
3368
|
+
const asTabId = (value) => value;
|
|
3369
|
+
const asFilterName = (value) => value;
|
|
3370
|
+
const asLayerName = (value) => value;
|
|
3371
|
+
const asAttributeName = (value) => value;
|
|
3372
|
+
const asDataSourceName = (value) => value;
|
|
3373
|
+
const asResourceId = (value) => value;
|
|
3374
|
+
|
|
3375
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
3376
|
+
// ЛИТЕРАЛЫ И CSS-ТОКЕНЫ
|
|
3377
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
3378
|
+
/** Список допустимых типов диаграммы. `as const` даёт runtime-доступ для dropdown-ов. */
|
|
3379
|
+
const CHART_TYPES = ["bar", "line", "pie", "stack"];
|
|
3380
|
+
/** Выравнивание текста/блоков. */
|
|
3381
|
+
const ALIGNMENTS = ["left", "center", "right"];
|
|
3382
|
+
/** Режим отображения коллекций. */
|
|
3383
|
+
const VIEW_MODES = ["grid", "list"];
|
|
3364
3384
|
exports.ContainerTemplate = void 0;
|
|
3365
3385
|
(function (ContainerTemplate) {
|
|
3366
3386
|
ContainerTemplate["Pages"] = "Pages";
|
|
@@ -4081,6 +4101,17 @@ const ServerNotificationsProvider = ({ url, initialized, apiClient, children })
|
|
|
4081
4101
|
}, children: children }));
|
|
4082
4102
|
};
|
|
4083
4103
|
|
|
4104
|
+
/**
|
|
4105
|
+
* Контекст виджет-фрейма. Возвращаемый объект включает поля и {@link DashboardContext},
|
|
4106
|
+
* и {@link FeatureCardContext}, а гибридные (`config`, `isEditing`, `isLoading`, `pageIndex`,
|
|
4107
|
+
* `filters`, `changeFilters`, `dataSources`, `expandContainer`, `expandedContainers`,
|
|
4108
|
+
* `selectedTabId`, `setSelectedTabId`, `nextPage`, `prevPage`, `changePage`) выбираются по `type`.
|
|
4109
|
+
*
|
|
4110
|
+
* Generic-параметр `T extends WidgetType` сейчас используется только как **намерение** —
|
|
4111
|
+
* сигнализирует, под какой виджет настраивается код. Дальнейшее сужение возвращаемого типа
|
|
4112
|
+
* через `WidgetContextMap[T]` потребует разделения {@link DashboardContext} и
|
|
4113
|
+
* {@link FeatureCardContext} на пересекающуюся базу и виджет-специфичные расширения.
|
|
4114
|
+
*/
|
|
4084
4115
|
const useWidgetContext = (type = exports.WidgetType.Dashboard) => {
|
|
4085
4116
|
const { toggleLayersVisibility, visibleLayers, projectInfo, updateProject, layerInfos, geometryFilter, dashboardLayers, setDashboardLayer, components: dashboardComponents, selectAttachmentsFromCatalog, config: dashboardConfig, containerIds, pageIndex: projectPageIndex, selectedTabId: projectSelectedTabId, setSelectedTabId: setProjectSelectedTabId, dataSources: projectDataSources, loading: projectLoading, editMode: projectEditMode, filters: projectFilters, changeFilters: projectChangeFilters, expandContainer: projectExpandContainer, expandedContainers: projectExpandedContainers, nextPage: projectNextPage, prevPage: projectPrevPage, changePage: projectChangePage, } = React.useContext(DashboardContext) || {};
|
|
4086
4117
|
const { layerInfo, attributes, feature, controls, changeControls, closeFeatureCard, config: featureConfig, pageIndex: featurePageIndex, selectedTabId: featureSelectedTabId, setSelectedTabId: setFeatureSelectedTabId, dataSources: featureDataSources, loading: featureLoading, editMode: featureEditMode, filters: featureFilters, changeFilters: featureChangeFilters, expandContainer: featureExpandContainer, expandedContainers: featureExpandedContainers, nextPage: featureNextPage, prevPage: featurePrevPage, changePage: featureChangePage, } = React.useContext(FeatureCardContext) || {};
|
|
@@ -8477,17 +8508,22 @@ const DividerContainer = React.memo(({ elementConfig, config }) => {
|
|
|
8477
8508
|
return (jsxRuntime.jsx(Container, { id: id, style: style, children: jsxRuntime.jsx(ContainerDivider, { "$bgColor": config?.options?.bgColor }) }));
|
|
8478
8509
|
});
|
|
8479
8510
|
|
|
8511
|
+
// `ProgressContainer` и `RoundedBackgroundContainer` исторически принимают `InnerContainerProps`
|
|
8512
|
+
// (см. `DataSourceInnerContainer/types.ts`). `<Name>ContainerProps` ⊆ `InnerContainerProps`
|
|
8513
|
+
// по структуре — каст оправдан, расхождение только в generic-параметре `propTypes`.
|
|
8514
|
+
const ProgressContainerTyped = ProgressContainer;
|
|
8515
|
+
const RoundedBackgroundContainerTyped = RoundedBackgroundContainer;
|
|
8480
8516
|
const containerComponents = {
|
|
8481
8517
|
[exports.ContainerTemplate.DefaultAttributes]: DefaultAttributesContainer,
|
|
8482
8518
|
[exports.ContainerTemplate.Pages]: PagesContainer,
|
|
8483
8519
|
[exports.ContainerTemplate.Tabs]: TabsContainer,
|
|
8484
8520
|
[exports.ContainerTemplate.Title]: TitleContainer,
|
|
8485
|
-
[exports.ContainerTemplate.RoundedBackground]:
|
|
8521
|
+
[exports.ContainerTemplate.RoundedBackground]: RoundedBackgroundContainerTyped,
|
|
8486
8522
|
[exports.ContainerTemplate.OneColumn]: OneColumnContainer,
|
|
8487
8523
|
[exports.ContainerTemplate.TwoColumn]: TwoColumnContainer,
|
|
8488
8524
|
[exports.ContainerTemplate.DataSource]: DataSourceContainer,
|
|
8489
8525
|
[exports.ContainerTemplate.DataSourceProgress]: DataSourceProgressContainer,
|
|
8490
|
-
[exports.ContainerTemplate.Progress]:
|
|
8526
|
+
[exports.ContainerTemplate.Progress]: ProgressContainerTyped,
|
|
8491
8527
|
[exports.ContainerTemplate.Image]: ImageContainer,
|
|
8492
8528
|
[exports.ContainerTemplate.Icon]: IconContainer,
|
|
8493
8529
|
[exports.ContainerTemplate.Layers]: LayersContainer,
|
|
@@ -8511,6 +8547,7 @@ const containerComponents = {
|
|
|
8511
8547
|
[exports.ContainerTemplate.EditAttachment]: EditAttachmentContainer,
|
|
8512
8548
|
[exports.ContainerTemplate.Attachment]: AttachmentContainer,
|
|
8513
8549
|
[exports.ContainerTemplate.EditGroup]: EditGroupContainer,
|
|
8550
|
+
[exports.ContainerTemplate.ContainersGroup]: ContainersGroupContainer,
|
|
8514
8551
|
default: ContainersGroupContainer,
|
|
8515
8552
|
};
|
|
8516
8553
|
|
|
@@ -10310,7 +10347,9 @@ const getElementValue = ({ getDefaultContainer, ...props }) => {
|
|
|
10310
10347
|
if (type === "layerName") {
|
|
10311
10348
|
return layerInfo?.name || "";
|
|
10312
10349
|
}
|
|
10313
|
-
const ElementComponent = type
|
|
10350
|
+
const ElementComponent = (type && type in elementComponents
|
|
10351
|
+
? elementComponents[type]
|
|
10352
|
+
: null);
|
|
10314
10353
|
return ElementComponent ? (jsxRuntime.jsx(ElementComponent, { ...props })) : (getDefaultContainer?.());
|
|
10315
10354
|
};
|
|
10316
10355
|
|
|
@@ -11749,6 +11788,10 @@ const useChartChange = ({ dataSources, chartId, width, height, relatedAttributes
|
|
|
11749
11788
|
return [customize, onChange];
|
|
11750
11789
|
};
|
|
11751
11790
|
|
|
11791
|
+
/**
|
|
11792
|
+
* Generic-параметр `T` сейчас идёт как намерение (под какой виджет). Дальнейшее сужение
|
|
11793
|
+
* `config` под конкретный виджет — отдельная задача.
|
|
11794
|
+
*/
|
|
11752
11795
|
const useWidgetConfig = (type = exports.WidgetType.Dashboard) => {
|
|
11753
11796
|
const { config: configProp, containerIds, projectInfo, layerInfo, isEditing } = useWidgetContext(type);
|
|
11754
11797
|
const config = React.useMemo(() => {
|
|
@@ -11783,6 +11826,9 @@ const useWidgetConfig = (type = exports.WidgetType.Dashboard) => {
|
|
|
11783
11826
|
};
|
|
11784
11827
|
};
|
|
11785
11828
|
|
|
11829
|
+
/**
|
|
11830
|
+
* Generic-параметр `T` — намерение под виджет. Дальнейшая параметризация — отдельная задача.
|
|
11831
|
+
*/
|
|
11786
11832
|
const useWidgetPage = (type = exports.WidgetType.Dashboard) => {
|
|
11787
11833
|
const { t } = useGlobalContext();
|
|
11788
11834
|
const { pageIndex, changePage, projectInfo, updateProject } = useWidgetContext(type);
|
|
@@ -12161,20 +12207,28 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
12161
12207
|
properties: item.properties || item.attributes,
|
|
12162
12208
|
}))
|
|
12163
12209
|
: items;
|
|
12210
|
+
const rawAttributes = response.status === "fulfilled"
|
|
12211
|
+
? response.value?.attributes
|
|
12212
|
+
: undefined;
|
|
12213
|
+
const normalizedAttributes = Array.isArray(rawAttributes)
|
|
12214
|
+
? rawAttributes
|
|
12215
|
+
: rawAttributes && typeof rawAttributes === "object"
|
|
12216
|
+
? Object.entries(rawAttributes).map(([attributeName, val]) => ({
|
|
12217
|
+
attributeName,
|
|
12218
|
+
...(val && typeof val === "object" ? val : {}),
|
|
12219
|
+
}))
|
|
12220
|
+
: null;
|
|
12164
12221
|
newDataSources[index].attributes =
|
|
12165
12222
|
response.status === "rejected" ||
|
|
12166
12223
|
(!isQueryDataSource && !isPythonDataSource)
|
|
12167
12224
|
? null
|
|
12168
|
-
:
|
|
12169
|
-
?.attributes ||
|
|
12225
|
+
: normalizedAttributes ||
|
|
12170
12226
|
(isPythonDataSource && items?.[0]?.properties
|
|
12171
|
-
? Object.
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
},
|
|
12177
|
-
]))
|
|
12227
|
+
? Object.entries(items[0].properties).map(([attributeName, val]) => ({
|
|
12228
|
+
attributeName,
|
|
12229
|
+
type: typeof val === "number" ? "Float" : "String",
|
|
12230
|
+
isDisplayed: true,
|
|
12231
|
+
}))
|
|
12178
12232
|
: null);
|
|
12179
12233
|
});
|
|
12180
12234
|
return newDataSources;
|
|
@@ -13459,6 +13513,7 @@ const Map$1 = ({ zIndex, lowerSiblings, upperSiblings, onError, children, ...res
|
|
|
13459
13513
|
}, children: children }), upperSiblings] }));
|
|
13460
13514
|
};
|
|
13461
13515
|
|
|
13516
|
+
exports.ALIGNMENTS = ALIGNMENTS;
|
|
13462
13517
|
exports.AddFeatureButton = AddFeatureButton;
|
|
13463
13518
|
exports.AddFeatureContainer = AddFeatureContainer;
|
|
13464
13519
|
exports.AlertIconContainer = AlertIconContainer;
|
|
@@ -13466,6 +13521,7 @@ exports.AttachmentContainer = AttachmentContainer;
|
|
|
13466
13521
|
exports.AttributeGalleryContainer = AttributeGalleryContainer;
|
|
13467
13522
|
exports.AttributeLabel = AttributeLabel;
|
|
13468
13523
|
exports.BASE_CONTAINER_STYLE = BASE_CONTAINER_STYLE;
|
|
13524
|
+
exports.CHART_TYPES = CHART_TYPES;
|
|
13469
13525
|
exports.CONFIG_PAGES_ID = CONFIG_PAGES_ID;
|
|
13470
13526
|
exports.CONFIG_PAGE_ID = CONFIG_PAGE_ID;
|
|
13471
13527
|
exports.CameraContainer = CameraContainer;
|
|
@@ -13619,12 +13675,22 @@ exports.TopContainer = TopContainer;
|
|
|
13619
13675
|
exports.TopContainerButtons = TopContainerButtons;
|
|
13620
13676
|
exports.TwoColumnContainer = TwoColumnContainer;
|
|
13621
13677
|
exports.UploadContainer = UploadContainer;
|
|
13678
|
+
exports.VIEW_MODES = VIEW_MODES;
|
|
13622
13679
|
exports.addDataSource = addDataSource;
|
|
13623
13680
|
exports.addDataSources = addDataSources;
|
|
13624
13681
|
exports.adjustColor = adjustColor;
|
|
13625
13682
|
exports.applyFiltersToCondition = applyFiltersToCondition;
|
|
13626
13683
|
exports.applyQueryFilters = applyQueryFilters;
|
|
13627
13684
|
exports.applyVarsToCondition = applyVarsToCondition;
|
|
13685
|
+
exports.asAttributeName = asAttributeName;
|
|
13686
|
+
exports.asChartId = asChartId;
|
|
13687
|
+
exports.asContainerId = asContainerId;
|
|
13688
|
+
exports.asDataSourceName = asDataSourceName;
|
|
13689
|
+
exports.asFilterName = asFilterName;
|
|
13690
|
+
exports.asLayerName = asLayerName;
|
|
13691
|
+
exports.asModalId = asModalId;
|
|
13692
|
+
exports.asResourceId = asResourceId;
|
|
13693
|
+
exports.asTabId = asTabId;
|
|
13628
13694
|
exports.checkEqualOrIncludes = checkEqualOrIncludes;
|
|
13629
13695
|
exports.checkIsLoading = checkIsLoading;
|
|
13630
13696
|
exports.createConfigLayer = createConfigLayer;
|