@uiw/react-amap-polygon
Advanced tools
Comparing version 5.0.11 to 5.0.12
@@ -5,2 +5,3 @@ /// <reference types="@uiw/react-amap-types" /> | ||
export * from './usePolygon'; | ||
export declare const PolygonContext: import("react").Context<AMap.Polygon | undefined>; | ||
export interface PolygonProps extends OverlayProps, AMap.PolygonEvents, AMap.PolygonOptions { | ||
@@ -7,0 +8,0 @@ /** 覆盖物是否可见 */ |
@@ -8,5 +8,6 @@ "use strict"; | ||
var _exportNames = { | ||
PolygonContext: true, | ||
Polygon: true | ||
}; | ||
exports.Polygon = void 0; | ||
exports.PolygonContext = exports.Polygon = void 0; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
@@ -26,2 +27,5 @@ var _react = require("react"); | ||
}); | ||
var _jsxRuntime = require("react/jsx-runtime"); | ||
var PolygonContext = /*#__PURE__*/(0, _react.createContext)(undefined); | ||
exports.PolygonContext = PolygonContext; | ||
var Polygon = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) { | ||
@@ -36,11 +40,7 @@ var children = props.children; | ||
}, [polygon]); | ||
if (children && /*#__PURE__*/(0, _react.isValidElement)(children) && polygon) { | ||
var oProps = { | ||
polygon: polygon, | ||
polyElement: polygon | ||
}; | ||
return /*#__PURE__*/(0, _react.cloneElement)(children, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), oProps)); | ||
} | ||
return null; | ||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PolygonContext.Provider, { | ||
value: polygon, | ||
children: children | ||
}); | ||
}); | ||
exports.Polygon = Polygon; |
@@ -47,3 +47,3 @@ "use strict"; | ||
}; | ||
}, [map, polygon]); | ||
}, [map]); | ||
(0, _react.useEffect)(function () { | ||
@@ -50,0 +50,0 @@ if (polygon) { |
@@ -5,2 +5,3 @@ /// <reference types="@uiw/react-amap-types" /> | ||
export * from './usePolygon'; | ||
export declare const PolygonContext: import("react").Context<AMap.Polygon | undefined>; | ||
export interface PolygonProps extends OverlayProps, AMap.PolygonEvents, AMap.PolygonOptions { | ||
@@ -7,0 +8,0 @@ /** 覆盖物是否可见 */ |
import _extends from "@babel/runtime/helpers/extends"; | ||
import { useImperativeHandle, forwardRef, isValidElement, cloneElement } from 'react'; | ||
import { useImperativeHandle, forwardRef, createContext } from 'react'; | ||
import { usePolygon } from './usePolygon'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
export * from './usePolygon'; | ||
export var PolygonContext = /*#__PURE__*/createContext(undefined); | ||
export var Polygon = /*#__PURE__*/forwardRef((props, ref) => { | ||
@@ -15,10 +17,6 @@ var { | ||
}), [polygon]); | ||
if (children && /*#__PURE__*/isValidElement(children) && polygon) { | ||
var oProps = { | ||
polygon, | ||
polyElement: polygon | ||
}; | ||
return /*#__PURE__*/cloneElement(children, _extends({}, props, oProps)); | ||
} | ||
return null; | ||
return /*#__PURE__*/_jsx(PolygonContext.Provider, { | ||
value: polygon, | ||
children: children | ||
}); | ||
}); |
@@ -41,3 +41,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
}; | ||
}, [map, polygon]); | ||
}, [map]); | ||
useEffect(() => { | ||
@@ -44,0 +44,0 @@ if (polygon) { |
{ | ||
"name": "@uiw/react-amap-polygon", | ||
"version": "5.0.11", | ||
"version": "5.0.12", | ||
"description": "构造多边形对象,通过 PolygonOptions 指定多边形样式。", | ||
@@ -37,4 +37,4 @@ "homepage": "https://uiwjs.github.io/react-amap/#/polygon", | ||
"dependencies": { | ||
"@uiw/react-amap-map": "5.0.11", | ||
"@uiw/react-amap-utils": "5.0.11" | ||
"@uiw/react-amap-map": "5.0.12", | ||
"@uiw/react-amap-utils": "5.0.12" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18508
289
+ Added@uiw/react-amap-map@5.0.12(transitive)
+ Added@uiw/react-amap-types@5.0.12(transitive)
+ Added@uiw/react-amap-utils@5.0.12(transitive)
- Removed@uiw/react-amap-map@5.0.11(transitive)
- Removed@uiw/react-amap-types@5.0.11(transitive)
- Removed@uiw/react-amap-utils@5.0.11(transitive)
Updated@uiw/react-amap-map@5.0.12
Updated@uiw/react-amap-utils@5.0.12