@mapcomponents/ra-geospatial 1.5.5 → 1.5.7-2

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.
Files changed (78) hide show
  1. package/dist/README.md +74 -0
  2. package/dist/components/GeospatialInput.d.ts +9 -0
  3. package/dist/components/GeospatialInput.d.ts.map +1 -0
  4. package/dist/components/GeospatialInputMap.d.ts +18 -0
  5. package/dist/components/GeospatialInputMap.d.ts.map +1 -0
  6. package/dist/components/GeospatialShow.d.ts +9 -0
  7. package/dist/components/GeospatialShow.d.ts.map +1 -0
  8. package/dist/components/GeospatialShowMap.d.ts +11 -0
  9. package/dist/components/GeospatialShowMap.d.ts.map +1 -0
  10. package/dist/contexts/DataContext.d.ts +4 -0
  11. package/dist/contexts/DataContext.d.ts.map +1 -0
  12. package/dist/contexts/dataProvider.d.ts +35 -0
  13. package/dist/contexts/dataProvider.d.ts.map +1 -0
  14. package/dist/contexts/lsDataProvider.d.ts +44 -0
  15. package/dist/contexts/lsDataProvider.d.ts.map +1 -0
  16. package/dist/decorators/ReactAdminDefaultDecorator.d.ts +3 -0
  17. package/dist/decorators/ReactAdminDefaultDecorator.d.ts.map +1 -0
  18. package/dist/favicon.ico +0 -0
  19. package/dist/html2canvas.esm-CUkZERmf.cjs +23 -0
  20. package/dist/html2canvas.esm-CUkZERmf.cjs.map +1 -0
  21. package/dist/html2canvas.esm-Dmi1NfiH.js +4872 -0
  22. package/dist/html2canvas.esm-Dmi1NfiH.js.map +1 -0
  23. package/dist/index-BYtSitNR.js +61509 -0
  24. package/dist/index-BYtSitNR.js.map +1 -0
  25. package/dist/index-DD78QbMh.cjs +1222 -0
  26. package/dist/index-DD78QbMh.cjs.map +1 -0
  27. package/dist/index.cjs +2 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.css +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.es-DBcuOIG0.js +6675 -0
  33. package/dist/index.es-DBcuOIG0.js.map +1 -0
  34. package/dist/index.es-YxBXdzDQ.cjs +19 -0
  35. package/dist/index.es-YxBXdzDQ.cjs.map +1 -0
  36. package/dist/index.js +6 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/layout/GisLayout.d.ts +6 -0
  39. package/dist/layout/GisLayout.d.ts.map +1 -0
  40. package/dist/manifest.json +25 -0
  41. package/dist/package.json +24 -0
  42. package/dist/purify.es-D1I7B1hP.cjs +3 -0
  43. package/dist/purify.es-D1I7B1hP.cjs.map +1 -0
  44. package/dist/purify.es-DHbHSKL1.js +529 -0
  45. package/dist/purify.es-DHbHSKL1.js.map +1 -0
  46. package/dist/ra_components/Poi.d.ts +5 -0
  47. package/dist/ra_components/Poi.d.ts.map +1 -0
  48. package/dist/ra_components/Property.d.ts +5 -0
  49. package/dist/ra_components/Property.d.ts.map +1 -0
  50. package/dist/ra_components/Route.d.ts +5 -0
  51. package/dist/ra_components/Route.d.ts.map +1 -0
  52. package/dist/ra_components/raGeospatialProps.d.ts +12 -0
  53. package/dist/ra_components/raGeospatialProps.d.ts.map +1 -0
  54. package/dist/ra_components/raGeospatialWebGisProps.d.ts +12 -0
  55. package/dist/ra_components/raGeospatialWebGisProps.d.ts.map +1 -0
  56. package/index.html +16 -0
  57. package/package.json +11 -16
  58. package/project.json +8 -2
  59. package/src/components/GeospatialInput.stories.tsx +1 -1
  60. package/src/components/GeospatialInputMap.tsx +9 -7
  61. package/src/components/GeospatialShow.stories.tsx +1 -1
  62. package/src/components/GeospatialShow.tsx +0 -1
  63. package/src/contexts/lsDataProvider.js +106 -110
  64. package/src/decorators/ReactAdminDefaultDecorator.tsx +1 -2
  65. package/src/layout/GisLayout.jsx +8 -15
  66. package/src/ra_components/raGeospatialProps.ts +3 -3
  67. package/src/ra_components/raGeospatialWebGisProps.ts +3 -3
  68. package/src/types.d.ts +1 -1
  69. package/tsconfig.lib.json +1 -1
  70. package/vite.config.ts +13 -4
  71. package/.babelrc +0 -12
  72. package/.storybook/main.ts +0 -19
  73. package/.storybook/manager.js +0 -6
  74. package/.storybook/preview.ts +0 -27
  75. package/.storybook/style.css +0 -20
  76. package/.storybook/wheregroupTheme.js +0 -9
  77. package/tsconfig.json +0 -9
  78. /package/{.storybook/mapcomponents_logo.png → dist/logo.png} +0 -0
