@mapcomponents/ra-geospatial 1.5.3 → 1.5.5
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/.babelrc +12 -0
- package/.storybook/main.ts +19 -0
- package/.storybook/manager.js +6 -0
- package/.storybook/mapcomponents_logo.png +0 -0
- package/.storybook/preview.ts +27 -0
- package/.storybook/style.css +20 -0
- package/.storybook/wheregroupTheme.js +9 -0
- package/README.md +1 -2
- package/assets/ra_geospatial_screenshots.png +0 -0
- package/eslint.config.cjs +3 -0
- package/package.json +28 -42
- package/project.json +8 -0
- package/src/components/GeospatialInput.stories.tsx +83 -0
- package/src/components/GeospatialInput.tsx +14 -17
- package/src/components/GeospatialInputMap.tsx +168 -163
- package/src/components/GeospatialShow.stories.tsx +84 -0
- package/src/components/GeospatialShow.tsx +15 -17
- package/src/components/GeospatialShowMap.tsx +53 -58
- package/src/contexts/DataContext.jsx +66 -0
- package/src/contexts/dataProvider.tsx +30 -0
- package/src/contexts/lsDataProvider.js +142 -0
- package/src/decorators/ReactAdminDefaultDecorator.tsx +41 -0
- package/src/index.ts +2 -2
- package/src/layout/GisLayout.jsx +97 -0
- package/src/ra_components/Poi.tsx +42 -0
- package/src/ra_components/Property.tsx +42 -0
- package/src/ra_components/Route.tsx +42 -0
- package/src/ra_components/raGeospatialProps.ts +5 -0
- package/src/ra_components/raGeospatialWebGisProps.ts +5 -0
- package/src/types.d.ts +3 -2
- package/tsconfig.json +7 -101
- package/tsconfig.lib.json +29 -0
- package/vite.config.ts +49 -0
- package/dist/index.esm.js +0 -157
- package/dist/index.esm.js.map +0 -1
- package/rollup.config.js +0 -50
package/.babelrc
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ['../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
|
|
5
|
+
framework: {
|
|
6
|
+
name: '@storybook/react-vite',
|
|
7
|
+
options: {
|
|
8
|
+
builder: {
|
|
9
|
+
viteConfigPath: 'vite.config.ts',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
16
|
+
|
|
17
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
18
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
19
|
+
// and https://nx.dev/recipes/storybook/custom-builder-configs
|
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import './style.css';
|
|
2
|
+
|
|
3
|
+
export const parameters = {
|
|
4
|
+
docs: {
|
|
5
|
+
inlineStories: false,
|
|
6
|
+
},
|
|
7
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
8
|
+
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const globalTypes = {
|
|
12
|
+
theme: {
|
|
13
|
+
name: 'Theme',
|
|
14
|
+
title: 'Theme',
|
|
15
|
+
description: 'Theme for your components',
|
|
16
|
+
defaultValue: 'light',
|
|
17
|
+
toolbar: {
|
|
18
|
+
icon: 'paintbrush',
|
|
19
|
+
dynamicTitle: true,
|
|
20
|
+
items: [
|
|
21
|
+
{ value: 'light', left: '☀️', title: 'Light mode' },
|
|
22
|
+
{ value: 'dark', left: '🌙', title: 'Dark mode' },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const tags = ['autodocs'];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.docs-story > div:first-child{
|
|
2
|
+
z-index:0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.docs-story > div > div:first-child, .innerZoomElementWrapper, .innerZoomElementWrapper > div:first-child, .innerZoomElementWrapper > div:first-child > div:first-child{
|
|
6
|
+
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
bottom: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.docs-story > div > div:first-child{
|
|
15
|
+
height: initial;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.innerZoomElementWrapper > div > div > div:first-child{
|
|
19
|
+
height: 100% !important;
|
|
20
|
+
}
|
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/@mapcomponents%2Fra-geospatial) [](https://opensource.org/licenses/MIT)  
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
Input and view components to work with geospatial data in react admin. This package is based on @mapcomponents/react-maplibre and uses MapLibre-gl to display geospatial data on a map.
|
|
9
8
|
|
|
10
9
|

|
|
@@ -72,4 +71,4 @@ export const PoiShow = () => (
|
|
|
72
71
|
</SimpleShowLayout>
|
|
73
72
|
</Show>
|
|
74
73
|
);
|
|
75
|
-
```
|
|
74
|
+
```
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"@types/wellknown": "^0.5.4",
|
|
31
|
-
"react": "^18.2.0",
|
|
32
|
-
"react-admin": "^4.7.2",
|
|
33
|
-
"rollup": "^3.12.0",
|
|
34
|
-
"rollup-plugin-delete": "^2.0.0",
|
|
35
|
-
"rollup-plugin-import-css": "^3.1.0",
|
|
36
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
37
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
38
|
-
"rollup-plugin-typescript2": "^0.34.1",
|
|
39
|
-
"typescript": "^4.9.5",
|
|
40
|
-
"wellknown": "^0.5.0"
|
|
41
|
-
},
|
|
42
|
-
"gitHead": "8570f4d4c3bd5e74a14d80c456a5d7a2039ee285"
|
|
43
|
-
}
|
|
2
|
+
"name": "@mapcomponents/ra-geospatial",
|
|
3
|
+
"version": "1.5.5",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.mjs",
|
|
10
|
+
"require": "./index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@emotion/react": "^11.14.0",
|
|
15
|
+
"@emotion/styled": "^11.14.1",
|
|
16
|
+
"@mapcomponents/react-maplibre": "^1.3.3",
|
|
17
|
+
"@mui/icons-material": "^7.2.0",
|
|
18
|
+
"@mui/material": "^7.2.0",
|
|
19
|
+
"@turf/helpers": "^7.2.0",
|
|
20
|
+
"@turf/turf": "^7.2.0",
|
|
21
|
+
"@types/geojson": "^7946.0.16",
|
|
22
|
+
"lodash": "^4.17.21",
|
|
23
|
+
"maplibre-gl": "^5.6.1",
|
|
24
|
+
"ra-data-fakerest": "^5.10.0",
|
|
25
|
+
"react-admin": "^5.10.0",
|
|
26
|
+
"react-router-dom": "^7.7.1",
|
|
27
|
+
"wellknown": "^0.5.0"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react';
|
|
2
|
+
import GeospatialInput from './GeospatialInput';
|
|
3
|
+
import { ReactAdminDefaultDecorator } from '../decorators/ReactAdminDefaultDecorator';
|
|
4
|
+
import { PoiEdit, PoiEditWebGis } from '../ra_components/Poi';
|
|
5
|
+
import { PropertyEdit, PropertyEditWebGis } from '../ra_components/Property';
|
|
6
|
+
import { RouteEdit, RouteEditWebGis } from '../ra_components/Route';
|
|
7
|
+
import GisLayout from '../layout/GisLayout';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
component: GeospatialInput,
|
|
11
|
+
title: 'MapComponents/GeospatialInput',
|
|
12
|
+
decorators: [ReactAdminDefaultDecorator],
|
|
13
|
+
} satisfies Meta<typeof GeospatialInput>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
export const PoisEdit = PoiEdit.bind({});
|
|
18
|
+
|
|
19
|
+
PoisEdit.args = {
|
|
20
|
+
primary: true,
|
|
21
|
+
embeddedMap: true,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
PoisEdit.parameters = {
|
|
25
|
+
name: 'pois',
|
|
26
|
+
};
|
|
27
|
+
export const PropertiesEdit = PropertyEdit.bind({});
|
|
28
|
+
|
|
29
|
+
PropertiesEdit.args = {
|
|
30
|
+
primary: true,
|
|
31
|
+
embeddedMap: true,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
PropertiesEdit.parameters = {
|
|
35
|
+
name: 'properties',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const RoutesEdit = RouteEdit.bind({});
|
|
39
|
+
|
|
40
|
+
RoutesEdit.args = {
|
|
41
|
+
primary: true,
|
|
42
|
+
embeddedMap: true,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
RoutesEdit.parameters = {
|
|
46
|
+
name: 'routes',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const PoisEditGIS = PoiEditWebGis.bind({});
|
|
50
|
+
|
|
51
|
+
PoisEditGIS.args = {
|
|
52
|
+
primary: true,
|
|
53
|
+
embeddedMap: false,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
PoisEditGIS.parameters = {
|
|
57
|
+
name: 'pois',
|
|
58
|
+
layout: GisLayout,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const PropertiesEditGIS = PropertyEditWebGis.bind({});
|
|
62
|
+
|
|
63
|
+
PropertiesEditGIS.args = {
|
|
64
|
+
primary: true,
|
|
65
|
+
embeddedMap: false,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
PropertiesEditGIS.parameters = {
|
|
69
|
+
name: 'properties',
|
|
70
|
+
layout: GisLayout,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const RoutesEditGIS = RouteEditWebGis.bind({});
|
|
74
|
+
|
|
75
|
+
RoutesEditGIS.args = {
|
|
76
|
+
primary: true,
|
|
77
|
+
embeddedMap: false,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
RoutesEditGIS.parameters = {
|
|
81
|
+
name: 'routes',
|
|
82
|
+
layout: GisLayout,
|
|
83
|
+
};
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import GeometryInputMap, {
|
|
4
|
-
GeospatialInputMapProps,
|
|
5
|
-
} from "./GeospatialInputMap.js";
|
|
1
|
+
import { MapComponentsProvider } from '@mapcomponents/react-maplibre';
|
|
2
|
+
import GeospatialInputMap, { GeospatialInputMapProps } from './GeospatialInputMap.js';
|
|
6
3
|
|
|
7
4
|
function GeospatialInput(props: GeospatialInputMapProps) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
{props.embeddedMap ? (
|
|
8
|
+
<MapComponentsProvider>
|
|
9
|
+
<GeospatialInputMap {...props} />
|
|
10
|
+
</MapComponentsProvider>
|
|
11
|
+
) : (
|
|
12
|
+
<GeospatialInputMap {...props} />
|
|
13
|
+
)}
|
|
14
|
+
</>
|
|
15
|
+
);
|
|
19
16
|
}
|
|
20
17
|
GeospatialInput.defaultProps = {
|
|
21
|
-
|
|
18
|
+
embeddedMap: true,
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
export default GeospatialInput;
|