esrieact 0.3.0 → 0.3.1
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/README.md +2 -2
- package/dist/map/MapView.d.ts +2 -2
- package/dist/map/MapView.js +2 -2
- package/dist/widgets/BasemapGallery.d.ts +1 -1
- package/dist/widgets/Expand.d.ts +1 -1
- package/dist/widgets/Histogram.d.ts +14 -0
- package/dist/widgets/Histogram.js +16 -0
- package/dist/widgets/HistogramRangeSlider.d.ts +21 -0
- package/dist/widgets/HistogramRangeSlider.js +16 -0
- package/dist/widgets/LayerList/ListItem.d.ts +3 -1
- package/dist/widgets/LayerList/ListItem.js +2 -0
- package/dist/widgets/LayerList/index.d.ts +1 -1
- package/dist/widgets/Legend.d.ts +1 -1
- package/dist/widgets/SearchBar.d.ts +1 -1
- package/dist/widgets/Sketch.d.ts +7 -1
- package/dist/widgets/createWidgetComponent.d.ts +2 -2
- package/dist/widgets/createWidgetComponent.js +1 -1
- package/dist/widgets/index.d.ts +2 -0
- package/dist/widgets/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,7 +219,7 @@ In order for `<MapView />` child components to be properly associated with the u
|
|
|
219
219
|
|
|
220
220
|
```ts
|
|
221
221
|
// App.tsx
|
|
222
|
-
import { MapViewCore, MapContextProvider } from '
|
|
222
|
+
import { MapViewCore, MapContextProvider } from 'esrieact';
|
|
223
223
|
|
|
224
224
|
const App = () => {
|
|
225
225
|
// Wrap MapViewCore and other components that need access to the map context
|
|
@@ -233,7 +233,7 @@ const App = () => {
|
|
|
233
233
|
|
|
234
234
|
// OtherUI.tsx
|
|
235
235
|
import { useContext } from 'react';
|
|
236
|
-
import { MapContext } from '
|
|
236
|
+
import { MapContext } from 'esrieact';
|
|
237
237
|
|
|
238
238
|
const OtherUI = () => {
|
|
239
239
|
const { view } = useContext(MapContext);
|
package/dist/map/MapView.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
115
115
|
*
|
|
116
116
|
* @example
|
|
117
117
|
* // App.tsx
|
|
118
|
-
* import { MapViewCore, MapContextProvider } from '
|
|
118
|
+
* import { MapViewCore, MapContextProvider } from 'esrieact';
|
|
119
119
|
*
|
|
120
120
|
* const App = () => {
|
|
121
121
|
* return (
|
|
@@ -128,7 +128,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
128
128
|
*
|
|
129
129
|
* // OtherUI.tsx
|
|
130
130
|
* import { useContext } from 'react';
|
|
131
|
-
* import { MapContext } from '
|
|
131
|
+
* import { MapContext } from 'esrieact';
|
|
132
132
|
*
|
|
133
133
|
* const OtherUI = () => {
|
|
134
134
|
* const { view } = useContext(MapContext);
|
package/dist/map/MapView.js
CHANGED
|
@@ -35,7 +35,7 @@ export const MapContextProvider = ({ children, }) => {
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* // App.tsx
|
|
38
|
-
* import { MapViewCore, MapContextProvider } from '
|
|
38
|
+
* import { MapViewCore, MapContextProvider } from 'esrieact';
|
|
39
39
|
*
|
|
40
40
|
* const App = () => {
|
|
41
41
|
* return (
|
|
@@ -48,7 +48,7 @@ export const MapContextProvider = ({ children, }) => {
|
|
|
48
48
|
*
|
|
49
49
|
* // OtherUI.tsx
|
|
50
50
|
* import { useContext } from 'react';
|
|
51
|
-
* import { MapContext } from '
|
|
51
|
+
* import { MapContext } from 'esrieact';
|
|
52
52
|
*
|
|
53
53
|
* const OtherUI = () => {
|
|
54
54
|
* const { view } = useContext(MapContext);
|
|
@@ -9,6 +9,6 @@ import EsriBasemapGallery from "@arcgis/core/widgets/BasemapGallery";
|
|
|
9
9
|
export declare const BasemapGallery: React.ForwardRefExoticComponent<__esri.BasemapGalleryProperties & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
13
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
14
|
} & React.RefAttributes<EsriBasemapGallery>>;
|
package/dist/widgets/Expand.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ import EsriExpandWidget from "@arcgis/core/widgets/Expand";
|
|
|
9
9
|
export declare const Expand: React.ForwardRefExoticComponent<__esri.ExpandProperties & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
13
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
14
|
} & React.RefAttributes<EsriExpandWidget>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import EsriHistogramWidget from "@arcgis/core/widgets/Histogram";
|
|
3
|
+
/**
|
|
4
|
+
* A Histogram Widget component
|
|
5
|
+
*
|
|
6
|
+
* ArcGIS JS API Source Components:
|
|
7
|
+
* - [Histogram](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html)
|
|
8
|
+
*/
|
|
9
|
+
export declare const Histogram: React.ForwardRefExoticComponent<__esri.HistogramProperties & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
} & {
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
|
+
position?: string | __esri.UIAddPosition | undefined;
|
|
14
|
+
} & React.RefAttributes<EsriHistogramWidget>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import EsriHistogramWidget from "@arcgis/core/widgets/Histogram";
|
|
3
|
+
import { createWidgetComponent } from ".";
|
|
4
|
+
const createWidget = (properties) => {
|
|
5
|
+
return new EsriHistogramWidget(properties);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A Histogram Widget component
|
|
9
|
+
*
|
|
10
|
+
* ArcGIS JS API Source Components:
|
|
11
|
+
* - [Histogram](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Histogram.html)
|
|
12
|
+
*/
|
|
13
|
+
export const Histogram = React.forwardRef((properties, ref) => {
|
|
14
|
+
// @ts-expect-error internal mismatch of arcgis types?
|
|
15
|
+
return createWidgetComponent(createWidget, ref, properties);
|
|
16
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import EsriHistogramRangeSliderWidget from "@arcgis/core/widgets/HistogramRangeSlider";
|
|
3
|
+
export type HistogramRangeSliderEventHandlerFnMap = Partial<{
|
|
4
|
+
"max-change": __esri.HistogramRangeSliderMaxChangeEventHandler;
|
|
5
|
+
"min-change": __esri.HistogramRangeSliderMinChangeEventHandler;
|
|
6
|
+
"segment-drag": __esri.HistogramRangeSliderSegmentDragEventHandler;
|
|
7
|
+
"thumb-change": __esri.HistogramRangeSliderThumbChangeEventHandler;
|
|
8
|
+
"thumb-drag": __esri.HistogramRangeSliderThumbDragEventHandler;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* A HistogramRangeSlider Widget component
|
|
12
|
+
*
|
|
13
|
+
* ArcGIS JS API Source Components:
|
|
14
|
+
* - [HistogramRangeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-HistogramRangeSlider.html)
|
|
15
|
+
*/
|
|
16
|
+
export declare const HistogramRangeSlider: React.ForwardRefExoticComponent<__esri.HistogramRangeSliderProperties & {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
} & {
|
|
19
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
20
|
+
position?: string | __esri.UIAddPosition | undefined;
|
|
21
|
+
} & React.RefAttributes<EsriHistogramRangeSliderWidget>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import EsriHistogramRangeSliderWidget from "@arcgis/core/widgets/HistogramRangeSlider";
|
|
3
|
+
import { createWidgetComponent } from ".";
|
|
4
|
+
const createWidget = (properties) => {
|
|
5
|
+
return new EsriHistogramRangeSliderWidget(properties);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A HistogramRangeSlider Widget component
|
|
9
|
+
*
|
|
10
|
+
* ArcGIS JS API Source Components:
|
|
11
|
+
* - [HistogramRangeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-HistogramRangeSlider.html)
|
|
12
|
+
*/
|
|
13
|
+
export const HistogramRangeSlider = React.forwardRef((properties, ref) => {
|
|
14
|
+
// @ts-expect-error internal mismatch of arcgis types?
|
|
15
|
+
return createWidgetComponent(createWidget, ref, properties);
|
|
16
|
+
});
|
|
@@ -3,12 +3,14 @@ import EsriListItem from "@arcgis/core/widgets/LayerList/ListItem";
|
|
|
3
3
|
/**
|
|
4
4
|
* An LayerList ListItem component
|
|
5
5
|
*
|
|
6
|
+
* TODO: Add support for children that attach to parent LayerList
|
|
7
|
+
*
|
|
6
8
|
* ArcGIS JS API Source Components:
|
|
7
9
|
* - [ListItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItem.html)
|
|
8
10
|
*/
|
|
9
11
|
export declare const LayerList: React.ForwardRefExoticComponent<__esri.ListItemProperties & {
|
|
10
12
|
children?: React.ReactNode;
|
|
11
13
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
14
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
15
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
16
|
} & React.RefAttributes<EsriListItem>>;
|
|
@@ -7,6 +7,8 @@ const createWidget = (properties) => {
|
|
|
7
7
|
/**
|
|
8
8
|
* An LayerList ListItem component
|
|
9
9
|
*
|
|
10
|
+
* TODO: Add support for children that attach to parent LayerList
|
|
11
|
+
*
|
|
10
12
|
* ArcGIS JS API Source Components:
|
|
11
13
|
* - [ListItem](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList-ListItem.html)
|
|
12
14
|
*/
|
|
@@ -9,6 +9,6 @@ import EsriLayerList from "@arcgis/core/widgets/LayerList";
|
|
|
9
9
|
export declare const LayerList: React.ForwardRefExoticComponent<__esri.LayerListProperties & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
13
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
14
|
} & React.RefAttributes<EsriLayerList>>;
|
package/dist/widgets/Legend.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ import EsriLegendWidget from "@arcgis/core/widgets/Legend";
|
|
|
9
9
|
export declare const Legend: React.ForwardRefExoticComponent<__esri.LegendProperties & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
13
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
14
|
} & React.RefAttributes<EsriLegendWidget>>;
|
|
@@ -9,6 +9,6 @@ import EsriSearch from "@arcgis/core/widgets/Search";
|
|
|
9
9
|
export declare const SearchBar: React.ForwardRefExoticComponent<__esri.SearchProperties & __esri.WidgetProperties & {
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
} & {
|
|
12
|
-
events?: {} | undefined;
|
|
12
|
+
events?: {} | ((widgetInstance: __esri.Widget) => {}) | undefined;
|
|
13
13
|
position?: string | __esri.UIAddPosition | undefined;
|
|
14
14
|
} & React.RefAttributes<EsriSearch>>;
|
package/dist/widgets/Sketch.d.ts
CHANGED
|
@@ -18,7 +18,13 @@ export declare const Sketch: React.ForwardRefExoticComponent<SketchProperties &
|
|
|
18
18
|
update: __esri.SketchUpdateEventHandler;
|
|
19
19
|
redo: __esri.SketchRedoEventHandler;
|
|
20
20
|
undo: __esri.SketchUndoEventHandler;
|
|
21
|
-
}> |
|
|
21
|
+
}> | ((widgetInstance: __esri.Widget) => Partial<{
|
|
22
|
+
delete: __esri.SketchDeleteEventHandler;
|
|
23
|
+
create: __esri.SketchCreateEventHandler;
|
|
24
|
+
update: __esri.SketchUpdateEventHandler;
|
|
25
|
+
redo: __esri.SketchRedoEventHandler;
|
|
26
|
+
undo: __esri.SketchUndoEventHandler;
|
|
27
|
+
}>) | undefined;
|
|
22
28
|
position?: string | __esri.UIAddPosition | undefined;
|
|
23
29
|
} & React.RefAttributes<EsriSketch>>;
|
|
24
30
|
export {};
|
|
@@ -6,8 +6,8 @@ import EsriWidget from "@arcgis/core/widgets/Widget";
|
|
|
6
6
|
*/
|
|
7
7
|
export type WidgetComponentProps<T extends __esri.WidgetProperties = __esri.WidgetProperties & {
|
|
8
8
|
view?: __esri.MapView;
|
|
9
|
-
}, E extends Record<string, Function> = {}> = React.PropsWithChildren<T> & {
|
|
10
|
-
events?: E;
|
|
9
|
+
}, E extends Record<string, Function> = {}, I extends __esri.Widget = __esri.Widget> = React.PropsWithChildren<T> & {
|
|
10
|
+
events?: E | ((widgetInstance: I) => E);
|
|
11
11
|
position?: string | __esri.UIAddPosition;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
@@ -33,7 +33,7 @@ export function createWidgetComponent(createWidget, ref, { children, events, pos
|
|
|
33
33
|
}, [view]);
|
|
34
34
|
useImperativeHandle(ref, () => instance);
|
|
35
35
|
useEsriPropertyUpdates(instance, properties);
|
|
36
|
-
useEvents(instance, events);
|
|
36
|
+
useEvents(instance, typeof events === "function" ? events(instance) : events);
|
|
37
37
|
/**
|
|
38
38
|
* Check if children is a singular HTML element and assign its ref to instance.content,
|
|
39
39
|
* enables dev to make arbitrary UI elements children of an Expand widget
|
package/dist/widgets/index.d.ts
CHANGED
package/dist/widgets/index.js
CHANGED