UNPKG

@glodon-aiot/react-components

Version:

aiot react components

84 lines (83 loc) 2.34 kB
import React, { CSSProperties, ReactElement } from 'react'; import './style.less'; export interface Position { id: number | string; x: number; y: number; } export type OrderedPosition = Position & { order: number; }; export interface Transform { translate?: number[]; rotate?: number; scale?: number[]; } export interface ITrackPoint { id: string | number; x: number; y: number; order: number; lineStyle?: CSSProperties & any; pointStyle?: CSSProperties & any; tooltipStyle?: CSSProperties; tooltipOpen?: boolean; tooltipRender?: (item: Position) => HTMLElement | string | number; } export interface TrackEditButtonConfirm { text: string; } export interface TrackEditButton { text?: string; style?: CSSProperties; className?: string; children?: React.ReactNode; } export interface TrackEditConfirmableButton extends TrackEditButton { confirm?: boolean | TrackEditButtonConfirm; } export interface TrackEditButtons { editButton?: TrackEditButton & { exitTitleText?: string; titleText?: string; }; okButton?: TrackEditConfirmableButton; cancelButton?: TrackEditConfirmableButton; } export type TrackMapActions = boolean | TrackEditButtons; interface TrackMapProps { width: number; height: number; points: ITrackPoint[]; scale: number; pointSize?: number; direction?: number; activePointId?: string; style?: CSSProperties; lineStyle?: CSSProperties & any; pointStyle?: CSSProperties & any; directionStyle?: CSSProperties; marks?: ITrackMapMark[]; movable?: boolean; resizable?: boolean; transform?: Transform; keepRatio?: boolean; actions?: TrackMapActions; onPointClick?: (val: ITrackPoint) => void; onTransform?: (transform: Transform, pointsEl?: SVGCircleElement[], canvas?: SVGSVGElement) => void; onPointsChange?: (points: ITrackPoint[]) => void; onCancelResize?: VoidFunction; setIsSaved?: (val: boolean) => void; isSaved?: boolean; } export interface Point { id: string | number; x: number; y: number; } export interface ITrackMapMark extends Point { renderData: any; render: (renderData: any, markData: Point) => ReactElement; } declare const TrackMap: React.FC<TrackMapProps>; export default TrackMap;