@evergis/react 4.0.22-alpha.4 → 4.0.23-alpha.0
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/types.d.ts +4 -4
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +18 -21
- package/dist/react.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { CSSProperties, FC, ReactNode } from 'react';
|
|
|
2
2
|
import { i18n } from 'i18next';
|
|
3
3
|
import { PieChartData, BarChartMarker } from '@evergis/charts';
|
|
4
4
|
import { IconTypesKeys, IOption } from '@evergis/uilib-gl';
|
|
5
|
-
import { AttributeFormatConfigurationDc, AttributeType, EqlRequestDc, FeatureDc, OgcGeometryType, PagedFeaturesListDc, PositionDc, QueryLayerServiceInfoDc, RemoteTaskStatus, StringSubType,
|
|
5
|
+
import { AttributeFormatConfigurationDc, AttributeType, EqlRequestDc, FeatureDc, OgcGeometryType, PagedFeaturesListDc, PositionDc, QueryLayerServiceInfoDc, RemoteTaskStatus, StringSubType, AttributesConfigurationDc } from '@evergis/api';
|
|
6
6
|
import { FeatureAttributeValue, EditGeometryType, ThemeName } from '../../types';
|
|
7
7
|
import { InnerContainerProps } from './containers/DataSourceInnerContainer/types';
|
|
8
8
|
export interface DashboardsProps {
|
|
@@ -171,7 +171,7 @@ export interface ConfigDataSource {
|
|
|
171
171
|
}
|
|
172
172
|
export interface EqlDataSource {
|
|
173
173
|
items: FeatureDc[];
|
|
174
|
-
|
|
174
|
+
attributes?: AttributesConfigurationDc["attributes"];
|
|
175
175
|
}
|
|
176
176
|
export type ConfigFilterValueType = "single" | "range" | "array";
|
|
177
177
|
export interface ConfigFilter {
|
|
@@ -361,13 +361,13 @@ export interface FetchedDataSource {
|
|
|
361
361
|
name: string;
|
|
362
362
|
features: FeatureDc[];
|
|
363
363
|
layerName?: string;
|
|
364
|
-
|
|
364
|
+
attributes?: AttributesConfigurationDc["attributes"];
|
|
365
365
|
}
|
|
366
366
|
export interface WidgetDataSource {
|
|
367
367
|
name: string;
|
|
368
368
|
features: FeatureDc[];
|
|
369
369
|
layerName?: string;
|
|
370
|
-
|
|
370
|
+
attributes?: AttributesConfigurationDc["attributes"];
|
|
371
371
|
}
|
|
372
372
|
export type SelectedFilters = Record<string, SelectedFilter>;
|
|
373
373
|
type DashboardLayerProps = {
|
package/dist/index.js
CHANGED
|
@@ -9734,7 +9734,7 @@ const useBarChartFilter = ({ type, filter, elementConfig }) => {
|
|
|
9734
9734
|
layerInfo: {
|
|
9735
9735
|
configuration: {
|
|
9736
9736
|
attributesConfiguration: {
|
|
9737
|
-
attributes: dataSource?.
|
|
9737
|
+
attributes: dataSource?.attributes,
|
|
9738
9738
|
},
|
|
9739
9739
|
},
|
|
9740
9740
|
},
|
|
@@ -10644,11 +10644,18 @@ const useChartData = ({ element, type }) => {
|
|
|
10644
10644
|
.map(relatedAxis => {
|
|
10645
10645
|
const { dataSourceName, axisColor, attributeName, attributeUnits } = relatedAxis;
|
|
10646
10646
|
const dataSource = configDataSources.find(({ name }) => name === dataSourceName);
|
|
10647
|
-
const layerInfo = layerInfos?.find(item => item?.name === dataSource?.layerName);
|
|
10648
10647
|
const featureDataSource = getDataSource(dataSourceName, dataSources);
|
|
10649
|
-
const
|
|
10650
|
-
|
|
10651
|
-
|
|
10648
|
+
const layerInfo = layerInfos?.find(item => item?.name === dataSource?.layerName) ||
|
|
10649
|
+
(featureDataSource?.attributes
|
|
10650
|
+
? {
|
|
10651
|
+
configuration: {
|
|
10652
|
+
attributesConfiguration: {
|
|
10653
|
+
attributes: featureDataSource.attributes,
|
|
10654
|
+
},
|
|
10655
|
+
},
|
|
10656
|
+
}
|
|
10657
|
+
: null);
|
|
10658
|
+
const hasLayerInfo = !!layerInfo || !!featureDataSource?.features?.length;
|
|
10652
10659
|
return {
|
|
10653
10660
|
items: hasLayerInfo
|
|
10654
10661
|
? getDataFromRelatedFeatures({
|
|
@@ -10657,14 +10664,7 @@ const useChartData = ({ element, type }) => {
|
|
|
10657
10664
|
filters: currentPage?.filters,
|
|
10658
10665
|
relatedConfig: relatedAxis,
|
|
10659
10666
|
dataSource: featureDataSource,
|
|
10660
|
-
layerInfo
|
|
10661
|
-
{
|
|
10662
|
-
configuration: {
|
|
10663
|
-
attributesConfiguration: {
|
|
10664
|
-
attributes: featureDataSource.attributeDefinition,
|
|
10665
|
-
},
|
|
10666
|
-
},
|
|
10667
|
-
},
|
|
10667
|
+
layerInfo,
|
|
10668
10668
|
})
|
|
10669
10669
|
: null,
|
|
10670
10670
|
color: axisColor,
|
|
@@ -10817,7 +10817,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10817
10817
|
const json = await response.json();
|
|
10818
10818
|
return {
|
|
10819
10819
|
items: json.result.items,
|
|
10820
|
-
|
|
10820
|
+
attributes: json.result.attributeDefinition,
|
|
10821
10821
|
};
|
|
10822
10822
|
}
|
|
10823
10823
|
catch (error) {
|
|
@@ -10836,10 +10836,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10836
10836
|
const descriptionResponse = await api.eql.getQueryDescription(getProps);
|
|
10837
10837
|
return {
|
|
10838
10838
|
items: queryResponse.features,
|
|
10839
|
-
|
|
10840
|
-
...acc,
|
|
10841
|
-
[curr.attributeName]: curr,
|
|
10842
|
-
}), {}),
|
|
10839
|
+
attributes: descriptionResponse,
|
|
10843
10840
|
};
|
|
10844
10841
|
}
|
|
10845
10842
|
return api.layers.getFeatures(layerName, {
|
|
@@ -10917,7 +10914,7 @@ const useDataSources = ({ type: widgetType, config, attributes, filters, layerPa
|
|
|
10917
10914
|
(!isQueryDataSource && !isPythonDataSource)
|
|
10918
10915
|
? null
|
|
10919
10916
|
: response.value
|
|
10920
|
-
?.
|
|
10917
|
+
?.attributes ||
|
|
10921
10918
|
(isPythonDataSource && items?.[0]?.properties
|
|
10922
10919
|
? Object.fromEntries(Object.entries(items[0].properties).map(([key, val]) => [
|
|
10923
10920
|
key,
|
|
@@ -11197,10 +11194,10 @@ const useRelatedDataSourceAttributes = ({ type = exports.WidgetType.Dashboard, e
|
|
|
11197
11194
|
{
|
|
11198
11195
|
configuration: {
|
|
11199
11196
|
attributesConfiguration: {
|
|
11200
|
-
attributes: dataSource?.
|
|
11197
|
+
attributes: dataSource?.attributes || {},
|
|
11201
11198
|
},
|
|
11202
11199
|
},
|
|
11203
|
-
}, [currentPage?.dataSources, dataSource?.
|
|
11200
|
+
}, [currentPage?.dataSources, dataSource?.attributes, layerInfos, relatedDataSource]);
|
|
11204
11201
|
const attributes = React.useMemo(() => getFeatureAttributes(feature, layerInfo, dataSource), [dataSource, feature, layerInfo]);
|
|
11205
11202
|
return { layerInfo, attributes, dataSource };
|
|
11206
11203
|
};
|