@@ -1,5 +1,5 @@
1
- import fakeRestProvider from "ra-data-fakerest";
2
- import pullAt from "lodash/pullAt";
1
+ import fakeRestProvider from 'ra-data-fakerest';
2
+ import pullAt from 'lodash/pullAt';
3
3
 
4
4
  /**
5
5
  * Respond to react-admin data queries using a local database persisted in localStorage
@@ -27,116 +27,112 @@ import pullAt from "lodash/pullAt";
27
27
  * }
28
28
  * });
29
29
  */
30
- export default function localStorageDataProvider (params) {
31
- const {
32
- defaultData = {},
33
- localStorageKey = "ra-data-local-storage",
34
- loggingEnabled = false,
35
- localStorageUpdateDelay = 10, // milliseconds
36
- } = params || {};
37
- const localStorageData = localStorage.getItem(localStorageKey);
38
- let data = localStorageData ? JSON.parse(localStorageData) : defaultData;
30
+ export default function localStorageDataProvider(params) {
31
+ const {
32
+ defaultData = {},
33
+ localStorageKey = 'ra-data-local-storage',
34
+ loggingEnabled = false,
35
+ localStorageUpdateDelay = 10, // milliseconds
36
+ } = params || {};
37
+ const localStorageData = localStorage.getItem(localStorageKey);
38
+ let data = localStorageData ? JSON.parse(localStorageData) : defaultData;
39
39
 
40
- // change data by executing callback, then persist in localStorage
41
- const updateLocalStorage = (callback) => {
42
- // modify localStorage after the next tick
43
- setTimeout(() => {
44
- callback();
45
- localStorage.setItem(localStorageKey, JSON.stringify(data));
46
- const evt = new Event("storageItemUpdated", {
47
- bubbles: true,
48
- cancelable: false,
49
- });
50
- document.dispatchEvent(evt);
51
- }, localStorageUpdateDelay);
52
- };
40
+ // change data by executing callback, then persist in localStorage
41
+ const updateLocalStorage = (callback) => {
42
+ // modify localStorage after the next tick
43
+ setTimeout(() => {
44
+ callback();
45
+ localStorage.setItem(localStorageKey, JSON.stringify(data));
46
+ const evt = new Event('storageItemUpdated', {
47
+ bubbles: true,
48
+ cancelable: false,
49
+ });
50
+ document.dispatchEvent(evt);
51
+ }, localStorageUpdateDelay);
52
+ };
53
53
 
54
- let baseDataProvider = fakeRestProvider(data, loggingEnabled);
54
+ let baseDataProvider = fakeRestProvider(data, loggingEnabled);
55
55
 
56
- window?.addEventListener("storage", (event) => {
57
- if (event.key === localStorageKey) {
58
- const newData = JSON.parse(event.newValue);
59
- data = newData;
60
- baseDataProvider = fakeRestProvider(newData, loggingEnabled);
61
- }
62
- });
56
+ window?.addEventListener('storage', (event) => {
57
+ if (event.key === localStorageKey) {
58
+ const newData = JSON.parse(event.newValue);
59
+ data = newData;
60
+ baseDataProvider = fakeRestProvider(newData, loggingEnabled);
61
+ }
62
+ });
63
63
 
64
- return {
65
- // read methods are just proxies to FakeRest
66
- getList: (resource, params) =>
67
- baseDataProvider.getList(resource, params).catch((error) => {
68
- if (error.code === 1) {
69
- // undefined collection error: hide the error and return an empty list instead
70
- return { data: [], total: 0 };
71
- } else {
72
- throw error;
73
- }
74
- }),
75
- getOne: (resource, params) => baseDataProvider.getOne(resource, params),
76
- getMany: (resource, params) => baseDataProvider.getMany(resource, params),
77
- getManyReference: (resource, params) =>
78
- baseDataProvider.getManyReference(resource, params).catch((error) => {
79
- if (error.code === 1) {
80
- // undefined collection error: hide the error and return an empty list instead
81
- return { data: [], total: 0 };
82
- } else {
83
- throw error;
84
- }
85
- }),
64
+ return {
65
+ // read methods are just proxies to FakeRest
66
+ getList: (resource, params) =>
67
+ baseDataProvider.getList(resource, params).catch((error) => {
68
+ if (error.code === 1) {
69
+ // undefined collection error: hide the error and return an empty list instead
70
+ return { data: [], total: 0 };
71
+ } else {
72
+ throw error;
73
+ }
74
+ }),
75
+ getOne: (resource, params) => baseDataProvider.getOne(resource, params),
76
+ getMany: (resource, params) => baseDataProvider.getMany(resource, params),
77
+ getManyReference: (resource, params) =>
78
+ baseDataProvider.getManyReference(resource, params).catch((error) => {
79
+ if (error.code === 1) {
80
+ // undefined collection error: hide the error and return an empty list instead
81
+ return { data: [], total: 0 };
82
+ } else {
83
+ throw error;
84
+ }
85
+ }),
86
86
 
87
- // update methods need to persist changes in localStorage
88
- update: (resource, params) => {
89
- updateLocalStorage(() => {
90
-
91
- const index = data[resource].findIndex(item => item.id === params.data.id);
92
- data[resource][index] = {
93
- ...params.data,
94
- };
95
-
96
- });
97
- return baseDataProvider.update(resource, params);
98
- },
99
- updateMany: (resource, params) => {
100
- updateLocalStorage(() => {
101
- params.ids.forEach((id) => {
102
- const index = data[resource]?.findIndex((record) => record.id === id);
103
- data[resource][index] = {
104
- ...data[resource][index],
105
- ...params.data,
106
- };
107
- });
108
- });
109
- return baseDataProvider.updateMany(resource, params);
110
- },
111
- create: (resource, params) => {
112
- // we need to call the fakerest provider first to get the generated id
113
- return baseDataProvider.create(resource, params).then((response) => {
114
- updateLocalStorage(() => {
115
- if (!Object.prototype.hasOwnProperty.call(data, resource)) {
116
- data[resource] = [];
117
- }
118
- data[resource].push(response.data);
119
- });
120
- return response;
121
- });
122
- },
123
- delete: (resource, params) => {
124
- updateLocalStorage(() => {
125
- const index = data[resource]?.findIndex(
126
- (record) => record.id === params.id
127
- );
128
- pullAt(data[resource], [index]);
129
- });
130
- return baseDataProvider.delete(resource, params);
131
- },
132
- deleteMany: (resource, params) => {
133
- updateLocalStorage(() => {
134
- const indexes = params.ids.map((id) =>
135
- data[resource]?.findIndex((record) => record.id === id)
136
- );
137
- pullAt(data[resource], indexes);
138
- });
139
- return baseDataProvider.deleteMany(resource, params);
140
- },
141
- };
142
- };
87
+ // update methods need to persist changes in localStorage
88
+ update: (resource, params) => {
89
+ updateLocalStorage(() => {
90
+ const index = data[resource].findIndex((item) => item.id === params.data.id);
91
+ data[resource][index] = {
92
+ ...params.data,
93
+ };
94
+ });
95
+ return baseDataProvider.update(resource, params);
96
+ },
97
+ updateMany: (resource, params) => {
98
+ updateLocalStorage(() => {
99
+ params.ids.forEach((id) => {
100
+ const index = data[resource]?.findIndex((record) => record.id === id);
101
+ data[resource][index] = {
102
+ ...data[resource][index],
103
+ ...params.data,
104
+ };
105
+ });
106
+ });
107
+ return baseDataProvider.updateMany(resource, params);
108
+ },
109
+ create: (resource, params) => {
110
+ // we need to call the fakerest provider first to get the generated id
111
+ return baseDataProvider.create(resource, params).then((response) => {
112
+ updateLocalStorage(() => {
113
+ if (!Object.prototype.hasOwnProperty.call(data, resource)) {
114
+ data[resource] = [];
115
+ }
116
+ data[resource].push(response.data);
117
+ });
118
+ return response;
119
+ });
120
+ },
121
+ delete: (resource, params) => {
122
+ updateLocalStorage(() => {
123
+ const index = data[resource]?.findIndex((record) => record.id === params.id);
124
+ pullAt(data[resource], [index]);
125
+ });
126
+ return baseDataProvider.delete(resource, params);
127
+ },
128
+ deleteMany: (resource, params) => {
129
+ updateLocalStorage(() => {
130
+ const indexes = params.ids.map((id) =>
131
+ data[resource]?.findIndex((record) => record.id === id)
132
+ );
133
+ pullAt(data[resource], indexes);
134
+ });
135
+ return baseDataProvider.deleteMany(resource, params);
136
+ },
137
+ };
138
+ }
@@ -3,8 +3,7 @@ import DataContextProvider from '../contexts/DataContext';
3
3
  import { MapComponentsProvider, MapLibreMap } from '@mapcomponents/react-maplibre';
