mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 02:12:56 +00:00
feat: when field rendering error, output error log
This commit is contained in:
parent
b4c20b181f
commit
14d294c92c
@ -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<FieldProps> {
|
||||
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<FieldProps> {
|
||||
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<FieldProps> {
|
||||
}
|
||||
|
||||
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<FieldProps> {
|
||||
*/
|
||||
function createValueState(/* valueState?: number, onClear?: (e: React.MouseEvent) => void */) {
|
||||
return null;
|
||||
|
||||
/*
|
||||
let tip: any = null;
|
||||
let className = 'lc-valuestate';
|
||||
|
||||
@ -24,7 +24,7 @@ export interface IBaseModelResource<
|
||||
get description(): string | undefined;
|
||||
|
||||
get config(): {
|
||||
disableBehaviors?: ('copy' | 'remove')[];
|
||||
[key: string]: any;
|
||||
} | undefined;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user