mirror of https://gitee.com/antv-l7/antv-l7
chore: 移除ConfigSchemaValidation
This commit is contained in:
parent
873e70132f
commit
2a06485922
|
@ -197,10 +197,7 @@ export interface ILayer {
|
||||||
off(type: string, handler: (...args: any[]) => void): void;
|
off(type: string, handler: (...args: any[]) => void): void;
|
||||||
emit(type: string, handler: unknown): void;
|
emit(type: string, handler: unknown): void;
|
||||||
once(type: string, handler: (...args: any[]) => void): void;
|
once(type: string, handler: (...args: any[]) => void): void;
|
||||||
/**
|
|
||||||
* JSON Schema 用于校验配置项
|
|
||||||
*/
|
|
||||||
getConfigSchemaForValidation(): object;
|
|
||||||
isDirty(): boolean;
|
isDirty(): boolean;
|
||||||
/**
|
/**
|
||||||
* 直接调用拾取方法,在非鼠标交互场景中使用
|
* 直接调用拾取方法,在非鼠标交互场景中使用
|
||||||
|
|
|
@ -48,8 +48,6 @@ import { encodePickingColor } from '@antv/l7-utils';
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import { EventEmitter } from 'eventemitter3';
|
||||||
import { Container } from 'inversify';
|
import { Container } from 'inversify';
|
||||||
import { isFunction, isObject } from 'lodash';
|
import { isFunction, isObject } from 'lodash';
|
||||||
// @ts-ignore
|
|
||||||
import mergeJsonSchemas from 'merge-json-schemas';
|
|
||||||
import { normalizePasses } from '../plugins/MultiPassRendererPlugin';
|
import { normalizePasses } from '../plugins/MultiPassRendererPlugin';
|
||||||
import { BlendTypes } from '../utils/blend';
|
import { BlendTypes } from '../utils/blend';
|
||||||
import { handleStyleDataMapping } from '../utils/dataMappingStyle';
|
import { handleStyleDataMapping } from '../utils/dataMappingStyle';
|
||||||
|
@ -807,18 +805,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
||||||
public getEncodedData() {
|
public getEncodedData() {
|
||||||
return this.encodedData;
|
return this.encodedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfigSchemaForValidation() {
|
|
||||||
if (!this.configSchema) {
|
|
||||||
// 相比 allOf, merge 有一些优势
|
|
||||||
// @see https://github.com/goodeggs/merge-json-schemas
|
|
||||||
this.configSchema = mergeJsonSchemas([
|
|
||||||
baseLayerSchema,
|
|
||||||
this.getConfigSchema(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
return this.configSchema;
|
|
||||||
}
|
|
||||||
public getLegendItems(name: string): any {
|
public getLegendItems(name: string): any {
|
||||||
const scale = this.styleAttributeService.getLayerAttributeScale(name);
|
const scale = this.styleAttributeService.getLayerAttributeScale(name);
|
||||||
if (scale) {
|
if (scale) {
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
// import {
|
|
||||||
// IGlobalConfigService,
|
|
||||||
// ILayer,
|
|
||||||
// ILayerPlugin,
|
|
||||||
// ILogService,
|
|
||||||
// TYPES,
|
|
||||||
// } from '@antv/l7-core';
|
|
||||||
// import { inject, injectable } from 'inversify';
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Layer 初始化阶段以及重绘阶段首先校验传入参数,如果校验失败则中断后续插件处理。
|
|
||||||
// */
|
|
||||||
// @injectable()
|
|
||||||
// export default class ConfigSchemaValidationPlugin implements ILayerPlugin {
|
|
||||||
// @inject(TYPES.IGlobalConfigService)
|
|
||||||
// private readonly configService: IGlobalConfigService;
|
|
||||||
|
|
||||||
// @inject(TYPES.ILogService)
|
|
||||||
// private readonly logger: ILogService;
|
|
||||||
|
|
||||||
// public apply(layer: ILayer) {
|
|
||||||
// layer.hooks.init.tap('ConfigSchemaValidationPlugin', () => {
|
|
||||||
// this.configService.registerLayerConfigSchemaValidator(
|
|
||||||
// layer.name as string,
|
|
||||||
// layer.getConfigSchemaForValidation(),
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const { valid, errorText } = this.configService.validateLayerConfig(
|
|
||||||
// layer.name as string,
|
|
||||||
// layer.getLayerConfig(),
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (!valid) {
|
|
||||||
// this.logger.error(errorText || '');
|
|
||||||
// // 中断 init 过程
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// layer.hooks.beforeRender.tap('ConfigSchemaValidationPlugin', () => {
|
|
||||||
// // TODO: 配置项发生变化,需要重新校验
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
Loading…
Reference in New Issue