mirror of https://gitee.com/antv-l7/antv-l7
feat: 去除 Control 中 abstract 的描述
This commit is contained in:
parent
87faaf9189
commit
f81367dc3b
|
@ -11,7 +11,7 @@ export interface IButtonControlOption extends IControlOption {
|
|||
vertical?: boolean;
|
||||
}
|
||||
|
||||
export default abstract class ButtonControl<
|
||||
export default class ButtonControl<
|
||||
O extends IButtonControlOption = IButtonControlOption
|
||||
> extends Control<O> {
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import type {
|
||||
IControlOption
|
||||
} from '@antv/l7-core';
|
||||
import {
|
||||
IControl,
|
||||
IControlOption,
|
||||
IControlService,
|
||||
IGlobalConfigService,
|
||||
ILayerService,
|
||||
|
@ -22,7 +20,7 @@ export { PositionType } from '@antv/l7-core';
|
|||
|
||||
export { Control, IControlOption };
|
||||
|
||||
export default abstract class Control<O extends IControlOption = IControlOption>
|
||||
export default class Control<O extends IControlOption = IControlOption>
|
||||
extends EventEmitter<ControlEvent>
|
||||
implements IControl<O> {
|
||||
/**
|
||||
|
@ -142,12 +140,15 @@ export default abstract class Control<O extends IControlOption = IControlOption>
|
|||
/**
|
||||
* Control 被添加的时候被调用,返回 Control 对应的 DOM 容器
|
||||
*/
|
||||
public abstract onAdd(): HTMLElement;
|
||||
public onAdd(): HTMLElement {
|
||||
return DOM.create('div');
|
||||
}
|
||||
|
||||
/**
|
||||
* Control 被移除时调用
|
||||
*/
|
||||
public abstract onRemove(): void;
|
||||
// tslint:disable-next-line:no-empty
|
||||
public onRemove() {}
|
||||
|
||||
/**
|
||||
* 显示控件时触发
|
||||
|
|
|
@ -25,7 +25,7 @@ const PopperPlacementMap: Record<PositionName, PopperPlacement> = {
|
|||
rightbottom: 'top-end',
|
||||
};
|
||||
|
||||
export default abstract class PopperControl<
|
||||
export default class PopperControl<
|
||||
O extends IPopperControlOption = IPopperControlOption
|
||||
> extends ButtonControl<O> {
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ enum SelectControlConstant {
|
|||
OptionIndexAttrKey = 'data-option-index',
|
||||
}
|
||||
|
||||
export default abstract class SelectControl<
|
||||
export default class SelectControl<
|
||||
O extends ISelectControlOption = ISelectControlOption
|
||||
> extends PopperControl<O> {
|
||||
/**
|
||||
|
@ -103,7 +103,9 @@ export default abstract class SelectControl<
|
|||
* 是否为多选
|
||||
* @protected
|
||||
*/
|
||||
protected abstract getIsMultiple(): boolean;
|
||||
protected getIsMultiple() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected getPopperContent(options: ControlOptionItem[]): HTMLElement {
|
||||
const isImageOptions = this.isImageOptions();
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { PositionType } from '@antv/l7-core';
|
||||
import { DOM } from '@antv/l7-utils';
|
||||
import { ELType } from '@antv/l7-utils/src/dom';
|
||||
import { createL7Icon } from '../utils/icon';
|
||||
import { Control, IControlOption } from './baseControl';
|
||||
|
||||
export interface IZoomControlOption extends IControlOption {
|
||||
zoomInText: Element | string;
|
||||
zoomInText: ELType | string;
|
||||
zoomInTitle: string;
|
||||
zoomOutText: Element | string;
|
||||
zoomOutText: ELType | string;
|
||||
zoomOutTitle: string;
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ export default class Zoom extends Control<IZoomControlOption> {
|
|||
}
|
||||
|
||||
private createButton(
|
||||
html: Element | string,
|
||||
html: ELType | string,
|
||||
tile: string,
|
||||
className: string,
|
||||
container: HTMLElement,
|
||||
|
|
Loading…
Reference in New Issue