mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Co-authored-by: chenfan02 <chenfan02@baidu.com>
This commit is contained in:
parent
8624ec5468
commit
be917022ff
@ -545,18 +545,24 @@ export class CardsPlugin extends BasePlugin {
|
||||
node.schema.source && String(node.schema.source).match(/{([\w-_]+)}/);
|
||||
let field = node.schema.name || match?.[1];
|
||||
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
|
||||
const schema = scope?.parent?.getSchemaByPath(field);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
if (scope) {
|
||||
const origin = this.manager.dataSchema.current;
|
||||
this.manager.dataSchema.switchTo(scope.parent!);
|
||||
const schema = this.manager.dataSchema.getSchemaByPath(field);
|
||||
this.manager.dataSchema.switchTo(origin);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return dataSchema;
|
||||
|
@ -397,19 +397,24 @@ export class EachPlugin extends BasePlugin {
|
||||
node.schema.source && String(node.schema.source).match(/{([\w-_]+)}/);
|
||||
let field = node.schema.name || match?.[1];
|
||||
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
|
||||
const schema = scope?.parent?.getSchemaByPath(field);
|
||||
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
if (scope) {
|
||||
const origin = this.manager.dataSchema.current;
|
||||
this.manager.dataSchema.switchTo(scope.parent!);
|
||||
const schema = this.manager.dataSchema.getSchemaByPath(field);
|
||||
this.manager.dataSchema.switchTo(origin);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 循环添加索引方便渲染序号
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return dataSchema;
|
||||
|
@ -353,19 +353,24 @@ export class ListPlugin extends BasePlugin {
|
||||
node.schema.source && String(node.schema.source).match(/{([\w-_]+)}/);
|
||||
let field = node.schema.name || match?.[1];
|
||||
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
|
||||
const schema = scope?.parent?.getSchemaByPath(field);
|
||||
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
if (scope) {
|
||||
const origin = this.manager.dataSchema.current;
|
||||
this.manager.dataSchema.switchTo(scope.parent!);
|
||||
const schema = this.manager.dataSchema.getSchemaByPath(field);
|
||||
this.manager.dataSchema.switchTo(origin);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 循环添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '序号'
|
||||
});
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return dataSchema;
|
||||
|
@ -421,18 +421,24 @@ export class List2Plugin extends BasePlugin {
|
||||
node.schema.source && String(node.schema.source).match(/{([\w-_]+)}/);
|
||||
let field = node.schema.name || match?.[1];
|
||||
const scope = this.manager.dataSchema.getScope(`${node.id}-${node.type}`);
|
||||
const schema = scope?.parent?.getSchemaByPath(field);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
if (scope) {
|
||||
const origin = this.manager.dataSchema.current;
|
||||
this.manager.dataSchema.switchTo(scope.parent!);
|
||||
const schema = this.manager.dataSchema.getSchemaByPath(field);
|
||||
this.manager.dataSchema.switchTo(origin);
|
||||
if (isObject(schema?.items)) {
|
||||
dataSchema = {
|
||||
...dataSchema,
|
||||
...(schema!.items as any)
|
||||
};
|
||||
|
||||
// 列表添加序号方便处理
|
||||
set(dataSchema, 'properties.index', {
|
||||
type: 'number',
|
||||
title: '索引'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return dataSchema;
|
||||
|
Loading…
Reference in New Issue
Block a user