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