feat: 去除 Control 中 abstract 的描述

This commit is contained in:
yanxiong 2022-10-13 19:23:57 +08:00
parent 87faaf9189
commit f81367dc3b
5 changed files with 17 additions and 13 deletions

View File

@ -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> {
/**

View File

@ -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() {}
/**
*

View File

@ -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> {
/**

View File

@ -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();

View File

@ -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,