mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
fix: 优化 configure.supports.events 的类型
This commit is contained in:
parent
a93fe0df71
commit
f9734e8a7e
@ -7,6 +7,8 @@ import {
|
||||
ObjectOf,
|
||||
ArrayOf,
|
||||
TransformedComponentMetadata,
|
||||
ConfigureSupport,
|
||||
OneOfType,
|
||||
} from '@ali/lowcode-types';
|
||||
|
||||
function propConfigToFieldConfig(propConfig: PropConfig): FieldConfig {
|
||||
@ -102,7 +104,7 @@ function propTypeToSetter(propType: PropType): SetterType {
|
||||
isRequired,
|
||||
initialValue: (field: any) => {
|
||||
const data: any = {};
|
||||
items.forEach((item) => {
|
||||
items.forEach((item: any) => {
|
||||
let initial = item.defaultValue;
|
||||
if (initial == null && item.setter && typeof item.setter === 'object') {
|
||||
initial = (item.setter as any).initialValue;
|
||||
@ -224,14 +226,14 @@ export default function (metadata: TransformedComponentMetadata): TransformedCom
|
||||
name,
|
||||
description,
|
||||
});
|
||||
(supports as any).events = supportedEvents;
|
||||
(supports as ConfigureSupport).events = supportedEvents;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (name === 'className' && (propType === 'string' || propType === 'any')) {
|
||||
if ((supports as any).className == null) {
|
||||
(supports as any).className = true;
|
||||
if ((supports as ConfigureSupport).className == null) {
|
||||
(supports as ConfigureSupport).className = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import { ReactNode, ComponentType, ReactElement } from 'react';
|
||||
import { IconType } from './icon';
|
||||
import { TipContent } from './tip';
|
||||
import { TitleContent } from './title';
|
||||
import { PropConfig } from './prop-config';
|
||||
import { PropConfig, PropType } from './prop-config';
|
||||
import { NpmInfo } from './npm';
|
||||
import { FieldConfig } from './field-config';
|
||||
import { NodeSchema, NodeData, ComponentSchema } from './schema';
|
||||
@ -105,18 +105,26 @@ export interface LiveTextEditingConfig {
|
||||
onSaveContent?: (content: string, prop: any) => any;
|
||||
}
|
||||
|
||||
export type ConfigureSupportEvent = string | {
|
||||
name: string;
|
||||
propType?: PropType;
|
||||
description?: string;
|
||||
};
|
||||
|
||||
export type ConfigureSupport = {
|
||||
events?: ConfigureSupportEvent[];
|
||||
className?: boolean;
|
||||
style?: boolean;
|
||||
lifecycles?: any[];
|
||||
// general?: boolean;
|
||||
loop?: boolean;
|
||||
condition?: boolean;
|
||||
};
|
||||
|
||||
export interface Configure {
|
||||
props?: FieldConfig[];
|
||||
component?: ComponentConfigure;
|
||||
supports?: {
|
||||
events?: any[];
|
||||
className?: boolean;
|
||||
style?: boolean;
|
||||
lifecycles?: any[];
|
||||
// general?: boolean;
|
||||
loop?: boolean;
|
||||
condition?: boolean;
|
||||
};
|
||||
supports?: ConfigureSupport;
|
||||
}
|
||||
|
||||
export interface ActionContentObject {
|
||||
|
||||
@ -43,4 +43,5 @@ export interface PropConfig {
|
||||
propType: PropType;
|
||||
description?: string;
|
||||
defaultValue?: any;
|
||||
setter?: any
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user