@d3-maps/core / feature
feature
Table of contents
Functions
getFeatureKey()
ts
function getFeatureKey(item: MapFeatureData, fallback: string | number): MapFeatureKey;Parameters
| Parameter | Type |
|---|---|
item | MapFeatureData |
fallback | string |
Returns
makeMapFeatures()
ts
function makeMapFeatures<TExtra>(context: Pick<MapContext, "path">, __namedParameters: {
data?: MapData;
getKey?: MapFeatureKeyAccessor<TExtra>;
objectKey?: string;
transformer?: MapFeatureTransformer<TExtra>;
}): MapFeatureRendered<TExtra>[];Type Parameters
| Type Parameter | Default type |
|---|---|
TExtra extends object | object |
Parameters
| Parameter | Type |
|---|---|
context | Pick<MapContext, "path"> |
__namedParameters | { data?: MapData; getKey?: MapFeatureKeyAccessor<TExtra>; objectKey?: string; transformer?: MapFeatureTransformer<TExtra>; } |
__namedParameters.data? | MapData |
__namedParameters.getKey? | MapFeatureKeyAccessor<TExtra> |
__namedParameters.objectKey? | string |
__namedParameters.transformer? | MapFeatureTransformer<TExtra> |
Returns
MapFeatureRendered<TExtra>[]
Interfaces
MapFeatureProps
Extends
MapElementProps<TStyle>
Type Parameters
| Type Parameter | Default type |
|---|---|
TStyle | unknown |
Properties
| Property | Type | Inherited from |
|---|---|---|
d? | string | - |
styles? | Partial<Record<"default" | "hover" |
MapFeaturesProps
Extends
MapElementProps<TStyle>
Type Parameters
| Type Parameter | Default type |
|---|---|
TExtra extends object | object |
TStyle | unknown |
Properties
| Property | Type | Inherited from |
|---|---|---|
data? | MapData | - |
getKey? | MapFeatureKeyAccessor<NoInfer<TExtra>> | - |
objectKey? | string | - |
styles? | Partial<Record<"default" | "hover" |
transformer? | MapFeatureTransformer<TExtra> | - |
Type Aliases
MapFeatureKey
ts
type MapFeatureKey = string | number;MapFeatureKeyAccessor
ts
type MapFeatureKeyAccessor<TExtra> = (item: MapFeatureNormalized & TExtra, fallback: string | number) => MapFeatureKey | undefined;Type Parameters
| Type Parameter | Default type |
|---|---|
TExtra extends object | object |
Parameters
| Parameter | Type |
|---|---|
item | MapFeatureNormalized & TExtra |
fallback | string |
Returns
MapFeatureKey | undefined
MapFeatureNormalized
ts
type MapFeatureNormalized = GeoJSON.Feature<GeoJSON.Geometry | null, Record<string, unknown>>;MapFeatureRendered
ts
type MapFeatureRendered<TExtra> = MapFeatureNormalized & TExtra & {
d?: string;
key: MapFeatureKey;
};Type Declaration
d?
ts
optional d?: string;key
ts
key: MapFeatureKey;Type Parameters
| Type Parameter | Default type |
|---|---|
TExtra extends object | object |
MapFeatureTransformer
ts
type MapFeatureTransformer<TExtra> = (features: readonly MapFeatureNormalized[]) => readonly MapFeatureNormalized & TExtra[];Type Parameters
| Type Parameter | Default type |
|---|---|
TExtra extends object | object |
Parameters
| Parameter | Type |
|---|---|
features | readonly MapFeatureNormalized[] |
Returns
readonly MapFeatureNormalized & TExtra[]