4
4
  import { Admin, CustomRoutes, defaultLightTheme } from 'react-admin';
5
5
  import { dataProvider } from '../contexts/dataProvider';
6
- import { Route } from "react-router-dom";
7
-
6
+ import { Route } from 'react-router-dom';
8
7
 
9
8
  export const ReactAdminDefaultDecorator = (Story: React.ComponentType, context: any) => (
10
9
  <DataContextProvider>
@@ -5,7 +5,7 @@ import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
5
5
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
6
6
  import { AppBar, Menu, Sidebar, useSidebarState } from 'react-admin';
7
7
 
8
- const Root = styled('div')(({ theme }) => ({
8
+ const Root = styled('div')(() => ({
9
9
  display: 'flex',
10
10
  flexDirection: 'column',
11
11
  zIndex: 1,
@@ -15,18 +15,18 @@ const Root = styled('div')(({ theme }) => ({
15
15
  pointerEvents: 'none',
16
16
  }));
17
17
 
18
- const AppFrame = styled('div')(({ theme }) => ({
18
+ const AppFrame = styled('div')(() => ({
19
19
  display: 'flex',
20
20
  flexDirection: 'column',
21
21
  }));
22
22
 
23
- const ContentWithSidebar = styled('main')(({ theme }) => ({
23
+ const ContentWithSidebar = styled('main')(() => ({
24
24
  display: 'flex',
25
25
  flexGrow: 1,
26
26
  marginTop: '3em',
27
27
  }));
28
28
 
29
- const Content = styled('div')(({ theme }) => ({
29
+ const Content = styled('div')(() => ({
30
30
  display: 'flex',
31
31
  flexDirection: 'row',
32
32
  justifyContent: 'center',
@@ -40,7 +40,7 @@ const Content = styled('div')(({ theme }) => ({
40
40
  boxShadow: '0px 0px 8px rgba(0,0,0,0.2)',
41
41
  }));
42
42
 
43
- const ContentWrapper = styled(Box)(({ theme }) => ({
43
+ const ContentWrapper = styled(Box)(() => ({
44
44
  maxWidth: '600px',
45
45
  width: '100%',
46
46
  height: '100%',
@@ -62,7 +62,7 @@ const GisLayout = ({ children, title }) => {
62
62
  sx={{
63
63
  backgroundColor: '#f0f0f0',
64
64
  pointerEvents: 'all',
65
- overflow: 'hidden'
65
+ overflow: 'hidden',
66
66
  }}
67
67
  >
68
68
  <Menu />
@@ -76,16 +76,10 @@ const GisLayout = ({ children, title }) => {
76
76
  onClick={() => setContentOpen((val) => !val)}
77
77
  sx={{ position: 'absolute', top: 0, zIndex: 100 }}
78
78
  >
79
- {contentOpen ? (
80
- <KeyboardArrowDownIcon />
81
- ) : (
82
- <KeyboardArrowUpIcon />
83
- )}
79
+ {contentOpen ? <KeyboardArrowDownIcon /> : <KeyboardArrowUpIcon />}
84
80
  </IconButton>
85
81
 
86
- <ContentWrapper>
87
- {children}
88
- </ContentWrapper>
82
+ <ContentWrapper>{children}</ContentWrapper>
89
83
  </Content>
90
84
  </ContentWithSidebar>
91
85
  </AppFrame>
@@ -93,5 +87,4 @@ const GisLayout = ({ children, title }) => {
93
87
  );
94
88
  };
95
89
 
96
-
97
90
  export default GisLayout;
@@ -1,5 +1,5 @@
1
1
  export default {
2
- MapLibreMapProps: { options: { zoom: 14 , center: [7.0851268, 50.73884] as [number, number] } },
3
- embeddedMap: true,
4
- source: "geom",
2
+ MapLibreMapProps: { options: { zoom: 14, center: [7.0851268, 50.73884] as [number, number] } },
3
+ embeddedMap: true,
4
+ source: 'geom',
5
5
  };
@@ -1,5 +1,5 @@
1
1
  export default {
2
- MapLibreMapProps: { options: { zoom: 14 , center: [7.0851268, 50.73884] as [number, number] } },
3
- embeddedMap: false,
4
- source: "geom",
2
+ MapLibreMapProps: { options: { zoom: 14, center: [7.0851268, 50.73884] as [number, number] } },
3
+ embeddedMap: false,
4
+ source: 'geom',
5
5
  };
package/src/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  declare module '@turf/helpers';
2
2
  declare module '@turf/turf';
3
- declare module 'wellknown';
3
+ declare module 'wellknown';
package/tsconfig.lib.json CHANGED
@@ -25,5 +25,5 @@
25
25
  "**/*.stories.jsx",
26
26
  "**/*.stories.tsx"
27
27
  ],
28
- "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
28
+ "include": ["src/**/*", "../react-maplibre/src/**/*"]
29
29
  }
package/vite.config.ts CHANGED
@@ -8,7 +8,7 @@ import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
8
8
 
9
9
  export default defineConfig(() => ({
10
10
  root: __dirname,
11
- cacheDir: '../../node_modules/.vite/libs/ra-geospatial',
11
+ cacheDir: '../../node_modules/.vite/packages/ra-geospatial',
12
12
  plugins: [
13
13
  react(),
14
14
  nxViteTsPaths(),
@@ -26,7 +26,7 @@ export default defineConfig(() => ({
26
26
  // Configuration for building your library.
27
27
  // See: https://vitejs.dev/guide/build.html#library-mode
28
28
  build: {
29
- outDir: '../../dist/libs/ra-geospatial',
29
+ outDir: 'dist',
30
30
  emptyOutDir: true,
31
31
  reportCompressedSize: true,
32
32
  commonjsOptions: {
@@ -39,11 +39,20 @@ export default defineConfig(() => ({
39
39
  fileName: 'index',
40
40
  // Change this to the formats you want to support.
41
41
  // Don't forget to update your package.json as well.
42
- formats: ['es' as const],
42
+ formats: ['es' as const, 'cjs' as const],
43
43
  },
44
+ sourcemap: true,
44
45
  rollupOptions: {
45
46
  // External packages that should not be bundled into your library.
46
- external: ['react', 'react-dom', 'react/jsx-runtime'],
47
+ external: [
48
+ 'react',
49
+ 'react-dom',
50
+ 'd3',
51
+ 'sql.js',
52
+ /* ...Object.keys(pkg.dependencies),
53
+ ...Object.keys(pkg.devDependencies),*/
54
+ ],
55
+ input: [path.join(__dirname, 'src/index.ts')],
47
56
  },
48
57
  },
49
58
  }));
package/.babelrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@nx/react/babel",
5
- {
6
- "runtime": "automatic",
7
- "useBuiltIns": "usage"
8
- }
9
- ]
10
- ],
11
- "plugins": []
12
- }
@@ -1,19 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- import { addons } from "@storybook/addons";
2
- import wheregroupTheme from "./wheregroupTheme";
3
-
4
- addons.setConfig({
5
- theme: wheregroupTheme,
6
- });
@@ -1,27 +0,0 @@
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'];
@@ -1,20 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
1
- import { create } from 'storybook/theming';
2
- import logo from './mapcomponents_logo.png';
3
-
4
- export default create({
5
- base: 'light',
6
- brandTitle: 'WhereGroup GmbH',
7
- brandUrl: 'https://wheregroup.com',
8
- brandImage: logo,
9
- });
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "include": [],
3
- "references": [
4
- {
5
- "path": "./tsconfig.lib.json"
6
- }
7
- ],
8
- "extends": "../../tsconfig.base.json"
9
- }