fix: when the component is configured in a loop, the key value changes and renders error

This commit is contained in:
liujuping 2023-03-03 17:08:04 +08:00 committed by 林熠
parent 29b91846fb
commit 5db418efe4
4 changed files with 19 additions and 4 deletions

View File

@ -774,6 +774,11 @@ export default function baseRendererFactory(): IBaseRenderComponent {
{
...schema,
loop: undefined,
props: {
...schema.props,
// 循环下 key 不能为常量,这样会造成 key 值重复,渲染异常
key: isJSExpression(schema.props?.key) ? schema.props?.key : null,
},
},
loopSelf,
parentInfo,

View File

@ -13,6 +13,11 @@ export interface IPluginPreferenceMananger {
export type PluginOptionsType = string | number | boolean | object;
export interface IPublicApiPlugins {
/**
* plugin api export
*/
[key: string]: any;
register(
pluginModel: IPublicTypePlugin,
options?: Record<string, PluginOptionsType>,
@ -21,6 +26,7 @@ export interface IPublicApiPlugins {
/**
*
*
* use this to get preference config for this plugin when engine.init() called
*/
getPluginPreference(
@ -29,24 +35,28 @@ export interface IPublicApiPlugins {
/**
*
*
* get plugin instance by name
*/
get(pluginName: string): IPublicModelPluginInstance | null;
/**
*
*
* get all plugin instances
*/
getAll(): IPublicModelPluginInstance[];
/**
*
*
* check if plugin with certain name exists
*/
has(pluginName: string): boolean;
/**
*
*
* delete plugin instance by name
*/
delete(pluginName: string): void;

View File

@ -1,3 +1,3 @@
import { IPublicTypeCompositeObject } from './';
import { IPublicTypeCompositeObject, IPublicTypeNodeData } from './';
export type IPublicTypePropsMap = IPublicTypeCompositeObject;
export type IPublicTypePropsMap = IPublicTypeCompositeObject<IPublicTypeNodeData | IPublicTypeNodeData[]>;

View File

@ -131,6 +131,6 @@ export interface IPublicTypeJSONObject {
}
export type IPublicTypeCompositeArray = IPublicTypeCompositeValue[];
export interface IPublicTypeCompositeObject {
[key: string]: IPublicTypeCompositeValue;
export interface IPublicTypeCompositeObject<T = IPublicTypeCompositeValue> {
[key: string]: IPublicTypeCompositeValue | T;
}