mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:08:55 +08:00
fix:修复crud事件显示空问题&动作面板初始化增加数据来源组件上下文获取逻辑
Change-Id: I4465e1ecff2a6b1f29a3319d4a584f3be1c9fa84
This commit is contained in:
parent
fa240966d4
commit
4598f128fd
@ -361,8 +361,8 @@ export const EditorStore = types
|
||||
return this.getNodeById(self.activeId)?.info;
|
||||
},
|
||||
|
||||
getSchema(id?: string) {
|
||||
return id ? JSONGetById(self.schema, id) : self.schema;
|
||||
getSchema(id?: string, idKey?: string) {
|
||||
return id ? JSONGetById(self.schema, id, idKey) : self.schema;
|
||||
},
|
||||
|
||||
getSchemaParentById(id: string) {
|
||||
|
@ -210,7 +210,7 @@ export function JSONGetByPath(
|
||||
return target;
|
||||
}
|
||||
|
||||
export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
export function JSONGetPathById(json: any, id: string, idKey: string = '$$id'): Array<string> | null {
|
||||
let paths: Array<string> = [];
|
||||
let resolved: boolean = false;
|
||||
let stack: Array<any> = [
|
||||
@ -225,7 +225,7 @@ export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
let data = cur.data;
|
||||
let path = cur.path;
|
||||
|
||||
if (data.$$id === id) {
|
||||
if (data[idKey] === id) {
|
||||
resolved = true;
|
||||
paths = path.split('.').filter((item: any) => item);
|
||||
break;
|
||||
@ -255,8 +255,8 @@ export function JSONGetPathById(json: any, id: string): Array<string> | null {
|
||||
return resolved ? paths : null;
|
||||
}
|
||||
|
||||
export function JSONGetById(json: any, id: string): any {
|
||||
let paths = JSONGetPathById(json, id);
|
||||
export function JSONGetById(json: any, id: string, idKey?: string): any {
|
||||
let paths = JSONGetPathById(json, id, idKey);
|
||||
if (paths === null) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user