39 lines
919 B
TypeScript
39 lines
919 B
TypeScript
/**
|
|
* Created by jiangzhixiong on 2024/05/23
|
|
*/
|
|
import React, { forwardRef, useImperativeHandle } from 'react'
|
|
import { Source, Layer, SourceProps } from 'react-map-gl';
|
|
import { clusterLayer, clusterCountLayer } from './layers';
|
|
|
|
// const { ConfigContext } = ConfigProvider
|
|
|
|
export interface ClusterProps {
|
|
prefixCls?: string;
|
|
}
|
|
|
|
export interface ClusterRefProps {
|
|
}
|
|
|
|
const Cluster = forwardRef<ClusterRefProps, ClusterProps & SourceProps>((props, ref) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
...rest
|
|
} = props
|
|
// const { getPrefixCls } = useContext(ConfigContext)
|
|
// const componentName = getPrefixCls('map-cluster', customizePrefixCls);
|
|
|
|
useImperativeHandle(ref, () => ({}))
|
|
|
|
return (
|
|
<Source
|
|
{...rest}
|
|
>
|
|
<Layer {...clusterLayer} />
|
|
<Layer {...clusterCountLayer} />
|
|
{/* <Layer {...unclusteredPointLayer} /> */}
|
|
</Source>
|
|
)
|
|
})
|
|
|
|
export default Cluster
|