@axdspub/axiom-ui-forms 0.2.9-alpha.0 → 0.2.10
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/library/axiom-ui-forms.d.ts +113 -51
- package/library/esm/_virtual/_commonjsHelpers.js +26 -1
- package/library/esm/_virtual/_commonjsHelpers.js.map +1 -1
- package/library/esm/_virtual/_freeGlobal.js +7 -0
- package/library/esm/_virtual/_freeGlobal.js.map +1 -0
- package/library/esm/_virtual/get.js +8 -0
- package/library/esm/_virtual/get.js.map +1 -0
- package/library/esm/_virtual/index10.js +2 -2
- package/library/esm/_virtual/index11.js +2 -2
- package/library/esm/_virtual/index12.js +4 -4
- package/library/esm/_virtual/index13.js +4 -4
- package/library/esm/_virtual/index14.js +2 -2
- package/library/esm/_virtual/index15.js +2 -2
- package/library/esm/_virtual/index3.js +2 -2
- package/library/esm/_virtual/index4.js +2 -2
- package/library/esm/_virtual/index5.js +2 -2
- package/library/esm/_virtual/index6.js +2 -2
- package/library/esm/_virtual/index6.js.map +1 -1
- package/library/esm/_virtual/index7.js +2 -2
- package/library/esm/_virtual/index7.js.map +1 -1
- package/library/esm/_virtual/index9.js +2 -2
- package/library/esm/_virtual/set.js +8 -0
- package/library/esm/_virtual/set.js.map +1 -0
- package/library/esm/node_modules/ajv/dist/compile/codegen/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/compile/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/compile/validate/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
- package/library/esm/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
- package/library/esm/node_modules/fast-uri/index.js +1 -1
- package/library/esm/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/library/esm/node_modules/json-schema-traverse/index.js +1 -1
- package/library/esm/node_modules/lodash/_Hash.js +49 -0
- package/library/esm/node_modules/lodash/_Hash.js.map +1 -0
- package/library/esm/node_modules/lodash/_ListCache.js +49 -0
- package/library/esm/node_modules/lodash/_ListCache.js.map +1 -0
- package/library/esm/node_modules/lodash/_Map.js +21 -0
- package/library/esm/node_modules/lodash/_Map.js.map +1 -0
- package/library/esm/node_modules/lodash/_MapCache.js +49 -0
- package/library/esm/node_modules/lodash/_MapCache.js.map +1 -0
- package/library/esm/node_modules/lodash/_Symbol.js +19 -0
- package/library/esm/node_modules/lodash/_Symbol.js.map +1 -0
- package/library/esm/node_modules/lodash/_arrayMap.js +33 -0
- package/library/esm/node_modules/lodash/_arrayMap.js.map +1 -0
- package/library/esm/node_modules/lodash/_assignValue.js +42 -0
- package/library/esm/node_modules/lodash/_assignValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_assocIndexOf.js +34 -0
- package/library/esm/node_modules/lodash/_assocIndexOf.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseAssignValue.js +38 -0
- package/library/esm/node_modules/lodash/_baseAssignValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseGet.js +38 -0
- package/library/esm/node_modules/lodash/_baseGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseGetTag.js +43 -0
- package/library/esm/node_modules/lodash/_baseGetTag.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseIsNative.js +63 -0
- package/library/esm/node_modules/lodash/_baseIsNative.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseSet.js +68 -0
- package/library/esm/node_modules/lodash/_baseSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_baseToString.js +50 -0
- package/library/esm/node_modules/lodash/_baseToString.js.map +1 -0
- package/library/esm/node_modules/lodash/_castPath.js +37 -0
- package/library/esm/node_modules/lodash/_castPath.js.map +1 -0
- package/library/esm/node_modules/lodash/_coreJsData.js +19 -0
- package/library/esm/node_modules/lodash/_coreJsData.js.map +1 -0
- package/library/esm/node_modules/lodash/_defineProperty.js +24 -0
- package/library/esm/node_modules/lodash/_defineProperty.js.map +1 -0
- package/library/esm/node_modules/lodash/_freeGlobal.js +7 -0
- package/library/esm/node_modules/lodash/_freeGlobal.js.map +1 -0
- package/library/esm/node_modules/lodash/_getMapData.js +31 -0
- package/library/esm/node_modules/lodash/_getMapData.js.map +1 -0
- package/library/esm/node_modules/lodash/_getNative.js +31 -0
- package/library/esm/node_modules/lodash/_getNative.js.map +1 -0
- package/library/esm/node_modules/lodash/_getRawTag.js +59 -0
- package/library/esm/node_modules/lodash/_getRawTag.js.map +1 -0
- package/library/esm/node_modules/lodash/_getValue.js +25 -0
- package/library/esm/node_modules/lodash/_getValue.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashClear.js +28 -0
- package/library/esm/node_modules/lodash/_hashClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashDelete.js +29 -0
- package/library/esm/node_modules/lodash/_hashDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashGet.js +43 -0
- package/library/esm/node_modules/lodash/_hashGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashHas.js +36 -0
- package/library/esm/node_modules/lodash/_hashHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_hashSet.js +36 -0
- package/library/esm/node_modules/lodash/_hashSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_isIndex.js +37 -0
- package/library/esm/node_modules/lodash/_isIndex.js.map +1 -0
- package/library/esm/node_modules/lodash/_isKey.js +43 -0
- package/library/esm/node_modules/lodash/_isKey.js.map +1 -0
- package/library/esm/node_modules/lodash/_isKeyable.js +27 -0
- package/library/esm/node_modules/lodash/_isKeyable.js.map +1 -0
- package/library/esm/node_modules/lodash/_isMasked.js +33 -0
- package/library/esm/node_modules/lodash/_isMasked.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheClear.js +25 -0
- package/library/esm/node_modules/lodash/_listCacheClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheDelete.js +48 -0
- package/library/esm/node_modules/lodash/_listCacheDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheGet.js +32 -0
- package/library/esm/node_modules/lodash/_listCacheGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheHas.js +29 -0
- package/library/esm/node_modules/lodash/_listCacheHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_listCacheSet.js +39 -0
- package/library/esm/node_modules/lodash/_listCacheSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheClear.js +36 -0
- package/library/esm/node_modules/lodash/_mapCacheClear.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheDelete.js +31 -0
- package/library/esm/node_modules/lodash/_mapCacheDelete.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheGet.js +29 -0
- package/library/esm/node_modules/lodash/_mapCacheGet.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheHas.js +29 -0
- package/library/esm/node_modules/lodash/_mapCacheHas.js.map +1 -0
- package/library/esm/node_modules/lodash/_mapCacheSet.js +35 -0
- package/library/esm/node_modules/lodash/_mapCacheSet.js.map +1 -0
- package/library/esm/node_modules/lodash/_memoizeCapped.js +39 -0
- package/library/esm/node_modules/lodash/_memoizeCapped.js.map +1 -0
- package/library/esm/node_modules/lodash/_nativeCreate.js +19 -0
- package/library/esm/node_modules/lodash/_nativeCreate.js.map +1 -0
- package/library/esm/node_modules/lodash/_objectToString.js +34 -0
- package/library/esm/node_modules/lodash/_objectToString.js.map +1 -0
- package/library/esm/node_modules/lodash/_root.js +22 -0
- package/library/esm/node_modules/lodash/_root.js.map +1 -0
- package/library/esm/node_modules/lodash/_stringToPath.js +40 -0
- package/library/esm/node_modules/lodash/_stringToPath.js.map +1 -0
- package/library/esm/node_modules/lodash/_toKey.js +31 -0
- package/library/esm/node_modules/lodash/_toKey.js.map +1 -0
- package/library/esm/node_modules/lodash/_toSource.js +38 -0
- package/library/esm/node_modules/lodash/_toSource.js.map +1 -0
- package/library/esm/node_modules/lodash/eq.js +49 -0
- package/library/esm/node_modules/lodash/eq.js.map +1 -0
- package/library/esm/node_modules/lodash/get.js +46 -0
- package/library/esm/node_modules/lodash/get.js.map +1 -0
- package/library/esm/node_modules/lodash/isArray.js +38 -0
- package/library/esm/node_modules/lodash/isArray.js.map +1 -0
- package/library/esm/node_modules/lodash/isFunction.js +51 -0
- package/library/esm/node_modules/lodash/isFunction.js.map +1 -0
- package/library/esm/node_modules/lodash/isObject.js +43 -0
- package/library/esm/node_modules/lodash/isObject.js.map +1 -0
- package/library/esm/node_modules/lodash/isObjectLike.js +41 -0
- package/library/esm/node_modules/lodash/isObjectLike.js.map +1 -0
- package/library/esm/node_modules/lodash/isSymbol.js +43 -0
- package/library/esm/node_modules/lodash/isSymbol.js.map +1 -0
- package/library/esm/node_modules/lodash/memoize.js +86 -0
- package/library/esm/node_modules/lodash/memoize.js.map +1 -0
- package/library/esm/node_modules/lodash/set.js +48 -0
- package/library/esm/node_modules/lodash/set.js.map +1 -0
- package/library/esm/node_modules/lodash/toString.js +41 -0
- package/library/esm/node_modules/lodash/toString.js.map +1 -0
- package/library/esm/node_modules/react-router/dist/development/chunk-HA7DTUK3.js +1 -1
- package/library/esm/node_modules/unified/lib/index.js +1 -1
- package/library/esm/src/Form/Components/FieldCreator.js +7 -5
- package/library/esm/src/Form/Components/FieldCreator.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Geometry.js +144 -156
- package/library/esm/src/Form/Components/Inputs/Geometry.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/GeometryInputLoader.js +4 -1
- package/library/esm/src/Form/Components/Inputs/GeometryInputLoader.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/JSON.js +20 -10
- package/library/esm/src/Form/Components/Inputs/JSON.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/Object.js +7 -2
- package/library/esm/src/Form/Components/Inputs/Object.js.map +1 -1
- package/library/esm/src/Form/Components/Inputs/String.js +2 -2
- package/library/esm/src/Form/Components/Inputs/String.js.map +1 -1
- package/library/esm/src/Form/Creator/FormCreator.js +3 -1
- package/library/esm/src/Form/Creator/FormCreator.js.map +1 -1
- package/library/esm/src/Form/Creator/Page.js +1 -1
- package/library/esm/src/Form/Creator/Page.js.map +1 -1
- package/library/esm/src/Form/Creator/Wizard.js +1 -1
- package/library/esm/src/Form/Creator/Wizard.js.map +1 -1
- package/library/esm/src/library.js +6 -3
- package/library/esm/src/library.js.map +1 -1
- package/library/esm/src/utils/getters.js +105 -0
- package/library/esm/src/utils/getters.js.map +1 -0
- package/library/esm/src/utils/manipulators.js +94 -0
- package/library/esm/src/utils/manipulators.js.map +1 -0
- package/library/esm/src/{Form → utils}/schemaToFormHelpers.js +7 -6
- package/library/esm/src/utils/schemaToFormHelpers.js.map +1 -0
- package/library/esm/src/utils/validators.js +36 -0
- package/library/esm/src/utils/validators.js.map +1 -0
- package/package.json +8 -3
- package/library/esm/src/Form/helpers.js +0 -162
- package/library/esm/src/Form/helpers.js.map +0 -1
- package/library/esm/src/Form/schemaToFormHelpers.js.map +0 -1
@@ -3,7 +3,7 @@ import { Button, TextArea } from '../../../../node_modules/@axdspub/axiom-ui-uti
|
|
3
3
|
import FieldLabel from '../FieldLabel.js';
|
4
4
|
import { EMapShape } from '../../../../node_modules/@axdspub/axiom-maps/library/index.js';
|
5
5
|
import { OpenLayersMap as OpenLayersMapComponent } from '../../../../node_modules/@axdspub/axiom-maps/library/openlayers/index.esm.js';
|
6
|
-
import React__default, { useState,
|
6
|
+
import React__default, { useState, useCallback, useEffect } from 'react';
|
7
7
|
import { DrawingPinFilledIcon, BorderSolidIcon, SquareIcon, TrashIcon } from '../../../../node_modules/@radix-ui/react-icons/dist/react-icons.esm.js';
|
8
8
|
|
9
9
|
/*
|
@@ -11,9 +11,12 @@ List of coordinates for testing. Around Anchorage.
|
|
11
11
|
...
|
12
12
|
*/
|
13
13
|
// --- calculateCenterFromGeoJSON remains the same (zoom ignored for initial load) ---
|
14
|
-
var calculateCenterFromGeoJSON = function (geo) {
|
14
|
+
var calculateCenterFromGeoJSON = function (geo, defaultCenter) {
|
15
15
|
var _a;
|
16
|
-
//
|
16
|
+
// If default center is provided, use it
|
17
|
+
if (defaultCenter) {
|
18
|
+
return defaultCenter;
|
19
|
+
}
|
17
20
|
// If input is Geometry, wrap it temporarily for calculation
|
18
21
|
var featureCollection;
|
19
22
|
if (geo && geo.type !== 'FeatureCollection') {
|
@@ -27,12 +30,14 @@ var calculateCenterFromGeoJSON = function (geo) {
|
|
27
30
|
else if (geo && geo.type === 'FeatureCollection') {
|
28
31
|
featureCollection = geo;
|
29
32
|
}
|
33
|
+
// Default to Anchorage if no valid GeoJSON
|
34
|
+
var DEFAULT_CENTER = { lat: 61.2181, lon: -149.9003, zoom: 8 };
|
30
35
|
if (!featureCollection || !('features' in featureCollection) || !Array.isArray(featureCollection.features) || featureCollection.features.length === 0) {
|
31
|
-
return
|
36
|
+
return DEFAULT_CENTER;
|
32
37
|
}
|
33
38
|
var feature = featureCollection.features[0];
|
34
39
|
if (!(feature === null || feature === void 0 ? void 0 : feature.geometry)) {
|
35
|
-
return
|
40
|
+
return DEFAULT_CENTER;
|
36
41
|
}
|
37
42
|
var geometry = feature.geometry;
|
38
43
|
var coordinates = []; // Adjusted type
|
@@ -47,7 +52,7 @@ var calculateCenterFromGeoJSON = function (geo) {
|
|
47
52
|
coordinates = [geometry.coordinates]; // Wrap single point for uniform handling
|
48
53
|
break;
|
49
54
|
default:
|
50
|
-
return
|
55
|
+
return DEFAULT_CENTER;
|
51
56
|
}
|
52
57
|
// Flatten coordinates for bounds calculation if needed (e.g., MultiPoint, MultiLineString)
|
53
58
|
var flatCoordinates = (_a = []).concat.apply(_a, coordinates);
|
@@ -60,7 +65,7 @@ var calculateCenterFromGeoJSON = function (geo) {
|
|
60
65
|
return { lat: lat, lon: lon, zoom: 8 }; // Default zoom
|
61
66
|
}
|
62
67
|
console.warn('Could not determine coordinates for centering.');
|
63
|
-
return
|
68
|
+
return DEFAULT_CENTER;
|
64
69
|
}
|
65
70
|
// Calculate bounds
|
66
71
|
var minLat = Infinity;
|
@@ -83,7 +88,7 @@ var calculateCenterFromGeoJSON = function (geo) {
|
|
83
88
|
count++;
|
84
89
|
});
|
85
90
|
if (count === 0) {
|
86
|
-
return
|
91
|
+
return DEFAULT_CENTER;
|
87
92
|
}
|
88
93
|
var centerLat = sumLat / count;
|
89
94
|
var centerLon = sumLon / count;
|
@@ -107,12 +112,12 @@ var calculateCenterFromGeoJSON = function (geo) {
|
|
107
112
|
zoom = 6;
|
108
113
|
return { lat: centerLat, lon: centerLon, zoom: zoom };
|
109
114
|
};
|
110
|
-
//
|
115
|
+
// Helper function to determine initial draw type based on settings
|
111
116
|
var getInitialDrawType = function (field) {
|
112
117
|
var _a;
|
113
118
|
var settings = (_a = field.settings) !== null && _a !== void 0 ? _a : {};
|
114
119
|
var drawEnabled = settings.drawEnabled !== false;
|
115
|
-
var drawPointEnabled = settings.
|
120
|
+
var drawPointEnabled = settings.drawPointEnabled === true && drawEnabled;
|
116
121
|
var drawPathEnabled = settings.drawPathEnabled === true && drawEnabled;
|
117
122
|
var drawPolygonEnabled = settings.drawPolygonEnabled === true && drawEnabled;
|
118
123
|
if (drawPointEnabled)
|
@@ -124,13 +129,12 @@ var getInitialDrawType = function (field) {
|
|
124
129
|
return EMapShape.point; // Defaulting to Point if none specified
|
125
130
|
};
|
126
131
|
var GeometryInput = function (_a) {
|
127
|
-
var _b, _c, _d, _e, _f;
|
132
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
128
133
|
var field = _a.field, onChange = _a.onChange, value = _a.value;
|
129
|
-
var
|
130
|
-
var
|
134
|
+
var _k = useState(undefined), map = _k[0], setMapState = _k[1];
|
135
|
+
var _l = useState(undefined), error = _l[0], setError = _l[1];
|
131
136
|
var showGeoJSONInput = useState(false)[0];
|
132
|
-
|
133
|
-
var _j = useState(function () {
|
137
|
+
var _m = useState(function () {
|
134
138
|
if (value && typeof value === 'object' && 'type' in value && value.type !== 'FeatureCollection' && value.type !== 'Feature') {
|
135
139
|
return { type: 'Feature', properties: {}, geometry: value };
|
136
140
|
}
|
@@ -138,146 +142,23 @@ var GeometryInput = function (_a) {
|
|
138
142
|
return value;
|
139
143
|
}
|
140
144
|
return undefined;
|
141
|
-
}), geojson =
|
142
|
-
|
143
|
-
var
|
144
|
-
var
|
145
|
-
|
146
|
-
var
|
147
|
-
var
|
148
|
-
var
|
149
|
-
var
|
150
|
-
var
|
151
|
-
// Effect to handle value prop updates
|
152
|
-
useEffect(function () {
|
153
|
-
var normalizedFeature;
|
154
|
-
if (value && typeof value === 'object' && 'type' in value) {
|
155
|
-
if (value.type !== 'FeatureCollection' && value.type !== 'Feature') {
|
156
|
-
normalizedFeature = { type: 'Feature', properties: {}, geometry: value };
|
157
|
-
}
|
158
|
-
else if (value.type === 'Feature') {
|
159
|
-
normalizedFeature = value;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
var currentJson = geojson ? JSON.stringify(geojson) : '';
|
163
|
-
var newJson = normalizedFeature ? JSON.stringify(normalizedFeature) : '';
|
164
|
-
if (currentJson !== newJson) {
|
165
|
-
setGeojson(normalizedFeature);
|
166
|
-
if (normalizedFeature === null || normalizedFeature === void 0 ? void 0 : normalizedFeature.geometry) {
|
167
|
-
setIsDrawing(false);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}, [value]);
|
171
|
-
// Effect to sync map state with geojson
|
172
|
-
useEffect(function () {
|
173
|
-
if (!map)
|
174
|
-
return;
|
175
|
-
// Always update map's visual state to match geojson
|
176
|
-
if (geojson === null || geojson === void 0 ? void 0 : geojson.geometry) {
|
177
|
-
map.setDrawGeojson({ type: 'FeatureCollection', features: [geojson] });
|
178
|
-
map.disableDraw(currentDrawType);
|
179
|
-
}
|
180
|
-
else {
|
181
|
-
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
182
|
-
// Only enable/disable drawing based on isDrawing state
|
183
|
-
if (isDrawing && drawEnabled) {
|
184
|
-
map.enableDraw(currentDrawType);
|
185
|
-
}
|
186
|
-
else {
|
187
|
-
map.disableDraw(currentDrawType);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
}, [map, geojson, currentDrawType, isDrawing, drawEnabled]);
|
191
|
-
// Effect to handle map drawing events
|
192
|
-
useEffect(function () {
|
193
|
-
if (!map)
|
194
|
-
return;
|
195
|
-
var drawCompleteListener = function (e) {
|
196
|
-
var _a, _b, _c;
|
197
|
-
var f = (_c = (_b = (_a = e.data) === null || _a === void 0 ? void 0 : _a.geojson) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c[0];
|
198
|
-
if (f) {
|
199
|
-
setGeojson(f);
|
200
|
-
setIsDrawing(false);
|
201
|
-
map.disableDraw(currentDrawType);
|
202
|
-
}
|
203
|
-
};
|
204
|
-
var drawUpdateListener = function (e) {
|
205
|
-
var _a, _b, _c;
|
206
|
-
var f = (_c = (_b = (_a = e.data) === null || _a === void 0 ? void 0 : _a.geojson) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c[0];
|
207
|
-
if (f) {
|
208
|
-
setGeojson(f);
|
209
|
-
}
|
210
|
-
else {
|
211
|
-
// Handle deletion via map tools
|
212
|
-
setGeojson(undefined);
|
213
|
-
setIsDrawing(false); // Ensure drawing is disabled when user deletes shape
|
214
|
-
}
|
215
|
-
};
|
216
|
-
map.onDrawComplete(drawCompleteListener);
|
217
|
-
map.onDrawUpdate(drawUpdateListener);
|
218
|
-
// Return cleanup function that removes the event listeners
|
219
|
-
return function () {
|
220
|
-
// Remove event listeners by re-adding with empty functions
|
221
|
-
map.onDrawComplete(function () { });
|
222
|
-
map.onDrawUpdate(function () { });
|
223
|
-
};
|
224
|
-
}, [map, currentDrawType]);
|
225
|
-
// Effect to notify parent of changes
|
226
|
-
useEffect(function () {
|
227
|
-
var _a;
|
228
|
-
onChange((_a = geojson === null || geojson === void 0 ? void 0 : geojson.geometry) !== null && _a !== void 0 ? _a : undefined);
|
229
|
-
}, [geojson]);
|
230
|
-
var clearShape = function () {
|
231
|
-
setGeojson(undefined);
|
232
|
-
setCoordinates('');
|
233
|
-
setShowShapeTypeButtons(false);
|
234
|
-
if (map && drawEnabled) {
|
235
|
-
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
236
|
-
var iType = getInitialDrawType(field);
|
237
|
-
setCurrentDrawType(iType);
|
238
|
-
setIsDrawing(true); // Explicitly enable drawing when user clicks clear
|
239
|
-
map.enableDraw(iType);
|
240
|
-
}
|
241
|
-
};
|
242
|
-
var handleDrawTypeChange = function (shapeType) {
|
243
|
-
if (map && drawEnabled) {
|
244
|
-
var isAllowed = (shapeType === EMapShape.point && drawPointEnabled) ||
|
245
|
-
(shapeType === EMapShape.linestring && drawPathEnabled) ||
|
246
|
-
(shapeType === EMapShape.polygon && drawPolygonEnabled);
|
247
|
-
if (isAllowed && shapeType !== currentDrawType) {
|
248
|
-
setGeojson(undefined);
|
249
|
-
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
250
|
-
setCurrentDrawType(shapeType);
|
251
|
-
setIsDrawing(true);
|
252
|
-
map.enableDraw(shapeType);
|
253
|
-
}
|
254
|
-
}
|
255
|
-
};
|
256
|
-
var handleCoordinatesChange = function (e) {
|
257
|
-
var newCoords = e !== null && e !== void 0 ? e : '';
|
258
|
-
setCoordinates(newCoords);
|
259
|
-
if (!newCoords.trim()) {
|
260
|
-
setGeojson(undefined);
|
261
|
-
setError(undefined);
|
262
|
-
setIsDrawing(false);
|
263
|
-
return;
|
264
|
-
}
|
265
|
-
var newFeature = createGeoJSONFromCoordinates(newCoords);
|
266
|
-
if (newFeature) {
|
267
|
-
setGeojson(newFeature);
|
268
|
-
setError(undefined);
|
269
|
-
setIsDrawing(false);
|
270
|
-
}
|
271
|
-
};
|
272
|
-
var initialMapCenter = calculateCenterFromGeoJSON(geojson);
|
273
|
-
var INITIAL_DEFAULT_ZOOM = 8; // Fixed default zoom
|
145
|
+
}), geojson = _m[0], setGeojson = _m[1];
|
146
|
+
var geomField = field;
|
147
|
+
var drawEnabled = ((_b = geomField.settings) === null || _b === void 0 ? void 0 : _b.drawEnabled) !== false;
|
148
|
+
var drawPointEnabled = ((_c = geomField.settings) === null || _c === void 0 ? void 0 : _c.drawPointEnabled) === true && drawEnabled;
|
149
|
+
var drawPathEnabled = ((_d = geomField.settings) === null || _d === void 0 ? void 0 : _d.drawPathEnabled) === true && drawEnabled;
|
150
|
+
var drawPolygonEnabled = ((_e = geomField.settings) === null || _e === void 0 ? void 0 : _e.drawPolygonEnabled) === true && drawEnabled;
|
151
|
+
var showCoordinateInput = ((_f = geomField.settings) === null || _f === void 0 ? void 0 : _f.showCoordinateInput) !== false;
|
152
|
+
var _o = useState(function () { return getInitialDrawType(field); }), currentDrawType = _o[0], setCurrentDrawType = _o[1];
|
153
|
+
var _p = useState(!geojson && drawEnabled), isDrawing = _p[0], setIsDrawing = _p[1];
|
154
|
+
var initialMapCenter = calculateCenterFromGeoJSON(geojson, (_g = geomField.settings) === null || _g === void 0 ? void 0 : _g.defaultCenter);
|
274
155
|
var MAP_CONFIG = {
|
275
156
|
baseLayerKey: 'hybrid',
|
276
|
-
height: '500px',
|
157
|
+
height: (_j = (_h = geomField.settings) === null || _h === void 0 ? void 0 : _h.height) !== null && _j !== void 0 ? _j : '500px',
|
277
158
|
width: '100%',
|
278
159
|
style: { /* ... styles ... */},
|
279
160
|
center: { lat: initialMapCenter.lat, lon: initialMapCenter.lon },
|
280
|
-
zoom:
|
161
|
+
zoom: initialMapCenter.zoom,
|
281
162
|
tools: {
|
282
163
|
draw: {
|
283
164
|
shape: currentDrawType,
|
@@ -318,7 +199,7 @@ var GeometryInput = function (_a) {
|
|
318
199
|
setCoordinates(newCoords);
|
319
200
|
// setShowShapeTypeButtons(shouldShowShapeButtons(newCoords)); // Let coordinate effect handle this
|
320
201
|
}, []);
|
321
|
-
var
|
202
|
+
var _q = useState(function () {
|
322
203
|
var _a, _b, _c;
|
323
204
|
if (!(geojson === null || geojson === void 0 ? void 0 : geojson.geometry))
|
324
205
|
return '';
|
@@ -343,8 +224,10 @@ var GeometryInput = function (_a) {
|
|
343
224
|
initCoords = '';
|
344
225
|
}
|
345
226
|
return initCoords;
|
346
|
-
}), coordinates =
|
347
|
-
useEffect(function () {
|
227
|
+
}), coordinates = _q[0], setCoordinates = _q[1];
|
228
|
+
useEffect(function () {
|
229
|
+
updateCoordinatesFromFeature(geojson);
|
230
|
+
}, [geojson, updateCoordinatesFromFeature]);
|
348
231
|
var createGeoJSONFromCoordinates = function (coordString, forceType) {
|
349
232
|
if (!coordString.trim()) {
|
350
233
|
setError(undefined);
|
@@ -381,10 +264,115 @@ var GeometryInput = function (_a) {
|
|
381
264
|
var validLinesCount = coords.trim().split('\n').filter(function (l) { return l.trim(); }).length;
|
382
265
|
return (drawPolygonEnabled || drawPathEnabled) && validLinesCount >= 2;
|
383
266
|
};
|
384
|
-
var
|
267
|
+
var _r = useState(function () { return shouldShowShapeButtons(coordinates); }), showShapeTypeButtons = _r[0], setShowShapeTypeButtons = _r[1];
|
385
268
|
useEffect(function () { setShowShapeTypeButtons(shouldShowShapeButtons(coordinates)); }, [coordinates, drawPolygonEnabled, drawPathEnabled]); // Added effect to update buttons
|
269
|
+
// ---- Map Event Handlers & State Updates ----
|
270
|
+
useEffect(function () {
|
271
|
+
if (!map)
|
272
|
+
return;
|
273
|
+
var drawCompleteListener = function (e) { var _a, _b, _c; /* ... same ... */ var f = (_c = (_b = (_a = e.data) === null || _a === void 0 ? void 0 : _a.geojson) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c[0]; if (f) {
|
274
|
+
setGeojson(f);
|
275
|
+
setIsDrawing(false);
|
276
|
+
map.disableDraw(currentDrawType);
|
277
|
+
} };
|
278
|
+
var drawUpdateListener = function (e) { var _a, _b, _c; /* ... same ... */ var f = (_c = (_b = (_a = e.data) === null || _a === void 0 ? void 0 : _a.geojson) === null || _b === void 0 ? void 0 : _b.features) === null || _c === void 0 ? void 0 : _c[0]; if (f) {
|
279
|
+
setGeojson(f);
|
280
|
+
} };
|
281
|
+
map.onDrawComplete(drawCompleteListener);
|
282
|
+
map.onDrawUpdate(drawUpdateListener);
|
283
|
+
// Cleanup omitted
|
284
|
+
}, [map, currentDrawType]);
|
285
|
+
useEffect(function () {
|
286
|
+
var _a;
|
287
|
+
onChange((_a = geojson === null || geojson === void 0 ? void 0 : geojson.geometry) !== null && _a !== void 0 ? _a : undefined);
|
288
|
+
}, [geojson]);
|
289
|
+
useEffect(function () {
|
290
|
+
if (!map)
|
291
|
+
return;
|
292
|
+
var correctDrawType = getInitialDrawType(field);
|
293
|
+
if (currentDrawType !== correctDrawType) {
|
294
|
+
setCurrentDrawType(correctDrawType);
|
295
|
+
}
|
296
|
+
if (geojson === null || geojson === void 0 ? void 0 : geojson.geometry) {
|
297
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [geojson] });
|
298
|
+
map.disableDraw(correctDrawType); // Ensure correct tool is disabled
|
299
|
+
setIsDrawing(false);
|
300
|
+
}
|
301
|
+
else {
|
302
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
303
|
+
if (drawEnabled && (drawPointEnabled || drawPathEnabled || drawPolygonEnabled)) {
|
304
|
+
map.enableDraw(correctDrawType); // Enable the correct initial tool
|
305
|
+
setIsDrawing(true);
|
306
|
+
}
|
307
|
+
else {
|
308
|
+
map.disableDraw(correctDrawType); // Ensure drawing is off if not enabled
|
309
|
+
setIsDrawing(false);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}, [map, geojson, drawEnabled, drawPointEnabled, drawPathEnabled, drawPolygonEnabled, currentDrawType, field]);
|
386
313
|
// ---- Helper Functions ----
|
387
314
|
var hasValidShape = function (feature) { return !!(feature === null || feature === void 0 ? void 0 : feature.geometry); };
|
315
|
+
var clearShape = function () {
|
316
|
+
setGeojson(undefined);
|
317
|
+
setCoordinates('');
|
318
|
+
setShowShapeTypeButtons(false);
|
319
|
+
if (map && drawEnabled) {
|
320
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
321
|
+
var iType = getInitialDrawType(field);
|
322
|
+
setCurrentDrawType(iType);
|
323
|
+
map.enableDraw(iType);
|
324
|
+
setIsDrawing(true);
|
325
|
+
}
|
326
|
+
};
|
327
|
+
var handleDrawTypeChange = function (shapeType) {
|
328
|
+
if (map && drawEnabled) {
|
329
|
+
var isAllowed = (shapeType === EMapShape.point && drawPointEnabled) || (shapeType === EMapShape.linestring && drawPathEnabled) || (shapeType === EMapShape.polygon && drawPolygonEnabled);
|
330
|
+
if (isAllowed && shapeType !== currentDrawType) {
|
331
|
+
map.disableDraw(currentDrawType);
|
332
|
+
setCurrentDrawType(shapeType);
|
333
|
+
map.enableDraw(shapeType);
|
334
|
+
setIsDrawing(true);
|
335
|
+
}
|
336
|
+
}
|
337
|
+
};
|
338
|
+
var handleCoordinatesChange = function (e) {
|
339
|
+
var newCoords = e !== null && e !== void 0 ? e : '';
|
340
|
+
setCoordinates(newCoords);
|
341
|
+
var pointsCount = newCoords.trim().split('\n').filter(function (l) { return l.trim(); }).length;
|
342
|
+
var intendedType;
|
343
|
+
if (pointsCount === 1 && drawPointEnabled)
|
344
|
+
intendedType = EMapShape.point;
|
345
|
+
else if (pointsCount >= 3 && drawPolygonEnabled)
|
346
|
+
intendedType = EMapShape.polygon;
|
347
|
+
else if (pointsCount >= 2 && drawPathEnabled)
|
348
|
+
intendedType = EMapShape.linestring;
|
349
|
+
var newFeature = createGeoJSONFromCoordinates(newCoords, intendedType);
|
350
|
+
if (newFeature) {
|
351
|
+
setGeojson(newFeature);
|
352
|
+
setError(undefined);
|
353
|
+
if (map) {
|
354
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
355
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [newFeature] });
|
356
|
+
map.disableDraw(currentDrawType);
|
357
|
+
setIsDrawing(false);
|
358
|
+
}
|
359
|
+
// setShowShapeTypeButtons(shouldShowShapeButtons(newCoords)); // Let effect handle this
|
360
|
+
}
|
361
|
+
else {
|
362
|
+
if (!newCoords.trim()) {
|
363
|
+
setGeojson(undefined);
|
364
|
+
if (map && drawEnabled) {
|
365
|
+
map.setDrawGeojson({ type: 'FeatureCollection', features: [] });
|
366
|
+
map.enableDraw(currentDrawType);
|
367
|
+
setIsDrawing(true);
|
368
|
+
}
|
369
|
+
setShowShapeTypeButtons(false);
|
370
|
+
}
|
371
|
+
else if (!error) {
|
372
|
+
setError('Cannot form valid shape with coords/tools.');
|
373
|
+
}
|
374
|
+
}
|
375
|
+
};
|
388
376
|
var applyShapeType = function (shapeType) {
|
389
377
|
var newFeature = createGeoJSONFromCoordinates(coordinates, shapeType);
|
390
378
|
if (newFeature) {
|
@@ -399,7 +387,7 @@ var GeometryInput = function (_a) {
|
|
399
387
|
return (React__default.createElement("div", null,
|
400
388
|
React__default.createElement(FieldLabel, __assign({}, field)),
|
401
389
|
React__default.createElement("div", { className: "relative" },
|
402
|
-
drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled) && (React__default.createElement("div", { className: "absolute z-20 top-
|
390
|
+
drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled) && (React__default.createElement("div", { className: "absolute z-20 top-4 right-4 flex flex-col gap-2" },
|
403
391
|
drawPointEnabled && (React__default.createElement("div", { className: "tooltip-container relative group" },
|
404
392
|
React__default.createElement(Button, { onClick: function () { handleDrawTypeChange(EMapShape.point); },
|
405
393
|
// Reverted className logic
|
@@ -444,7 +432,7 @@ var GeometryInput = function (_a) {
|
|
444
432
|
"Create Polygon")))),
|
445
433
|
React__default.createElement(TextArea, { error: error, className: 'min-h-[100px] bg-slate-50 rounded-lg shadow-inner font-mono text-sm', id: "".concat(field.id, "-coordinates"), testId: "".concat(field.id, "-coordinates"), value: coordinates, onChange: handleCoordinatesChange, placeholder: '...', "aria-label": "Coordinates Input" }),
|
446
434
|
error && React__default.createElement("p", { className: "text-red-600 text-xs mt-1" }, error))),
|
447
|
-
showGeoJSONInput &&
|
435
|
+
showGeoJSONInput && React__default.createElement(TextArea, { error: error, className: '...', id: field.id + '-debug', testId: field.id + '-debug', label: React__default.createElement(FieldLabel, __assign({}, field, { label: "Debug GeoJSON Feature State" })), value: JSON.stringify(value, null, 2) }))));
|
448
436
|
};
|
449
437
|
|
450
438
|
export { GeometryInput, GeometryInput as default };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Geometry.js","sources":["../../../../../../src/Form/Components/Inputs/Geometry.tsx"],"sourcesContent":["import { Button, TextArea } from '@axdspub/axiom-ui-utilities'\nimport FieldLabel from '@/Form/Components/FieldLabel'\nimport { type IFieldInputProps, type IFormField } from '@/Form/Creator/FormCreatorTypes' // Added IFormField explicitly\n\nimport { EMapShape, type IMap, type IMapDrawEvent, type IStyleableMapProps } from '@axdspub/axiom-maps'\nimport { OpenLayersMap as Map } from '@axdspub/axiom-maps/library/openlayers'\n// Import Geometry type if not already done\nimport { type Feature, type GeoJSON, type Geometry } from 'geojson'\nimport React, { useEffect, useState, type ReactElement, useCallback } from 'react' // Added useCallback\nimport { TrashIcon, SquareIcon, BorderSolidIcon, DrawingPinFilledIcon } from '@radix-ui/react-icons'\n\n/*\nList of coordinates for testing. Around Anchorage.\n...\n*/\n\n// --- calculateCenterFromGeoJSON remains the same (zoom ignored for initial load) ---\nconst calculateCenterFromGeoJSON = (geo: GeoJSON | undefined): { lat: number, lon: number, zoom: number } => {\n // ... (Implementation from previous correct version) ...\n // If input is Geometry, wrap it temporarily for calculation\n let featureCollection: GeoJSON.FeatureCollection | undefined\n if (geo && geo.type !== 'FeatureCollection') {\n if (geo.type === 'Feature') {\n featureCollection = { type: 'FeatureCollection', features: [geo] }\n } else if (geo.type === 'Point' || geo.type === 'LineString' || geo.type === 'Polygon' /* add others as needed */) {\n featureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', properties: {}, geometry: geo as Geometry }] }\n }\n } else if (geo && geo.type === 'FeatureCollection') {\n featureCollection = geo\n }\n\n if (!featureCollection || !('features' in featureCollection) || !Array.isArray(featureCollection.features) || featureCollection.features.length === 0) {\n return { lat: 61.2181, lon: -149.9003, zoom: 8 } // Default to Anchorage\n }\n\n const feature = featureCollection.features[0]\n if (!feature?.geometry) {\n return { lat: 61.2181, lon: -149.9003, zoom: 8 }\n }\n\n const geometry = feature.geometry\n let coordinates: GeoJSON.Position | GeoJSON.Position[] | GeoJSON.Position[][] = [] // Adjusted type\n\n switch (geometry.type) {\n case 'Polygon':\n coordinates = geometry.coordinates[0] // Get first ring (ignore holes)\n break\n case 'LineString':\n coordinates = geometry.coordinates\n break\n case 'Point':\n coordinates = [geometry.coordinates] // Wrap single point for uniform handling\n break\n default:\n return { lat: 61.2181, lon: -149.9003, zoom: 8 }\n }\n\n // Flatten coordinates for bounds calculation if needed (e.g., MultiPoint, MultiLineString)\n const flatCoordinates = ([] as GeoJSON.Position[]).concat(...coordinates as any)\n\n if (!Array.isArray(flatCoordinates) || flatCoordinates.length === 0 || !Array.isArray(flatCoordinates[0])) {\n // Handle single point case where flatCoordinates might be just [lon, lat]\n if (Array.isArray(flatCoordinates) && flatCoordinates.length === 2 && typeof flatCoordinates[0] === 'number') {\n const [lon, lat] = flatCoordinates as unknown as GeoJSON.Position\n // FIX #2: Return a default zoom even for a point here for centering logic,\n // but we won't use this zoom for the initial MAP_CONFIG.\n return { lat, lon, zoom: 8 } // Default zoom\n }\n console.warn('Could not determine coordinates for centering.')\n return { lat: 61.2181, lon: -149.9003, zoom: 8 }\n }\n\n // Calculate bounds\n let minLat = Infinity; let maxLat = -Infinity; let minLon = Infinity; let maxLon = -Infinity\n let sumLat = 0; let sumLon = 0; let count = 0\n\n flatCoordinates.forEach((coord: GeoJSON.Position) => {\n if (!Array.isArray(coord) || coord.length < 2) return; const [lon, lat] = coord\n minLat = Math.min(minLat, lat); maxLat = Math.max(maxLat, lat); minLon = Math.min(minLon, lon); maxLon = Math.max(maxLon, lon)\n sumLat += lat; sumLon += lon; count++\n })\n\n if (count === 0) { return { lat: 61.2181, lon: -149.9003, zoom: 8 } }\n\n const centerLat = sumLat / count; const centerLon = sumLon / count\n const latDiff = maxLat - minLat; const lonDiff = maxLon - minLon; const maxDiff = Math.max(latDiff, lonDiff)\n\n let zoom = 8 // default zoom\n if (count === 1 || maxDiff === 0) zoom = 12; else if (maxDiff < 0.1) zoom = 12; else if (maxDiff < 0.5) zoom = 10\n else if (maxDiff < 1) zoom = 9; else if (maxDiff < 2) zoom = 8; else if (maxDiff < 5) zoom = 7; else zoom = 6\n\n return { lat: centerLat, lon: centerLon, zoom }\n}\n\n// Add type for field settings\ninterface IGeometryFieldSettings {\n drawEnabled?: boolean\n drawPointEnable?: boolean\n drawPathEnabled?: boolean\n drawPolygonEnabled?: boolean\n showCoordinateInput?: boolean\n step?: number\n}\n\n// Use type intersection instead of interface extension\ntype IGeometryFormField = IFormField & {\n settings?: IGeometryFieldSettings\n}\n\n// Update getInitialDrawType function signature\nconst getInitialDrawType = (field: IGeometryFormField): EMapShape => {\n const settings = field.settings ?? {}\n const drawEnabled = settings.drawEnabled !== false\n const drawPointEnabled = settings.drawPointEnable === true && drawEnabled\n const drawPathEnabled = settings.drawPathEnabled === true && drawEnabled\n const drawPolygonEnabled = settings.drawPolygonEnabled === true && drawEnabled\n\n if (drawPointEnabled) return EMapShape.point\n if (drawPathEnabled) return EMapShape.linestring\n if (drawPolygonEnabled) return EMapShape.polygon\n return EMapShape.point // Defaulting to Point if none specified\n}\n\nexport const GeometryInput = ({ field, onChange, value }: IFieldInputProps & { field: IGeometryFormField }): ReactElement => {\n const [map, setMapState] = useState<IMap | undefined>(undefined)\n const [error, setError] = useState<string | undefined>(undefined)\n const [showGeoJSONInput] = useState<boolean>(false)\n\n // Initialize geojson state from value prop\n const [geojson, setGeojson] = useState<Feature | undefined>(() => {\n if (value && typeof value === 'object' && 'type' in value && value.type !== 'FeatureCollection' && value.type !== 'Feature') {\n return { type: 'Feature', properties: {}, geometry: value as Geometry }\n }\n if (value && typeof value === 'object' && 'type' in value && value.type === 'Feature') { return value as Feature }\n return undefined\n })\n\n // Initialize drawing state - only true if no initial shape and drawing is enabled\n const [isDrawing, setIsDrawing] = useState<boolean>(false)\n const [currentDrawType, setCurrentDrawType] = useState<EMapShape>(() => getInitialDrawType(field))\n\n // Settings from field props\n const drawEnabled = field.settings?.drawEnabled !== false\n const drawPointEnabled = field.settings?.drawPointEnable === true && drawEnabled\n const drawPathEnabled = field.settings?.drawPathEnabled === true && drawEnabled\n const drawPolygonEnabled = field.settings?.drawPolygonEnabled === true && drawEnabled\n const showCoordinateInput = field.settings?.showCoordinateInput !== false\n\n // Effect to handle value prop updates\n useEffect(() => {\n let normalizedFeature: Feature | undefined\n\n if (value && typeof value === 'object' && 'type' in value) {\n if (value.type !== 'FeatureCollection' && value.type !== 'Feature') {\n normalizedFeature = { type: 'Feature', properties: {}, geometry: value as Geometry }\n } else if (value.type === 'Feature') {\n normalizedFeature = value as Feature\n }\n }\n\n const currentJson = geojson ? JSON.stringify(geojson) : ''\n const newJson = normalizedFeature ? JSON.stringify(normalizedFeature) : ''\n\n if (currentJson !== newJson) {\n setGeojson(normalizedFeature)\n if (normalizedFeature?.geometry) {\n setIsDrawing(false)\n }\n }\n }, [value])\n\n // Effect to sync map state with geojson\n useEffect(() => {\n if (!map) return\n\n // Always update map's visual state to match geojson\n if (geojson?.geometry) {\n map.setDrawGeojson({ type: 'FeatureCollection', features: [geojson] })\n map.disableDraw(currentDrawType)\n } else {\n map.setDrawGeojson({ type: 'FeatureCollection', features: [] })\n // Only enable/disable drawing based on isDrawing state\n if (isDrawing && drawEnabled) {\n map.enableDraw(currentDrawType)\n } else {\n map.disableDraw(currentDrawType)\n }\n }\n }, [map, geojson, currentDrawType, isDrawing, drawEnabled])\n\n // Effect to handle map drawing events\n useEffect(() => {\n if (!map) return\n\n const drawCompleteListener = (e: IMapDrawEvent): void => {\n const f = e.data?.geojson?.features?.[0]\n if (f) {\n setGeojson(f)\n setIsDrawing(false)\n map.disableDraw(currentDrawType)\n }\n }\n\n const drawUpdateListener = (e: IMapDrawEvent): void => {\n const f = e.data?.geojson?.features?.[0]\n if (f) {\n setGeojson(f)\n } else {\n // Handle deletion via map tools\n setGeojson(undefined)\n setIsDrawing(false) // Ensure drawing is disabled when user deletes shape\n }\n }\n\n map.onDrawComplete(drawCompleteListener)\n map.onDrawUpdate(drawUpdateListener)\n\n // Return cleanup function that removes the event listeners\n return () => {\n // Remove event listeners by re-adding with empty functions\n map.onDrawComplete(() => {})\n map.onDrawUpdate(() => {})\n }\n }, [map, currentDrawType])\n\n // Effect to notify parent of changes\n useEffect(() => {\n onChange(geojson?.geometry ?? undefined)\n }, [geojson])\n\n const clearShape = (): void => {\n setGeojson(undefined)\n setCoordinates('')\n setShowShapeTypeButtons(false)\n if (map && drawEnabled) {\n map.setDrawGeojson({ type: 'FeatureCollection', features: [] })\n const iType = getInitialDrawType(field)\n setCurrentDrawType(iType)\n setIsDrawing(true) // Explicitly enable drawing when user clicks clear\n map.enableDraw(iType)\n }\n }\n\n const handleDrawTypeChange = (shapeType: EMapShape): void => {\n if (map && drawEnabled) {\n const isAllowed = (shapeType === EMapShape.point && drawPointEnabled) ||\n (shapeType === EMapShape.linestring && drawPathEnabled) ||\n (shapeType === EMapShape.polygon && drawPolygonEnabled)\n\n if (isAllowed && shapeType !== currentDrawType) {\n setGeojson(undefined)\n map.setDrawGeojson({ type: 'FeatureCollection', features: [] })\n setCurrentDrawType(shapeType)\n setIsDrawing(true)\n map.enableDraw(shapeType)\n }\n }\n }\n\n const handleCoordinatesChange = (e: string | undefined): void => {\n const newCoords = e ?? ''\n setCoordinates(newCoords)\n\n if (!newCoords.trim()) {\n setGeojson(undefined)\n setError(undefined)\n setIsDrawing(false)\n return\n }\n\n const newFeature = createGeoJSONFromCoordinates(newCoords)\n if (newFeature) {\n setGeojson(newFeature)\n setError(undefined)\n setIsDrawing(false)\n }\n }\n\n const initialMapCenter = calculateCenterFromGeoJSON(geojson)\n const INITIAL_DEFAULT_ZOOM = 8 // Fixed default zoom\n\n const MAP_CONFIG: IStyleableMapProps = {\n baseLayerKey: 'hybrid',\n height: '500px',\n width: '100%',\n style: { /* ... styles ... */ },\n center: { lat: initialMapCenter.lat, lon: initialMapCenter.lon },\n zoom: INITIAL_DEFAULT_ZOOM, // Use fixed zoom\n tools: {\n draw: {\n shape: currentDrawType,\n enabled: drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled)\n }\n }\n }\n\n // ---- Coordinate Handling ----\n const updateCoordinatesFromFeature = useCallback((feature: Feature | undefined): void => {\n if (!feature?.geometry) { setCoordinates(''); return }\n const geometry = feature.geometry; let newCoords = ''\n try {\n if (geometry.type === 'Polygon') { newCoords = (geometry.coordinates[0] ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'LineString') { newCoords = (geometry.coordinates ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'Point') { const coords = geometry.coordinates ?? [NaN, NaN]; if (!isNaN(coords[0]) && !isNaN(coords[1])) { newCoords = `${coords[1]}, ${coords[0]}` } else { newCoords = '' } }\n } catch (e) { console.error('Err format coords:', e); newCoords = '' }\n setCoordinates(newCoords)\n // setShowShapeTypeButtons(shouldShowShapeButtons(newCoords)); // Let coordinate effect handle this\n }, [])\n\n const [coordinates, setCoordinates] = useState<string>(() => {\n if (!geojson?.geometry) return ''; let initCoords = ''; const geometry = geojson.geometry\n try {\n if (geometry.type === 'Polygon') { initCoords = (geometry.coordinates[0] ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'LineString') { initCoords = (geometry.coordinates ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'Point') { const coords = geometry.coordinates ?? [NaN, NaN]; if (!isNaN(coords[0]) && !isNaN(coords[1])) { initCoords = `${coords[1]}, ${coords[0]}` } }\n } catch (e) { console.error('Err init coords:', e); initCoords = '' } return initCoords\n })\n\n useEffect(() => { updateCoordinatesFromFeature(geojson) }, [geojson, updateCoordinatesFromFeature])\n\n const createGeoJSONFromCoordinates = (coordString: string, forceType?: EMapShape): Feature | undefined => { /* ... same as last working version ... */\n if (!coordString.trim()) { setError(undefined); return undefined }\n try {\n const points = coordString.split('\\n').map(l => l.trim()).filter(l => l).map(l => { const [lat, lon] = l.split(',').map(c => parseFloat(c.trim())); if (isNaN(lat) || isNaN(lon) || lat < -90 || lat > 90 || lon < -180 || lon > 180) throw Error(`Invalid: ${lat}, ${lon}`); return [lon, lat] })\n if (points.length === 0) throw Error('No valid coords')\n if (points.length === 1 && drawPointEnabled) return { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: points[0] } }\n if ((forceType === EMapShape.polygon || (!forceType && points.length >= 3)) && drawPolygonEnabled) { if (points.length > 0 && JSON.stringify(points[0]) !== JSON.stringify(points[points.length - 1])) points.push(points[0]); if (points.length < 4) throw Error('Min 3 unique coords for polygon'); return { type: 'Feature', properties: {}, geometry: { type: 'Polygon', coordinates: [points] } } }\n if ((forceType === EMapShape.linestring || (!forceType && points.length >= 2)) && drawPathEnabled) { if (points.length < 2) throw Error('Min 2 coords for path'); return { type: 'Feature', properties: {}, geometry: { type: 'LineString', coordinates: points } } }\n setError('Cannot create shape. Check tools/coords.'); return undefined\n } catch (e: any) { setError(`Invalid coords/count: ${e.message}. Use \"lat, lon\"`); return undefined }\n }\n\n const shouldShowShapeButtons = (coords: string): boolean => { /* ... same as last working version ... */\n const validLinesCount = coords.trim().split('\\n').filter(l => l.trim()).length\n return (drawPolygonEnabled || drawPathEnabled) && validLinesCount >= 2\n }\n const [showShapeTypeButtons, setShowShapeTypeButtons] = useState<boolean>(() => shouldShowShapeButtons(coordinates))\n useEffect(() => { setShowShapeTypeButtons(shouldShowShapeButtons(coordinates)) }, [coordinates, drawPolygonEnabled, drawPathEnabled]) // Added effect to update buttons\n\n // ---- Helper Functions ----\n const hasValidShape = (feature?: Feature): boolean => !!feature?.geometry\n\n const applyShapeType = (shapeType: EMapShape): void => { /* ... same ... */\n const newFeature = createGeoJSONFromCoordinates(coordinates, shapeType)\n if (newFeature) { setGeojson(newFeature); setError(undefined) } else if (!error) { setError(`Could not create ${shapeType === EMapShape.polygon ? 'poly' : 'path'}.`) }\n }\n\n // ---- JSX Return (Reverting Button ClassNames and removing disabled) ----\n return (\n <div>\n <FieldLabel {...field} />\n <div className=\"relative\">\n {drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled) && (\n <div className=\"absolute z-20 top-12 right-4 flex flex-col gap-2\">\n {/* Point Button - Render only if allowed */}\n {drawPointEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.point) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.point && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Point\"\n >\n <DrawingPinFilledIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Point\n </span>\n </Button>\n </div>\n )}\n {/* Path Button - Render only if allowed */}\n {drawPathEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.linestring) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.linestring && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Path\"\n >\n <BorderSolidIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Path\n </span>\n </Button>\n </div>\n )}\n {/* Polygon Button - Render only if allowed */}\n {drawPolygonEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.polygon) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.polygon && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Polygon\"\n >\n <SquareIcon className=\"w-5 h-5 rotate-45\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Polygon\n </span>\n </Button>\n </div>\n )}\n {/* Clear Button - Render if shape exists */}\n {hasValidShape(geojson) && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={clearShape}\n className=\"p-2 rounded-lg shadow-lg bg-red-500 hover:bg-red-600 text-white w-10 h-10 flex items-center justify-center\"\n aria-label=\"Clear Shape\"\n >\n <TrashIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Clear Shape\n </span>\n </Button>\n </div>\n )}\n </div>\n )}\n\n {/* Map Component */}\n <Map {...MAP_CONFIG} setState={setMapState} />\n\n {/* Coordinate Input Section */}\n {showCoordinateInput && (\n <div className=\"mt-4\">\n <div className=\"flex justify-between items-center mb-2 flex-wrap gap-y-2\">\n <span className=\"text-sm\"> {/* ... label ... */} </span>\n {showShapeTypeButtons && (drawPathEnabled || drawPolygonEnabled) && (\n <div className=\"flex gap-2\"> {/* ... Create Path/Polygon buttons ... */}\n {drawPathEnabled && <Button onClick={() => { applyShapeType(EMapShape.linestring) }} className=\"px-3 py-1 bg-white hover:bg-gray-50 text-black rounded-lg shadow-sm border border-gray-200 text-xs flex items-center gap-1\"><BorderSolidIcon className=\"w-3 h-3\" />Create Path</Button>}\n {drawPolygonEnabled && <Button onClick={() => { applyShapeType(EMapShape.polygon) }} className=\"px-3 py-1 bg-white hover:bg-gray-50 text-black rounded-lg shadow-sm border border-gray-200 text-xs flex items-center gap-1\"><SquareIcon className=\"w-3 h-3 rotate-45\" />Create Polygon</Button>}\n </div>\n )}\n </div>\n <TextArea error={error} className='min-h-[100px] bg-slate-50 rounded-lg shadow-inner font-mono text-sm' id={`${field.id}-coordinates`} testId={`${field.id}-coordinates`} value={coordinates} onChange={handleCoordinatesChange} placeholder={'...'} aria-label=\"Coordinates Input\" />\n {error && <p className=\"text-red-600 text-xs mt-1\">{error}</p>}\n </div>\n )}\n\n {/* Debug Output (Optional) */}\n {showGeoJSONInput && (\n <TextArea\n error={error}\n className='...'\n id={field.id + '-debug'}\n testId={field.id + '-debug'}\n label={<FieldLabel {...field} label=\"Debug GeoJSON Feature State\"/>}\n value={geojson ? JSON.stringify(geojson, null, 2) : ''}\n disabled={true}\n />\n )}\n </div>\n </div>\n )\n}\n\nexport default GeometryInput\n"],"names":["React","Map"],"mappings":";;;;;;;;AAWA;;;AAGE;AAEF;AACA,IAAM,0BAA0B,GAAG,UAAC,GAAwB,EAAA;;;;AAG1D,IAAA,IAAI,iBAAwD;IAC5D,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,mBAAmB,EAAE;AAC3C,QAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;AAC1B,YAAA,iBAAiB,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE;;aAC7D,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,IAAI,GAAG,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,EAAA,KAAK,CAAK,CAC5D,CACT;AAGC,YAAA,gBAAgB,KACfA,cAAC,CAAA,aAAA,CAAA,QAAQ,IACP,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,KAAK,EACf,EAAE,EAAE,KAAK,CAAC,EAAE,GAAG,QAAQ,EACvB,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,QAAQ,EAC3B,KAAK,EAAEA,cAAA,CAAA,aAAA,CAAC,UAAU,EAAK,QAAA,CAAA,EAAA,EAAA,KAAK,EAAE,EAAA,KAAK,EAAC,6BAA6B,EAAE,CAAA,CAAA,EACnE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,EACtD,QAAQ,EAAE,IAAI,EACd,CAAA,CACH,CACA,CACJ;AAEd;;;;"}
|
1
|
+
{"version":3,"file":"Geometry.js","sources":["../../../../../../src/Form/Components/Inputs/Geometry.tsx"],"sourcesContent":["import { Button, TextArea } from '@axdspub/axiom-ui-utilities'\nimport FieldLabel from '@/Form/Components/FieldLabel'\nimport { type IGeometryField, type IFieldInputProps, type IFormField } from '@/Form/Creator/FormCreatorTypes' // Added IFormField explicitly\n\nimport { EMapShape, type IMap, type IMapDrawEvent, type IStyleableMapProps } from '@axdspub/axiom-maps'\nimport { OpenLayersMap as Map } from '@axdspub/axiom-maps/library/openlayers'\n// Import Geometry type if not already done\nimport { type Feature, type GeoJSON, type Geometry } from 'geojson'\nimport React, { useEffect, useState, type ReactElement, useCallback } from 'react' // Added useCallback\nimport { TrashIcon, SquareIcon, BorderSolidIcon, DrawingPinFilledIcon } from '@radix-ui/react-icons'\n\n/*\nList of coordinates for testing. Around Anchorage.\n...\n*/\n\n// --- calculateCenterFromGeoJSON remains the same (zoom ignored for initial load) ---\nconst calculateCenterFromGeoJSON = (geo: GeoJSON | undefined, defaultCenter?: { lat: number, lon: number, zoom: number }): { lat: number, lon: number, zoom: number } => {\n // If default center is provided, use it\n if (defaultCenter) {\n return defaultCenter\n }\n\n // If input is Geometry, wrap it temporarily for calculation\n let featureCollection: GeoJSON.FeatureCollection | undefined\n if (geo && geo.type !== 'FeatureCollection') {\n if (geo.type === 'Feature') {\n featureCollection = { type: 'FeatureCollection', features: [geo] }\n } else if (geo.type === 'Point' || geo.type === 'LineString' || geo.type === 'Polygon' /* add others as needed */) {\n featureCollection = { type: 'FeatureCollection', features: [{ type: 'Feature', properties: {}, geometry: geo as Geometry }] }\n }\n } else if (geo && geo.type === 'FeatureCollection') {\n featureCollection = geo\n }\n\n // Default to Anchorage if no valid GeoJSON\n const DEFAULT_CENTER = { lat: 61.2181, lon: -149.9003, zoom: 8 }\n\n if (!featureCollection || !('features' in featureCollection) || !Array.isArray(featureCollection.features) || featureCollection.features.length === 0) {\n return DEFAULT_CENTER\n }\n\n const feature = featureCollection.features[0]\n if (!feature?.geometry) {\n return DEFAULT_CENTER\n }\n\n const geometry = feature.geometry\n let coordinates: GeoJSON.Position | GeoJSON.Position[] | GeoJSON.Position[][] = [] // Adjusted type\n\n switch (geometry.type) {\n case 'Polygon':\n coordinates = geometry.coordinates[0] // Get first ring (ignore holes)\n break\n case 'LineString':\n coordinates = geometry.coordinates\n break\n case 'Point':\n coordinates = [geometry.coordinates] // Wrap single point for uniform handling\n break\n default:\n return DEFAULT_CENTER\n }\n\n // Flatten coordinates for bounds calculation if needed (e.g., MultiPoint, MultiLineString)\n const flatCoordinates = ([] as GeoJSON.Position[]).concat(...coordinates as any)\n\n if (!Array.isArray(flatCoordinates) || flatCoordinates.length === 0 || !Array.isArray(flatCoordinates[0])) {\n // Handle single point case where flatCoordinates might be just [lon, lat]\n if (Array.isArray(flatCoordinates) && flatCoordinates.length === 2 && typeof flatCoordinates[0] === 'number') {\n const [lon, lat] = flatCoordinates as unknown as GeoJSON.Position\n // FIX #2: Return a default zoom even for a point here for centering logic,\n // but we won't use this zoom for the initial MAP_CONFIG.\n return { lat, lon, zoom: 8 } // Default zoom\n }\n console.warn('Could not determine coordinates for centering.')\n return DEFAULT_CENTER\n }\n\n // Calculate bounds\n let minLat = Infinity; let maxLat = -Infinity; let minLon = Infinity; let maxLon = -Infinity\n let sumLat = 0; let sumLon = 0; let count = 0\n\n flatCoordinates.forEach((coord: GeoJSON.Position) => {\n if (!Array.isArray(coord) || coord.length < 2) return; const [lon, lat] = coord\n minLat = Math.min(minLat, lat); maxLat = Math.max(maxLat, lat); minLon = Math.min(minLon, lon); maxLon = Math.max(maxLon, lon)\n sumLat += lat; sumLon += lon; count++\n })\n\n if (count === 0) { return DEFAULT_CENTER }\n\n const centerLat = sumLat / count; const centerLon = sumLon / count\n const latDiff = maxLat - minLat; const lonDiff = maxLon - minLon; const maxDiff = Math.max(latDiff, lonDiff)\n\n let zoom = 8 // default zoom\n if (count === 1 || maxDiff === 0) zoom = 12; else if (maxDiff < 0.1) zoom = 12; else if (maxDiff < 0.5) zoom = 10\n else if (maxDiff < 1) zoom = 9; else if (maxDiff < 2) zoom = 8; else if (maxDiff < 5) zoom = 7; else zoom = 6\n\n return { lat: centerLat, lon: centerLon, zoom }\n}\n\n// Helper function to determine initial draw type based on settings\nconst getInitialDrawType = (field: IFormField): EMapShape => {\n const settings = (field as IGeometryField).settings ?? {}\n const drawEnabled = settings.drawEnabled !== false\n const drawPointEnabled = settings.drawPointEnabled === true && drawEnabled\n const drawPathEnabled = settings.drawPathEnabled === true && drawEnabled\n const drawPolygonEnabled = settings.drawPolygonEnabled === true && drawEnabled\n\n if (drawPointEnabled) return EMapShape.point\n if (drawPathEnabled) return EMapShape.linestring\n if (drawPolygonEnabled) return EMapShape.polygon\n return EMapShape.point // Defaulting to Point if none specified\n}\n\nexport const GeometryInput = ({ field, onChange, value }: IFieldInputProps): ReactElement => {\n const [map, setMapState] = useState<IMap | undefined>(undefined)\n const [error, setError] = useState<string | undefined>(undefined)\n const [showGeoJSONInput] = useState<boolean>(false)\n\n const [geojson, setGeojson] = useState<Feature | undefined>(() => {\n if (value && typeof value === 'object' && 'type' in value && value.type !== 'FeatureCollection' && value.type !== 'Feature') {\n return { type: 'Feature', properties: {}, geometry: value as Geometry }\n }\n if (value && typeof value === 'object' && 'type' in value && value.type === 'Feature') { return value as Feature }\n return undefined\n })\n\n const geomField = field as IGeometryField\n\n const drawEnabled = geomField.settings?.drawEnabled !== false\n const drawPointEnabled = geomField.settings?.drawPointEnabled === true && drawEnabled\n const drawPathEnabled = geomField.settings?.drawPathEnabled === true && drawEnabled\n const drawPolygonEnabled = geomField.settings?.drawPolygonEnabled === true && drawEnabled\n const showCoordinateInput = geomField.settings?.showCoordinateInput !== false\n\n const [currentDrawType, setCurrentDrawType] = useState<EMapShape>(() => getInitialDrawType(field))\n const [isDrawing, setIsDrawing] = useState<boolean>(!geojson && drawEnabled)\n\n const initialMapCenter = calculateCenterFromGeoJSON(geojson, geomField.settings?.defaultCenter)\n\n const MAP_CONFIG: IStyleableMapProps = {\n baseLayerKey: 'hybrid',\n height: geomField.settings?.height ?? '500px',\n width: '100%',\n style: { /* ... styles ... */ },\n center: { lat: initialMapCenter.lat, lon: initialMapCenter.lon },\n zoom: initialMapCenter.zoom,\n tools: {\n draw: {\n shape: currentDrawType,\n enabled: drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled)\n }\n }\n }\n\n // ---- Coordinate Handling ----\n const updateCoordinatesFromFeature = useCallback((feature: Feature | undefined): void => {\n if (!feature?.geometry) { setCoordinates(''); return }\n const geometry = feature.geometry; let newCoords = ''\n try {\n if (geometry.type === 'Polygon') { newCoords = (geometry.coordinates[0] ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'LineString') { newCoords = (geometry.coordinates ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'Point') { const coords = geometry.coordinates ?? [NaN, NaN]; if (!isNaN(coords[0]) && !isNaN(coords[1])) { newCoords = `${coords[1]}, ${coords[0]}` } else { newCoords = '' } }\n } catch (e) { console.error('Err format coords:', e); newCoords = '' }\n setCoordinates(newCoords)\n // setShowShapeTypeButtons(shouldShowShapeButtons(newCoords)); // Let coordinate effect handle this\n }, [])\n\n const [coordinates, setCoordinates] = useState<string>(() => {\n if (!geojson?.geometry) return ''; let initCoords = ''; const geometry = geojson.geometry\n try {\n if (geometry.type === 'Polygon') { initCoords = (geometry.coordinates[0] ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'LineString') { initCoords = (geometry.coordinates ?? []).map(pos => `${pos[1]}, ${pos[0]}`).join('\\n') } else if (geometry.type === 'Point') { const coords = geometry.coordinates ?? [NaN, NaN]; if (!isNaN(coords[0]) && !isNaN(coords[1])) { initCoords = `${coords[1]}, ${coords[0]}` } }\n } catch (e) { console.error('Err init coords:', e); initCoords = '' } return initCoords\n })\n\n useEffect(() => {\n updateCoordinatesFromFeature(geojson)\n }, [geojson, updateCoordinatesFromFeature])\n\n const createGeoJSONFromCoordinates = (coordString: string, forceType?: EMapShape): Feature | undefined => { /* ... same as last working version ... */\n if (!coordString.trim()) { setError(undefined); return undefined }\n try {\n const points = coordString.split('\\n').map(l => l.trim()).filter(l => l).map(l => { const [lat, lon] = l.split(',').map(c => parseFloat(c.trim())); if (isNaN(lat) || isNaN(lon) || lat < -90 || lat > 90 || lon < -180 || lon > 180) throw Error(`Invalid: ${lat}, ${lon}`); return [lon, lat] })\n if (points.length === 0) throw Error('No valid coords')\n if (points.length === 1 && drawPointEnabled) return { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: points[0] } }\n if ((forceType === EMapShape.polygon || (!forceType && points.length >= 3)) && drawPolygonEnabled) { if (points.length > 0 && JSON.stringify(points[0]) !== JSON.stringify(points[points.length - 1])) points.push(points[0]); if (points.length < 4) throw Error('Min 3 unique coords for polygon'); return { type: 'Feature', properties: {}, geometry: { type: 'Polygon', coordinates: [points] } } }\n if ((forceType === EMapShape.linestring || (!forceType && points.length >= 2)) && drawPathEnabled) { if (points.length < 2) throw Error('Min 2 coords for path'); return { type: 'Feature', properties: {}, geometry: { type: 'LineString', coordinates: points } } }\n setError('Cannot create shape. Check tools/coords.'); return undefined\n } catch (e: any) { setError(`Invalid coords/count: ${e.message}. Use \"lat, lon\"`); return undefined }\n }\n\n const shouldShowShapeButtons = (coords: string): boolean => { /* ... same as last working version ... */\n const validLinesCount = coords.trim().split('\\n').filter(l => l.trim()).length\n return (drawPolygonEnabled || drawPathEnabled) && validLinesCount >= 2\n }\n const [showShapeTypeButtons, setShowShapeTypeButtons] = useState<boolean>(() => shouldShowShapeButtons(coordinates))\n useEffect(() => { setShowShapeTypeButtons(shouldShowShapeButtons(coordinates)) }, [coordinates, drawPolygonEnabled, drawPathEnabled]) // Added effect to update buttons\n\n // ---- Map Event Handlers & State Updates ----\n useEffect(() => { // Map event listeners\n if (!map) return\n const drawCompleteListener = (e: IMapDrawEvent): void => { /* ... same ... */ const f = e.data?.geojson?.features?.[0]; if (f) { setGeojson(f); setIsDrawing(false); map.disableDraw(currentDrawType) } }\n const drawUpdateListener = (e: IMapDrawEvent): void => { /* ... same ... */ const f = e.data?.geojson?.features?.[0]; if (f) { setGeojson(f) } }\n map.onDrawComplete(drawCompleteListener); map.onDrawUpdate(drawUpdateListener)\n // Cleanup omitted\n }, [map, currentDrawType])\n\n useEffect(() => { // Parent onChange trigger\n onChange(geojson?.geometry ?? undefined)\n }, [geojson])\n\n useEffect(() => { // Map drawing/state sync effect\n if (!map) return\n const correctDrawType = getInitialDrawType(field)\n if (currentDrawType !== correctDrawType) {\n setCurrentDrawType(correctDrawType)\n }\n\n if (geojson?.geometry) {\n map.setDrawGeojson({ type: 'FeatureCollection', features: [geojson] })\n map.disableDraw(correctDrawType) // Ensure correct tool is disabled\n setIsDrawing(false)\n } else {\n map.setDrawGeojson({ type: 'FeatureCollection', features: [] })\n if (drawEnabled && (drawPointEnabled || drawPathEnabled || drawPolygonEnabled)) {\n map.enableDraw(correctDrawType) // Enable the correct initial tool\n setIsDrawing(true)\n } else {\n map.disableDraw(correctDrawType) // Ensure drawing is off if not enabled\n setIsDrawing(false)\n }\n }\n }, [map, geojson, drawEnabled, drawPointEnabled, drawPathEnabled, drawPolygonEnabled, currentDrawType, field])\n\n // ---- Helper Functions ----\n const hasValidShape = (feature?: Feature): boolean => !!feature?.geometry\n\n const clearShape = (): void => { /* ... same ... */\n setGeojson(undefined); setCoordinates(''); setShowShapeTypeButtons(false)\n if (map && drawEnabled) { map.setDrawGeojson({ type: 'FeatureCollection', features: [] }); const iType = getInitialDrawType(field); setCurrentDrawType(iType); map.enableDraw(iType); setIsDrawing(true) }\n }\n\n const handleDrawTypeChange = (shapeType: EMapShape): void => { /* ... same as minimal fix version ... */\n if (map && drawEnabled) {\n const isAllowed = (shapeType === EMapShape.point && drawPointEnabled) || (shapeType === EMapShape.linestring && drawPathEnabled) || (shapeType === EMapShape.polygon && drawPolygonEnabled)\n if (isAllowed && shapeType !== currentDrawType) { map.disableDraw(currentDrawType); setCurrentDrawType(shapeType); map.enableDraw(shapeType); setIsDrawing(true) }\n }\n }\n\n const handleCoordinatesChange = (e: string | undefined): void => { /* ... same as minimal fix version ... */\n const newCoords = e ?? ''; setCoordinates(newCoords)\n const pointsCount = newCoords.trim().split('\\n').filter(l => l.trim()).length\n let intendedType: EMapShape | undefined\n if (pointsCount === 1 && drawPointEnabled) intendedType = EMapShape.point\n else if (pointsCount >= 3 && drawPolygonEnabled) intendedType = EMapShape.polygon\n else if (pointsCount >= 2 && drawPathEnabled) intendedType = EMapShape.linestring\n const newFeature = createGeoJSONFromCoordinates(newCoords, intendedType)\n if (newFeature) {\n setGeojson(newFeature); setError(undefined)\n if (map) { map.setDrawGeojson({ type: 'FeatureCollection', features: [] }); map.setDrawGeojson({ type: 'FeatureCollection', features: [newFeature] }); map.disableDraw(currentDrawType); setIsDrawing(false) }\n // setShowShapeTypeButtons(shouldShowShapeButtons(newCoords)); // Let effect handle this\n } else {\n if (!newCoords.trim()) { setGeojson(undefined); if (map && drawEnabled) { map.setDrawGeojson({ type: 'FeatureCollection', features: [] }); map.enableDraw(currentDrawType); setIsDrawing(true) } setShowShapeTypeButtons(false) } else if (!error) { setError('Cannot form valid shape with coords/tools.') }\n }\n }\n\n const applyShapeType = (shapeType: EMapShape): void => { /* ... same ... */\n const newFeature = createGeoJSONFromCoordinates(coordinates, shapeType)\n if (newFeature) { setGeojson(newFeature); setError(undefined) } else if (!error) { setError(`Could not create ${shapeType === EMapShape.polygon ? 'poly' : 'path'}.`) }\n }\n\n // ---- JSX Return (Reverting Button ClassNames and removing disabled) ----\n return (\n <div>\n <FieldLabel {...field} />\n <div className=\"relative\">\n {drawEnabled && (drawPolygonEnabled || drawPathEnabled || drawPointEnabled) && (\n <div className=\"absolute z-20 top-4 right-4 flex flex-col gap-2\">\n {/* Point Button - Render only if allowed */}\n {drawPointEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.point) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.point && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Point\"\n >\n <DrawingPinFilledIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Point\n </span>\n </Button>\n </div>\n )}\n {/* Path Button - Render only if allowed */}\n {drawPathEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.linestring) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.linestring && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Path\"\n >\n <BorderSolidIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Path\n </span>\n </Button>\n </div>\n )}\n {/* Polygon Button - Render only if allowed */}\n {drawPolygonEnabled && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={() => { handleDrawTypeChange(EMapShape.polygon) }}\n // Reverted className logic\n className={`p-2 rounded-lg shadow-lg ${\n currentDrawType === EMapShape.polygon && isDrawing\n ? 'bg-white hover:bg-gray-50 ring-2 ring-yellow-200 shadow-[0_0_10px_rgba(253,224,71,0.5)]'\n : 'bg-gray-100 hover:bg-gray-50'\n } text-black w-10 h-10 flex items-center justify-center`}\n aria-label=\"Draw Polygon\"\n >\n <SquareIcon className=\"w-5 h-5 rotate-45\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Draw Polygon\n </span>\n </Button>\n </div>\n )}\n {/* Clear Button - Render if shape exists */}\n {hasValidShape(geojson) && (\n <div className=\"tooltip-container relative group\">\n <Button\n onClick={clearShape}\n className=\"p-2 rounded-lg shadow-lg bg-red-500 hover:bg-red-600 text-white w-10 h-10 flex items-center justify-center\"\n aria-label=\"Clear Shape\"\n >\n <TrashIcon className=\"w-5 h-5\" />\n <span className=\"tooltip absolute right-full mr-2 px-2 py-1 bg-gray-800 text-white text-sm rounded whitespace-nowrap opacity-0 group-hover:opacity-100 pointer-events-none\">\n Clear Shape\n </span>\n </Button>\n </div>\n )}\n </div>\n )}\n\n {/* Map Component */}\n <Map {...MAP_CONFIG} setState={setMapState} />\n\n {/* Coordinate Input Section */}\n {showCoordinateInput && (\n <div className=\"mt-4\">\n <div className=\"flex justify-between items-center mb-2 flex-wrap gap-y-2\">\n <span className=\"text-sm\"> {/* ... label ... */} </span>\n {showShapeTypeButtons && (drawPathEnabled || drawPolygonEnabled) && (\n <div className=\"flex gap-2\"> {/* ... Create Path/Polygon buttons ... */}\n {drawPathEnabled && <Button onClick={() => { applyShapeType(EMapShape.linestring) }} className=\"px-3 py-1 bg-white hover:bg-gray-50 text-black rounded-lg shadow-sm border border-gray-200 text-xs flex items-center gap-1\"><BorderSolidIcon className=\"w-3 h-3\" />Create Path</Button>}\n {drawPolygonEnabled && <Button onClick={() => { applyShapeType(EMapShape.polygon) }} className=\"px-3 py-1 bg-white hover:bg-gray-50 text-black rounded-lg shadow-sm border border-gray-200 text-xs flex items-center gap-1\"><SquareIcon className=\"w-3 h-3 rotate-45\" />Create Polygon</Button>}\n </div>\n )}\n </div>\n <TextArea error={error} className='min-h-[100px] bg-slate-50 rounded-lg shadow-inner font-mono text-sm' id={`${field.id}-coordinates`} testId={`${field.id}-coordinates`} value={coordinates} onChange={handleCoordinatesChange} placeholder={'...'} aria-label=\"Coordinates Input\" />\n {error && <p className=\"text-red-600 text-xs mt-1\">{error}</p>}\n </div>\n )}\n\n {/* Debug Output (Optional) */}\n {showGeoJSONInput && <TextArea error={error} className='...' id={field.id + '-debug'} testId={field.id + '-debug'} label={<FieldLabel {...field} label=\"Debug GeoJSON Feature State\"/>} value={JSON.stringify(value, null, 2)} />}\n </div>\n </div>\n )\n}\n\nexport default GeometryInput\n"],"names":["React","Map"],"mappings":";;;;;;;;AAWA;;;AAGE;AAEF;AACA,IAAM,0BAA0B,GAAG,UAAC,GAAwB,EAAE,aAA0D,EAAA;;;IAEtH,IAAI,aAAa,EAAE;AACjB,QAAA,OAAO,aAAa;;;AAItB,IAAA,IAAI,iBAAwD;IAC5D,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,mBAAmB,EAAE;AAC3C,QAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;AAC1B,YAAA,iBAAiB,GAAG,EAAE,IAAI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