@evergis/react 4.0.66 → 4.0.68
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 +7 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +18 -3
- package/dist/react.esm.js.map +1 -1
- package/dist/types/styling.d.ts +12 -0
- package/dist/utils/geometryToEwkt.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import { Geometry } from 'geojson';
|
|
2
3
|
import { i18n } from 'i18next';
|
|
3
4
|
import { PieChartData, BarChartMarker } from '@evergis/charts';
|
|
4
5
|
import { IconTypesKeys, IOption } from '@evergis/uilib-gl';
|
|
@@ -75,11 +76,16 @@ export interface EditConfigurationOptions {
|
|
|
75
76
|
}
|
|
76
77
|
/**
|
|
77
78
|
* Вход для `runBeforeSave` / `runAfterSave` хуков `useFeatureSaveHooks`.
|
|
78
|
-
*
|
|
79
|
+
*
|
|
80
|
+
* - `featureId` равен `null` при создании нового объекта.
|
|
81
|
+
* - `changedGeometry` — новая или отредактированная GeoJSON-геометрия
|
|
82
|
+
* объекта (в WGS84). Опционально: пусто, если геометрия не менялась —
|
|
83
|
+
* в этом случае `edit.featureGeometry` в payload скрипта не попадёт.
|
|
79
84
|
*/
|
|
80
85
|
export interface SaveHookInput {
|
|
81
86
|
featureId: number | string | null;
|
|
82
87
|
changedProperties: Record<string, unknown>;
|
|
88
|
+
changedGeometry?: Geometry;
|
|
83
89
|
}
|
|
84
90
|
export interface ConfigControl extends Pick<ConfigOptions, "relatedDataSource" | "minValue" | "maxValue" | "step" | "label" | "placeholder" | "width" | "variants"> {
|
|
85
91
|
type: "dropdown" | "checkbox" | "chips" | "string";
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,11 @@ var color$1 = require('@evergis/color');
|
|
|
11
11
|
var dateFns = require('date-fns');
|
|
12
12
|
var lodash = require('lodash');
|
|
13
13
|
var locale = require('date-fns/locale');
|
|
14
|
+
var wkt = require('wkt');
|
|
15
|
+
var turf = require('@turf/turf');
|
|
14
16
|
var signalr = require('@microsoft/signalr');
|
|
15
17
|
var findAnd = require('find-and');
|
|
16
18
|
var MapboxDraw = require('@mapbox/mapbox-gl-draw');
|
|
17
|
-
var turf = require('@turf/turf');
|
|
18
19
|
var MapGL = require('react-map-gl/maplibre');
|
|
19
20
|
require('@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css');
|
|
20
21
|
require('mapbox-gl/dist/mapbox-gl.css');
|
|
@@ -3937,6 +3938,16 @@ const formatPolygonMeasure = (t, area, perimiter) => {
|
|
|
3937
3938
|
return `S : ${formatArea(t, area)} P : ${formatLength(t, perimiter)}`;
|
|
3938
3939
|
};
|
|
3939
3940
|
|
|
3941
|
+
const geometryToEwkt = (geometry) => {
|
|
3942
|
+
if (!geometry) {
|
|
3943
|
+
return "";
|
|
3944
|
+
}
|
|
3945
|
+
const projected = turf.toMercator({ type: "Feature", geometry, properties: {} });
|
|
3946
|
+
const projectedCoords = projected?.geometry?.coordinates;
|
|
3947
|
+
const wkt$1 = wkt.stringify({ ...geometry, coordinates: projectedCoords });
|
|
3948
|
+
return `SRID=3857;${wkt$1}`;
|
|
3949
|
+
};
|
|
3950
|
+
|
|
3940
3951
|
function isObject(value) {
|
|
3941
3952
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3942
3953
|
}
|
|
@@ -12689,7 +12700,11 @@ const useSavePrototypeBuilder = () => {
|
|
|
12689
12700
|
projectName: projectInfo?.name,
|
|
12690
12701
|
layerName: layerInfo?.name,
|
|
12691
12702
|
featureId: input.featureId,
|
|
12692
|
-
|
|
12703
|
+
...(ewktGeometry ? { selectionGeometry: ewktGeometry } : {}),
|
|
12704
|
+
edit: {
|
|
12705
|
+
attributes: input.changedProperties,
|
|
12706
|
+
...(input.changedGeometry ? { featureGeometry: geometryToEwkt(input.changedGeometry) } : {}),
|
|
12707
|
+
},
|
|
12693
12708
|
...resolvedParameters,
|
|
12694
12709
|
};
|
|
12695
12710
|
return {
|
|
@@ -14085,6 +14100,7 @@ exports.formatElementValue = formatElementValue;
|
|
|
14085
14100
|
exports.formatLength = formatLength;
|
|
14086
14101
|
exports.formatNumber = formatNumber;
|
|
14087
14102
|
exports.formatPolygonMeasure = formatPolygonMeasure;
|
|
14103
|
+
exports.geometryToEwkt = geometryToEwkt;
|
|
14088
14104
|
exports.getActualExtrusionHeight = getActualExtrusionHeight;
|
|
14089
14105
|
exports.getAttributeByName = getAttributeByName;
|
|
14090
14106
|
exports.getAttributeValue = getAttributeValue;
|