chore: 透出组件类型定义 (#1175)

* chore: 透出组件类型定义

* chore: 修复类型导出问题

* chore: 代码格式化
This commit is contained in:
lvisei 2022-06-22 15:29:05 +08:00 committed by GitHub
parent c8720ebda5
commit d29bcfb9fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 58 additions and 60 deletions

View File

@ -1,17 +1,12 @@
import { IControlOption, PositionName, PositionType } from '@antv/l7-core';
import { bindAll, DOM, lnglatDistance } from '@antv/l7-utils';
import { PositionType } from '@antv/l7-core';
import { bindAll, DOM } from '@antv/l7-utils';
import { ILayerControlOption } from '../interface';
import Control from './BaseControl';
export interface ILayerControlOption extends IControlOption {
collapsed: boolean;
autoZIndex: boolean;
hideSingleBase: boolean;
sortLayers: boolean;
sortFunction: (...args: any[]) => any;
}
interface IInputItem extends HTMLInputElement {
layerId: string;
}
export default class Layers extends Control {
private layerControlInputs: any[];
private layers: any[];

View File

@ -1,6 +1,7 @@
import { IControlOption } from '@antv/l7-core';
import { DOM } from '@antv/l7-utils';
import Control, { PositionType } from './BaseControl';
export default class Logo extends Control {
public getDefault() {
return {

View File

@ -1,13 +1,7 @@
import { IControlOption } from '@antv/l7-core';
import { bindAll, DOM, lnglatDistance } from '@antv/l7-utils';
import { IScaleControlOption } from '../interface';
import Control, { PositionType } from './BaseControl';
export interface IScaleControlOption extends IControlOption {
maxWidth: number;
metric: boolean;
updateWhenIdle: boolean;
imperial: boolean;
}
export default class Scale extends Control {
private mScale: HTMLElement;
private iScale: HTMLElement;

View File

@ -1,12 +1,7 @@
import { IControlOption } from '@antv/l7-core';
import { bindAll, DOM } from '@antv/l7-utils';
import { IZoomControlOption } from '../interface';
import Control, { PositionType } from './BaseControl';
export interface IZoomControlOption extends IControlOption {
zoomInText: string;
zoomInTitle: string;
zoomOutText: string;
zoomOutTitle: string;
}
export default class Zoom extends Control {
private disabled: boolean;
private zoomInButton: HTMLElement;

View File

@ -1,27 +1,16 @@
import Control from './control/BaseControl';
import Layers, { ILayerControlOption } from './control/layer';
import Layers from './control/layer';
import Logo from './control/logo';
import Scale, { IScaleControlOption } from './control/scale';
import Zoom, { IZoomControlOption } from './control/zoom';
import Scale from './control/scale';
import Zoom from './control/zoom';
import Marker from './marker';
import MarkerLayer, { IMarkerLayerOption } from './markerlayer';
import MarkerLayer from './marker-layer';
import Popup from './popup';
// 引入样式
// TODO: 使用 Less 或者 Sass每个组件单独引用自身样式
import './css/l7.css';
export {
Control,
Logo,
Scale,
IScaleControlOption,
Zoom,
IZoomControlOption,
Layers,
ILayerControlOption,
Marker,
Popup,
MarkerLayer,
IMarkerLayerOption,
};
export { Control, Logo, Scale, Zoom, Layers, Marker, Popup, MarkerLayer };
export * from './interface';

View File

@ -0,0 +1,41 @@
import { IControlOption } from '@antv/l7-core';
export interface ILayerControlOption extends IControlOption {
collapsed: boolean;
autoZIndex: boolean;
hideSingleBase: boolean;
sortLayers: boolean;
sortFunction: (...args: any[]) => any;
}
export interface IScaleControlOption extends IControlOption {
maxWidth: number;
metric: boolean;
updateWhenIdle: boolean;
imperial: boolean;
}
export interface IZoomControlOption extends IControlOption {
zoomInText: string;
zoomInTitle: string;
zoomOutText: string;
zoomOutTitle: string;
}
export interface IMarkerStyleOption {
element?: (...args: any[]) => any;
style: { [key: string]: any } | ((...args: any[]) => any);
className: string;
field?: string;
method?: 'sum' | 'max' | 'min' | 'mean';
radius: number;
maxZoom: number;
minZoom: number;
zoom: number;
}
export interface IMarkerLayerOption {
cluster: boolean;
clusterOption: Partial<IMarkerStyleOption>;
}

View File

@ -13,26 +13,9 @@ import { merge } from 'lodash';
// @ts-ignore
// tslint:disable-next-line:no-submodule-imports
import Supercluster from 'supercluster/dist/supercluster';
import { IMarkerLayerOption, IMarkerStyleOption } from './interface';
import Marker from './marker';
type CallBack = (...args: any[]) => any;
export interface IMarkerStyleOption {
element?: CallBack;
style: { [key: string]: any } | CallBack;
className: string;
field?: string;
method?: 'sum' | 'max' | 'min' | 'mean';
radius: number;
maxZoom: number;
minZoom: number;
zoom: number;
}
export interface IMarkerLayerOption {
cluster: boolean;
clusterOption: Partial<IMarkerStyleOption>;
}
interface IPointFeature {
geometry: {
type: 'Point';