@object-ui/plugin-map 0.5.0 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectMap.d.ts","sourceRoot":"","sources":["../../src/ObjectMap.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAY,MAAM,kBAAkB,CAAC;AAI/E,OAAO,kCAAkC,CAAC;AAY1C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAsKD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAyP9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ObjectMap.d.ts","sourceRoot":"","sources":["../../src/ObjectMap.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAY,MAAM,kBAAkB,CAAC;AAI/E,OAAO,kCAAkC,CAAC;AAY1C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAsKD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAsQ9C,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-map",
3
- "version": "0.5.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Map visualization plugin for Object UI",
@@ -24,22 +24,22 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@objectstack/spec": "^0.9.2",
27
+ "@objectstack/spec": "^2.0.7",
28
28
  "lucide-react": "^0.563.0",
29
29
  "maplibre-gl": "^5.17.0",
30
30
  "react-map-gl": "^8.1.0",
31
31
  "zod": "^4.3.6",
32
- "@object-ui/components": "0.5.0",
33
- "@object-ui/core": "0.5.0",
34
- "@object-ui/react": "0.5.0",
35
- "@object-ui/types": "0.5.0"
32
+ "@object-ui/components": "2.0.0",
33
+ "@object-ui/core": "2.0.0",
34
+ "@object-ui/react": "2.0.0",
35
+ "@object-ui/types": "2.0.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "^18.0.0 || ^19.0.0",
39
39
  "react-dom": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/react": "^19.2.10",
42
+ "@types/react": "^19.2.13",
43
43
  "@types/react-dom": "^19.2.3",
44
44
  "@vitejs/plugin-react": "^5.1.3",
45
45
  "typescript": "^5.9.3",
package/src/ObjectMap.tsx CHANGED
@@ -215,6 +215,8 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
215
215
  dataSource,
216
216
  className,
217
217
  onMarkerClick,
218
+ onEdit,
219
+ onDelete,
218
220
  ...rest
219
221
  }) => {
220
222
  const [data, setData] = useState<any[]>([]);
@@ -326,19 +328,23 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
326
328
  }, [schema.objectName, dataSource, hasInlineData, dataConfig]);
327
329
 
328
330
  // Transform data to map markers
329
- const markers = useMemo(() => {
330
- return data
331
+ const { markers, invalidCount } = useMemo(() => {
332
+ let invalid = 0;
333
+ const validMarkers = data
331
334
  .map((record, index) => {
332
335
  const coordinates = extractCoordinates(record, mapConfig);
333
- if (!coordinates) return null;
336
+ if (!coordinates) {
337
+ invalid++;
338
+ return null;
339
+ }
334
340
 
335
341
  const title = mapConfig.titleField ? record[mapConfig.titleField] : 'Marker';
336
342
  const description = mapConfig.descriptionField ? record[mapConfig.descriptionField] : undefined;
337
343
 
338
344
  // Ensure lat/lng are within valid ranges
339
345
  const [lat, lng] = coordinates;
340
- if (lat < -90 || lat > 90 || lng < -180 || lng > 180) {
341
- console.warn(`Invalid coordinates for marker ${index}: [${lat}, ${lng}]`);
346
+ if (!isFinite(lat) || !isFinite(lng) || lat < -90 || lat > 90 || lng < -180 || lng > 180) {
347
+ invalid++;
342
348
  return null;
343
349
  }
344
350
 
@@ -351,6 +357,8 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
351
357
  };
352
358
  })
353
359
  .filter((marker): marker is NonNullable<typeof marker> => marker !== null);
360
+
361
+ return { markers: validMarkers, invalidCount: invalid };
354
362
  }, [data, mapConfig]);
355
363
 
356
364
  const selectedMarker = useMemo(() =>
@@ -405,6 +413,11 @@ export const ObjectMap: React.FC<ObjectMapProps> = ({
405
413
 
406
414
  return (
407
415
  <div className={className}>
416
+ {invalidCount > 0 && (
417
+ <div className="mb-2 p-2 text-sm text-yellow-800 bg-yellow-50 border border-yellow-200 rounded">
418
+ {`${invalidCount} record${invalidCount !== 1 ? 's' : ''} with missing or invalid coordinates excluded from the map.`}
419
+ </div>
420
+ )}
408
421
  <div className="relative border rounded-lg overflow-hidden bg-muted" style={{ height: '600px', width: '100%' }}>
409
422
  <Map
410
423
  initialViewState={initialViewState}
package/src/index.tsx CHANGED
@@ -25,7 +25,17 @@ console.log('Registering object-map...');
25
25
  ComponentRegistry.register('object-map', ObjectMapRenderer, {
26
26
  namespace: 'plugin-map',
27
27
  label: 'Object Map',
28
- category: 'plugin',
28
+ category: 'view',
29
+ inputs: [
30
+ { name: 'objectName', type: 'string', label: 'Object Name', required: true },
31
+ { name: 'map', type: 'object', label: 'Map Config', description: 'latitudeField, longitudeField, titleField' },
32
+ ],
33
+ });
34
+
35
+ ComponentRegistry.register('map', ObjectMapRenderer, {
36
+ namespace: 'view',
37
+ label: 'Map View',
38
+ category: 'view',
29
39
  inputs: [
30
40
  { name: 'objectName', type: 'string', label: 'Object Name', required: true },
31
41
  { name: 'map', type: 'object', label: 'Map Config', description: 'latitudeField, longitudeField, titleField' },