diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index 187ad6d532..a2f41146a3 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -197,10 +197,7 @@ export interface ILayer { off(type: string, handler: (...args: any[]) => void): void; emit(type: string, handler: unknown): void; once(type: string, handler: (...args: any[]) => void): void; - /** - * JSON Schema 用于校验配置项 - */ - getConfigSchemaForValidation(): object; + isDirty(): boolean; /** * 直接调用拾取方法,在非鼠标交互场景中使用 diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 463ff7f59d..71ecfa6dff 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -48,8 +48,6 @@ import { encodePickingColor } from '@antv/l7-utils'; import { EventEmitter } from 'eventemitter3'; import { Container } from 'inversify'; import { isFunction, isObject } from 'lodash'; -// @ts-ignore -import mergeJsonSchemas from 'merge-json-schemas'; import { normalizePasses } from '../plugins/MultiPassRendererPlugin'; import { BlendTypes } from '../utils/blend'; import { handleStyleDataMapping } from '../utils/dataMappingStyle'; @@ -807,18 +805,6 @@ export default class BaseLayer extends EventEmitter public getEncodedData() { 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 { const scale = this.styleAttributeService.getLayerAttributeScale(name); if (scale) { diff --git a/packages/layers/src/plugins/ConfigSchemaValidationPlugin.ts b/packages/layers/src/plugins/ConfigSchemaValidationPlugin.ts deleted file mode 100644 index 4018902899..0000000000 --- a/packages/layers/src/plugins/ConfigSchemaValidationPlugin.ts +++ /dev/null @@ -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: 配置项发生变化,需要重新校验 -// }); -// } -// }