diff --git a/packages/editor-skeleton/src/components/field/fields.tsx b/packages/editor-skeleton/src/components/field/fields.tsx index 84ac56f48..b773995e3 100644 --- a/packages/editor-skeleton/src/components/field/fields.tsx +++ b/packages/editor-skeleton/src/components/field/fields.tsx @@ -1,5 +1,5 @@ /* eslint-disable react/no-unused-prop-types */ -import { Component, MouseEvent } from 'react'; +import { Component, ErrorInfo, MouseEvent } from 'react'; import { isObject } from 'lodash'; import classNames from 'classnames'; import { Icon } from '@alifd/next'; @@ -9,6 +9,9 @@ import { PopupPipe, PopupContext } from '../popup'; import './index.less'; import InlineTip from './inlinetip'; import { intl } from '../../locale'; +import { Logger } from '@alilc/lowcode-utils'; + +const logger = new Logger({ level: 'warn', bizName: 'skeleton:field' }); export interface FieldProps { className?: string; @@ -31,6 +34,10 @@ export class Field extends Component { hasError: false, }; + private body: HTMLDivElement | null = null; + + private dispose?: () => void; + constructor(props: any) { super(props); this.handleClear = this.handleClear.bind(this); @@ -47,10 +54,6 @@ export class Field extends Component { onExpandChange && onExpandChange(!collapsed); }; - private body: HTMLDivElement | null = null; - - private dispose?: () => void; - private deployBlockTesting() { if (this.dispose) { this.dispose(); @@ -101,7 +104,13 @@ export class Field extends Component { } static getDerivedStateFromError() { - return { hasError: true }; + return { + hasError: true, + }; + } + + componentDidCatch(error: Error, errorInfo: ErrorInfo) { + logger.error(`${this.props.title} has error`, error, errorInfo); } getTipContent(propName: string, tip?: any): any { @@ -194,6 +203,7 @@ export class Field extends Component { */ function createValueState(/* valueState?: number, onClear?: (e: React.MouseEvent) => void */) { return null; + /* let tip: any = null; let className = 'lc-valuestate'; diff --git a/packages/types/src/shell/model/resource.ts b/packages/types/src/shell/model/resource.ts index b79b6acfc..acd7d056f 100644 --- a/packages/types/src/shell/model/resource.ts +++ b/packages/types/src/shell/model/resource.ts @@ -24,7 +24,7 @@ export interface IBaseModelResource< get description(): string | undefined; get config(): { - disableBehaviors?: ('copy' | 'remove')[]; + [key: string]: any; } | undefined; } diff --git a/packages/types/src/shell/type/resource-list.ts b/packages/types/src/shell/type/resource-list.ts index ec998a95b..1d7c34232 100644 --- a/packages/types/src/shell/type/resource-list.ts +++ b/packages/types/src/shell/type/resource-list.ts @@ -5,6 +5,11 @@ export interface IPublicResourceData { /** 资源名字 */ resourceName: string; + /** 资源扩展配置 */ + config?: { + [key: string]: any; + }; + /** 资源标题 */ title?: string; @@ -20,7 +25,7 @@ export interface IPublicResourceData { /** 资源 icon */ icon?: ReactElement; - /** 资源其他配置 */ + /** 资源其他配置,资源初始化时的第二个参数 */ options: { [key: string]: any; };